follow up D139076, add icmp with not only eq/ne, but also gt/lt/ge/le.
Details
Diff Detail
Event Timeline
It would be easier to review if you pre-commit the tests. You can add ; negative test comments in this patch to make it clear when a test is not intended to change.
Why are there changes in test files that do contain the patterns that are matched in this patch?
llvm/test/Transforms/InstCombine/select-cmp.ll | ||
---|---|---|
298 | This is not correct. |
Also, maybe we should handle all matching predicates without trying to swap as a first step. Then, add swap logic to deal with patterns that have swapped predicates in a follow-up patch. That way, we can be sure there are no bugs.
llvm/test/Transforms/InstCombine/select-cmp.ll | ||
---|---|---|
298 | I just noticed that the predicate changed, but the common operand position did not. |
llvm/test/Transforms/InstCombine/select-cmp.ll | ||
---|---|---|
298 | Should be correct now. Sorry for the wrong code. |
llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp | ||
---|---|---|
340 | This deserves a code comment to explain the logic. Something like: // If we are allowing commute or swap of operands, then // allow a cross-operand match. In that case, MatchIsOpZero // means that TI's operand 0 (FI's operand 1) is the common op. |
This deserves a code comment to explain the logic. Something like: