aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/IR/Constants.cpp
diff options
context:
space:
mode:
authorStephen Tozer <stephen.tozer@sony.com>2024-03-19 14:41:27 +0000
committerStephen Tozer <stephen.tozer@sony.com>2024-03-19 14:41:27 +0000
commitab851f7fe946e7eed700ef9d82082eb721860189 (patch)
treeb14b007cd95ce2f114afa635e69fc1f4f0579e67 /llvm/lib/IR/Constants.cpp
parent885f93d62a0a7d2955a755cdc451d394577b36e2 (diff)
downloadllvm-ab851f7fe946e7eed700ef9d82082eb721860189.zip
llvm-ab851f7fe946e7eed700ef9d82082eb721860189.tar.gz
llvm-ab851f7fe946e7eed700ef9d82082eb721860189.tar.bz2
Revert "[NFC][RemoveDIs] Switch ConstantExpr::getAsInstruction to not insert (#84737)"
Reverted due to buildbot failures: https://lab.llvm.org/buildbot/#/builders/139/builds/61717/ This reverts commit 7ef433f62c199c414bffdcac1c8ee3159b29c5f5.
Diffstat (limited to 'llvm/lib/IR/Constants.cpp')
-rw-r--r--llvm/lib/IR/Constants.cpp21
1 files changed, 11 insertions, 10 deletions
diff --git a/llvm/lib/IR/Constants.cpp b/llvm/lib/IR/Constants.cpp
index 07b5bce..e6b92aa 100644
--- a/llvm/lib/IR/Constants.cpp
+++ b/llvm/lib/IR/Constants.cpp
@@ -3303,7 +3303,7 @@ Value *ConstantExpr::handleOperandChangeImpl(Value *From, Value *ToV) {
NewOps, this, From, To, NumUpdated, OperandNo);
}
-Instruction *ConstantExpr::getAsInstruction() const {
+Instruction *ConstantExpr::getAsInstruction(Instruction *InsertBefore) const {
SmallVector<Value *, 4> ValueOperands(operands());
ArrayRef<Value*> Ops(ValueOperands);
@@ -3322,31 +3322,32 @@ Instruction *ConstantExpr::getAsInstruction() const {
case Instruction::BitCast:
case Instruction::AddrSpaceCast:
return CastInst::Create((Instruction::CastOps)getOpcode(), Ops[0],
- getType(), "");
+ getType(), "", InsertBefore);
case Instruction::InsertElement:
- return InsertElementInst::Create(Ops[0], Ops[1], Ops[2], "");
+ return InsertElementInst::Create(Ops[0], Ops[1], Ops[2], "", InsertBefore);
case Instruction::ExtractElement:
- return ExtractElementInst::Create(Ops[0], Ops[1], "");
+ return ExtractElementInst::Create(Ops[0], Ops[1], "", InsertBefore);
case Instruction::ShuffleVector:
- return new ShuffleVectorInst(Ops[0], Ops[1], getShuffleMask(), "");
+ return new ShuffleVectorInst(Ops[0], Ops[1], getShuffleMask(), "",
+ InsertBefore);
case Instruction::GetElementPtr: {
const auto *GO = cast<GEPOperator>(this);
if (GO->isInBounds())
- return GetElementPtrInst::CreateInBounds(GO->getSourceElementType(),
- Ops[0], Ops.slice(1), "");
+ return GetElementPtrInst::CreateInBounds(
+ GO->getSourceElementType(), Ops[0], Ops.slice(1), "", InsertBefore);
return GetElementPtrInst::Create(GO->getSourceElementType(), Ops[0],
- Ops.slice(1), "");
+ Ops.slice(1), "", InsertBefore);
}
case Instruction::ICmp:
case Instruction::FCmp:
return CmpInst::Create((Instruction::OtherOps)getOpcode(),
(CmpInst::Predicate)getPredicate(), Ops[0], Ops[1],
- "");
+ "", InsertBefore);
default:
assert(getNumOperands() == 2 && "Must be binary operator?");
BinaryOperator *BO = BinaryOperator::Create(
- (Instruction::BinaryOps)getOpcode(), Ops[0], Ops[1], "");
+ (Instruction::BinaryOps)getOpcode(), Ops[0], Ops[1], "", InsertBefore);
if (isa<OverflowingBinaryOperator>(BO)) {
BO->setHasNoUnsignedWrap(SubclassOptionalData &
OverflowingBinaryOperator::NoUnsignedWrap);