[PATCH] D59916: [CorrelatedValuePropagation][InstCombine] Teach CorrelatedValuePropagation to also mark sub as no wrap and use that in InstCombine to fold icmp+sub.
Nikita Popov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Mar 28 01:20:20 PDT 2019
nikic added a comment.
Can you please split off the InstCombine change into a separate revision?
================
Comment at: llvm/test/Transforms/InstCombine/icmp-sub.ll:3
+
+define i64 @test_icmp_sub_elide(i64 %offset) {
+; CHECK-LABEL: @test_icmp_sub_elide
----------------
For the instcombine tests it's enough to just check the sub+icmp folding to true/false, such as:
```
define i1 @test(i64 %x) {
%y = sub nuw i64 10, %x
%z = icmp ult i64 %y, 3
ret i1 %z
}
```
Instead we'd want to test more variations here, in particular: Both nuw and nsw should be covered. Cases where the subtraction overflows should be covered. And I believe this transform also needs to be guarded based on the signedness of the predicate -- i.e. you can't do it if you have sub nsw and ult, so we'd want to test such combinations as well.
Test checks can be generated using `utils/update_test_checks.py`.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D59916/new/
https://reviews.llvm.org/D59916
More information about the llvm-commits
mailing list