[PATCH] Added InstCombine for ((1 << X) & C) pattern
Dinesh Dwivedi
dinesh.d at samsung.com
Fri May 9 13:49:59 PDT 2014
I have written smt-lib program to verify these transformations.
http://rise4fun.com/Z3/Skhom (verifies ((1 << x) & c)? c : 0, if c is power of 2)
http://rise4fun.com/Z3/p4BF (verifies ((1 << x) & c)? (1 << x) : 0, if c+1 is power of 2)
This verification assumes:
1) c > 0, this case is ensured by existing code, => x & 0 = 0
2) (1 << x) does not overflow, assumed handled in existing code, (http://reviews.llvm.org/D3371)
Update patch to use c in place of (1 << x) in ICmp in new SelectInst.
Updated test case for (1 << x) & 8, to non 'if' version as there are similar test case in icmp.ll (test17, test19)
http://reviews.llvm.org/D3678
Files:
lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
test/Transforms/InstCombine/icmp.ll
test/Transforms/InstCombine/shift.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D3678.9273.patch
Type: text/x-patch
Size: 3364 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140509/5a1ddaab/attachment.bin>
More information about the llvm-commits
mailing list