Fixes: https://github.com/llvm/llvm-project/issues/61120
Signed-off-by: Jun Zhang <jun@junz.org>
Paths
| Differential D146512
[TLI] SimplifySetCC - Fold ~X >/< ~Y --> Y >/< X ClosedPublic Authored by junaire on Mar 21 2023, 4:20 AM.
Details
Summary Fixes: https://github.com/llvm/llvm-project/issues/61120 Signed-off-by: Jun Zhang <jun@junz.org>
Diff Detail
Event TimelineComment Actions Looks like the patch doesn't work for vectors, do you have any insights about it? @RKSimon Comment Actions RKSimon retitled this revision from [TLI] Fold ~X s>/u< ~Y --> Y s>/u< X to [TLI] SimplifySetCC - Fold ~X s>/u< ~Y --> Y s>/u< X.Mar 21 2023, 4:39 AM junaire added inline comments.
Comment Actions What regressions are you seeing for ULE vector cases with this fold? Manual optimization looks OK - https://llvm.godbolt.org/z/n9ezae5En
Comment Actions
I may misunderstand something. I was expected it could folded like https://llvm.godbolt.org/z/ebfj4MoKr junaire retitled this revision from [TLI] SimplifySetCC - Fold ~X s>/u< ~Y --> Y s>/u< X to [TLI] SimplifySetCC - Fold ~X >/< ~Y --> Y >/< X.Mar 22 2023, 1:38 AM Comment Actions Revert 'Make N0.getValueType().isInteger() an assert.' since it causes a lot of crashes in the tests.
This revision is now accepted and ready to land.Mar 22 2023, 9:12 AM This revision was landed with ongoing or failed builds.Mar 22 2023, 9:49 PM Closed by commit rGb3e12beb44dc: [TLI] Fold ~X >/< ~Y --> Y >/< X (authored by junaire). · Explain Why This revision was automatically updated to reflect the committed changes.
Revision Contents
Diff 507265 llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
llvm/test/CodeGen/X86/cmov.ll
llvm/test/CodeGen/X86/setcc-combine.ll
|
Take a look at https://github.com/llvm/llvm-project/blob/3a8f161a3401edeb58e018e2d389dd2413a6417f/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp#L6501
This shows its safe to handle all icmp predicates - and handles cases where one operand is a constant which can be constant folded