Skip to content

Commit 61c8e98

Browse files
committed
[DebugInfo][RemoveDIs] Remove a swathe of debug-intrinsic code
Seeing how we can't generate any debug intrinsics any more: delete a variety of codepaths where they're handled. For the most part these are plain deletions, in others I've tweaked comments to remain coherent, or added a type to (what was) type-generic-lambdas. This isn't all the DbgInfoIntrinsic call sites but it's most of the simple scenarios.
1 parent 013034c commit 61c8e98

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+103
-394
lines changed

llvm/include/llvm/Analysis/IRSimilarityIdentifier.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -545,10 +545,6 @@ struct IRInstructionMapper {
545545
// dependent.
546546
InstrType visitLandingPadInst(LandingPadInst &LPI) { return Illegal; }
547547
InstrType visitFuncletPadInst(FuncletPadInst &FPI) { return Illegal; }
548-
// DebugInfo should be included in the regions, but should not be
549-
// analyzed for similarity as it has no bearing on the outcome of the
550-
// program.
551-
InstrType visitDbgInfoIntrinsic(DbgInfoIntrinsic &DII) { return Invisible; }
552548
InstrType visitIntrinsicInst(IntrinsicInst &II) {
553549
// These are disabled due to complications in the CodeExtractor when
554550
// outlining these instructions. For instance, It is unclear what we

llvm/include/llvm/Analysis/PtrUseVisitor.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,6 @@ class PtrUseVisitor : protected InstVisitor<DerivedT>,
285285

286286
// No-op intrinsics which we know don't escape the pointer to logic in
287287
// some other function.
288-
void visitDbgInfoIntrinsic(DbgInfoIntrinsic &I) {}
289288
void visitMemIntrinsic(MemIntrinsic &I) {}
290289
void visitIntrinsicInst(IntrinsicInst &II) {
291290
switch (II.getIntrinsicID()) {

llvm/include/llvm/IR/InstVisitor.h

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -199,13 +199,6 @@ class InstVisitor {
199199
RetTy visitCatchPadInst(CatchPadInst &I) { DELEGATE(FuncletPadInst); }
200200
RetTy visitFreezeInst(FreezeInst &I) { DELEGATE(Instruction); }
201201

202-
// Handle the special intrinsic instruction classes.
203-
RetTy visitDbgDeclareInst(DbgDeclareInst &I) { DELEGATE(DbgVariableIntrinsic);}
204-
RetTy visitDbgValueInst(DbgValueInst &I) { DELEGATE(DbgVariableIntrinsic);}
205-
RetTy visitDbgVariableIntrinsic(DbgVariableIntrinsic &I)
206-
{ DELEGATE(DbgInfoIntrinsic);}
207-
RetTy visitDbgLabelInst(DbgLabelInst &I) { DELEGATE(DbgInfoIntrinsic);}
208-
RetTy visitDbgInfoIntrinsic(DbgInfoIntrinsic &I){ DELEGATE(IntrinsicInst); }
209202
RetTy visitMemSetInst(MemSetInst &I) { DELEGATE(MemIntrinsic); }
210203
RetTy visitMemSetPatternInst(MemSetPatternInst &I) {
211204
DELEGATE(IntrinsicInst);
@@ -286,9 +279,6 @@ class InstVisitor {
286279
if (const Function *F = I.getCalledFunction()) {
287280
switch (F->getIntrinsicID()) {
288281
default: DELEGATE(IntrinsicInst);
289-
case Intrinsic::dbg_declare: DELEGATE(DbgDeclareInst);
290-
case Intrinsic::dbg_value: DELEGATE(DbgValueInst);
291-
case Intrinsic::dbg_label: DELEGATE(DbgLabelInst);
292282
case Intrinsic::memcpy:
293283
case Intrinsic::memcpy_inline:
294284
DELEGATE(MemCpyInst);

llvm/include/llvm/Transforms/Utils/Local.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -394,11 +394,9 @@ handleUnreachableTerminator(Instruction *I,
394394
SmallVectorImpl<Value *> &PoisonedValues);
395395

396396
/// Remove all instructions from a basic block other than its terminator
397-
/// and any present EH pad instructions. Returns a pair where the first element
398-
/// is the number of instructions (excluding debug info intrinsics) that have
399-
/// been removed, and the second element is the number of debug info intrinsics
397+
/// and any present EH pad instructions. Returns the number of instructions
400398
/// that have been removed.
401-
LLVM_ABI std::pair<unsigned, unsigned>
399+
LLVM_ABI unsigned
402400
removeAllNonTerminatorAndEHPadInstructions(BasicBlock *BB);
403401

404402
/// Insert an unreachable instruction before the specified

llvm/lib/Analysis/AliasSetTracker.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -343,9 +343,6 @@ void AliasSetTracker::add(AnyMemTransferInst *MTI) {
343343
}
344344

345345
void AliasSetTracker::addUnknown(Instruction *Inst) {
346-
if (isa<DbgInfoIntrinsic>(Inst))
347-
return; // Ignore DbgInfo Intrinsics.
348-
349346
if (auto *II = dyn_cast<IntrinsicInst>(Inst)) {
350347
// These intrinsics will show up as affecting memory, but they are just
351348
// markers.

llvm/lib/Analysis/CallGraph.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,7 @@ CallGraph::CallGraph(Module &M)
3434
CallsExternalNode(std::make_unique<CallGraphNode>(this, nullptr)) {
3535
// Add every interesting function to the call graph.
3636
for (Function &F : M)
37-
if (!isDbgInfoIntrinsic(F.getIntrinsicID()))
38-
addToCallGraph(&F);
37+
addToCallGraph(&F);
3938
}
4039

4140
CallGraph::CallGraph(CallGraph &&Arg)
@@ -101,7 +100,7 @@ void CallGraph::populateCallGraphNode(CallGraphNode *Node) {
101100
const Function *Callee = Call->getCalledFunction();
102101
if (!Callee)
103102
Node->addCalledFunction(Call, CallsExternalNode.get());
104-
else if (!isDbgInfoIntrinsic(Callee->getIntrinsicID()))
103+
else
105104
Node->addCalledFunction(Call, getOrInsertFunction(Callee));
106105

107106
// Add reference to callback functions.

llvm/lib/Analysis/DemandedBits.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ using namespace llvm::PatternMatch;
4646
#define DEBUG_TYPE "demanded-bits"
4747

4848
static bool isAlwaysLive(Instruction *I) {
49-
return I->isTerminator() || isa<DbgInfoIntrinsic>(I) || I->isEHPad() ||
49+
return I->isTerminator() || I->isEHPad() ||
5050
I->mayHaveSideEffects();
5151
}
5252

llvm/lib/Analysis/Loads.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -434,7 +434,7 @@ bool llvm::isSafeToLoadUnconditionally(Value *V, Align Alignment, const APInt &S
434434
// If we see a free or a call which may write to memory (i.e. which might do
435435
// a free) the pointer could be marked invalid.
436436
if (isa<CallInst>(BBI) && BBI->mayWriteToMemory() &&
437-
!isa<LifetimeIntrinsic>(BBI) && !isa<DbgInfoIntrinsic>(BBI))
437+
!isa<LifetimeIntrinsic>(BBI))
438438
return false;
439439

440440
Value *AccessedPtr;

llvm/lib/Analysis/MemoryDependenceAnalysis.cpp

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -188,9 +188,6 @@ MemDepResult MemoryDependenceResults::getCallDependencyFrom(
188188
// Walk backwards through the block, looking for dependencies.
189189
while (ScanIt != BB->begin()) {
190190
Instruction *Inst = &*--ScanIt;
191-
// Debug intrinsics don't cause dependences and should not affect Limit
192-
if (isa<DbgInfoIntrinsic>(Inst))
193-
continue;
194191

195192
// Limit the amount of scanning we do so we don't end up with quadratic
196193
// running time on extreme testcases.
@@ -432,11 +429,6 @@ MemDepResult MemoryDependenceResults::getSimplePointerDependencyFrom(
432429
while (ScanIt != BB->begin()) {
433430
Instruction *Inst = &*--ScanIt;
434431

435-
if (IntrinsicInst *II = dyn_cast<IntrinsicInst>(Inst))
436-
// Debug intrinsics don't (and can't) cause dependencies.
437-
if (isa<DbgInfoIntrinsic>(II))
438-
continue;
439-
440432
// Limit the amount of scanning we do so we don't end up with quadratic
441433
// running time on extreme testcases.
442434
--*Limit;

llvm/lib/Analysis/ValueTracking.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7842,8 +7842,6 @@ bool llvm::isGuaranteedToTransferExecutionToSuccessor(
78427842
iterator_range<BasicBlock::const_iterator> Range, unsigned ScanLimit) {
78437843
assert(ScanLimit && "scan limit must be non-zero");
78447844
for (const Instruction &I : Range) {
7845-
if (isa<DbgInfoIntrinsic>(I))
7846-
continue;
78477845
if (--ScanLimit == 0)
78487846
return false;
78497847
if (!isGuaranteedToTransferExecutionToSuccessor(&I))
@@ -8046,8 +8044,6 @@ static bool programUndefinedIfUndefOrPoison(const Value *V,
80468044
// well-defined operands.
80478045

80488046
for (const auto &I : make_range(Begin, End)) {
8049-
if (isa<DbgInfoIntrinsic>(I))
8050-
continue;
80518047
if (--ScanLimit == 0)
80528048
break;
80538049

@@ -8072,8 +8068,6 @@ static bool programUndefinedIfUndefOrPoison(const Value *V,
80728068

80738069
while (true) {
80748070
for (const auto &I : make_range(Begin, End)) {
8075-
if (isa<DbgInfoIntrinsic>(I))
8076-
continue;
80778071
if (--ScanLimit == 0)
80788072
return false;
80798073
if (mustTriggerUB(&I, YieldsPoison))

0 commit comments

Comments
 (0)