[Bug tree-optimization/102463] [12 Regression] ice in fold_using_range::relation_fold_and_or

amacleod at redhat dot com gcc-bugzilla@gcc.gnu.org
Thu Sep 23 13:58:41 GMT 2021


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102463

--- Comment #6 from Andrew Macleod <amacleod at redhat dot com> ---
That trapping routine (relation_fold_and_or)  is looking to see if there are
any relationships between dependencies that can be exploited. ie
   c_2 = a_6 > b_7
   c_3 = a_6 < b_7
   c_4 = c_2 && c_3
  if (c_4 != 0)

when looking at c_2 and c_3, it notes that they both depend on the same 2
ssa-names,  a_6, and a_7.
It then queries whether there is a relationship between them when c_2 is [1,1]
and c_3 is [1,1].   If so, it then tries to apply that relation to see if the
stmt can never be true or not based on that raw relation.

In this case, the 2 defining stmts are both PHI nodes, which happen to have the
same 2 ssa_names in the dependency list, so it matches the pattern being looked
for:

  # ntdef_6 = PHI <newdef_10(2), _bfd_elf_merge_symbol_h.0_1(3)>
  # tdef_7 = PHI <_bfd_elf_merge_symbol_h.0_1(2), newdef_10(3)>
  _5 = __tdef_7 & ntdef_6

both names depend on the value of newdef_10 and _bfd_elf_merge_symbol_h.0_1, so
a check is being made for a relationship between op1 and op2 in those stmts.

Whats missing is that we can only check for operand relationships in range-ops
enabled stmts... The phi will never overtly give us a relation between the
first and second operand, so no need to check.


More information about the Gcc-bugs mailing list