<div dir="ltr">Seems like the test case should/could be simplified a bit, maybe? (could it be something really simple like "void f(bool b) { #pragma ... while (b) ; }"?)<br><br>Also, is it relying on LLVM optimizations to run (add "-disable-llvm-passes" to the command line to be sure it isn't, perhaps?)?<br><br><div class="gmail_quote"><div dir="ltr">On Sun, Sep 3, 2017 at 10:35 AM Karl-Johan Karlsson via Phabricator via cfe-commits <<a href="mailto:cfe-commits@lists.llvm.org">cfe-commits@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Ka-Ka created this revision.<br>
Herald added a subscriber: aprantl.<br>
<br>
As no stoppoint was generated the attributed statements got faulty debug locations.<br>
<br>
<br>
<a href="https://reviews.llvm.org/D37428" rel="noreferrer" target="_blank">https://reviews.llvm.org/D37428</a><br>
<br>
Files:<br>
lib/CodeGen/CGStmt.cpp<br>
test/CodeGen/debug-info-attributed-stmt.c<br>
<br>
<br>
Index: test/CodeGen/debug-info-attributed-stmt.c<br>
===================================================================<br>
--- /dev/null<br>
+++ test/CodeGen/debug-info-attributed-stmt.c<br>
@@ -0,0 +1,19 @@<br>
+// RUN: %clang_cc1 -triple x86_64-unk-unk -debug-info-kind=limited -emit-llvm %s -o - | FileCheck %s<br>
+int data[50] = { 0 };<br>
+<br>
+void foo()<br>
+{<br>
+ int i = 0;<br>
+ int x = 7;<br>
+#pragma nounroll<br>
+ while (i < 50)<br>
+ {<br>
+ data[i] = i;<br>
+ ++i;<br>
+ }<br>
+<br>
+// CHECK: br label %while.cond, !dbg ![[NUM:[0-9]+]]<br>
+// CHECK: br i1 %cmp, label %while.body, label %while.end, !dbg ![[NUM]]<br>
+// CHECK: br label %while.cond, !dbg ![[NUM]], !llvm.loop<br>
+// CHECK: ![[NUM]] = !DILocation(line: 9, scope: !14)<br>
+}<br>
Index: lib/CodeGen/CGStmt.cpp<br>
===================================================================<br>
--- lib/CodeGen/CGStmt.cpp<br>
+++ lib/CodeGen/CGStmt.cpp<br>
@@ -556,6 +556,10 @@<br>
<br>
void CodeGenFunction::EmitAttributedStmt(const AttributedStmt &S) {<br>
const Stmt *SubStmt = S.getSubStmt();<br>
+<br>
+ // Generate a stoppoint if we are emitting debug info.<br>
+ EmitStopPoint(SubStmt);<br>
+<br>
switch (SubStmt->getStmtClass()) {<br>
case Stmt::DoStmtClass:<br>
EmitDoStmt(cast<DoStmt>(*SubStmt), S.getAttrs());<br>
<br>
<br>
_______________________________________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@lists.llvm.org" target="_blank">cfe-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits</a><br>
</blockquote></div></div>