If FastISel is run and it has known DebugLoc then use it.
authorDevang Patel <dpatel@apple.com>
Thu, 16 Apr 2009 01:33:10 +0000 (01:33 +0000)
committerDevang Patel <dpatel@apple.com>
Thu, 16 Apr 2009 01:33:10 +0000 (01:33 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69253 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/CodeGen/FastISel.h
lib/CodeGen/SelectionDAG/SelectionDAGBuild.h
lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp

index 8c23058c3d1d23047ecab9fc6a052c9e92e7ebc2..38c1710d7103297d4440f1a6e708effaad5fecf5 100644 (file)
@@ -83,6 +83,9 @@ public:
   ///
   void setCurDebugLoc(DebugLoc dl) { DL = dl; }
 
+  /// getCurDebugLoc() - Return current debug location information.
+  DebugLoc getCurDebugLoc() const { return DL; }
+
   /// SelectInstruction - Do "fast" instruction selection for the given
   /// LLVM IR instruction, and append generated machine instructions to
   /// the current block. Return true if selection was successful.
index a9c3d6a523b13359519eb0e1d1202d0c49512df8..7a76c5f83d2bba6a5470e6f71929eb2ac492d557 100644 (file)
@@ -392,6 +392,7 @@ public:
   SDValue getControlRoot();
 
   DebugLoc getCurDebugLoc() const { return CurDebugLoc; }
+  void setCurDebugLoc(DebugLoc dl) { CurDebugLoc = dl; }
 
   void CopyValueToVirtualRegister(Value *V, unsigned Reg);
 
@@ -542,8 +543,6 @@ private:
   
   const char *implVisitBinaryAtomic(CallInst& I, ISD::NodeType Op);
   const char *implVisitAluOverflow(CallInst &I, ISD::NodeType Op);
-
-  void setCurDebugLoc(DebugLoc dl) { CurDebugLoc = dl; }
 };
 
 /// AddCatchInfo - Extract the personality and type infos from an eh.selector
index d7d0efcd2929c532bcc5e347fa01a86f734c5b1a..7343b838b1e6ea1a1d671d502f2cf407471d9294 100644 (file)
@@ -824,6 +824,7 @@ void SelectionDAGISel::SelectAllBasicBlocks(Function &Fn,
               R = FuncInfo->CreateRegForValue(BI);
           }
 
+          SDL->setCurDebugLoc(FastIS->getCurDebugLoc());
           SelectBasicBlock(LLVMBB, BI, next(BI));
           // If the instruction was codegen'd with multiple blocks,
           // inform the FastISel object where to resume inserting.
@@ -850,8 +851,12 @@ void SelectionDAGISel::SelectAllBasicBlocks(Function &Fn,
     // Run SelectionDAG instruction selection on the remainder of the block
     // not handled by FastISel. If FastISel is not run, this is the entire
     // block.
-    if (BI != End)
+    if (BI != End) {
+      // If FastISel is run and it has known DebugLoc then use it.
+      if (FastIS && !FastIS->getCurDebugLoc().isUnknown())
+        SDL->setCurDebugLoc(FastIS->getCurDebugLoc());
       SelectBasicBlock(LLVMBB, BI, End);
+    }
 
     FinishBasicBlock();
   }