This is an archive of the discontinued LLVM Phabricator instance.

[MergeICmps] Don't reorder the comparison chain
AbandonedPublic

Authored by Allen on Apr 30 2023, 2:30 AM.

Details

Summary

The address of the comparison value is expected from small to large,
so we can't reorder the comparison chain to judge the areContiguous.
Fix https://github.com/llvm/llvm-project/issues/62459

Diff Detail

Event Timeline

Allen created this revision.Apr 30 2023, 2:30 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 30 2023, 2:30 AM
Allen requested review of this revision.Apr 30 2023, 2:30 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 30 2023, 2:30 AM

Any thoughts on introducing appropriate "freeze" instructions, instead of suppressing the transform?

aeubanks added inline comments.May 1 2023, 5:07 PM
llvm/lib/Transforms/Scalar/MergeICmps.cpp
494

"anew" is correct here

Allen added a comment.May 3 2023, 11:44 PM

Any thoughts on introducing appropriate "freeze" instructions, instead of suppressing the transform?

Thanks very much for your advice, I tried to add freeze for the return value of memcmp, but it is still inconsistent (https://alive2.llvm.org/ce/z/gVHbUS) . Did I add it the wrong way?

For the non-memcmp case, see https://alive2.llvm.org/ce/z/_RDywP .

re: memcmp, if https://github.com/llvm/llvm-project/issues/62459#issuecomment-1528966123 is right, alive2 probably doesn't have the right memcmp semantics. Haven't thought it through.

Allen abandoned this revision.May 5 2023, 8:00 PM

as the discussion above, the miscompile doesn't need to be handled because alive2 doesn't have the right memcmp semantics.