From: Devang Patel Date: Tue, 5 Jan 2010 01:10:40 +0000 (+0000) Subject: Remove dead debug info intrinsics. X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=44a29e066a24e88bdf127e88be4380a5f259c4b4;p=oota-llvm.git Remove dead debug info intrinsics. Intrinsic::dbg_stoppoint Intrinsic::dbg_region_start Intrinsic::dbg_region_end Intrinsic::dbg_func_start AutoUpgrade simply ignores these intrinsics now. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92557 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/llvm-c/Core.h b/include/llvm-c/Core.h index c741d1c19a3..c7f653fc8c0 100644 --- a/include/llvm-c/Core.h +++ b/include/llvm-c/Core.h @@ -427,10 +427,6 @@ void LLVMDisposeTypeHandle(LLVMTypeHandleRef TypeHandle); macro(IntrinsicInst) \ macro(DbgInfoIntrinsic) \ macro(DbgDeclareInst) \ - macro(DbgFuncStartInst) \ - macro(DbgRegionEndInst) \ - macro(DbgRegionStartInst) \ - macro(DbgStopPointInst) \ macro(EHSelectorInst) \ macro(MemIntrinsic) \ macro(MemCpyInst) \ diff --git a/include/llvm/Analysis/DebugInfo.h b/include/llvm/Analysis/DebugInfo.h index fdbd9c1130c..813a4bd78d5 100644 --- a/include/llvm/Analysis/DebugInfo.h +++ b/include/llvm/Analysis/DebugInfo.h @@ -30,11 +30,7 @@ namespace llvm { class Module; class Type; class Value; - struct DbgStopPointInst; struct DbgDeclareInst; - struct DbgFuncStartInst; - struct DbgRegionStartInst; - struct DbgRegionEndInst; class DebugLoc; struct DebugLocTracker; class Instruction; @@ -661,14 +657,6 @@ namespace llvm { Constant *GetTagConstant(unsigned TAG); }; - /// Finds the stoppoint coressponding to this instruction, that is the - /// stoppoint that dominates this instruction - const DbgStopPointInst *findStopPoint(const Instruction *Inst); - - /// Finds the stoppoint corresponding to first real (non-debug intrinsic) - /// instruction in this Basic Block, and returns the stoppoint for it. - const DbgStopPointInst *findBBStopPoint(const BasicBlock *BB); - /// Finds the dbg.declare intrinsic corresponding to this value if any. /// It looks through pointer casts too. const DbgDeclareInst *findDbgDeclare(const Value *V, bool stripCasts = true); @@ -680,21 +668,11 @@ namespace llvm { std::string &Type, unsigned &LineNo, std::string &File, std::string &Dir); - /// ExtractDebugLocation - Extract debug location information - /// from llvm.dbg.stoppoint intrinsic. - DebugLoc ExtractDebugLocation(DbgStopPointInst &SPI, - DebugLocTracker &DebugLocInfo); - /// ExtractDebugLocation - Extract debug location information /// from DILocation. DebugLoc ExtractDebugLocation(DILocation &Loc, DebugLocTracker &DebugLocInfo); - /// ExtractDebugLocation - Extract debug location information - /// from llvm.dbg.func_start intrinsic. - DebugLoc ExtractDebugLocation(DbgFuncStartInst &FSI, - DebugLocTracker &DebugLocInfo); - /// getDISubprogram - Find subprogram that is enclosing this scope. DISubprogram getDISubprogram(MDNode *Scope); diff --git a/include/llvm/IntrinsicInst.h b/include/llvm/IntrinsicInst.h index 3c18de10674..58897094855 100644 --- a/include/llvm/IntrinsicInst.h +++ b/include/llvm/IntrinsicInst.h @@ -64,10 +64,6 @@ namespace llvm { static inline bool classof(const DbgInfoIntrinsic *) { return true; } static inline bool classof(const IntrinsicInst *I) { switch (I->getIntrinsicID()) { - case Intrinsic::dbg_stoppoint: - case Intrinsic::dbg_func_start: - case Intrinsic::dbg_region_start: - case Intrinsic::dbg_region_end: case Intrinsic::dbg_declare: case Intrinsic::dbg_value: return true; @@ -81,80 +77,6 @@ namespace llvm { static Value *StripCast(Value *C); }; - /// DbgStopPointInst - This represents the llvm.dbg.stoppoint instruction. - /// - struct DbgStopPointInst : public DbgInfoIntrinsic { - Value *getLineValue() const { return const_cast(getOperand(1)); } - Value *getColumnValue() const { return const_cast(getOperand(2)); } - MDNode *getContext() const { - return cast(getOperand(3)); - } - - unsigned getLine() const { - return unsigned(cast(getOperand(1))->getZExtValue()); - } - unsigned getColumn() const { - return unsigned(cast(getOperand(2))->getZExtValue()); - } - - Value *getFileName() const; - Value *getDirectory() const; - - // Methods for support type inquiry through isa, cast, and dyn_cast: - static inline bool classof(const DbgStopPointInst *) { return true; } - static inline bool classof(const IntrinsicInst *I) { - return I->getIntrinsicID() == Intrinsic::dbg_stoppoint; - } - static inline bool classof(const Value *V) { - return isa(V) && classof(cast(V)); - } - }; - - /// DbgFuncStartInst - This represents the llvm.dbg.func.start instruction. - /// - struct DbgFuncStartInst : public DbgInfoIntrinsic { - MDNode *getSubprogram() const { return cast(getOperand(1)); } - - // Methods for support type inquiry through isa, cast, and dyn_cast: - static inline bool classof(const DbgFuncStartInst *) { return true; } - static inline bool classof(const IntrinsicInst *I) { - return I->getIntrinsicID() == Intrinsic::dbg_func_start; - } - static inline bool classof(const Value *V) { - return isa(V) && classof(cast(V)); - } - }; - - /// DbgRegionStartInst - This represents the llvm.dbg.region.start - /// instruction. - struct DbgRegionStartInst : public DbgInfoIntrinsic { - MDNode *getContext() const { return cast(getOperand(1)); } - - // Methods for support type inquiry through isa, cast, and dyn_cast: - static inline bool classof(const DbgRegionStartInst *) { return true; } - static inline bool classof(const IntrinsicInst *I) { - return I->getIntrinsicID() == Intrinsic::dbg_region_start; - } - static inline bool classof(const Value *V) { - return isa(V) && classof(cast(V)); - } - }; - - /// DbgRegionEndInst - This represents the llvm.dbg.region.end instruction. - /// - struct DbgRegionEndInst : public DbgInfoIntrinsic { - MDNode *getContext() const { return cast(getOperand(1)); } - - // Methods for support type inquiry through isa, cast, and dyn_cast: - static inline bool classof(const DbgRegionEndInst *) { return true; } - static inline bool classof(const IntrinsicInst *I) { - return I->getIntrinsicID() == Intrinsic::dbg_region_end; - } - static inline bool classof(const Value *V) { - return isa(V) && classof(cast(V)); - } - }; - /// DbgDeclareInst - This represents the llvm.dbg.declare instruction. /// struct DbgDeclareInst : public DbgInfoIntrinsic { diff --git a/include/llvm/Transforms/Utils/BasicBlockUtils.h b/include/llvm/Transforms/Utils/BasicBlockUtils.h index 8172114d8b6..f1a99978ab5 100644 --- a/include/llvm/Transforms/Utils/BasicBlockUtils.h +++ b/include/llvm/Transforms/Utils/BasicBlockUtils.h @@ -65,11 +65,6 @@ void ReplaceInstWithInst(BasicBlock::InstListType &BIL, // void ReplaceInstWithInst(Instruction *From, Instruction *To); -/// CopyPrecedingStopPoint - If I is immediately preceded by a StopPoint, -/// make a copy of the stoppoint before InsertPos (presumably before copying -/// or moving I). -void CopyPrecedingStopPoint(Instruction *I, BasicBlock::iterator InsertPos); - /// FindAvailableLoadedValue - Scan the ScanBB block backwards (starting at the /// instruction before ScanFrom) checking to see if we have the value at the /// memory address *Ptr locally available within a small number of instructions. diff --git a/lib/Analysis/DbgInfoPrinter.cpp b/lib/Analysis/DbgInfoPrinter.cpp index 7d72b383a5e..3532b052dc5 100644 --- a/lib/Analysis/DbgInfoPrinter.cpp +++ b/lib/Analysis/DbgInfoPrinter.cpp @@ -37,8 +37,6 @@ PrintDirectory("print-fullpath", namespace { class PrintDbgInfo : public FunctionPass { raw_ostream &Out; - void printStopPoint(const DbgStopPointInst *DSI); - void printFuncStart(const DbgFuncStartInst *FS); void printVariableDeclaration(const Value *V); public: static char ID; // Pass identification @@ -74,27 +72,6 @@ void PrintDbgInfo::printVariableDeclaration(const Value *V) { Out << File << ":" << LineNo << "\n"; } -void PrintDbgInfo::printStopPoint(const DbgStopPointInst *DSI) { - if (PrintDirectory) - if (MDString *Str = dyn_cast(DSI->getDirectory())) - Out << Str->getString() << '/'; - - if (MDString *Str = dyn_cast(DSI->getFileName())) - Out << Str->getString(); - Out << ':' << DSI->getLine(); - - if (unsigned Col = DSI->getColumn()) - Out << ':' << Col; -} - -void PrintDbgInfo::printFuncStart(const DbgFuncStartInst *FS) { - DISubprogram Subprogram(FS->getSubprogram()); - Out << "; fully qualified function name: " << Subprogram.getDisplayName() - << " return type: " << Subprogram.getReturnTypeName() - << " at line " << Subprogram.getLineNumber() - << "\n\n"; -} - bool PrintDbgInfo::runOnFunction(Function &F) { if (F.isDeclaration()) return false; @@ -108,57 +85,21 @@ bool PrintDbgInfo::runOnFunction(Function &F) { // Skip dead blocks. continue; - const DbgStopPointInst *DSI = findBBStopPoint(BB); Out << BB->getName(); Out << ":"; - if (DSI) { - Out << "; ("; - printStopPoint(DSI); - Out << ")"; - } - Out << "\n"; - // A dbgstoppoint's information is valid until we encounter a new one. - const DbgStopPointInst *LastDSP = DSI; - bool Printed = DSI != 0; for (BasicBlock::const_iterator i = BB->begin(), e = BB->end(); i != e; ++i) { - if (isa(i)) { - if ((DSI = dyn_cast(i))) { - if (DSI->getContext() == LastDSP->getContext() && - DSI->getLineValue() == LastDSP->getLineValue() && - DSI->getColumnValue() == LastDSP->getColumnValue()) - // Don't print same location twice. - continue; - - LastDSP = cast(i); - - // Don't print consecutive stoppoints, use a flag to know which one we - // printed. - Printed = false; - } else if (const DbgFuncStartInst *FS = dyn_cast(i)) { - printFuncStart(FS); - } - } else { - if (!Printed && LastDSP) { - Out << "; "; - printStopPoint(LastDSP); - Out << "\n"; - Printed = true; - } - Out << *i << '\n'; printVariableDeclaration(i); if (const User *U = dyn_cast(i)) { for(unsigned i=0;igetNumOperands();i++) printVariableDeclaration(U->getOperand(i)); } - } } } - return false; } diff --git a/lib/Analysis/DebugInfo.cpp b/lib/Analysis/DebugInfo.cpp index de2d839f6d6..3768f6776c7 100644 --- a/lib/Analysis/DebugInfo.cpp +++ b/lib/Analysis/DebugInfo.cpp @@ -1242,52 +1242,6 @@ bool DebugInfoFinder::addSubprogram(DISubprogram SP) { return true; } -/// findStopPoint - Find the stoppoint coressponding to this instruction, that -/// is the stoppoint that dominates this instruction. -const DbgStopPointInst *llvm::findStopPoint(const Instruction *Inst) { - if (const DbgStopPointInst *DSI = dyn_cast(Inst)) - return DSI; - - const BasicBlock *BB = Inst->getParent(); - BasicBlock::const_iterator I = Inst, B; - while (BB) { - B = BB->begin(); - - // A BB consisting only of a terminator can't have a stoppoint. - while (I != B) { - --I; - if (const DbgStopPointInst *DSI = dyn_cast(I)) - return DSI; - } - - // This BB didn't have a stoppoint: if there is only one predecessor, look - // for a stoppoint there. We could use getIDom(), but that would require - // dominator info. - BB = I->getParent()->getUniquePredecessor(); - if (BB) - I = BB->getTerminator(); - } - - return 0; -} - -/// findBBStopPoint - Find the stoppoint corresponding to first real -/// (non-debug intrinsic) instruction in this Basic Block, and return the -/// stoppoint for it. -const DbgStopPointInst *llvm::findBBStopPoint(const BasicBlock *BB) { - for(BasicBlock::const_iterator I = BB->begin(), E = BB->end(); I != E; ++I) - if (const DbgStopPointInst *DSI = dyn_cast(I)) - return DSI; - - // Fallback to looking for stoppoint of unique predecessor. Useful if this - // BB contains no stoppoints, but unique predecessor does. - BB = BB->getUniquePredecessor(); - if (BB) - return findStopPoint(BB->getTerminator()); - - return 0; -} - Value *llvm::findDbgGlobalDeclare(GlobalVariable *V) { const Module *M = V->getParent(); NamedMDNode *NMD = M->getNamedMetadata("llvm.dbg.gv"); @@ -1371,29 +1325,6 @@ bool llvm::getLocationInfo(const Value *V, std::string &DisplayName, return true; } -/// ExtractDebugLocation - Extract debug location information -/// from llvm.dbg.stoppoint intrinsic. -DebugLoc llvm::ExtractDebugLocation(DbgStopPointInst &SPI, - DebugLocTracker &DebugLocInfo) { - DebugLoc DL; - Value *Context = SPI.getContext(); - - // If this location is already tracked then use it. - DebugLocTuple Tuple(cast(Context), NULL, SPI.getLine(), - SPI.getColumn()); - DenseMap::iterator II - = DebugLocInfo.DebugIdMap.find(Tuple); - if (II != DebugLocInfo.DebugIdMap.end()) - return DebugLoc::get(II->second); - - // Add a new location entry. - unsigned Id = DebugLocInfo.DebugLocations.size(); - DebugLocInfo.DebugLocations.push_back(Tuple); - DebugLocInfo.DebugIdMap[Tuple] = Id; - - return DebugLoc::get(Id); -} - /// ExtractDebugLocation - Extract debug location information /// from DILocation. DebugLoc llvm::ExtractDebugLocation(DILocation &Loc, @@ -1419,32 +1350,6 @@ DebugLoc llvm::ExtractDebugLocation(DILocation &Loc, return DebugLoc::get(Id); } -/// ExtractDebugLocation - Extract debug location information -/// from llvm.dbg.func_start intrinsic. -DebugLoc llvm::ExtractDebugLocation(DbgFuncStartInst &FSI, - DebugLocTracker &DebugLocInfo) { - DebugLoc DL; - Value *SP = FSI.getSubprogram(); - - DISubprogram Subprogram(cast(SP)); - unsigned Line = Subprogram.getLineNumber(); - DICompileUnit CU(Subprogram.getCompileUnit()); - - // If this location is already tracked then use it. - DebugLocTuple Tuple(CU.getNode(), NULL, Line, /* Column */ 0); - DenseMap::iterator II - = DebugLocInfo.DebugIdMap.find(Tuple); - if (II != DebugLocInfo.DebugIdMap.end()) - return DebugLoc::get(II->second); - - // Add a new location entry. - unsigned Id = DebugLocInfo.DebugLocations.size(); - DebugLocInfo.DebugLocations.push_back(Tuple); - DebugLocInfo.DebugIdMap[Tuple] = Id; - - return DebugLoc::get(Id); -} - /// getDISubprogram - Find subprogram that is enclosing this scope. DISubprogram llvm::getDISubprogram(MDNode *Scope) { DIDescriptor D(Scope); diff --git a/lib/Target/CBackend/CBackend.cpp b/lib/Target/CBackend/CBackend.cpp index 1ab3c0a2405..ba1a377a92b 100644 --- a/lib/Target/CBackend/CBackend.cpp +++ b/lib/Target/CBackend/CBackend.cpp @@ -2921,7 +2921,6 @@ void CWriter::lowerIntrinsics(Function &F) { case Intrinsic::setjmp: case Intrinsic::longjmp: case Intrinsic::prefetch: - case Intrinsic::dbg_stoppoint: case Intrinsic::powi: case Intrinsic::x86_sse_cmp_ss: case Intrinsic::x86_sse_cmp_ps: @@ -3178,20 +3177,6 @@ bool CWriter::visitBuiltinCall(CallInst &I, Intrinsic::ID ID, Out << "0; *((void**)&" << GetValueName(&I) << ") = __builtin_stack_save()"; return true; - case Intrinsic::dbg_stoppoint: { - // If we use writeOperand directly we get a "u" suffix which is rejected - // by gcc. - DbgStopPointInst &SPI = cast(I); - std::string dir; - GetConstantStringInfo(SPI.getDirectory(), dir); - std::string file; - GetConstantStringInfo(SPI.getFileName(), file); - Out << "\n#line " - << SPI.getLine() - << " \"" - << dir << '/' << file << "\"\n"; - return true; - } case Intrinsic::x86_sse_cmp_ss: case Intrinsic::x86_sse_cmp_ps: case Intrinsic::x86_sse2_cmp_sd: diff --git a/lib/Transforms/InstCombine/InstructionCombining.cpp b/lib/Transforms/InstCombine/InstructionCombining.cpp index 0c9e1357850..2785fa8286f 100644 --- a/lib/Transforms/InstCombine/InstructionCombining.cpp +++ b/lib/Transforms/InstCombine/InstructionCombining.cpp @@ -8643,7 +8643,6 @@ static bool TryToSinkInstruction(Instruction *I, BasicBlock *DestBlock) { BasicBlock::iterator InsertPos = DestBlock->getFirstNonPHI(); - CopyPrecedingStopPoint(I, InsertPos); I->moveBefore(InsertPos); ++NumSunkInst; return true; diff --git a/lib/Transforms/Scalar/LICM.cpp b/lib/Transforms/Scalar/LICM.cpp index 99f3ae07f60..6a447dba125 100644 --- a/lib/Transforms/Scalar/LICM.cpp +++ b/lib/Transforms/Scalar/LICM.cpp @@ -384,10 +384,6 @@ bool LICM::canSinkOrHoistInst(Instruction &I) { Size = AA->getTypeStoreSize(LI->getType()); return !pointerInvalidatedByLoop(LI->getOperand(0), Size); } else if (CallInst *CI = dyn_cast(&I)) { - if (isa(CI)) { - // Don't hoist/sink dbgstoppoints, we handle them separately - return false; - } // Handle obvious cases efficiently. AliasAnalysis::ModRefBehavior Behavior = AA->getModRefBehavior(CI); if (Behavior == AliasAnalysis::DoesNotAccessMemory) diff --git a/lib/Transforms/Utils/BasicBlockUtils.cpp b/lib/Transforms/Utils/BasicBlockUtils.cpp index 2962e8497e8..840fe3ef71e 100644 --- a/lib/Transforms/Utils/BasicBlockUtils.cpp +++ b/lib/Transforms/Utils/BasicBlockUtils.cpp @@ -673,16 +673,3 @@ Value *llvm::FindAvailableLoadedValue(Value *Ptr, BasicBlock *ScanBB, return 0; } -/// CopyPrecedingStopPoint - If I is immediately preceded by a StopPoint, -/// make a copy of the stoppoint before InsertPos (presumably before copying -/// or moving I). -void llvm::CopyPrecedingStopPoint(Instruction *I, - BasicBlock::iterator InsertPos) { - if (I != I->getParent()->begin()) { - BasicBlock::iterator BBI = I; --BBI; - if (DbgStopPointInst *DSPI = dyn_cast(BBI)) { - CallInst *newDSPI = cast(DSPI->clone()); - newDSPI->insertBefore(InsertPos); - } - } -} diff --git a/lib/Transforms/Utils/CloneFunction.cpp b/lib/Transforms/Utils/CloneFunction.cpp index c287747b91d..bd750ccd4d2 100644 --- a/lib/Transforms/Utils/CloneFunction.cpp +++ b/lib/Transforms/Utils/CloneFunction.cpp @@ -184,7 +184,6 @@ namespace { const char *NameSuffix; ClonedCodeInfo *CodeInfo; const TargetData *TD; - Value *DbgFnStart; public: PruningFunctionCloner(Function *newFunc, const Function *oldFunc, DenseMap &valueMap, @@ -193,7 +192,7 @@ namespace { ClonedCodeInfo *codeInfo, const TargetData *td) : NewFunc(newFunc), OldFunc(oldFunc), ValueMap(valueMap), Returns(returns), - NameSuffix(nameSuffix), CodeInfo(codeInfo), TD(td), DbgFnStart(NULL) { + NameSuffix(nameSuffix), CodeInfo(codeInfo), TD(td) { } /// CloneBlock - The specified block is found to be reachable, clone it and @@ -235,19 +234,6 @@ void PruningFunctionCloner::CloneBlock(const BasicBlock *BB, continue; } - // Do not clone llvm.dbg.region.end. It will be adjusted by the inliner. - if (const DbgFuncStartInst *DFSI = dyn_cast(II)) { - if (DbgFnStart == NULL) { - DISubprogram SP(DFSI->getSubprogram()); - if (SP.describes(BB->getParent())) - DbgFnStart = DFSI->getSubprogram(); - } - } - if (const DbgRegionEndInst *DREIS = dyn_cast(II)) { - if (DREIS->getContext() == DbgFnStart) - continue; - } - Instruction *NewInst = II->clone(); if (II->hasName()) NewInst->setName(II->getName()+NameSuffix); diff --git a/lib/Transforms/Utils/InlineFunction.cpp b/lib/Transforms/Utils/InlineFunction.cpp index 043046c813e..17f8827fd5c 100644 --- a/lib/Transforms/Utils/InlineFunction.cpp +++ b/lib/Transforms/Utils/InlineFunction.cpp @@ -210,34 +210,6 @@ static void UpdateCallGraphAfterInlining(CallSite CS, CallerNode->removeCallEdgeFor(CS); } -/// findFnRegionEndMarker - This is a utility routine that is used by -/// InlineFunction. Return llvm.dbg.region.end intrinsic that corresponds -/// to the llvm.dbg.func.start of the function F. Otherwise return NULL. -/// -static const DbgRegionEndInst *findFnRegionEndMarker(const Function *F) { - - MDNode *FnStart = NULL; - const DbgRegionEndInst *FnEnd = NULL; - for (Function::const_iterator FI = F->begin(), FE =F->end(); FI != FE; ++FI) - for (BasicBlock::const_iterator BI = FI->begin(), BE = FI->end(); BI != BE; - ++BI) { - if (FnStart == NULL) { - if (const DbgFuncStartInst *FSI = dyn_cast(BI)) { - DISubprogram SP(FSI->getSubprogram()); - assert (SP.isNull() == false && "Invalid llvm.dbg.func.start"); - if (SP.describes(F)) - FnStart = SP.getNode(); - } - continue; - } - - if (const DbgRegionEndInst *REI = dyn_cast(BI)) - if (REI->getContext() == FnStart) - FnEnd = REI; - } - return FnEnd; -} - // InlineFunction - This function inlines the called function into the basic // block of the caller. This returns false if it is not possible to inline this // call. The program is still in a well defined state if this occurs though. @@ -364,23 +336,6 @@ bool llvm::InlineFunction(CallSite CS, CallGraph *CG, const TargetData *TD, ValueMap[I] = ActualArg; } - // Adjust llvm.dbg.region.end. If the CalledFunc has region end - // marker then clone that marker after next stop point at the - // call site. The function body cloner does not clone original - // region end marker from the CalledFunc. This will ensure that - // inlined function's scope ends at the right place. - if (const DbgRegionEndInst *DREI = findFnRegionEndMarker(CalledFunc)) { - for (BasicBlock::iterator BI = TheCall, BE = TheCall->getParent()->end(); - BI != BE; ++BI) { - if (DbgStopPointInst *DSPI = dyn_cast(BI)) { - if (DbgRegionEndInst *NewDREI = - dyn_cast(DREI->clone())) - NewDREI->insertAfter(DSPI); - break; - } - } - } - // We want the inliner to prune the code as it copies. We would LOVE to // have no dead or constant instructions leftover after inlining occurs // (which can happen, e.g., because an argument was constant), but we'll be diff --git a/lib/Transforms/Utils/SimplifyCFG.cpp b/lib/Transforms/Utils/SimplifyCFG.cpp index d7ca45e6e97..70e4b39a8d8 100644 --- a/lib/Transforms/Utils/SimplifyCFG.cpp +++ b/lib/Transforms/Utils/SimplifyCFG.cpp @@ -1658,13 +1658,6 @@ bool llvm::SimplifyCFG(BasicBlock *BB) { Instruction *NewRet = RI->clone(); Pred->getInstList().push_back(NewRet); - BasicBlock::iterator BBI = RI; - if (BBI != BB->begin()) { - // Move region end info into the predecessor. - if (DbgRegionEndInst *DREI = dyn_cast(--BBI)) - DREI->moveBefore(NewRet); - } - // If the return instruction returns a value, and if the value was a // PHI node in "BB", propagate the right value into the return. for (User::op_iterator i = NewRet->op_begin(), e = NewRet->op_end(); diff --git a/lib/VMCore/AutoUpgrade.cpp b/lib/VMCore/AutoUpgrade.cpp index 77ab19f417c..0676caa2c64 100644 --- a/lib/VMCore/AutoUpgrade.cpp +++ b/lib/VMCore/AutoUpgrade.cpp @@ -486,55 +486,35 @@ void llvm::CheckDebugInfoIntrinsics(Module *M) { if (Function *FuncStart = M->getFunction("llvm.dbg.func.start")) { - if (!FuncStart->use_empty()) { - DbgFuncStartInst *DFSI = cast(FuncStart->use_back()); - if (!isa(DFSI->getOperand(1))) { - while (!FuncStart->use_empty()) { - CallInst *CI = cast(FuncStart->use_back()); - CI->eraseFromParent(); - } - FuncStart->eraseFromParent(); - } + while (!FuncStart->use_empty()) { + CallInst *CI = cast(FuncStart->use_back()); + CI->eraseFromParent(); } + FuncStart->eraseFromParent(); } - + if (Function *StopPoint = M->getFunction("llvm.dbg.stoppoint")) { - if (!StopPoint->use_empty()) { - DbgStopPointInst *DSPI = cast(StopPoint->use_back()); - if (!isa(DSPI->getOperand(3))) { - while (!StopPoint->use_empty()) { - CallInst *CI = cast(StopPoint->use_back()); - CI->eraseFromParent(); - } - StopPoint->eraseFromParent(); - } + while (!StopPoint->use_empty()) { + CallInst *CI = cast(StopPoint->use_back()); + CI->eraseFromParent(); } + StopPoint->eraseFromParent(); } if (Function *RegionStart = M->getFunction("llvm.dbg.region.start")) { - if (!RegionStart->use_empty()) { - DbgRegionStartInst *DRSI = cast(RegionStart->use_back()); - if (!isa(DRSI->getOperand(1))) { - while (!RegionStart->use_empty()) { - CallInst *CI = cast(RegionStart->use_back()); - CI->eraseFromParent(); - } - RegionStart->eraseFromParent(); - } + while (!RegionStart->use_empty()) { + CallInst *CI = cast(RegionStart->use_back()); + CI->eraseFromParent(); } + RegionStart->eraseFromParent(); } if (Function *RegionEnd = M->getFunction("llvm.dbg.region.end")) { - if (!RegionEnd->use_empty()) { - DbgRegionEndInst *DREI = cast(RegionEnd->use_back()); - if (!isa(DREI->getOperand(1))) { - while (!RegionEnd->use_empty()) { - CallInst *CI = cast(RegionEnd->use_back()); - CI->eraseFromParent(); - } - RegionEnd->eraseFromParent(); - } + while (!RegionEnd->use_empty()) { + CallInst *CI = cast(RegionEnd->use_back()); + CI->eraseFromParent(); } + RegionEnd->eraseFromParent(); } if (Function *Declare = M->getFunction("llvm.dbg.declare")) { diff --git a/lib/VMCore/IntrinsicInst.cpp b/lib/VMCore/IntrinsicInst.cpp index 5e0f42e063b..daa768c0cfe 100644 --- a/lib/VMCore/IntrinsicInst.cpp +++ b/lib/VMCore/IntrinsicInst.cpp @@ -8,11 +8,7 @@ //===----------------------------------------------------------------------===// // // This file implements methods that make it really easy to deal with intrinsic -// functions with the isa/dyncast family of functions. In particular, this -// allows you to do things like: -// -// if (DbgStopPointInst *SPI = dyn_cast(Inst)) -// ... SPI->getFileName() ... SPI->getDirectory() ... +// functions. // // All intrinsic function calls are instances of the call instruction, so these // are all subclasses of the CallInst class. Note that none of these classes @@ -54,22 +50,6 @@ Value *DbgInfoIntrinsic::StripCast(Value *C) { return dyn_cast(C); } -//===----------------------------------------------------------------------===// -/// DbgStopPointInst - This represents the llvm.dbg.stoppoint instruction. -/// - -Value *DbgStopPointInst::getFileName() const { - // Once the operand indices are verified, update this assert - assert(LLVMDebugVersion == (7 << 16) && "Verify operand indices"); - return getContext()->getOperand(3); -} - -Value *DbgStopPointInst::getDirectory() const { - // Once the operand indices are verified, update this assert - assert(LLVMDebugVersion == (7 << 16) && "Verify operand indices"); - return getContext()->getOperand(4); -} - //===----------------------------------------------------------------------===// /// DbgValueInst - This represents the llvm.dbg.value instruction. /// diff --git a/test/DebugInfo/printdbginfo2.ll b/test/DebugInfo/printdbginfo2.ll index c5fe7ad6c80..759310fc9f5 100644 --- a/test/DebugInfo/printdbginfo2.ll +++ b/test/DebugInfo/printdbginfo2.ll @@ -9,32 +9,26 @@ define i32 @main() nounwind { entry: -; CHECK:; (x.c:6:3) %retval = alloca i32 ; [#uses=3] %b = alloca %struct.foo, align 4 ; <%struct.foo*> [#uses=2] ; CHECK:; %b is variable b of type foo declared at x.c:7 %a = alloca [4 x i32], align 4 ; <[4 x i32]*> [#uses=1] ; CHECK:; %a is variable a of type declared at x.c:8 call void @llvm.dbg.func.start(metadata !3) -; CHECK:; fully qualified function name: main return type: int at line 5 store i32 0, i32* %retval call void @llvm.dbg.stoppoint(i32 6, i32 3, metadata !1) -; CHECK:; x.c:7:3 call void @llvm.dbg.stoppoint(i32 7, i32 3, metadata !1) %0 = bitcast %struct.foo* %b to { }* ; <{ }*> [#uses=1] call void @llvm.dbg.declare({ }* %0, metadata !4) ; CHECK:; %0 is variable b of type foo declared at x.c:7 call void @llvm.dbg.stoppoint(i32 8, i32 3, metadata !1) -; CHECK:; x.c:8:3 %1 = bitcast [4 x i32]* %a to { }* ; <{ }*> [#uses=1] call void @llvm.dbg.declare({ }* %1, metadata !8) ; CHECK:; %1 is variable a of type declared at x.c:8 call void @llvm.dbg.stoppoint(i32 9, i32 3, metadata !1) -; CHECK:; x.c:9:3 %tmp = getelementptr inbounds %struct.foo* %b, i32 0, i32 0 ; [#uses=1] ; CHECK:; %tmp is variable b of type foo declared at x.c:7 store i32 5, i32* %tmp -; CHECK:; x.c:10:3 call void @llvm.dbg.stoppoint(i32 10, i32 3, metadata !1) %tmp1 = load i32* @main.c ; [#uses=1] ; CHECK:; @main.c is variable c of type int declared at x.c:6 @@ -43,7 +37,6 @@ entry: ;