[llvm-commits] [llvm] r92557 - in /llvm/trunk: include/llvm-c/ include/llvm/ include/llvm/Analysis/ include/llvm/Transforms/Utils/ lib/Analysis/ lib/Target/CBackend/ lib/Transforms/InstCombine/ lib/Transforms/Scalar/ lib/Transforms/Utils/ lib/VMCore/ test/DebugInfo/ test/Transforms/LICM/

Devang Patel dpatel at apple.com
Mon Jan 4 17:10:40 PST 2010


Author: dpatel
Date: Mon Jan  4 19:10:40 2010
New Revision: 92557

URL: http://llvm.org/viewvc/llvm-project?rev=92557&view=rev
Log:
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.


Removed:
    llvm/trunk/test/Transforms/LICM/licm_preserve_dbginfo.ll
Modified:
    llvm/trunk/include/llvm-c/Core.h
    llvm/trunk/include/llvm/Analysis/DebugInfo.h
    llvm/trunk/include/llvm/IntrinsicInst.h
    llvm/trunk/include/llvm/Transforms/Utils/BasicBlockUtils.h
    llvm/trunk/lib/Analysis/DbgInfoPrinter.cpp
    llvm/trunk/lib/Analysis/DebugInfo.cpp
    llvm/trunk/lib/Target/CBackend/CBackend.cpp
    llvm/trunk/lib/Transforms/InstCombine/InstructionCombining.cpp
    llvm/trunk/lib/Transforms/Scalar/LICM.cpp
    llvm/trunk/lib/Transforms/Utils/BasicBlockUtils.cpp
    llvm/trunk/lib/Transforms/Utils/CloneFunction.cpp
    llvm/trunk/lib/Transforms/Utils/InlineFunction.cpp
    llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp
    llvm/trunk/lib/VMCore/AutoUpgrade.cpp
    llvm/trunk/lib/VMCore/IntrinsicInst.cpp
    llvm/trunk/test/DebugInfo/printdbginfo2.ll

Modified: llvm/trunk/include/llvm-c/Core.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm-c/Core.h?rev=92557&r1=92556&r2=92557&view=diff

==============================================================================
--- llvm/trunk/include/llvm-c/Core.h (original)
+++ llvm/trunk/include/llvm-c/Core.h Mon Jan  4 19:10:40 2010
@@ -427,10 +427,6 @@
         macro(IntrinsicInst)                \
           macro(DbgInfoIntrinsic)           \
             macro(DbgDeclareInst)           \
-            macro(DbgFuncStartInst)         \
-            macro(DbgRegionEndInst)         \
-            macro(DbgRegionStartInst)       \
-            macro(DbgStopPointInst)         \
           macro(EHSelectorInst)             \
           macro(MemIntrinsic)               \
             macro(MemCpyInst)               \

Modified: llvm/trunk/include/llvm/Analysis/DebugInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/DebugInfo.h?rev=92557&r1=92556&r2=92557&view=diff

==============================================================================
--- llvm/trunk/include/llvm/Analysis/DebugInfo.h (original)
+++ llvm/trunk/include/llvm/Analysis/DebugInfo.h Mon Jan  4 19:10:40 2010
@@ -30,11 +30,7 @@
   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 @@
     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);
@@ -681,20 +669,10 @@
                        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);
 

Modified: llvm/trunk/include/llvm/IntrinsicInst.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IntrinsicInst.h?rev=92557&r1=92556&r2=92557&view=diff

==============================================================================
--- llvm/trunk/include/llvm/IntrinsicInst.h (original)
+++ llvm/trunk/include/llvm/IntrinsicInst.h Mon Jan  4 19:10:40 2010
@@ -64,10 +64,6 @@
     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 @@
     static Value *StripCast(Value *C);
   };
 
