From: David Bolvansky Date: Wed, 4 Sep 2019 12:46:25 +0000 (+0000) Subject: [NFC] Added a negative test for new fold X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a9b2f8ffa261bb7715d4275c4e95885378b9809e;p=llvm [NFC] Added a negative test for new fold git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@370890 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/test/Transforms/InstCombine/sub-and-or-not-xor.ll b/test/Transforms/InstCombine/sub-and-or-not-xor.ll index e9bdcb11727..dc56ba7bf64 100644 --- a/test/Transforms/InstCombine/sub-and-or-not-xor.ll +++ b/test/Transforms/InstCombine/sub-and-or-not-xor.ll @@ -99,3 +99,22 @@ define <2 x i32> @sub_to_xor_vec(<2 x i32> %x, <2 x i32> %y) { %sub = sub <2 x i32> %and, %or ret <2 x i32> %sub } + +; Negative tests + +define i32 @sub_to_xor_extra_use_and_or(i32 %x, i32 %y) { +; CHECK-LABEL: @sub_to_xor_extra_use_and_or( +; CHECK-NEXT: [[OR:%.*]] = or i32 [[X:%.*]], [[Y:%.*]] +; CHECK-NEXT: call void @use(i32 [[OR]]) +; CHECK-NEXT: [[AND:%.*]] = and i32 [[X]], [[Y]] +; CHECK-NEXT: call void @use(i32 [[AND]]) +; CHECK-NEXT: [[SUB:%.*]] = sub i32 [[AND]], [[OR]] +; CHECK-NEXT: ret i32 [[SUB]] +; + %or = or i32 %x, %y + call void @use(i32 %or) + %and = and i32 %x, %y + call void @use(i32 %and) + %sub = sub i32 %and, %or + ret i32 %sub +}