Skip to content

[DebugInfo][RemoveDIs] Use iterators to insert everywhere #102003

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions llvm/lib/IR/Instructions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2484,8 +2484,9 @@ void ExtractValueInst::init(ArrayRef<unsigned> Idxs, const Twine &Name) {
}

ExtractValueInst::ExtractValueInst(const ExtractValueInst &EVI)
: UnaryInstruction(EVI.getType(), ExtractValue, EVI.getOperand(0)),
Indices(EVI.Indices) {
: UnaryInstruction(EVI.getType(), ExtractValue, EVI.getOperand(0),
(BasicBlock *)nullptr),
Indices(EVI.Indices) {
SubclassOptionalData = EVI.SubclassOptionalData;
}

Expand Down
2 changes: 1 addition & 1 deletion llvm/lib/Transforms/IPO/ExpandVariadics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -809,7 +809,7 @@ bool ExpandVariadics::expandCall(Module &M, IRBuilder<> &Builder, CallBase *CB,
Value *Dst = NF ? NF : CI->getCalledOperand();
FunctionType *NFTy = inlinableVariadicFunctionType(M, VarargFunctionType);

NewCB = CallInst::Create(NFTy, Dst, Args, OpBundles, "", CI);
NewCB = CallInst::Create(NFTy, Dst, Args, OpBundles, "", CI->getIterator());

CallInst::TailCallKind TCK = CI->getTailCallKind();
assert(TCK != CallInst::TCK_MustTail);
Expand Down
4 changes: 2 additions & 2 deletions llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -690,8 +690,8 @@ class RuntimeCallInserter {
if (EHPad && EHPad->isEHPad()) {
// Replace CI with a clone with an added funclet OperandBundle
OperandBundleDef OB("funclet", EHPad);
auto *NewCall =
CallBase::addOperandBundle(CI, LLVMContext::OB_funclet, OB, CI);
auto *NewCall = CallBase::addOperandBundle(CI, LLVMContext::OB_funclet,
OB, CI->getIterator());
NewCall->copyMetadata(*CI);
CI->replaceAllUsesWith(NewCall);
CI->eraseFromParent();
Expand Down
11 changes: 6 additions & 5 deletions llvm/lib/Transforms/Scalar/LICM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2767,8 +2767,9 @@ static bool hoistMulAddAssociation(Instruction &I, Loop &L,
unsigned OpIdx = U->getOperandNo();
auto *LHS = OpIdx == 0 ? Mul : Ins->getOperand(0);
auto *RHS = OpIdx == 1 ? Mul : Ins->getOperand(1);
auto *NewBO = BinaryOperator::Create(Ins->getOpcode(), LHS, RHS,
Ins->getName() + ".reass", Ins);
auto *NewBO =
BinaryOperator::Create(Ins->getOpcode(), LHS, RHS,
Ins->getName() + ".reass", Ins->getIterator());
NewBO->copyIRFlags(Ins);
if (VariantOp == Ins)
VariantOp = NewBO;
Expand Down Expand Up @@ -2821,9 +2822,9 @@ static bool hoistBOAssociation(Instruction &I, Loop &L,
assert(Preheader && "Loop is not in simplify form?");

auto *Inv = BinaryOperator::Create(Opcode, C1, C2, "invariant.op",
Preheader->getTerminator());
auto *NewBO =
BinaryOperator::Create(Opcode, LV, Inv, BO->getName() + ".reass", BO);
Preheader->getTerminator()->getIterator());
auto *NewBO = BinaryOperator::Create(
Opcode, LV, Inv, BO->getName() + ".reass", BO->getIterator());

// Copy NUW for ADDs if both instructions have it.
if (Opcode == Instruction::Add && BO->hasNoUnsignedWrap() &&
Expand Down
2 changes: 1 addition & 1 deletion llvm/lib/Transforms/Utils/PromoteMemoryToRegister.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,7 @@ static void convertMetadataToAssumes(LoadInst *LI, Value *Val,
LLVMContext &Ctx = LI->getContext();
new StoreInst(ConstantInt::getTrue(Ctx),
PoisonValue::get(PointerType::getUnqual(Ctx)),
/*isVolatile=*/false, Align(1), LI);
/*isVolatile=*/false, Align(1), LI->getIterator());
return;
}

Expand Down
5 changes: 3 additions & 2 deletions llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2632,8 +2632,9 @@ PHINode *InnerLoopVectorizer::createInductionResumeValue(
}

// Create phi nodes to merge from the backedge-taken check block.
PHINode *BCResumeVal = PHINode::Create(OrigPhi->getType(), 3, "bc.resume.val",
LoopScalarPreHeader->getFirstNonPHI());
PHINode *BCResumeVal =
PHINode::Create(OrigPhi->getType(), 3, "bc.resume.val",
LoopScalarPreHeader->getFirstNonPHIIt());
// Copy original phi DL over to the new one.
BCResumeVal->setDebugLoc(OrigPhi->getDebugLoc());

Expand Down
Loading