r216297 - DebugInfo: for loop backedge should be attributed to the start of the for statement.

David Blaikie dblaikie at gmail.com
Fri Aug 22 15:25:37 PDT 2014


Author: dblaikie
Date: Fri Aug 22 17:25:37 2014
New Revision: 216297

URL: http://llvm.org/viewvc/llvm-project?rev=216297&view=rev
Log:
DebugInfo: for loop backedge should be attributed to the start of the for statement.

Similar to r215768 (which fixed the same case for while loops). To quote
r215768's commit message:

"A little test case simplification - this could be simplified further,
though there are certainly interesting connections to the if/else
construct so I'm hesitant to remove that entirely though it does appear
somewhat unrelated.

(similar fix to r215766, related to PR19864)"

Modified:
    cfe/trunk/lib/CodeGen/CGStmt.cpp
    cfe/trunk/test/CodeGenCXX/debug-info-line-if.cpp

Modified: cfe/trunk/lib/CodeGen/CGStmt.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGStmt.cpp?rev=216297&r1=216296&r2=216297&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGStmt.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGStmt.cpp Fri Aug 22 17:25:37 2014
@@ -894,6 +894,8 @@ void CodeGenFunction::EmitForStmt(const
   BreakContinueStack.pop_back();
 
   ConditionScope.ForceCleanup();
+
+  EmitStopPoint(&S);
   EmitBranch(CondBlock);
 
   ForScope.ForceCleanup();

Modified: cfe/trunk/test/CodeGenCXX/debug-info-line-if.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/debug-info-line-if.cpp?rev=216297&r1=216296&r2=216297&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenCXX/debug-info-line-if.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/debug-info-line-if.cpp Fri Aug 22 17:25:37 2014
@@ -26,6 +26,18 @@ int main() {
 
   // CHECK: br label
   // CHECK: br label {{.*}}, !dbg [[DBG2:!.*]]
+
+#line 300
+  for (; a; )
+    if (b)
+      ++b; // CHECK: add nsw{{.*}}, 1
+    else
+      ++a; // CHECK: add nsw{{.*}}, 1
+
+  // CHECK: br label
+  // CHECK: br label {{.*}}, !dbg [[DBG3:!.*]]
+
   // CHECK: [[DBG1]] = metadata !{i32 100, i32 0, metadata !{{.*}}, null}
   // CHECK: [[DBG2]] = metadata !{i32 200, i32 0, metadata !{{.*}}, null}
+  // CHECK: [[DBG3]] = metadata !{i32 300, i32 0, metadata !{{.*}}, null}
 }





More information about the cfe-commits mailing list