From 41513bc7a23ff47b7435203aa1257e10e02ab7dd Mon Sep 17 00:00:00 2001 From: Sanjay Patel Date: Tue, 13 Dec 2022 16:11:33 -0500 Subject: [PATCH] Revert "[InstCombine] add tests for add-of-extends; NFC" This reverts commit c8cba0bc4a8c9f4f3f10e17f601ed924dfb82bef. An unintended code change snuck into this (was supposed to just add tests). --- llvm/lib/Analysis/ValueTracking.cpp | 6 -- llvm/test/Transforms/InstCombine/add.ll | 126 -------------------------------- 2 files changed, 132 deletions(-) diff --git a/llvm/lib/Analysis/ValueTracking.cpp b/llvm/lib/Analysis/ValueTracking.cpp index 66cae4e..584e645 100644 --- a/llvm/lib/Analysis/ValueTracking.cpp +++ b/llvm/lib/Analysis/ValueTracking.cpp @@ -270,12 +270,6 @@ bool llvm::haveNoCommonBitsSet(const Value *LHS, const Value *RHS, match(LHS, m_c_Xor(m_c_And(m_Specific(RHS), m_Value(Y)), m_Deferred(Y)))) return true; - // Peek through extends: - // (ext Y) op ext(~Y) - if (match(LHS, m_ZExtOrSExt(m_Value(Y))) && - match(RHS, m_ZExtOrSExt(m_Not(m_Specific(Y))))) - return true; - // Look for: (A & B) op ~(A | B) { Value *A, *B; diff --git a/llvm/test/Transforms/InstCombine/add.ll b/llvm/test/Transforms/InstCombine/add.ll index a8accf1..3706720 100644 --- a/llvm/test/Transforms/InstCombine/add.ll +++ b/llvm/test/Transforms/InstCombine/add.ll @@ -2345,129 +2345,3 @@ define @add_to_or_scalable( %in) { %add = add %shl, shufflevector ( insertelement ( poison, i32 1, i32 0), poison, zeroinitializer) ret %add } - -define i5 @zext_zext_not(i3 %x) { -; CHECK-LABEL: @zext_zext_not( -; CHECK-NEXT: [[ZX:%.*]] = zext i3 [[X:%.*]] to i5 -; CHECK-NEXT: [[NOTX:%.*]] = xor i3 [[X]], -1 -; CHECK-NEXT: [[ZNOTX:%.*]] = zext i3 [[NOTX]] to i5 -; CHECK-NEXT: [[R:%.*]] = add nuw nsw i5 [[ZX]], [[ZNOTX]] -; CHECK-NEXT: ret i5 [[R]] -; - %zx = zext i3 %x to i5 - %notx = xor i3 %x, -1 - %znotx = zext i3 %notx to i5 - %r = add i5 %zx, %znotx - ret i5 %r -} - -define <2 x i5> @zext_zext_not_commute(<2 x i3> %x) { -; CHECK-LABEL: @zext_zext_not_commute( -; CHECK-NEXT: [[ZX:%.*]] = zext <2 x i3> [[X:%.*]] to <2 x i5> -; CHECK-NEXT: [[NOTX:%.*]] = xor <2 x i3> [[X]], -; CHECK-NEXT: [[ZNOTX:%.*]] = zext <2 x i3> [[NOTX]] to <2 x i5> -; CHECK-NEXT: [[R:%.*]] = add nuw nsw <2 x i5> [[ZNOTX]], [[ZX]] -; CHECK-NEXT: ret <2 x i5> [[R]] -; - %zx = zext <2 x i3> %x to <2 x i5> - %notx = xor <2 x i3> %x, - %znotx = zext <2 x i3> %notx to <2 x i5> - %r = add <2 x i5> %znotx, %zx - ret <2 x i5> %r -} - -define i9 @sext_sext_not(i3 %x) { -; CHECK-LABEL: @sext_sext_not( -; CHECK-NEXT: [[SX:%.*]] = sext i3 [[X:%.*]] to i9 -; CHECK-NEXT: [[NOTX:%.*]] = xor i3 [[X]], -1 -; CHECK-NEXT: [[SNOTX:%.*]] = sext i3 [[NOTX]] to i9 -; CHECK-NEXT: [[R:%.*]] = add nsw i9 [[SX]], [[SNOTX]] -; CHECK-NEXT: ret i9 [[R]] -; - %sx = sext i3 %x to i9 - %notx = xor i3 %x, -1 - %snotx = sext i3 %notx to i9 - %r = add i9 %sx, %snotx - ret i9 %r -} - -define i8 @sext_sext_not_commute(i3 %x) { -; CHECK-LABEL: @sext_sext_not_commute( -; CHECK-NEXT: [[SX:%.*]] = sext i3 [[X:%.*]] to i8 -; CHECK-NEXT: call void @use(i8 [[SX]]) -; CHECK-NEXT: [[NOTX:%.*]] = xor i3 [[X]], -1 -; CHECK-NEXT: [[SNOTX:%.*]] = sext i3 [[NOTX]] to i8 -; CHECK-NEXT: [[R:%.*]] = add nsw i8 [[SNOTX]], [[SX]] -; CHECK-NEXT: ret i8 [[R]] -; - %sx = sext i3 %x to i8 - call void @use(i8 %sx) - %notx = xor i3 %x, -1 - %snotx = sext i3 %notx to i8 - %r = add i8 %snotx, %sx - ret i8 %r -} - -define i5 @zext_sext_not(i4 %x) { -; CHECK-LABEL: @zext_sext_not( -; CHECK-NEXT: [[ZX:%.*]] = zext i4 [[X:%.*]] to i5 -; CHECK-NEXT: [[NOTX:%.*]] = xor i4 [[X]], -1 -; CHECK-NEXT: [[SNOTX:%.*]] = sext i4 [[NOTX]] to i5 -; CHECK-NEXT: [[R:%.*]] = add i5 [[ZX]], [[SNOTX]] -; CHECK-NEXT: ret i5 [[R]] -; - %zx = zext i4 %x to i5 - %notx = xor i4 %x, -1 - %snotx = sext i4 %notx to i5 - %r = add i5 %zx, %snotx - ret i5 %r -} - -define i8 @zext_sext_not_commute(i4 %x) { -; CHECK-LABEL: @zext_sext_not_commute( -; CHECK-NEXT: [[ZX:%.*]] = zext i4 [[X:%.*]] to i8 -; CHECK-NEXT: call void @use(i8 [[ZX]]) -; CHECK-NEXT: [[NOTX:%.*]] = xor i4 [[X]], -1 -; CHECK-NEXT: [[SNOTX:%.*]] = sext i4 [[NOTX]] to i8 -; CHECK-NEXT: call void @use(i8 [[SNOTX]]) -; CHECK-NEXT: [[R:%.*]] = add nsw i8 [[SNOTX]], [[ZX]] -; CHECK-NEXT: ret i8 [[R]] -; - %zx = zext i4 %x to i8 - call void @use(i8 %zx) - %notx = xor i4 %x, -1 - %snotx = sext i4 %notx to i8 - call void @use(i8 %snotx) - %r = add i8 %snotx, %zx - ret i8 %r -} - -define i9 @sext_zext_not(i4 %x) { -; CHECK-LABEL: @sext_zext_not( -; CHECK-NEXT: [[SX:%.*]] = sext i4 [[X:%.*]] to i9 -; CHECK-NEXT: [[NOTX:%.*]] = xor i4 [[X]], -1 -; CHECK-NEXT: [[ZNOTX:%.*]] = zext i4 [[NOTX]] to i9 -; CHECK-NEXT: [[R:%.*]] = add nsw i9 [[SX]], [[ZNOTX]] -; CHECK-NEXT: ret i9 [[R]] -; - %sx = sext i4 %x to i9 - %notx = xor i4 %x, -1 - %znotx = zext i4 %notx to i9 - %r = add i9 %sx, %znotx - ret i9 %r -} - -define i9 @sext_zext_not_commute(i4 %x) { -; CHECK-LABEL: @sext_zext_not_commute( -; CHECK-NEXT: [[SX:%.*]] = sext i4 [[X:%.*]] to i9 -; CHECK-NEXT: [[NOTX:%.*]] = xor i4 [[X]], -1 -; CHECK-NEXT: [[ZNOTX:%.*]] = zext i4 [[NOTX]] to i9 -; CHECK-NEXT: [[R:%.*]] = add nsw i9 [[ZNOTX]], [[SX]] -; CHECK-NEXT: ret i9 [[R]] -; - %sx = sext i4 %x to i9 - %notx = xor i4 %x, -1 - %znotx = zext i4 %notx to i9 - %r = add i9 %znotx, %sx - ret i9 %r -} -- 2.7.4