aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikita Popov <npopov@redhat.com>2024-06-20 08:59:29 +0200
committerGitHub <noreply@github.com>2024-06-20 08:59:29 +0200
commit76d3ab2cc33336c1eece6484c9a55577eac7e79a (patch)
tree86deabd1829435f46a787d9f76773791fcad282e
parent930dd3fd873c91556b878444d57b1d12651b266f (diff)
downloadllvm-76d3ab2cc33336c1eece6484c9a55577eac7e79a.zip
llvm-76d3ab2cc33336c1eece6484c9a55577eac7e79a.tar.gz
llvm-76d3ab2cc33336c1eece6484c9a55577eac7e79a.tar.bz2
[IR] Remove support for shl constant expressions (#96037)
Remove support for shl constant expressions, as part of: https://discourse.llvm.org/t/rfc-remove-most-constant-expressions/63179
-rw-r--r--llvm/bindings/ocaml/llvm/llvm.ml1
-rw-r--r--llvm/bindings/ocaml/llvm/llvm.mli5
-rw-r--r--llvm/bindings/ocaml/llvm/llvm_ocaml.c6
-rw-r--r--llvm/docs/ReleaseNotes.rst2
-rw-r--r--llvm/include/llvm-c/Core.h1
-rw-r--r--llvm/include/llvm/IR/Constants.h10
-rw-r--r--llvm/lib/AsmParser/LLParser.cpp5
-rw-r--r--llvm/lib/IR/ConstantFold.cpp68
-rw-r--r--llvm/lib/IR/Constants.cpp15
-rw-r--r--llvm/lib/IR/Core.cpp5
-rw-r--r--llvm/test/Assembler/2003-05-21-MalformedShiftCrash.ll5
-rw-r--r--llvm/test/Assembler/flags.ll6
-rw-r--r--llvm/test/Transforms/InstCombine/rotate.ll6
-rw-r--r--llvm/test/Transforms/InstCombine/shift-logic.ll6
-rw-r--r--llvm/test/Transforms/InstCombine/udiv-simplify.ll9
-rw-r--r--llvm/test/Transforms/LoopStrengthReduce/pr2537.ll6
-rw-r--r--llvm/test/Verifier/ifunc-opaque.ll2
-rw-r--r--llvm/unittests/IR/ConstantsTest.cpp8
18 files changed, 25 insertions, 141 deletions
diff --git a/llvm/bindings/ocaml/llvm/llvm.ml b/llvm/bindings/ocaml/llvm/llvm.ml
index 7bfaf86..86b010e 100644
--- a/llvm/bindings/ocaml/llvm/llvm.ml
+++ b/llvm/bindings/ocaml/llvm/llvm.ml
@@ -651,7 +651,6 @@ external const_mul : llvalue -> llvalue -> llvalue = "llvm_const_mul"
external const_nsw_mul : llvalue -> llvalue -> llvalue = "llvm_const_nsw_mul"
external const_nuw_mul : llvalue -> llvalue -> llvalue = "llvm_const_nuw_mul"
external const_xor : llvalue -> llvalue -> llvalue = "llvm_const_xor"
-external const_shl : llvalue -> llvalue -> llvalue = "llvm_const_shl"
external const_gep : lltype -> llvalue -> llvalue array -> llvalue
= "llvm_const_gep"
external const_in_bounds_gep : lltype -> llvalue -> llvalue array -> llvalue
diff --git a/llvm/bindings/ocaml/llvm/llvm.mli b/llvm/bindings/ocaml/llvm/llvm.mli
index 89b894b..c16530d 100644
--- a/llvm/bindings/ocaml/llvm/llvm.mli
+++ b/llvm/bindings/ocaml/llvm/llvm.mli
@@ -1136,11 +1136,6 @@ val const_nuw_mul : llvalue -> llvalue -> llvalue
See the method [llvm::ConstantExpr::getXor]. *)
val const_xor : llvalue -> llvalue -> llvalue
-(** [const_shl c1 c2] returns the constant integer [c1] left-shifted by the
- constant integer [c2].
- See the method [llvm::ConstantExpr::getShl]. *)
-val const_shl : llvalue -> llvalue -> llvalue
-
(** [const_gep srcty pc indices] returns the constant [getElementPtr] of [pc]
with source element type [srcty] and the constant integers indices from the
array [indices].
diff --git a/llvm/bindings/ocaml/llvm/llvm_ocaml.c b/llvm/bindings/ocaml/llvm/llvm_ocaml.c
index 3976a96..4ac824c 100644
--- a/llvm/bindings/ocaml/llvm/llvm_ocaml.c
+++ b/llvm/bindings/ocaml/llvm/llvm_ocaml.c
@@ -1224,12 +1224,6 @@ value llvm_const_xor(value LHS, value RHS) {
return to_val(Value);
}
-/* llvalue -> llvalue -> llvalue */
-value llvm_const_shl(value LHS, value RHS) {
- LLVMValueRef Value = LLVMConstShl(Value_val(LHS), Value_val(RHS));
- return to_val(Value);
-}
-
/* lltype -> llvalue -> llvalue array -> llvalue */
value llvm_const_gep(value Ty, value ConstantVal, value Indices) {
mlsize_t Length = Wosize_val(Indices);
diff --git a/llvm/docs/ReleaseNotes.rst b/llvm/docs/ReleaseNotes.rst
index 507f6b2..abbb059 100644
--- a/llvm/docs/ReleaseNotes.rst
+++ b/llvm/docs/ReleaseNotes.rst
@@ -66,6 +66,7 @@ Changes to the LLVM IR
* ``icmp``
* ``fcmp``
+ * ``shl``
* LLVM has switched from using debug intrinsics in textual IR to using debug
records by default. Details of the change and instructions on how to update
any downstream tools and tests can be found in the `migration docs
@@ -227,6 +228,7 @@ Changes to the C API
* ``LLVMConstICmp``
* ``LLVMConstFCmp``
+ * ``LLVMConstShl``
**Note:** The following changes are due to the removal of the debug info
intrinsics from LLVM and to the introduction of debug records into LLVM.
diff --git a/llvm/include/llvm-c/Core.h b/llvm/include/llvm-c/Core.h
index 7de99c3..af2e562 100644
--- a/llvm/include/llvm-c/Core.h
+++ b/llvm/include/llvm-c/Core.h
@@ -2354,7 +2354,6 @@ LLVMValueRef LLVMConstMul(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
LLVMValueRef LLVMConstNSWMul(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
LLVMValueRef LLVMConstNUWMul(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
LLVMValueRef LLVMConstXor(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
-LLVMValueRef LLVMConstShl(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
LLVMValueRef LLVMConstGEP2(LLVMTypeRef Ty, LLVMValueRef ConstantVal,
LLVMValueRef *ConstantIndices, unsigned NumIndices);
LLVMValueRef LLVMConstInBoundsGEP2(LLVMTypeRef Ty, LLVMValueRef ConstantVal,
diff --git a/llvm/include/llvm/IR/Constants.h b/llvm/include/llvm/IR/Constants.h
index 0ccccab..4d13c38 100644
--- a/llvm/include/llvm/IR/Constants.h
+++ b/llvm/include/llvm/IR/Constants.h
@@ -1122,8 +1122,6 @@ public:
static Constant *getMul(Constant *C1, Constant *C2, bool HasNUW = false,
bool HasNSW = false);
static Constant *getXor(Constant *C1, Constant *C2);
- static Constant *getShl(Constant *C1, Constant *C2, bool HasNUW = false,
- bool HasNSW = false);
static Constant *getTrunc(Constant *C, Type *Ty, bool OnlyIfReduced = false);
static Constant *getPtrToInt(Constant *C, Type *Ty,
bool OnlyIfReduced = false);
@@ -1160,14 +1158,6 @@ public:
return getMul(C1, C2, true, false);
}
- static Constant *getNSWShl(Constant *C1, Constant *C2) {
- return getShl(C1, C2, false, true);
- }
-
- static Constant *getNUWShl(Constant *C1, Constant *C2) {
- return getShl(C1, C2, true, false);
- }
-
/// If C is a scalar/fixed width vector of known powers of 2, then this
/// function returns a new scalar/fixed width vector obtained from logBase2
/// of C. Undef vector elements are set to zero.
diff --git a/llvm/lib/AsmParser/LLParser.cpp b/llvm/lib/AsmParser/LLParser.cpp
index 6ca80e3..6c97e9e 100644
--- a/llvm/lib/AsmParser/LLParser.cpp
+++ b/llvm/lib/AsmParser/LLParser.cpp
@@ -4157,6 +4157,8 @@ bool LLParser::parseValID(ValID &ID, PerFunctionState *PFS, Type *ExpectedTy) {
return error(ID.Loc, "lshr constexprs are no longer supported");
case lltok::kw_ashr:
return error(ID.Loc, "ashr constexprs are no longer supported");
+ case lltok::kw_shl:
+ return error(ID.Loc, "shl constexprs are no longer supported");
case lltok::kw_fneg:
return error(ID.Loc, "fneg constexprs are no longer supported");
case lltok::kw_select:
@@ -4186,7 +4188,6 @@ bool LLParser::parseValID(ValID &ID, PerFunctionState *PFS, Type *ExpectedTy) {
case lltok::kw_add:
case lltok::kw_sub:
case lltok::kw_mul:
- case lltok::kw_shl:
case lltok::kw_xor: {
bool NUW = false;
bool NSW = false;
@@ -4194,7 +4195,7 @@ bool LLParser::parseValID(ValID &ID, PerFunctionState *PFS, Type *ExpectedTy) {
Constant *Val0, *Val1;
Lex.Lex();
if (Opc == Instruction::Add || Opc == Instruction::Sub ||
- Opc == Instruction::Mul || Opc == Instruction::Shl) {
+ Opc == Instruction::Mul) {
if (EatIfPresent(lltok::kw_nuw))
NUW = true;
if (EatIfPresent(lltok::kw_nsw)) {
diff --git a/llvm/lib/IR/ConstantFold.cpp b/llvm/lib/IR/ConstantFold.cpp
index 34bcf36..693674a 100644
--- a/llvm/lib/IR/ConstantFold.cpp
+++ b/llvm/lib/IR/ConstantFold.cpp
@@ -120,66 +120,6 @@ static Constant *FoldBitCast(Constant *V, Type *DestTy) {
return nullptr;
}
-
-/// V is an integer constant which only has a subset of its bytes used.
-/// The bytes used are indicated by ByteStart (which is the first byte used,
-/// counting from the least significant byte) and ByteSize, which is the number
-/// of bytes used.
-///
-/// This function analyzes the specified constant to see if the specified byte
-/// range can be returned as a simplified constant. If so, the constant is
-/// returned, otherwise null is returned.
-static Constant *ExtractConstantBytes(Constant *C, unsigned ByteStart,
- unsigned ByteSize) {
- assert(C->getType()->isIntegerTy() &&
- (cast<IntegerType>(C->getType())->getBitWidth() & 7) == 0 &&
- "Non-byte sized integer input");
- [[maybe_unused]] unsigned CSize = cast<IntegerType>(C->getType())->getBitWidth()/8;
- assert(ByteSize && "Must be accessing some piece");
- assert(ByteStart+ByteSize <= CSize && "Extracting invalid piece from input");
- assert(ByteSize != CSize && "Should not extract everything");
-
- // Constant Integers are simple.
- if (ConstantInt *CI = dyn_cast<ConstantInt>(C)) {
- APInt V = CI->getValue();
- if (ByteStart)
- V.lshrInPlace(ByteStart*8);
- V = V.trunc(ByteSize*8);
- return ConstantInt::get(CI->getContext(), V);
- }
-
- // In the input is a constant expr, we might be able to recursively simplify.
- // If not, we definitely can't do anything.
- ConstantExpr *CE = dyn_cast<ConstantExpr>(C);
- if (!CE) return nullptr;
-
- switch (CE->getOpcode()) {
- default: return nullptr;
- case Instruction::Shl: {
- ConstantInt *Amt = dyn_cast<ConstantInt>(CE->getOperand(1));
- if (!Amt)
- return nullptr;
- APInt ShAmt = Amt->getValue();
- // Cannot analyze non-byte shifts.
- if ((ShAmt & 7) != 0)
- return nullptr;
- ShAmt.lshrInPlace(3);
-
- // If the extract is known to be all zeros, return zero.
- if (ShAmt.uge(ByteStart + ByteSize))
- return Constant::getNullValue(
- IntegerType::get(CE->getContext(), ByteSize * 8));
- // If the extract is known to be fully in the input, extract it.
- if (ShAmt.ule(ByteStart))
- return ExtractConstantBytes(CE->getOperand(0),
- ByteStart - ShAmt.getZExtValue(), ByteSize);
-
- // TODO: Handle the 'partially zero' case.
- return nullptr;
- }
- }
-}
-
static Constant *foldMaybeUndesirableCast(unsigned opc, Constant *V,
Type *DestTy) {
return ConstantExpr::isDesirableCastOp(opc)
@@ -313,14 +253,6 @@ Constant *llvm::ConstantFoldCastInstruction(unsigned opc, Constant *V,
CI->getValue().trunc(DestBitWidth));
}
- // The input must be a constantexpr. See if we can simplify this based on
- // the bytes we are demanding. Only do this if the source and dest are an
- // even multiple of a byte.
- if ((DestBitWidth & 7) == 0 &&
- (cast<IntegerType>(V->getType())->getBitWidth() & 7) == 0)
- if (Constant *Res = ExtractConstantBytes(V, 0, DestBitWidth / 8))
- return Res;
-
return nullptr;
}
case Instruction::BitCast:
diff --git a/llvm/lib/IR/Constants.cpp b/llvm/lib/IR/Constants.cpp
index fed3670..bc91f90 100644
--- a/llvm/lib/IR/Constants.cpp
+++ b/llvm/lib/IR/Constants.cpp
@@ -2285,12 +2285,6 @@ Constant *ConstantExpr::get(unsigned Opcode, Constant *C1, Constant *C2,
assert(C1->getType()->isIntOrIntVectorTy() &&
"Tried to create a logical operation on a non-integral type!");
break;
- case Instruction::Shl:
- case Instruction::LShr:
- case Instruction::AShr:
- assert(C1->getType()->isIntOrIntVectorTy() &&
- "Tried to create a shift operation on a non-integer type!");
- break;
default:
break;
}
@@ -2351,11 +2345,11 @@ bool ConstantExpr::isSupportedBinOp(unsigned Opcode) {
case Instruction::Or:
case Instruction::LShr:
case Instruction::AShr:
+ case Instruction::Shl:
return false;
case Instruction::Add:
case Instruction::Sub:
case Instruction::Mul:
- case Instruction::Shl:
case Instruction::Xor:
return true;
default:
@@ -2589,13 +2583,6 @@ Constant *ConstantExpr::getXor(Constant *C1, Constant *C2) {
return get(Instruction::Xor, C1, C2);
}
-Constant *ConstantExpr::getShl(Constant *C1, Constant *C2,
- bool HasNUW, bool HasNSW) {
- unsigned Flags = (HasNUW ? OverflowingBinaryOperator::NoUnsignedWrap : 0) |
- (HasNSW ? OverflowingBinaryOperator::NoSignedWrap : 0);
- return get(Instruction::Shl, C1, C2, Flags);
-}
-
Constant *ConstantExpr::getExactLogBase2(Constant *C) {
Type *Ty = C->getType();
const APInt *IVal;
diff --git a/llvm/lib/IR/Core.cpp b/llvm/lib/IR/Core.cpp
index 3a91a4e..3b6b01f 100644
--- a/llvm/lib/IR/Core.cpp
+++ b/llvm/lib/IR/Core.cpp
@@ -1746,11 +1746,6 @@ LLVMValueRef LLVMConstXor(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant) {
unwrap<Constant>(RHSConstant)));
}
-LLVMValueRef LLVMConstShl(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant) {
- return wrap(ConstantExpr::getShl(unwrap<Constant>(LHSConstant),
- unwrap<Constant>(RHSConstant)));
-}
-
LLVMValueRef LLVMConstGEP2(LLVMTypeRef Ty, LLVMValueRef ConstantVal,
LLVMValueRef *ConstantIndices, unsigned NumIndices) {
ArrayRef<Constant *> IdxList(unwrap<Constant>(ConstantIndices, NumIndices),
diff --git a/llvm/test/Assembler/2003-05-21-MalformedShiftCrash.ll b/llvm/test/Assembler/2003-05-21-MalformedShiftCrash.ll
deleted file mode 100644
index a0dda45..0000000
--- a/llvm/test/Assembler/2003-05-21-MalformedShiftCrash.ll
+++ /dev/null
@@ -1,5 +0,0 @@
-; Found by inspection of the code
-; RUN: not llvm-as < %s > /dev/null 2> %t
-; RUN: grep "constexpr requires integer or integer vector operands" %t
-
-@0 = global i32 shl (float 1.0, float 2.0)
diff --git a/llvm/test/Assembler/flags.ll b/llvm/test/Assembler/flags.ll
index 7d2aafa..8420950 100644
--- a/llvm/test/Assembler/flags.ll
+++ b/llvm/test/Assembler/flags.ll
@@ -230,12 +230,6 @@ define i64 @mul_signed_ce() {
ret i64 mul nsw (i64 ptrtoint (ptr @addr to i64), i64 91)
}
-define i64 @shl_signed_ce() {
-; CHECK: ret i64 shl nsw (i64 ptrtoint (ptr @addr to i64), i64 17)
- ret i64 shl nsw (i64 ptrtoint (ptr @addr to i64), i64 17)
-}
-
-
define i64 @add_unsigned_ce() {
; CHECK: ret i64 add nuw (i64 ptrtoint (ptr @addr to i64), i64 91)
ret i64 add nuw (i64 ptrtoint (ptr @addr to i64), i64 91)
diff --git a/llvm/test/Transforms/InstCombine/rotate.ll b/llvm/test/Transforms/InstCombine/rotate.ll
index eec623e..35d15ea 100644
--- a/llvm/test/Transforms/InstCombine/rotate.ll
+++ b/llvm/test/Transforms/InstCombine/rotate.ll
@@ -893,11 +893,13 @@ define i64 @rotr_select_zext_shamt(i64 %x, i32 %y) {
define i32 @rotl_constant_expr(i32 %shamt) {
; CHECK-LABEL: @rotl_constant_expr(
; CHECK-NEXT: [[SHR:%.*]] = lshr i32 ptrtoint (ptr @external_global to i32), [[SHAMT:%.*]]
-; CHECK-NEXT: [[R:%.*]] = or i32 [[SHR]], shl (i32 ptrtoint (ptr @external_global to i32), i32 11)
+; CHECK-NEXT: [[SHL:%.*]] = shl i32 ptrtoint (ptr @external_global to i32), 11
+; CHECK-NEXT: [[R:%.*]] = or i32 [[SHR]], [[SHL]]
; CHECK-NEXT: ret i32 [[R]]
;
%shr = lshr i32 ptrtoint (ptr @external_global to i32), %shamt
- %r = or i32 %shr, shl (i32 ptrtoint (ptr @external_global to i32), i32 11)
+ %shl = shl i32 ptrtoint (ptr @external_global to i32), 11
+ %r = or i32 %shr, %shl
ret i32 %r
}
diff --git a/llvm/test/Transforms/InstCombine/shift-logic.ll b/llvm/test/Transforms/InstCombine/shift-logic.ll
index b591400..3d4547e 100644
--- a/llvm/test/Transforms/InstCombine/shift-logic.ll
+++ b/llvm/test/Transforms/InstCombine/shift-logic.ll
@@ -247,12 +247,14 @@ define i32 @lshr_or_extra_use(i32 %x, i32 %y, ptr %p) {
define i32 @PR44028(i32 %x) {
; CHECK-LABEL: @PR44028(
; CHECK-NEXT: [[SH1:%.*]] = ashr exact i32 [[X:%.*]], 16
-; CHECK-NEXT: [[T0:%.*]] = xor i32 [[SH1]], shl (i32 ptrtoint (ptr @g to i32), i32 16)
+; CHECK-NEXT: [[SH2:%.*]] = shl i32 ptrtoint (ptr @g to i32), 16
+; CHECK-NEXT: [[T0:%.*]] = xor i32 [[SH1]], [[SH2]]
; CHECK-NEXT: [[T27:%.*]] = ashr exact i32 [[T0]], 16
; CHECK-NEXT: ret i32 [[T27]]
;
%sh1 = ashr exact i32 %x, 16
- %t0 = xor i32 %sh1, shl (i32 ptrtoint (ptr @g to i32), i32 16)
+ %sh2 = shl i32 ptrtoint (ptr @g to i32), 16
+ %t0 = xor i32 %sh1, %sh2
%t27 = ashr exact i32 %t0, 16
ret i32 %t27
}
diff --git a/llvm/test/Transforms/InstCombine/udiv-simplify.ll b/llvm/test/Transforms/InstCombine/udiv-simplify.ll
index bd6e5ef..0af3348 100644
--- a/llvm/test/Transforms/InstCombine/udiv-simplify.ll
+++ b/llvm/test/Transforms/InstCombine/udiv-simplify.ll
@@ -55,12 +55,13 @@ define i64 @test2_PR2274(i32 %x, i32 %v) nounwind {
define i32 @PR30366(i1 %a) {
; CHECK-LABEL: @PR30366(
; CHECK-NEXT: [[Z:%.*]] = zext i1 [[A:%.*]] to i32
-; CHECK-NEXT: [[Z2:%.*]] = zext nneg i16 shl (i16 1, i16 ptrtoint (ptr @b to i16)) to i32
-; CHECK-NEXT: [[D:%.*]] = udiv i32 [[Z]], [[Z2]]
-; CHECK-NEXT: ret i32 [[D]]
+; CHECK-NEXT: [[TMP1:%.*]] = zext nneg i16 ptrtoint (ptr @b to i16) to i32
+; CHECK-NEXT: [[D1:%.*]] = lshr i32 [[Z]], [[TMP1]]
+; CHECK-NEXT: ret i32 [[D1]]
;
%z = zext i1 %a to i32
- %z2 = zext i16 shl (i16 1, i16 ptrtoint (ptr @b to i16)) to i32
+ %shl = shl i16 1, ptrtoint (ptr @b to i16)
+ %z2 = zext i16 %shl to i32
%d = udiv i32 %z, %z2
ret i32 %d
}
diff --git a/llvm/test/Transforms/LoopStrengthReduce/pr2537.ll b/llvm/test/Transforms/LoopStrengthReduce/pr2537.ll
index 46ad70e..d92323c 100644
--- a/llvm/test/Transforms/LoopStrengthReduce/pr2537.ll
+++ b/llvm/test/Transforms/LoopStrengthReduce/pr2537.ll
@@ -8,10 +8,10 @@ entry:
dobody: ; preds = %dobody, %entry
%y.0 = phi i128 [ 0, %entry ], [ %add, %dobody ]
%x.0 = phi i128 [ 0, %entry ], [ %add2, %dobody ]
- %add = add i128 %y.0, shl (i128 1, i128 64)
- %add2 = add i128 %x.0, shl (i128 1, i128 48)
+ %add = add i128 %y.0, u0x10000000000000000
+ %add2 = add i128 %x.0, u0x1000000000000
call void @b( i128 %add )
- %cmp = icmp ult i128 %add2, shl (i128 1, i128 64)
+ %cmp = icmp ult i128 %add2, u0x10000000000000000
br i1 %cmp, label %dobody, label %afterdo
afterdo: ; preds = %dobody
diff --git a/llvm/test/Verifier/ifunc-opaque.ll b/llvm/test/Verifier/ifunc-opaque.ll
index 349207b..a1505c3 100644
--- a/llvm/test/Verifier/ifunc-opaque.ll
+++ b/llvm/test/Verifier/ifunc-opaque.ll
@@ -14,4 +14,4 @@ define ptr @resolver() {
; CHECK: IFunc must have a Function resolver
; CHECK-NEXT: ptr @ifunc_shl
-@ifunc_shl = ifunc void (), ptr inttoptr (i64 shl (i64 ptrtoint (ptr @resolver to i64), i64 4) to ptr)
+@ifunc_shl = ifunc void (), ptr inttoptr (i64 add (i64 ptrtoint (ptr @resolver to i64), i64 4) to ptr)
diff --git a/llvm/unittests/IR/ConstantsTest.cpp b/llvm/unittests/IR/ConstantsTest.cpp
index 2a85aac55..48d65be 100644
--- a/llvm/unittests/IR/ConstantsTest.cpp
+++ b/llvm/unittests/IR/ConstantsTest.cpp
@@ -56,11 +56,11 @@ TEST(ConstantsTest, Integer_i1) {
// @h = constant i1 shl(i1 1 , i1 1) ; poison
// @h = constant i1 poison
- EXPECT_EQ(Poison, ConstantExpr::getShl(One, One));
+ EXPECT_EQ(Poison, ConstantFoldBinaryInstruction(Instruction::Shl, One, One));
// @i = constant i1 shl(i1 1 , i1 0)
// @i = constant i1 true
- EXPECT_EQ(One, ConstantExpr::getShl(One, Zero));
+ EXPECT_EQ(One, ConstantFoldBinaryInstruction(Instruction::Shl, One, Zero));
// @n = constant i1 mul(i1 -1, i1 1)
// @n = constant i1 true
@@ -216,10 +216,6 @@ TEST(ConstantsTest, AsInstructionsTest) {
CHECK(ConstantExpr::getSub(P0, P0), "sub i32 " P0STR ", " P0STR);
CHECK(ConstantExpr::getMul(P0, P0), "mul i32 " P0STR ", " P0STR);
CHECK(ConstantExpr::getXor(P0, P0), "xor i32 " P0STR ", " P0STR);
- CHECK(ConstantExpr::getShl(P0, P0), "shl i32 " P0STR ", " P0STR);
- CHECK(ConstantExpr::getShl(P0, P0, true), "shl nuw i32 " P0STR ", " P0STR);
- CHECK(ConstantExpr::getShl(P0, P0, false, true),
- "shl nsw i32 " P0STR ", " P0STR);
std::vector<Constant *> V;
V.push_back(One);