Skip to content

Commit 61c8b31

Browse files
committed
Reapply "[DebugInfo][RemoveDIs] Remove a swathe of debug-intrinsic code (llvm#144389)"
This reverts commit 9767ba6.
1 parent 691448b commit 61c8b31

39 files changed

+96
-347
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/Transforms/Utils/Local.h

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -394,12 +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>
402-
removeAllNonTerminatorAndEHPadInstructions(BasicBlock *BB);
399+
LLVM_ABI unsigned removeAllNonTerminatorAndEHPadInstructions(BasicBlock *BB);
403400

404401
/// Insert an unreachable instruction before the specified
405402
/// instruction, making it and the rest of the code in the block dead.

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 & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +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() ||
50-
I->mayHaveSideEffects();
49+
return I->isTerminator() || I->isEHPad() || I->mayHaveSideEffects();
5150
}
5251

5352
void DemandedBits::determineLiveOperandBits(

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
@@ -7846,8 +7846,6 @@ bool llvm::isGuaranteedToTransferExecutionToSuccessor(
78467846
iterator_range<BasicBlock::const_iterator> Range, unsigned ScanLimit) {
78477847
assert(ScanLimit && "scan limit must be non-zero");
78487848
for (const Instruction &I : Range) {
7849-
if (isa<DbgInfoIntrinsic>(I))
7850-
continue;
78517849
if (--ScanLimit == 0)
78527850
return false;
78537851
if (!isGuaranteedToTransferExecutionToSuccessor(&I))
@@ -8050,8 +8048,6 @@ static bool programUndefinedIfUndefOrPoison(const Value *V,
80508048
// well-defined operands.
80518049

80528050
for (const auto &I : make_range(Begin, End)) {
8053-
if (isa<DbgInfoIntrinsic>(I))
8054-
continue;
80558051
if (--ScanLimit == 0)
80568052
break;
80578053

@@ -8076,8 +8072,6 @@ static bool programUndefinedIfUndefOrPoison(const Value *V,
80768072

80778073
while (true) {
80788074
for (const auto &I : make_range(Begin, End)) {
8079-
if (isa<DbgInfoIntrinsic>(I))
8080-
continue;
80818075
if (--ScanLimit == 0)
80828076
return false;
80838077
if (mustTriggerUB(&I, YieldsPoison))

llvm/lib/CodeGen/CodeGenPrepare.cpp

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -896,12 +896,7 @@ BasicBlock *CodeGenPrepare::findDestBlockOfMergeableEmptyBlock(BasicBlock *BB) {
896896
BasicBlock::iterator BBI = BI->getIterator();
897897
if (BBI != BB->begin()) {
898898
--BBI;
899-
while (isa<DbgInfoIntrinsic>(BBI)) {
900-
if (BBI == BB->begin())
901-
break;
902-
--BBI;
903-
}
904-
if (!isa<DbgInfoIntrinsic>(BBI) && !isa<PHINode>(BBI))
899+
if (!isa<PHINode>(BBI))
905900
return nullptr;
906901
}
907902

@@ -2981,10 +2976,9 @@ bool CodeGenPrepare::dupRetToEnableTailCallOpts(BasicBlock *BB,
29812976
// Make sure there are no instructions between the first instruction
29822977
// and return.
29832978
BasicBlock::const_iterator BI = BB->getFirstNonPHIIt();
2984-
// Skip over debug and the bitcast.
2985-
while (isa<DbgInfoIntrinsic>(BI) || &*BI == BCI || &*BI == EVI ||
2986-
isa<PseudoProbeInst>(BI) || isLifetimeEndOrBitCastFor(&*BI) ||
2987-
isFakeUse(&*BI))
2979+
// Skip over pseudo-probes and the bitcast.
2980+
while (&*BI == BCI || &*BI == EVI || isa<PseudoProbeInst>(BI) ||
2981+
isLifetimeEndOrBitCastFor(&*BI) || isFakeUse(&*BI))
29882982
BI = std::next(BI);
29892983
if (&*BI != RetI)
29902984
return false;

0 commit comments

Comments
 (0)