Preserve debug info during iSel by keeping DanglingDebugInfoMap live until end of...
authorDevang Patel <dpatel@apple.com>
Mon, 23 May 2011 17:44:13 +0000 (17:44 +0000)
committerDevang Patel <dpatel@apple.com>
Mon, 23 May 2011 17:44:13 +0000 (17:44 +0000)
Patch by Micah Villmow

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@131908 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
lib/CodeGen/SelectionDAG/SelectionDAGBuilder.h
lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp

index 5177c9b2eaa8b62514c277f0ae7a78d6b24379b9..8edbdf07cce87a25f05a39e44f293daf6aae5c98 100644 (file)
@@ -783,11 +783,20 @@ void SelectionDAGBuilder::clear() {
   UnusedArgNodeMap.clear();
   PendingLoads.clear();
   PendingExports.clear();
-  DanglingDebugInfoMap.clear();
   CurDebugLoc = DebugLoc();
   HasTailCall = false;
 }
 
+/// clearDanglingDebugInfo - Clear the dangling debug information
+/// map. This function is seperated from the clear so that debug
+/// information that is dangling in a basic block can be properly
+/// resolved in a different basic block. This allows the
+/// SelectionDAG to resolve dangling debug information attached
+/// to PHI nodes.
+void SelectionDAGBuilder::clearDanglingDebugInfo() {
+  DanglingDebugInfoMap.clear();
+}
+
 /// getRoot - Return the current virtual root of the Selection DAG,
 /// flushing any PendingLoad items. This must be done before emitting
 /// a store or any other node that may need to be ordered after any
index a689b76cdc88e4d361563dd58df0ac3da6f5015b..8376d41e153181621ed0b80ff88260fc3ef0b668 100644 (file)
@@ -332,6 +332,14 @@ public:
   /// consumed.
   void clear();
 
+  /// clearDanglingDebugInfo - Clear the dangling debug information
+  /// map. This function is seperated from the clear so that debug
+  /// information that is dangling in a basic block can be properly
+  /// resolved in a different basic block. This allows the
+  /// SelectionDAG to resolve dangling debug information attached
+  /// to PHI nodes.
+  void clearDanglingDebugInfo();
+
   /// getRoot - Return the current virtual root of the Selection DAG,
   /// flushing any PendingLoad items. This must be done before emitting
   /// a store or any other node that may need to be ordered after any
index f24eb4029214d53af600b479b75b2a030d8f07c7..884bdfb156ddb6b8bacb2657bd7ed9e5d7941a98 100644 (file)
@@ -1019,6 +1019,7 @@ void SelectionDAGISel::SelectAllBasicBlocks(const Function &Fn) {
        MBI != MBE; ++MBI)
     CheckLineNumbers(MBI);
 #endif
+  SDB->clearDanglingDebugInfo();
 }
 
 void