This patch implements transform for pattern "(A ^ B) & ((~A) ^ B) -> False".
Please help in reviewing the same.
Thanks,
Sonam.
Differential D4690
Added InstCombine transform for pattern "(A ^ B) & ((~A) ^ B) -> False" sonamkumari on Jul 27 2014, 11:36 PM. Authored by
Details
This patch implements transform for pattern "(A ^ B) & ((~A) ^ B) -> False". Please help in reviewing the same. Thanks,
Diff Detail Event Timeline
Comment Actions Hi David, Thanks for your valuable comments.I will try to consider general case while doing any optimization in future. The test cases for which it fails are : define i32 @test15(i32 %x, i32 %y) { define i32 @test16(i32 %x, i32 %y) { So, I modified the patch and submitting the same. Thanks, Comment Actions I don't think we need to do anything here, running the reassociate pass before instcombine makes this problem go away. $ cat t.ll define i32 @test15(i32 %x, i32 %y) { %nega = xor i32 %x, -1 %xor = xor i32 %nega, %y %xor1 = xor i32 %x, %y %and = and i32 %xor, %xor1 ret i32 %and } define i32 @test16(i32 %x, i32 %y) { %xor = xor i32 %x, %y %nega = xor i32 %x, -1 %xor1 = xor i32 %nega, %y %and = and i32 %xor, %xor1 ret i32 %and } $ ~/llvm/Debug+Asserts/bin/opt -reassociate -instcombine t.ll -o - -S ; ModuleID = 't.ll' define i32 @test15(i32 %x, i32 %y) { ret i32 0 } define i32 @test16(i32 %x, i32 %y) { ret i32 0 } |
Please format the code to match the coding standards: http://llvm.org/docs/CodingStandards.html