aboutsummaryrefslogtreecommitdiff
path: root/llvm/test/Analysis
diff options
context:
space:
mode:
authorNoah Goldstein <goldstein.w.n@gmail.com>2023-11-18 15:49:29 -0600
committerNoah Goldstein <goldstein.w.n@gmail.com>2023-11-19 12:15:03 -0600
commitf112e4693a9718ef55019ab4d68ede739b2dca3d (patch)
tree8d5f5c8460241f4b881ec865f687201af90a2408 /llvm/test/Analysis
parent3af514e5aea2a3e7774c667232ccd0d611cf911a (diff)
downloadllvm-f112e4693a9718ef55019ab4d68ede739b2dca3d.zip
llvm-f112e4693a9718ef55019ab4d68ede739b2dca3d.tar.gz
llvm-f112e4693a9718ef55019ab4d68ede739b2dca3d.tar.bz2
[InstCombine] Don't transform `sub X, ~Y` -> `add X, -Y` unless `Y` is actually negatable
This combine was previously adding instruction in some cases (see the tests). Closes #72767
Diffstat (limited to 'llvm/test/Analysis')
-rw-r--r--llvm/test/Analysis/ValueTracking/knownbits-and-or-xor-lowbit.ll5
1 files changed, 2 insertions, 3 deletions
diff --git a/llvm/test/Analysis/ValueTracking/knownbits-and-or-xor-lowbit.ll b/llvm/test/Analysis/ValueTracking/knownbits-and-or-xor-lowbit.ll
index 7fbc780..f44948e 100644
--- a/llvm/test/Analysis/ValueTracking/knownbits-and-or-xor-lowbit.ll
+++ b/llvm/test/Analysis/ValueTracking/knownbits-and-or-xor-lowbit.ll
@@ -106,9 +106,8 @@ define <2 x i1> @sub_XY_and_bit0_is_zero_fail(<2 x i8> %x, <2 x i8> %C) nounwind
define i1 @sub_XY_xor_bit0_is_one_fail(i8 %x, i8 %C) nounwind {
; CHECK-LABEL: @sub_XY_xor_bit0_is_one_fail(
-; CHECK-NEXT: [[TMP1:%.*]] = xor i8 [[C:%.*]], -2
-; CHECK-NEXT: [[C1_NEG:%.*]] = add i8 [[TMP1]], 1
-; CHECK-NEXT: [[Y:%.*]] = add i8 [[C1_NEG]], [[X:%.*]]
+; CHECK-NEXT: [[C1:%.*]] = xor i8 [[C:%.*]], 1
+; CHECK-NEXT: [[Y:%.*]] = sub i8 [[X:%.*]], [[C1]]
; CHECK-NEXT: [[W:%.*]] = xor i8 [[Y]], [[X]]
; CHECK-NEXT: [[R:%.*]] = icmp eq i8 [[W]], 10
; CHECK-NEXT: ret i1 [[R]]