[PATCH] D12210: [InstCombine] Transform A & (L - 1) u< L --> L != 0
Philip Reames via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 20 13:43:52 PDT 2015
reames added inline comments.
================
Comment at: test/Transforms/InstCombine/ult-and-bitwise-and.ll:5
@@ +4,3 @@
+; CHECK: @f(
+ %lim.sub = add i32 %lim, -1
+ %val.and = and i32 %val, %lim.sub
----------------
Add a version of this test case with sub 1.
I think you need the fact that %lim is >= 0 for this to hold. Consider %lim with 0x101 and %val of 0x110. The original check fails, yours succeeds.
Also, I think that if the add is nsw, we can infer lim is > 0 and thus directly fold to true.
http://reviews.llvm.org/D12210
More information about the llvm-commits
mailing list