[PATCH] D152684: [ConstraintElimination] Handle non-equality predicates
Florian Hahn via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 12 04:04:42 PDT 2023
fhahn added inline comments.
================
Comment at: llvm/lib/Transforms/Scalar/ConstraintElimination.cpp:455
+ IsNe = true;
+ Pred = CmpInst::ICMP_ULE;
+ }
----------------
I think this is not correct, as this effectively means we will be adding `Op0 <= Op1` to the constraint system as fact for `Op0 != Op1` at the moment. To start with, it would be good to only support `NE` predicates for solving, not when adding facts.
A test case that shows the issue is below. Would be good to have similar variants with UGE/UGT/ULT and signed variants.
```
define i1 @assume(i64 %a, i64 %b, i64 %c) {
%1 = icmp ne i64 %a, %b
tail call void @llvm.assume(i1 %1)
%r = icmp ule i64 %a, %b
ret i1 %r
}
```
================
Comment at: llvm/test/Transforms/ConstraintElimination/ne.ll:298
+
+define i1 @assume_b_plus_1_ult_a(i64 %a, i64 %b) {
+; CHECK-LABEL: @assume_b_plus_1_ult_a(
----------------
please add the additional test coverage separately. It would also be good to use names for the various values (instead of numbers) so they are easier to modify/play with.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D152684/new/
https://reviews.llvm.org/D152684
More information about the llvm-commits
mailing list