Skip to content

Commit 57a5f9c

Browse files
authored
[DebugInfo][RemoveDIs] Suppress getNextNonDebugInfoInstruction (#144383)
There are no longer debug-info instructions, thus we don't need this skipping. Horray!
1 parent 8db92a7 commit 57a5f9c

28 files changed

+66
-91
lines changed

clang/lib/CodeGen/CGBlocks.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1549,8 +1549,8 @@ llvm::Function *CodeGenFunction::GenerateBlockFunction(
15491549
llvm::BasicBlock *resume = Builder.GetInsertBlock();
15501550

15511551
// Go back to the entry.
1552-
if (entry_ptr->getNextNonDebugInstruction())
1553-
entry_ptr = entry_ptr->getNextNonDebugInstruction()->getIterator();
1552+
if (entry_ptr->getNextNode())
1553+
entry_ptr = entry_ptr->getNextNode()->getIterator();
15541554
else
15551555
entry_ptr = entry->end();
15561556
Builder.SetInsertPoint(entry, entry_ptr);

llvm/include/llvm/IR/Instruction.h

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -898,17 +898,6 @@ class Instruction : public User,
898898
/// Return true if the instruction is a DbgInfoIntrinsic or PseudoProbeInst.
899899
LLVM_ABI bool isDebugOrPseudoInst() const LLVM_READONLY;
900900

901-
/// Return a pointer to the next non-debug instruction in the same basic
902-
/// block as 'this', or nullptr if no such instruction exists. Skip any pseudo
903-
/// operations if \c SkipPseudoOp is true.
904-
LLVM_ABI const Instruction *
905-
getNextNonDebugInstruction(bool SkipPseudoOp = false) const;
906-
Instruction *getNextNonDebugInstruction(bool SkipPseudoOp = false) {
907-
return const_cast<Instruction *>(
908-
static_cast<const Instruction *>(this)->getNextNonDebugInstruction(
909-
SkipPseudoOp));
910-
}
911-
912901
/// Return a pointer to the previous non-debug instruction in the same basic
913902
/// block as 'this', or nullptr if no such instruction exists. Skip any pseudo
914903
/// operations if \c SkipPseudoOp is true.

llvm/include/llvm/Transforms/Utils/LockstepReverseIterator.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ class LockstepReverseIterator
133133
return *this;
134134
SmallVector<Instruction *, 4> NewInsts;
135135
for (Instruction *Inst : Insts) {
136-
Instruction *Next = Inst->getNextNonDebugInstruction();
136+
Instruction *Next = Inst->getNextNode();
137137
// Already at end of block.
138138
if (!Next) {
139139
Fail = true;

llvm/lib/Analysis/MemoryDependenceAnalysis.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,7 @@ static bool canSkipClobberingStore(const StoreInst *SI,
353353
if (BatchAA.alias(MemoryLocation::get(LI), MemLoc) != AliasResult::MustAlias)
354354
return false;
355355
unsigned NumVisitedInsts = 0;
356-
for (const Instruction *I = LI; I != SI; I = I->getNextNonDebugInstruction())
356+
for (const Instruction *I = LI; I != SI; I = I->getNextNode())
357357
if (++NumVisitedInsts > ScanLimit ||
358358
isModSet(BatchAA.getModRefInfo(I, MemLoc)))
359359
return false;

llvm/lib/CodeGen/CodeGenPrepare.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7328,7 +7328,7 @@ bool CodeGenPrepare::optimizeLoadExt(LoadInst *Load) {
73287328
!TLI->isLoadExtLegal(ISD::ZEXTLOAD, LoadResultVT, TruncVT))
73297329
return false;
73307330

7331-
IRBuilder<> Builder(Load->getNextNonDebugInstruction());
7331+
IRBuilder<> Builder(Load->getNextNode());
73327332
auto *NewAnd = cast<Instruction>(
73337333
Builder.CreateAnd(Load, ConstantInt::get(Ctx, DemandBits)));
73347334
// Mark this instruction as "inserted by CGP", so that other

llvm/lib/IR/Instruction.cpp

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1235,14 +1235,6 @@ bool Instruction::isDebugOrPseudoInst() const {
12351235
return isa<DbgInfoIntrinsic>(this) || isa<PseudoProbeInst>(this);
12361236
}
12371237

1238-
const Instruction *
1239-
Instruction::getNextNonDebugInstruction(bool SkipPseudoOp) const {
1240-
for (const Instruction *I = getNextNode(); I; I = I->getNextNode())
1241-
if (!isa<DbgInfoIntrinsic>(I) && !(SkipPseudoOp && isa<PseudoProbeInst>(I)))
1242-
return I;
1243-
return nullptr;
1244-
}
1245-
12461238
const Instruction *
12471239
Instruction::getPrevNonDebugInstruction(bool SkipPseudoOp) const {
12481240
for (const Instruction *I = getPrevNode(); I; I = I->getPrevNode())
@@ -1252,9 +1244,6 @@ Instruction::getPrevNonDebugInstruction(bool SkipPseudoOp) const {
12521244
}
12531245

12541246
const DebugLoc &Instruction::getStableDebugLoc() const {
1255-
if (isa<DbgInfoIntrinsic>(this))
1256-
if (const Instruction *Next = getNextNonDebugInstruction())
1257-
return Next->getDebugLoc();
12581247
return getDebugLoc();
12591248
}
12601249

llvm/lib/IR/Verifier.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6541,7 +6541,7 @@ void Verifier::visitIntrinsicCall(Intrinsic::ID ID, CallBase &Call) {
65416541
Check(!Call.paramHasAttr(3, Attribute::InReg),
65426542
"VGPR arguments must not have the `inreg` attribute", &Call);
65436543

6544-
auto *Next = Call.getNextNonDebugInstruction();
6544+
auto *Next = Call.getNextNode();
65456545
bool IsAMDUnreachable = Next && isa<IntrinsicInst>(Next) &&
65466546
cast<IntrinsicInst>(Next)->getIntrinsicID() ==
65476547
Intrinsic::amdgcn_unreachable;

llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2674,14 +2674,14 @@ static std::optional<Instruction *> instCombineSVEInsr(InstCombiner &IC,
26742674
static std::optional<Instruction *> instCombineDMB(InstCombiner &IC,
26752675
IntrinsicInst &II) {
26762676
// If this barrier is post-dominated by identical one we can remove it
2677-
auto *NI = II.getNextNonDebugInstruction();
2677+
auto *NI = II.getNextNode();
26782678
unsigned LookaheadThreshold = DMBLookaheadThreshold;
26792679
auto CanSkipOver = [](Instruction *I) {
26802680
return !I->mayReadOrWriteMemory() && !I->mayHaveSideEffects();
26812681
};
26822682
while (LookaheadThreshold-- && CanSkipOver(NI)) {
26832683
auto *NIBB = NI->getParent();
2684-
NI = NI->getNextNonDebugInstruction();
2684+
NI = NI->getNextNode();
26852685
if (!NI) {
26862686
if (auto *SuccBB = NIBB->getUniqueSuccessor())
26872687
NI = &*SuccBB->getFirstNonPHIOrDbgOrLifetime();

llvm/lib/Target/X86/X86WinEHState.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -811,7 +811,7 @@ void WinEHStatePass::updateEspForInAllocas(Function &F) {
811811
if (auto *Alloca = dyn_cast<AllocaInst>(&I)) {
812812
if (Alloca->isStaticAlloca())
813813
continue;
814-
IRBuilder<> Builder(Alloca->getNextNonDebugInstruction());
814+
IRBuilder<> Builder(Alloca->getNextNode());
815815
// SavedESP = llvm.stacksave()
816816
Value *SP = Builder.CreateStackSave();
817817
Builder.CreateStore(SP, Builder.CreateStructGEP(RegNodeTy, RegNode, 0));
@@ -820,7 +820,7 @@ void WinEHStatePass::updateEspForInAllocas(Function &F) {
820820
if (auto *II = dyn_cast<IntrinsicInst>(&I)) {
821821
if (II->getIntrinsicID() != Intrinsic::stackrestore)
822822
continue;
823-
IRBuilder<> Builder(II->getNextNonDebugInstruction());
823+
IRBuilder<> Builder(II->getNextNode());
824824
// SavedESP = llvm.stacksave()
825825
Value *SP = Builder.CreateStackSave();
826826
Builder.CreateStore(SP, Builder.CreateStructGEP(RegNodeTy, RegNode, 0));

llvm/lib/Transforms/Coroutines/CoroSplit.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -808,15 +808,14 @@ static void updateScopeLine(Instruction *ActiveSuspend,
808808
return;
809809

810810
// No subsequent instruction -> fallback to the location of ActiveSuspend.
811-
if (!ActiveSuspend->getNextNonDebugInstruction()) {
811+
if (!ActiveSuspend->getNextNode()) {
812812
if (auto DL = ActiveSuspend->getDebugLoc())
813813
if (SPToUpdate.getFile() == DL->getFile())
814814
SPToUpdate.setScopeLine(DL->getLine());
815815
return;
816816
}
817817

818-
BasicBlock::iterator Successor =
819-
ActiveSuspend->getNextNonDebugInstruction()->getIterator();
818+
BasicBlock::iterator Successor = ActiveSuspend->getNextNode()->getIterator();
820819
// Corosplit splits the BB around ActiveSuspend, so the meaningful
821820
// instructions are not in the same BB.
822821
if (auto *Branch = dyn_cast_or_null<BranchInst>(Successor);

0 commit comments

Comments
 (0)