From: Sanjay Patel Date: Fri, 28 Apr 2017 23:14:33 +0000 (+0000) Subject: [InstCombine] add tests to show potentially bogus application of DeMorgan (NFC) X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=337942b20aec10e2941fb8332508989b0427db08;p=llvm [InstCombine] add tests to show potentially bogus application of DeMorgan (NFC) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301714 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/test/Transforms/InstCombine/and-or.ll b/test/Transforms/InstCombine/and-or.ll index 2ad90ad98e7..ce8c7664744 100644 --- a/test/Transforms/InstCombine/and-or.ll +++ b/test/Transforms/InstCombine/and-or.ll @@ -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 +} +