<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
p.msonormal0, li.msonormal0, div.msonormal0
{mso-style-name:msonormal;
mso-margin-top-alt:auto;
margin-right:0in;
mso-margin-bottom-alt:auto;
margin-left:0in;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
span.EmailStyle18
{mso-style-type:personal-reply;
font-family:"Calibri",sans-serif;
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;
font-family:"Calibri",sans-serif;}
@page WordSection1
{size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal">I will simplify the test. Thanks.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Sam<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><b>From:</b> David Blaikie [mailto:dblaikie@gmail.com] <br>
<b>Sent:</b> Monday, October 23, 2017 2:08 PM<br>
<b>To:</b> reviews+D39069+public+8da79e110d30366c@reviews.llvm.org; Yaxun Liu via Phabricator <reviews@reviews.llvm.org>; Liu, Yaxun (Sam) <Yaxun.Liu@amd.com>; rjmccall@gmail.com<br>
<b>Cc:</b> cfe-commits@lists.llvm.org<br>
<b>Subject:</b> Re: [PATCH] D39069: CodeGen: Fix missing debug loc due to alloca<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt">What John said, but also a narrower test would be good - checking that the appropriate call instruction gets a debug location, rather than checking that a bunch of inlining doesn't cause the assertion/verifier
failure, would be good. (Clang tests should, as much as possible, not rely on or run the LLVM optimization passes - but check the IR coming directly from Clang before any of that)<o:p></o:p></p>
<div>
<div>
<p class="MsoNormal">On Wed, Oct 18, 2017 at 2:15 PM Yaxun Liu via Phabricator via cfe-commits <<a href="mailto:cfe-commits@lists.llvm.org">cfe-commits@lists.llvm.org</a>> wrote:<o:p></o:p></p>
</div>
<blockquote style="border:none;border-left:solid #CCCCCC 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-right:0in">
<p class="MsoNormal">yaxunl created this revision.<br>
<br>
Builder save/restores insertion pointer when emitting addr space cast<br>
for alloca, but does not save/restore debug loc, which causes verifier<br>
failure for certain call instructions.<br>
<br>
This patch fixes that.<br>
<br>
<br>
<a href="https://reviews.llvm.org/D39069" target="_blank">https://reviews.llvm.org/D39069</a><br>
<br>
Files:<br>
lib/CodeGen/CGExpr.cpp<br>
test/CodeGenOpenCL/<a href="http://func-call-dbg-loc.cl" target="_blank">func-call-dbg-loc.cl</a><br>
<br>
<br>
Index: test/CodeGenOpenCL/<a href="http://func-call-dbg-loc.cl" target="_blank">func-call-dbg-loc.cl</a><br>
===================================================================<br>
--- /dev/null<br>
+++ test/CodeGenOpenCL/<a href="http://func-call-dbg-loc.cl" target="_blank">func-call-dbg-loc.cl</a><br>
@@ -0,0 +1,34 @@<br>
+// RUN: %clang_cc1 -triple amdgcn---amdgizcl -debug-info-kind=limited -dwarf-version=2 -debugger-tuning=gdb -O0 -emit-llvm -o - %s | FileCheck %s<br>
+// Checks the file compiles without verifier error: inlinable function call in a function with debug info must have a !dbg location.<br>
+<br>
+typedef struct<br>
+{<br>
+ float m_max;<br>
+} Struct;<br>
+<br>
+typedef struct<br>
+{<br>
+ Struct m_volume;<br>
+} Node;<br>
+<br>
+<br>
+Struct buzz(Node node)<br>
+{<br>
+ return node.m_volume;<br>
+}<br>
+<br>
+__attribute__((always_inline))<br>
+float bar(Struct aabb)<br>
+{<br>
+ return 0.0f;<br>
+}<br>
+<br>
+__attribute__((used))<br>
+void foo()<br>
+{<br>
+ Node node;<br>
+ // CHECK: store float 0.000000e+00, float addrspace(5)* %f, align 4, !dbg !{{[0-9]+}}<br>
+ float f = bar(buzz(node));<br>
+}<br>
+<br>
+<br>
Index: lib/CodeGen/CGExpr.cpp<br>
===================================================================<br>
--- lib/CodeGen/CGExpr.cpp<br>
+++ lib/CodeGen/CGExpr.cpp<br>
@@ -75,11 +75,13 @@<br>
if (CastToDefaultAddrSpace && getASTAllocaAddressSpace() != LangAS::Default) {<br>
auto DestAddrSpace = getContext().getTargetAddressSpace(LangAS::Default);<br>
auto CurIP = Builder.saveIP();<br>
+ auto DbgLoc = Builder.getCurrentDebugLocation();<br>
Builder.SetInsertPoint(AllocaInsertPt);<br>
V = getTargetHooks().performAddrSpaceCast(<br>
*this, V, getASTAllocaAddressSpace(), LangAS::Default,<br>
Ty->getPointerTo(DestAddrSpace), /*non-null*/ true);<br>
Builder.restoreIP(CurIP);<br>
+ Builder.SetCurrentDebugLocation(DbgLoc);<br>
}<br>
<br>
return Address(V, Align);<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" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits</a><o:p></o:p></p>
</blockquote>
</div>
</div>
</div>
</body>
</html>