-  /// DbgStopPointInst - This represents the llvm.dbg.stoppoint instruction.
-  ///
-  struct DbgStopPointInst : public DbgInfoIntrinsic {
-    Value *getLineValue() const { return const_cast<Value*>(getOperand(1)); }
-    Value *getColumnValue() const { return const_cast<Value*>(getOperand(2)); }
-    MDNode *getContext() const {
-      return cast<MDNode>(getOperand(3));
-    }
-
-    unsigned getLine() const {
-      return unsigned(cast<ConstantInt>(getOperand(1))->getZExtValue());
-    }
-    unsigned getColumn() const {
-      return unsigned(cast<ConstantInt>(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<IntrinsicInst>(V) && classof(cast<IntrinsicInst>(V));
-    }
-  };
-  
-  /// DbgFuncStartInst - This represents the llvm.dbg.func.start instruction.
-  ///
-  struct DbgFuncStartInst : public DbgInfoIntrinsic {
-    MDNode *getSubprogram() const { return cast<MDNode>(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<IntrinsicInst>(V) && classof(cast<IntrinsicInst>(V));
-    }
-  };
-
-  /// DbgRegionStartInst - This represents the llvm.dbg.region.start
-  /// instruction.
-  struct DbgRegionStartInst : public DbgInfoIntrinsic {
-    MDNode *getContext() const { return cast<MDNode>(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<IntrinsicInst>(V) && classof(cast<IntrinsicInst>(V));
-    }
-  };
-
-  /// DbgRegionEndInst - This represents the llvm.dbg.region.end instruction.
-  ///
-  struct DbgRegionEndInst : public DbgInfoIntrinsic {
-    MDNode *getContext() const { return cast<MDNode>(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<IntrinsicInst>(V) && classof(cast<IntrinsicInst>(V));
-    }
-  };
-
   /// DbgDeclareInst - This represents the llvm.dbg.declare instruction.
   ///
   struct DbgDeclareInst : public DbgInfoIntrinsic {

Modified: llvm/trunk/include/llvm/Transforms/Utils/BasicBlockUtils.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Transforms/Utils/BasicBlockUtils.h?rev=92557&r1=92556&r2=92557&view=diff

==============================================================================
--- llvm/trunk/include/llvm/Transforms/Utils/BasicBlockUtils.h (original)
+++ llvm/trunk/include/llvm/Transforms/Utils/BasicBlockUtils.h Mon Jan  4 19:10:40 2010
@@ -65,11 +65,6 @@
 //
 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.

Modified: llvm/trunk/lib/Analysis/DbgInfoPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/DbgInfoPrinter.cpp?rev=92557&r1=92556&r2=92557&view=diff

==============================================================================
--- llvm/trunk/lib/Analysis/DbgInfoPrinter.cpp (original)
+++ llvm/trunk/lib/Analysis/DbgInfoPrinter.cpp Mon Jan  4 19:10:40 2010
@@ -37,8 +37,6 @@
 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 @@
   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 @@
       // 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;
 }

Modified: llvm/trunk/lib/Analysis/DebugInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/DebugInfo.cpp?rev=92557&r1=92556&r2=92557&view=diff

==============================================================================
--- llvm/trunk/lib/Analysis/DebugInfo.cpp (original)
+++ llvm/trunk/lib/Analysis/DebugInfo.cpp Mon Jan  4 19:10:40 2010
@@ -1242,52 +1242,6 @@
   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 @@
 }
 
 /// 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 @@
   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);

Modified: llvm/trunk/lib/Target/CBackend/CBackend.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/CBackend/CBackend.cpp?rev=92557&r1=92556&r2=92557&view=diff

==============================================================================
--- llvm/trunk/lib/Target/CBackend/CBackend.cpp (original)
+++ llvm/trunk/lib/Target/CBackend/CBackend.cpp Mon Jan  4 19:10:40 2010
@@ -2921,7 +2921,6 @@
           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 @@
     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:

Modified: llvm/trunk/lib/Transforms/InstCombine/InstructionCombining.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/InstCombine/InstructionCombining.cpp?rev=92557&r1=92556&r2=92557&view=diff

==============================================================================
--- llvm/trunk/lib/Transforms/InstCombine/InstructionCombining.cpp (original)
+++ llvm/trunk/lib/Transforms/InstCombine/InstructionCombining.cpp Mon Jan  4 19:10:40 2010
@@ -8643,7 +8643,6 @@
 
   BasicBlock::iterator InsertPos = DestBlock->getFirstNonPHI();
 
-  CopyPrecedingStopPoint(I, InsertPos);
   I->moveBefore(InsertPos);
   ++NumSunkInst;
   return true;

Modified: llvm/trunk/lib/Transforms/Scalar/LICM.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LICM.cpp?rev=92557&r1=92556&r2=92557&view=diff

==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/LICM.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/LICM.cpp Mon Jan  4 19:10:40 2010
@@ -384,10 +384,6 @@
       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)

Modified: llvm/trunk/lib/Transforms/Utils/BasicBlockUtils.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/BasicBlockUtils.cpp?rev=92557&r1=92556&r2=92557&view=diff

==============================================================================
--- llvm/trunk/lib/Transforms/Utils/BasicBlockUtils.cpp (original)
+++ llvm/trunk/lib/Transforms/Utils/BasicBlockUtils.cpp Mon Jan  4 19:10:40 2010
@@ -673,16 +673,3 @@
   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);
-    }
-  }
-}

