[PATCH] D31120: [InstCombine] Teach SimplifyDemandedUseBits that adding or subtractings 0s from every bit below the highest demanded bit can be simplified

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 12 09:36:03 PDT 2017


craig.topper added inline comments.


================
Comment at: test/Transforms/InstCombine/and2.ll:125
 
 ; The add in this test is unnecessary because the LSBs of the RHS are 0 and we only consume those bits.
 define i32 @test11(i32 %a, i32 %b) {
----------------
spatel wrote:
> This comment (copy/pasted below too) confused me. Shouldn't it be:
> "The add in this test is unnecessary because the LSBs of the RHS are 0 and we do not consume those bits."
The comment is bad given the immediate used on the and. The optimization is valid even if the and immediate is 255. I'll try to clarify it. 


https://reviews.llvm.org/D31120





More information about the llvm-commits mailing list