diff options
author | Chandler Carruth <chandlerc@gmail.com> | 2014-12-23 02:58:14 +0000 |
---|---|---|
committer | Chandler Carruth <chandlerc@gmail.com> | 2014-12-23 02:58:14 +0000 |
commit | c7d1e24b34a40cb1b7670c66fab65de039e421f2 (patch) | |
tree | 81d8aa91b37d7e3502a520b8f1db3f415dfda0bd /llvm/lib/Transforms/Scalar/SROA.cpp | |
parent | 5238deb2ffba2573c5ebc13714f54507075f79b8 (diff) | |
download | bcm5719-llvm-c7d1e24b34a40cb1b7670c66fab65de039e421f2.tar.gz bcm5719-llvm-c7d1e24b34a40cb1b7670c66fab65de039e421f2.zip |
Revert r224739: Debug info: Teach SROA how to update debug info for
fragmented variables.
This caused codegen to start crashing when we built somewhat large
programs with debug info and optimizations. 'check-msan' hit in, and
I suspect a bootstrap would as well. I mailed a test case to the
review thread.
llvm-svn: 224750
Diffstat (limited to 'llvm/lib/Transforms/Scalar/SROA.cpp')
-rw-r--r-- | llvm/lib/Transforms/Scalar/SROA.cpp | 31 |
1 files changed, 1 insertions, 30 deletions
diff --git a/llvm/lib/Transforms/Scalar/SROA.cpp b/llvm/lib/Transforms/Scalar/SROA.cpp index 8fc9a94aefe..a7c1dc14713 100644 --- a/llvm/lib/Transforms/Scalar/SROA.cpp +++ b/llvm/lib/Transforms/Scalar/SROA.cpp @@ -1220,10 +1220,6 @@ class SROA : public FunctionPass { /// currently in the promotable queue. SetVector<SelectInst *, SmallVector<SelectInst *, 2>> SpeculatableSelects; - /// Debug intrinsics do not show up as regular uses in the - /// IR. This side-table holds the missing use edges. - DenseMap<AllocaInst *, DbgDeclareInst *> DbgDeclares; - public: SROA(bool RequiresDomTree = true) : FunctionPass(ID), RequiresDomTree(RequiresDomTree), C(nullptr), @@ -3497,27 +3493,6 @@ bool SROA::rewritePartition(AllocaInst &AI, AllocaSlices &AS, SliceTy, nullptr, Alignment, AI.getName() + ".sroa." + Twine(P.begin() - AS.begin()), &AI); ++NumNewAllocas; - - // Migrate debug information from the old alloca to the new alloca - // and the individial slices. - if (DbgDeclareInst *DbgDecl = DbgDeclares.lookup(&AI)) { - DIVariable Var(DbgDecl->getVariable()); - DIExpression Piece; - DIBuilder DIB(*AI.getParent()->getParent()->getParent(), - /*AllowUnresolved*/ false); - // Create a piece expression describing the slice, if the new slize is - // smaller than the old alloca or the old alloca already was described - // with a piece. It would be even better to just compare against the size - // of the type described in the debug info, but then we would need to - // build an expensive DIRefMap. - if (P.size() < DL->getTypeAllocSize(AI.getAllocatedType()) || - DIExpression(DbgDecl->getExpression()).isVariablePiece()) - Piece = DIB.createPieceExpression(P.beginOffset(), P.size()); - Instruction *NewDDI = DIB.insertDeclare(NewAI, Var, Piece, &AI); - NewDDI->setDebugLoc(DbgDecl->getDebugLoc()); - DbgDeclares.insert(std::make_pair(NewAI, cast<DbgDeclareInst>(NewDDI))); - DeadInsts.insert(DbgDecl); - } } DEBUG(dbgs() << "Rewriting alloca partition " @@ -3851,13 +3826,9 @@ bool SROA::runOnFunction(Function &F) { BasicBlock &EntryBB = F.getEntryBlock(); for (BasicBlock::iterator I = EntryBB.begin(), E = std::prev(EntryBB.end()); - I != E; ++I) { + I != E; ++I) if (AllocaInst *AI = dyn_cast<AllocaInst>(I)) Worklist.insert(AI); - else if (DbgDeclareInst *DDI = dyn_cast<DbgDeclareInst>(I)) - if (auto AI = dyn_cast_or_null<AllocaInst>(DDI->getAddress())) - DbgDeclares.insert(std::make_pair(AI, DDI)); - } bool Changed = false; // A set of deleted alloca instruction pointers which should be removed from |