aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/Analysis/DbgInfoPrinter.cpp59
-rw-r--r--lib/Analysis/DebugInfo.cpp95
-rw-r--r--lib/Target/CBackend/CBackend.cpp15
-rw-r--r--lib/Transforms/InstCombine/InstructionCombining.cpp1
-rw-r--r--lib/Transforms/Scalar/LICM.cpp4
-rw-r--r--lib/Transforms/Utils/BasicBlockUtils.cpp13
-rw-r--r--lib/Transforms/Utils/CloneFunction.cpp16
-rw-r--r--lib/Transforms/Utils/InlineFunction.cpp45
-rw-r--r--lib/Transforms/Utils/SimplifyCFG.cpp7
-rw-r--r--lib/VMCore/AutoUpgrade.cpp54
-rw-r--r--lib/VMCore/IntrinsicInst.cpp22
11 files changed, 19 insertions, 312 deletions
diff --git a/lib/Analysis/DbgInfoPrinter.cpp b/lib/Analysis/DbgInfoPrinter.cpp
index 7d72b383a5..3532b052dc 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<MDString>(DSI->getDirectory()))
- Out << Str->getString() << '/';
-
- if (MDString *Str = dyn_cast<MDString>(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<DbgInfoIntrinsic>(i)) {
- if ((DSI = dyn_cast<DbgStopPointInst>(i))) {
- if (DSI->getContext() == LastDSP->getContext() &&
- DSI->getLineValue() == LastDSP->getLineValue() &&
- DSI->getColumnValue() == LastDSP->getColumnValue())
- // Don't print same location twice.
- continue;
-
- LastDSP = cast<DbgStopPointInst>(i);
-
- // Don't print consecutive stoppoints, use a flag to know which one we
- // printed.
- Printed = false;
- } else if (const DbgFuncStartInst *FS = dyn_cast<DbgFuncStartInst>(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<User>(i)) {
for(unsigned i=0;i<U->getNumOperands();i++)
printVariableDeclaration(U->getOperand(i));
}
- }
}
}
-
return false;
}
diff --git a/lib/Analysis/DebugInfo.cpp b/lib/Analysis/DebugInfo.cpp
index de2d839f6d..3768f6776c 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<DbgStopPointInst>(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<DbgStopPointInst>(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<DbgStopPointInst>(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");
@@ -1372,29 +1326,6 @@ bool llvm::getLocationInfo(const Value *V, std::string &DisplayName,
}
/// 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<MDNode>(Context), NULL, SPI.getLine(),
- SPI.getColumn());
- DenseMap<DebugLocTuple, unsigned>::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,
DebugLocTracker &DebugLocInfo) {
@@ -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<MDNode>(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<DebugLocTuple, unsigned>::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 1ab3c0a240..ba1a377a92 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<DbgStopPointInst>(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 0c9e135785..2785fa8286 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 99f3ae07f6..6a447dba12 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<CallInst>(&I)) {
- if (isa<DbgStopPointInst>(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 2962e8497e..840fe3ef71 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<DbgStopPointInst>(BBI)) {
- CallInst *newDSPI = cast<CallInst>(DSPI->clone());
- newDSPI->insertBefore(InsertPos);
- }
- }
-}
diff --git a/lib/Transforms/Utils/CloneFunction.cpp b/lib/Transforms/Utils/CloneFunction.cpp
index c287747b91..bd750ccd4d 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<const Value*, Value*> &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<DbgFuncStartInst>(II)) {
- if (DbgFnStart == NULL) {
- DISubprogram SP(DFSI->getSubprogram());
- if (SP.describes(BB->getParent()))
- DbgFnStart = DFSI->getSubprogram();
- }
- }
- if (const DbgRegionEndInst *DREIS = dyn_cast<DbgRegionEndInst>(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 043046c813..17f8827fd5 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<DbgFuncStartInst>(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<DbgRegionEndInst>(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<DbgStopPointInst>(BI)) {
- if (DbgRegionEndInst *NewDREI =
- dyn_cast<DbgRegionEndInst>(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 d7ca45e6e9..70e4b39a8d 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<DbgRegionEndInst>(--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 77ab19f417..0676caa2c6 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<DbgFuncStartInst>(FuncStart->use_back());
- if (!isa<MDNode>(DFSI->getOperand(1))) {
- while (!FuncStart->use_empty()) {
- CallInst *CI = cast<CallInst>(FuncStart->use_back());
- CI->eraseFromParent();
- }
- FuncStart->eraseFromParent();
- }
+ while (!FuncStart->use_empty()) {
+ CallInst *CI = cast<CallInst>(FuncStart->use_back());
+ CI->eraseFromParent();
}
+ FuncStart->eraseFromParent();
}
-
+
if (Function *StopPoint = M->getFunction("llvm.dbg.stoppoint")) {
- if (!StopPoint->use_empty()) {
- DbgStopPointInst *DSPI = cast<DbgStopPointInst>(StopPoint->use_back());
- if (!isa<MDNode>(DSPI->getOperand(3))) {
- while (!StopPoint->use_empty()) {
- CallInst *CI = cast<CallInst>(StopPoint->use_back());
- CI->eraseFromParent();
- }
- StopPoint->eraseFromParent();
- }
+ while (!StopPoint->use_empty()) {
+ CallInst *CI = cast<CallInst>(StopPoint->use_back());
+ CI->eraseFromParent();
}
+ StopPoint->eraseFromParent();
}
if (Function *RegionStart = M->getFunction("llvm.dbg.region.start")) {
- if (!RegionStart->use_empty()) {
- DbgRegionStartInst *DRSI = cast<DbgRegionStartInst>(RegionStart->use_back());
- if (!isa<MDNode>(DRSI->getOperand(1))) {
- while (!RegionStart->use_empty()) {
- CallInst *CI = cast<CallInst>(RegionStart->use_back());
- CI->eraseFromParent();
- }
- RegionStart->eraseFromParent();
- }
+ while (!RegionStart->use_empty()) {
+ CallInst *CI = cast<CallInst>(RegionStart->use_back());
+ CI->eraseFromParent();
}
+ RegionStart->eraseFromParent();
}
if (Function *RegionEnd = M->getFunction("llvm.dbg.region.end")) {
- if (!RegionEnd->use_empty()) {
- DbgRegionEndInst *DREI = cast<DbgRegionEndInst>(RegionEnd->use_back());
- if (!isa<MDNode>(DREI->getOperand(1))) {
- while (!RegionEnd->use_empty()) {
- CallInst *CI = cast<CallInst>(RegionEnd->use_back());
- CI->eraseFromParent();
- }
- RegionEnd->eraseFromParent();
- }
+ while (!RegionEnd->use_empty()) {
+ CallInst *CI = cast<CallInst>(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 5e0f42e063..daa768c0cf 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<DbgStopPointInst>(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
@@ -55,22 +51,6 @@ Value *DbgInfoIntrinsic::StripCast(Value *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.
///