[PATCH] Added InstCombine transform for pattern "(A ^ B) | ((~A) ^ B) -> True".
David Majnemer
david.majnemer at gmail.com
Thu Aug 7 23:06:52 PDT 2014
I don't think we need to do anything here, running reassociate before instcombine cleans things up.
$ cat t.ll
define i32 @test14(i32 %x, i32 %y) {
%nega = xor i32 %x, -1
%xor = xor i32 %nega, %y
%xor1 = xor i32 %x, %y
%or = or i32 %xor, %xor1
ret i32 %or
}
define i32 @test15(i32 %x, i32 %y) {
%xor = xor i32 %x, %y
%nega = xor i32 %x, -1
%xor1 = xor i32 %nega, %y
%or = or i32 %xor, %xor1
ret i32 %or
}
$ ~/llvm/Debug+Asserts/bin/opt -reassociate -instcombine t.ll -o - -S
; ModuleID = 't.ll'
define i32 @test14(i32 %x, i32 %y) {
ret i32 -1
}
define i32 @test15(i32 %x, i32 %y) {
ret i32 -1
}
http://reviews.llvm.org/D4691
More information about the llvm-commits
mailing list