Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
4 changes: 0 additions & 4 deletions llvm/include/llvm/Analysis/IRSimilarityIdentifier.h
Original file line number Diff line number Diff line change
Expand Up @@ -545,10 +545,6 @@ struct IRInstructionMapper {
// dependent.
InstrType visitLandingPadInst(LandingPadInst &LPI) { return Illegal; }
InstrType visitFuncletPadInst(FuncletPadInst &FPI) { return Illegal; }
// DebugInfo should be included in the regions, but should not be
// analyzed for similarity as it has no bearing on the outcome of the
// program.
InstrType visitDbgInfoIntrinsic(DbgInfoIntrinsic &DII) { return Invisible; }
InstrType visitIntrinsicInst(IntrinsicInst &II) {
// These are disabled due to complications in the CodeExtractor when
// outlining these instructions. For instance, It is unclear what we
Expand Down
1 change: 0 additions & 1 deletion llvm/include/llvm/Analysis/PtrUseVisitor.h
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,6 @@ class PtrUseVisitor : protected InstVisitor<DerivedT>,

// No-op intrinsics which we know don't escape the pointer to logic in
// some other function.
void visitDbgInfoIntrinsic(DbgInfoIntrinsic &I) {}
void visitMemIntrinsic(MemIntrinsic &I) {}
void visitIntrinsicInst(IntrinsicInst &II) {
switch (II.getIntrinsicID()) {
Expand Down
10 changes: 0 additions & 10 deletions llvm/include/llvm/IR/InstVisitor.h
Original file line number Diff line number Diff line change
Expand Up @@ -199,13 +199,6 @@ class InstVisitor {
RetTy visitCatchPadInst(CatchPadInst &I) { DELEGATE(FuncletPadInst); }
RetTy visitFreezeInst(FreezeInst &I) { DELEGATE(Instruction); }

// Handle the special intrinsic instruction classes.
RetTy visitDbgDeclareInst(DbgDeclareInst &I) { DELEGATE(DbgVariableIntrinsic);}
RetTy visitDbgValueInst(DbgValueInst &I) { DELEGATE(DbgVariableIntrinsic);}
RetTy visitDbgVariableIntrinsic(DbgVariableIntrinsic &I)
{ DELEGATE(DbgInfoIntrinsic);}
RetTy visitDbgLabelInst(DbgLabelInst &I) { DELEGATE(DbgInfoIntrinsic);}
RetTy visitDbgInfoIntrinsic(DbgInfoIntrinsic &I){ DELEGATE(IntrinsicInst); }
RetTy visitMemSetInst(MemSetInst &I) { DELEGATE(MemIntrinsic); }
RetTy visitMemSetPatternInst(MemSetPatternInst &I) {
DELEGATE(IntrinsicInst);
Expand Down Expand Up @@ -286,9 +279,6 @@ class InstVisitor {
if (const Function *F = I.getCalledFunction()) {
switch (F->getIntrinsicID()) {
default: DELEGATE(IntrinsicInst);
case Intrinsic::dbg_declare: DELEGATE(DbgDeclareInst);
case Intrinsic::dbg_value: DELEGATE(DbgValueInst);
case Intrinsic::dbg_label: DELEGATE(DbgLabelInst);
case Intrinsic::memcpy:
case Intrinsic::memcpy_inline:
DELEGATE(MemCpyInst);
Expand Down
7 changes: 2 additions & 5 deletions llvm/include/llvm/Transforms/Utils/Local.h
Original file line number Diff line number Diff line change
Expand Up @@ -394,12 +394,9 @@ handleUnreachableTerminator(Instruction *I,
SmallVectorImpl<Value *> &PoisonedValues);

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

/// Insert an unreachable instruction before the specified
/// instruction, making it and the rest of the code in the block dead.
Expand Down
3 changes: 0 additions & 3 deletions llvm/lib/Analysis/AliasSetTracker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -343,9 +343,6 @@ void AliasSetTracker::add(AnyMemTransferInst *MTI) {
}

void AliasSetTracker::addUnknown(Instruction *Inst) {
if (isa<DbgInfoIntrinsic>(Inst))
return; // Ignore DbgInfo Intrinsics.

if (auto *II = dyn_cast<IntrinsicInst>(Inst)) {
// These intrinsics will show up as affecting memory, but they are just
// markers.
Expand Down
5 changes: 2 additions & 3 deletions llvm/lib/Analysis/CallGraph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@ CallGraph::CallGraph(Module &M)
CallsExternalNode(std::make_unique<CallGraphNode>(this, nullptr)) {
// Add every interesting function to the call graph.
for (Function &F : M)
if (!isDbgInfoIntrinsic(F.getIntrinsicID()))
addToCallGraph(&F);
addToCallGraph(&F);
}

CallGraph::CallGraph(CallGraph &&Arg)
Expand Down Expand Up @@ -101,7 +100,7 @@ void CallGraph::populateCallGraphNode(CallGraphNode *Node) {
const Function *Callee = Call->getCalledFunction();
if (!Callee)
Node->addCalledFunction(Call, CallsExternalNode.get());
else if (!isDbgInfoIntrinsic(Callee->getIntrinsicID()))
else
Node->addCalledFunction(Call, getOrInsertFunction(Callee));

// Add reference to callback functions.
Expand Down
3 changes: 1 addition & 2 deletions llvm/lib/Analysis/DemandedBits.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,7 @@ using namespace llvm::PatternMatch;
#define DEBUG_TYPE "demanded-bits"

static bool isAlwaysLive(Instruction *I) {
return I->isTerminator() || isa<DbgInfoIntrinsic>(I) || I->isEHPad() ||
I->mayHaveSideEffects();
return I->isTerminator() || I->isEHPad() || I->mayHaveSideEffects();
}

void DemandedBits::determineLiveOperandBits(
Expand Down
2 changes: 1 addition & 1 deletion llvm/lib/Analysis/Loads.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,7 @@ bool llvm::isSafeToLoadUnconditionally(Value *V, Align Alignment, const APInt &S
// If we see a free or a call which may write to memory (i.e. which might do
// a free) the pointer could be marked invalid.
if (isa<CallInst>(BBI) && BBI->mayWriteToMemory() &&
!isa<LifetimeIntrinsic>(BBI) && !isa<DbgInfoIntrinsic>(BBI))
!isa<LifetimeIntrinsic>(BBI))
return false;

Value *AccessedPtr;
Expand Down
8 changes: 0 additions & 8 deletions llvm/lib/Analysis/MemoryDependenceAnalysis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -188,9 +188,6 @@ MemDepResult MemoryDependenceResults::getCallDependencyFrom(
// Walk backwards through the block, looking for dependencies.
while (ScanIt != BB->begin()) {
Instruction *Inst = &*--ScanIt;
// Debug intrinsics don't cause dependences and should not affect Limit
if (isa<DbgInfoIntrinsic>(Inst))
continue;

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

if (IntrinsicInst *II = dyn_cast<IntrinsicInst>(Inst))
// Debug intrinsics don't (and can't) cause dependencies.
if (isa<DbgInfoIntrinsic>(II))
continue;

// Limit the amount of scanning we do so we don't end up with quadratic
// running time on extreme testcases.
--*Limit;
Expand Down
6 changes: 0 additions & 6 deletions llvm/lib/Analysis/ValueTracking.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7842,8 +7842,6 @@ bool llvm::isGuaranteedToTransferExecutionToSuccessor(
iterator_range<BasicBlock::const_iterator> Range, unsigned ScanLimit) {
assert(ScanLimit && "scan limit must be non-zero");
for (const Instruction &I : Range) {
if (isa<DbgInfoIntrinsic>(I))
continue;
if (--ScanLimit == 0)
return false;
if (!isGuaranteedToTransferExecutionToSuccessor(&I))
Expand Down Expand Up @@ -8046,8 +8044,6 @@ static bool programUndefinedIfUndefOrPoison(const Value *V,
// well-defined operands.

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

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

while (true) {
for (const auto &I : make_range(Begin, End)) {
if (isa<DbgInfoIntrinsic>(I))
continue;
if (--ScanLimit == 0)
return false;
if (mustTriggerUB(&I, YieldsPoison))
Expand Down
14 changes: 4 additions & 10 deletions llvm/lib/CodeGen/CodeGenPrepare.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -896,12 +896,7 @@ BasicBlock *CodeGenPrepare::findDestBlockOfMergeableEmptyBlock(BasicBlock *BB) {
BasicBlock::iterator BBI = BI->getIterator();
if (BBI != BB->begin()) {
--BBI;
while (isa<DbgInfoIntrinsic>(BBI)) {
if (BBI == BB->begin())
break;
--BBI;
}
if (!isa<DbgInfoIntrinsic>(BBI) && !isa<PHINode>(BBI))
if (!isa<PHINode>(BBI))
return nullptr;
}

Expand Down Expand Up @@ -2981,10 +2976,9 @@ bool CodeGenPrepare::dupRetToEnableTailCallOpts(BasicBlock *BB,
// Make sure there are no instructions between the first instruction
// and return.
BasicBlock::const_iterator BI = BB->getFirstNonPHIIt();
// Skip over debug and the bitcast.
while (isa<DbgInfoIntrinsic>(BI) || &*BI == BCI || &*BI == EVI ||
isa<PseudoProbeInst>(BI) || isLifetimeEndOrBitCastFor(&*BI) ||
isFakeUse(&*BI))
// Skip over pseudo-probes and the bitcast.
while (&*BI == BCI || &*BI == EVI || isa<PseudoProbeInst>(BI) ||
isLifetimeEndOrBitCastFor(&*BI) || isFakeUse(&*BI))
BI = std::next(BI);
if (&*BI != RetI)
return false;
Expand Down
5 changes: 1 addition & 4 deletions llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1320,10 +1320,7 @@ void SelectionDAGBuilder::visit(const Instruction &I) {
HandlePHINodesInSuccessorBlocks(I.getParent());
}

// Increase the SDNodeOrder if dealing with a non-debug instruction.
if (!isa<DbgInfoIntrinsic>(I))
++SDNodeOrder;

++SDNodeOrder;
CurInst = &I;

// Set inserted listener only if required.
Expand Down
1 change: 0 additions & 1 deletion llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1507,7 +1507,6 @@ static bool isFoldedOrDeadInstruction(const Instruction *I,
const FunctionLoweringInfo &FuncInfo) {
return !I->mayWriteToMemory() && // Side-effecting instructions aren't folded.
!I->isTerminator() && // Terminators aren't folded.
!isa<DbgInfoIntrinsic>(I) && // Debug instructions aren't folded.
!I->isEHPad() && // EH pad instructions aren't folded.
!FuncInfo.isExportedInst(I); // Exported instrs must be computed.
}
Expand Down
5 changes: 0 additions & 5 deletions llvm/lib/IR/DebugInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -586,11 +586,6 @@ bool llvm::stripDebugInfo(Function &F) {
DenseMap<MDNode *, MDNode *> LoopIDsMap;
for (BasicBlock &BB : F) {
for (Instruction &I : llvm::make_early_inc_range(BB)) {
if (isa<DbgInfoIntrinsic>(&I)) {
I.eraseFromParent();
Changed = true;
continue;
}
if (I.getDebugLoc()) {
Changed = true;
I.setDebugLoc(DebugLoc());
Expand Down
3 changes: 1 addition & 2 deletions llvm/lib/Target/AArch64/AArch64StackTagging.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -369,8 +369,7 @@ Instruction *AArch64StackTagging::collectInitializers(Instruction *StartInst,

unsigned Count = 0;
for (; Count < ClScanLimit && !BI->isTerminator(); ++BI) {
if (!isa<DbgInfoIntrinsic>(*BI))
++Count;
++Count;

if (isNoModRef(AA->getModRefInfo(&*BI, AllocaLoc)))
continue;
Expand Down
2 changes: 1 addition & 1 deletion llvm/lib/Target/Hexagon/HexagonLoopIdiomRecognition.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2318,7 +2318,7 @@ bool HexagonLoopIdiomRecognize::coverLoop(Loop *L,
// instructions in it that are not involved in the original set Insts.
for (auto *B : L->blocks()) {
for (auto &In : *B) {
if (isa<BranchInst>(In) || isa<DbgInfoIntrinsic>(In))
if (isa<BranchInst>(In))
continue;
if (!Worklist.count(&In) && In.mayHaveSideEffects())
return false;
Expand Down
5 changes: 2 additions & 3 deletions llvm/lib/Target/PowerPC/PPCBoolRetToInt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ class PPCBoolRetToInt : public FunctionPass {

// A PHINode is Promotable if:
// 1. Its type is i1 AND
// 2. All of its uses are ReturnInt, CallInst, PHINode, or DbgInfoIntrinsic
// 2. All of its uses are ReturnInt, CallInst, or PHINode
// AND
// 3. All of its operands are Constant or Argument or
// CallInst or PHINode AND
Expand All @@ -136,8 +136,7 @@ class PPCBoolRetToInt : public FunctionPass {
for (const PHINode *P : Promotable) {
// Condition 2 and 3
auto IsValidUser = [] (const Value *V) -> bool {
return isa<ReturnInst>(V) || isa<CallInst>(V) || isa<PHINode>(V) ||
isa<DbgInfoIntrinsic>(V);
return isa<ReturnInst>(V) || isa<CallInst>(V) || isa<PHINode>(V);
};
auto IsValidOperand = [] (const Value *V) -> bool {
return isa<Constant>(V) || isa<Argument>(V) || isa<CallInst>(V) ||
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -719,9 +719,7 @@ static bool foldLoadsRecursive(Value *V, LoadOps &LOps, const DataLayout &DL,
if (Inst.mayWriteToMemory() && isModSet(AA.getModRefInfo(&Inst, Loc)))
return false;

// Ignore debug info so that's not counted against MaxInstrsToScan.
// Otherwise debug info could affect codegen.
if (!isa<DbgInfoIntrinsic>(Inst) && ++NumScanned > MaxInstrsToScan)
if (++NumScanned > MaxInstrsToScan)
return false;
}

Expand Down
11 changes: 0 additions & 11 deletions llvm/lib/Transforms/IPO/IROutliner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -717,8 +717,6 @@ static void moveFunctionData(Function &Old, Function &New,
if (ReturnInst *RI = dyn_cast<ReturnInst>(I))
NewEnds.insert(std::make_pair(RI->getReturnValue(), &CurrBB));

std::vector<Instruction *> DebugInsts;

for (Instruction &Val : CurrBB) {
// Since debug-info originates from many different locations in the
// program, it will cause incorrect reporting from a debugger if we keep
Expand Down Expand Up @@ -749,21 +747,12 @@ static void moveFunctionData(Function &Old, Function &New,
// From this point we are only handling call instructions.
CallInst *CI = cast<CallInst>(&Val);

// Collect debug intrinsics for later removal.
if (isa<DbgInfoIntrinsic>(CI)) {
DebugInsts.push_back(&Val);
continue;
}

// Edit the scope of called functions inside of outlined functions.
if (DISubprogram *SP = New.getSubprogram()) {
DILocation *DI = DILocation::get(New.getContext(), 0, 0, SP);
Val.setDebugLoc(DI);
}
}

for (Instruction *I : DebugInsts)
I->eraseFromParent();
}
}

Expand Down
3 changes: 1 addition & 2 deletions llvm/lib/Transforms/IPO/SampleProfileProbe.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -385,8 +385,7 @@ void SampleProfileProber::instrumentOneFunc(Function &F, TargetMachine *TM) {
// line number. Real instructions generated by optimizations may not come
// with a line number either.
auto HasValidDbgLine = [](Instruction *J) {
return !isa<PHINode>(J) && !isa<DbgInfoIntrinsic>(J) &&
!J->isLifetimeStartOrEnd() && J->getDebugLoc();
return !isa<PHINode>(J) && !J->isLifetimeStartOrEnd() && J->getDebugLoc();
};

Instruction *J = &*BB->getFirstInsertionPt();
Expand Down
12 changes: 3 additions & 9 deletions llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4758,11 +4758,7 @@ bool InstCombinerImpl::freezeOtherUses(FreezeInst &FI) {
MoveBefore = *MoveBeforeOpt;
}

// Don't move to the position of a debug intrinsic.
if (isa<DbgInfoIntrinsic>(MoveBefore))
MoveBefore = MoveBefore->getNextNonDebugInstruction()->getIterator();
// Re-point iterator to come after any debug-info records, if we're
// running in "RemoveDIs" mode
// Re-point iterator to come after any debug-info records.
MoveBefore.setHeadBit(false);

bool Changed = false;
Expand Down Expand Up @@ -5554,11 +5550,9 @@ bool InstCombinerImpl::prepareWorklist(Function &F) {
continue;

unsigned NumDeadInstInBB;
unsigned NumDeadDbgInstInBB;
std::tie(NumDeadInstInBB, NumDeadDbgInstInBB) =
removeAllNonTerminatorAndEHPadInstructions(&BB);
NumDeadInstInBB = removeAllNonTerminatorAndEHPadInstructions(&BB);

MadeIRChange |= NumDeadInstInBB + NumDeadDbgInstInBB > 0;
MadeIRChange |= NumDeadInstInBB;
NumDeadInst += NumDeadInstInBB;
}

Expand Down
8 changes: 0 additions & 8 deletions llvm/lib/Transforms/Instrumentation/GCOVProfiling.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -583,10 +583,6 @@ static bool functionHasLines(const Function &F, unsigned &EndLine) {
EndLine = 0;
for (const auto &BB : F) {
for (const auto &I : BB) {
// Debug intrinsic locations correspond to the location of the
// declaration, not necessarily any statements or expressions.
if (isa<DbgInfoIntrinsic>(&I)) continue;

const DebugLoc &Loc = I.getDebugLoc();
if (!Loc)
continue;
Expand Down Expand Up @@ -874,10 +870,6 @@ bool GCOVProfiler::emitProfileNotes(
}

for (const auto &I : BB) {
// Debug intrinsic locations correspond to the location of the
// declaration, not necessarily any statements or expressions.
if (isa<DbgInfoIntrinsic>(&I)) continue;

const DebugLoc &Loc = I.getDebugLoc();
if (!Loc)
continue;
Expand Down
3 changes: 1 addition & 2 deletions llvm/lib/Transforms/Instrumentation/ThreadSanitizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -527,8 +527,7 @@ bool ThreadSanitizer::sanitizeFunction(Function &F,
AtomicAccesses.push_back(&Inst);
else if (isa<LoadInst>(Inst) || isa<StoreInst>(Inst))
LocalLoadsAndStores.push_back(&Inst);
else if ((isa<CallInst>(Inst) && !isa<DbgInfoIntrinsic>(Inst)) ||
isa<InvokeInst>(Inst)) {
else if (isa<CallInst>(Inst) || isa<InvokeInst>(Inst)) {
if (CallInst *CI = dyn_cast<CallInst>(&Inst))
maybeMarkSanitizerLibraryCallNoBuiltin(CI, &TLI);
if (isa<MemIntrinsic>(Inst))
Expand Down
15 changes: 1 addition & 14 deletions llvm/lib/Transforms/Scalar/ADCE.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -562,20 +562,7 @@ ADCEChanged AggressiveDeadCodeElimination::removeDeadInstructions() {
if (isLive(&I))
continue;

if (auto *DII = dyn_cast<DbgInfoIntrinsic>(&I)) {
// Avoid removing a dbg.assign that is linked to instructions because it
// holds information about an existing store.
if (auto *DAI = dyn_cast<DbgAssignIntrinsic>(DII))
if (!at::getAssignmentInsts(DAI).empty())
continue;
// Check if the scope of this variable location is alive.
if (AliveScopes.count(DII->getDebugLoc()->getScope()))
continue;

// Fallthrough and drop the intrinsic.
} else {
Changed.ChangedNonDebugInstr = true;
}
Changed.ChangedNonDebugInstr = true;

// Prepare to delete.
Worklist.push_back(&I);
Expand Down
Loading
Loading