Modified: llvm/trunk/lib/Transforms/Utils/CloneFunction.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/CloneFunction.cpp?rev=92557&r1=92556&r2=92557&view=diff

==============================================================================
--- llvm/trunk/lib/Transforms/Utils/CloneFunction.cpp (original)
+++ llvm/trunk/lib/Transforms/Utils/CloneFunction.cpp Mon Jan  4 19:10:40 2010
@@ -184,7 +184,6 @@
     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 @@
                           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 @@
       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);

Modified: llvm/trunk/lib/Transforms/Utils/InlineFunction.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/InlineFunction.cpp?rev=92557&r1=92556&r2=92557&view=diff

==============================================================================
--- llvm/trunk/lib/Transforms/Utils/InlineFunction.cpp (original)
+++ llvm/trunk/lib/Transforms/Utils/InlineFunction.cpp Mon Jan  4 19:10:40 2010
@@ -210,34 +210,6 @@
   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 @@
       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

Modified: llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp?rev=92557&r1=92556&r2=92557&view=diff

==============================================================================
--- llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp (original)
+++ llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp Mon Jan  4 19:10:40 2010
@@ -1658,13 +1658,6 @@
           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();

Modified: llvm/trunk/lib/VMCore/AutoUpgrade.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/AutoUpgrade.cpp?rev=92557&r1=92556&r2=92557&view=diff

==============================================================================
--- llvm/trunk/lib/VMCore/AutoUpgrade.cpp (original)
+++ llvm/trunk/lib/VMCore/AutoUpgrade.cpp Mon Jan  4 19:10:40 2010
@@ -486,55 +486,35 @@
 
 
   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")) {

Modified: llvm/trunk/lib/VMCore/IntrinsicInst.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/IntrinsicInst.cpp?rev=92557&r1=92556&r2=92557&view=diff

==============================================================================
--- llvm/trunk/lib/VMCore/IntrinsicInst.cpp (original)
+++ llvm/trunk/lib/VMCore/IntrinsicInst.cpp Mon Jan  4 19:10:40 2010
@@ -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 @@
 }
 
 //===----------------------------------------------------------------------===//
-/// 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.
 ///
 

Modified: llvm/trunk/test/DebugInfo/printdbginfo2.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/printdbginfo2.ll?rev=92557&r1=92556&r2=92557&view=diff

