Make LoadAndStorePromoter preserve debug info and create llvm.dbg.values when

promoting allocas to SSA variables. Fixes <rdar://problem/9479036>.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@131953 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Cameron Zwarich
2011-05-24 03:10:43 +00:00
parent e665798097
commit c827939046
9 changed files with 125 additions and 27 deletions

View File

@ -178,6 +178,10 @@ bool ConvertDebugDeclareToDebugValue(DbgDeclareInst *DDI,
/// of llvm.dbg.value intrinsics.
bool LowerDbgDeclare(Function &F);
/// FindAllocaDbgDeclare - Finds the llvm.dbg.declare intrinsic corresponding to
/// an alloca, if any.
DbgDeclareInst *FindAllocaDbgDeclare(Value *V);
} // End llvm namespace
#endif

View File

@ -21,6 +21,8 @@ namespace llvm {
class PHINode;
template<typename T> class SmallVectorImpl;
template<typename T> class SSAUpdaterTraits;
class DbgDeclareInst;
class DIBuilder;
class BumpPtrAllocator;
/// SSAUpdater - This class updates SSA form for a set of values defined in
@ -120,9 +122,12 @@ private:
class LoadAndStorePromoter {
protected:
SSAUpdater &SSA;
DbgDeclareInst *DDI;
DIBuilder *&DIB;
public:
LoadAndStorePromoter(const SmallVectorImpl<Instruction*> &Insts,
SSAUpdater &S, StringRef Name = StringRef());
SSAUpdater &S, DbgDeclareInst *DDI, DIBuilder *&DIB,
StringRef Name = StringRef());
virtual ~LoadAndStorePromoter() {}
/// run - This does the promotion. Insts is a list of loads and stores to