[Bug tree-optimization/82397] qsort comparator non-negative on sorted output: 1 in vect_analyze_data_ref_accesses

amonakov at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Mon Oct 2 14:59:00 GMT 2017


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

Alexander Monakov <amonakov at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |amonakov at gcc dot gnu.org

--- Comment #1 from Alexander Monakov <amonakov at gcc dot gnu.org> ---
This is because operand_equal_p is "smarter" than data_ref_compare_tree. We
have something like

A: (long)_1 + (_2 + _3)
B: (_2 + _4) + (long)_1
C: (_2 + _3) + (long)_1

with A == C != B according to operand_equal_p (and A < B < C according to
data_ref_compare_tree), making comparison steps like this non-transitive:

  if (!operand_equal_p (DR_BASE_ADDRESS (dra), DR_BASE_ADDRESS (drb), 0))
    {
      cmp = data_ref_compare_tree (DR_BASE_ADDRESS (dra),
                                   DR_BASE_ADDRESS (drb));


Perhaps additive chains in compared operands should be canonicalized first so
that if two items are equal according to operand_equal_p they're also
guaranteed to be equal according to data_ref_compare_tree?


More information about the Gcc-bugs mailing list