==============================================================================
--- llvm/trunk/test/DebugInfo/printdbginfo2.ll (original)
+++ llvm/trunk/test/DebugInfo/printdbginfo2.ll Mon Jan  4 19:10:40 2010
@@ -9,32 +9,26 @@
 
 define i32 @main() nounwind {
 entry:
-; CHECK:; (x.c:6:3)
   %retval = alloca i32                            ; <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 ; <i32*> [#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                       ; <i32> [#uses=1]
 ; CHECK:; @main.c is variable c of type int declared at x.c:6
@@ -43,7 +37,6 @@
 
 ; <label>:2                                       ; preds = %entry
   call void @llvm.dbg.stoppoint(i32 11, i32 1, metadata !1)
-; CHECK:; (x.c:11:1)
   call void @llvm.dbg.region.end(metadata !3)
   %3 = load i32* %retval                          ; <i32> [#uses=1]
   ret i32 %3

Removed: llvm/trunk/test/Transforms/LICM/licm_preserve_dbginfo.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/LICM/licm_preserve_dbginfo.ll?rev=92556&view=auto

==============================================================================
--- llvm/trunk/test/Transforms/LICM/licm_preserve_dbginfo.ll (original)
+++ llvm/trunk/test/Transforms/LICM/licm_preserve_dbginfo.ll (removed)
@@ -1,55 +0,0 @@
-; RUN: opt -licm -S <%s | FileCheck %s
-; Test that licm doesn't sink/delete debug info.
-define i32 @foo(i32 %a, i32 %j) nounwind {
-entry:
-;CHECK: entry:
-  call void @llvm.dbg.func.start(metadata !0)
-  call void @llvm.dbg.stoppoint(i32 3, i32 5, metadata !1)
-;CHECK: %mul = mul i32 %j, %j
-  br label %for.cond
-
-for.cond:
-;CHECK: for.cond:
-  %i.0 = phi i32 [ 0, %entry ], [ %inc, %for.inc ]
-  %s.0 = phi i32 [ 0, %entry ], [ %add, %for.inc ]
-  call void @llvm.dbg.stoppoint(i32 4, i32 5, metadata !1)
-; CHECK: call void @llvm.dbg.stoppoint(i32 4, i32 5, metadata !1)
-  %cmp = icmp slt i32 %i.0, %a
-  br i1 %cmp, label %for.body, label %for.end
-
-for.body:
-;CHECK: for.body:
-  call void @llvm.dbg.stoppoint(i32 5, i32 2, metadata !1)
-;CHECK: call void @llvm.dbg.stoppoint(i32 5, i32 2, metadata !1)
-  %mul = mul i32 %j, %j
-  %add = add nsw i32 %s.0, %mul
-  br label %for.inc
-
-for.inc:
-;CHECK: for.inc:
-  call void @llvm.dbg.stoppoint(i32 4, i32 18, metadata !1)
-;CHECK: call void @llvm.dbg.stoppoint(i32 4, i32 18, metadata !1)
-  %inc = add nsw i32 %i.0, 1
-  br label %for.cond
-
-for.end:
-  call void @llvm.dbg.stoppoint(i32 7, i32 5, metadata !1)
-  br label %0
-
-; <label>:0                                       ; preds = %for.end
-  call void @llvm.dbg.stoppoint(i32 8, i32 1, metadata !1)
-  call void @llvm.dbg.region.end(metadata !0)
-  ret i32 %s.0
-}
-
-declare void @llvm.dbg.func.start(metadata) nounwind readnone
-
-declare void @llvm.dbg.declare({ }*, metadata) nounwind readnone
-
-declare void @llvm.dbg.stoppoint(i32, i32, metadata) nounwind readnone
-
-declare void @llvm.dbg.region.end(metadata) nounwind readnone
-
-!0 = metadata !{i32 458798, i32 0, metadata !1, metadata !"foo", metadata !"foo", metadata !"foo", metadata !1, i32 2, metadata !2, i1 false, i1 true}; [DW_TAG_subprogram ]
-!1 = metadata !{i32 458769, i32 0, i32 12, metadata !"licm.c", metadata !"/home/edwin", metadata !"clang 1.1", i1 true, i1 false, metadata !"", i32 0}; [DW_TAG_compile_unit ]
-!2 = metadata !{i32 458788, metadata !1, metadata !"int", metadata !1, i32 0, i64 32, i64 32, i64 0, i32 0, i32 5}; [DW_TAG_base_type ]





More information about the llvm-commits mailing list