[llvm] r301714 - [InstCombine] add tests to show potentially bogus application of DeMorgan (NFC)
Sanjay Patel via llvm-commits
llvm-commits at lists.llvm.org
Fri Apr 28 16:14:33 PDT 2017
Author: spatel
Date: Fri Apr 28 18:14:33 2017
New Revision: 301714
URL: http://llvm.org/viewvc/llvm-project?rev=301714&view=rev
Log:
[InstCombine] add tests to show potentially bogus application of DeMorgan (NFC)
Modified:
llvm/trunk/test/Transforms/InstCombine/and-or.ll
Modified: llvm/trunk/test/Transforms/InstCombine/and-or.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/and-or.ll?rev=301714&r1=301713&r2=301714&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/InstCombine/and-or.ll (original)
+++ llvm/trunk/test/Transforms/InstCombine/and-or.ll Fri Apr 28 18:14:33 2017
@@ -53,3 +53,25 @@ define i32 @func4(i32 %a, i32 %b) {
ret i32 %tmp3
}
+define i32 @demorganize_constant1(i32 %a) {
+; CHECK-LABEL: @demorganize_constant1(
+; CHECK-NEXT: [[A_NOT:%.*]] = or i32 %a, -16
+; CHECK-NEXT: [[AND1:%.*]] = xor i32 [[A_NOT]], 15
+; CHECK-NEXT: ret i32 [[AND1]]
+;
+ %and = and i32 %a, 15
+ %and1 = xor i32 %and, -1
+ ret i32 %and1
+}
+
+define i32 @demorganize_constant2(i32 %a) {
+; CHECK-LABEL: @demorganize_constant2(
+; CHECK-NEXT: [[A_NOT:%.*]] = and i32 %a, -16
+; CHECK-NEXT: [[AND1:%.*]] = xor i32 [[A_NOT]], -16
+; CHECK-NEXT: ret i32 [[AND1]]
+;
+ %and = or i32 %a, 15
+ %and1 = xor i32 %and, -1
+ ret i32 %and1
+}
+
More information about the llvm-commits
mailing list