<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 14 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","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.MsoAcetate, li.MsoAcetate, div.MsoAcetate
        {mso-style-priority:99;
        mso-style-link:"Balloon Text Char";
        margin:0in;
        margin-bottom:.0001pt;
        font-size:8.0pt;
        font-family:"Tahoma","sans-serif";}
span.gmailmsg
        {mso-style-name:gmail_msg;}
span.BalloonTextChar
        {mso-style-name:"Balloon Text Char";
        mso-style-priority:99;
        mso-style-link:"Balloon Text";
        font-family:"Tahoma","sans-serif";}
span.EmailStyle20
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.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"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">I hadn't thought Clang wanted to be *quite* so knowledgeable about targets, and similarly not so tightly tied to byte-addressable targets.  But if both of those
 things are actually okay, then it's fine to set the alignment value here to what would be passed through to DWARF.<o:p></o:p></span></p>
<p class="MsoNormal"><a name="_MailEndCompose"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">--paulr<o:p></o:p></span></a></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<div style="border:none;border-left:solid blue 1.5pt;padding:0in 0in 0in 4.0pt">
<div>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">From:</span></b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif""> David Blaikie [mailto:dblaikie@gmail.com]
<br>
<b>Sent:</b> Monday, September 12, 2016 6:11 PM<br>
<b>To:</b> Robinson, Paul; reviews+D24426+public+6ee6274d38fdf0d6@reviews.llvm.org; vleschuk@accesssoftek.com; echristo@gmail.com; aprantl@apple.com; mehdi.amini@apple.com<br>
<b>Cc:</b> cfe-commits (cfe-commits@lists.llvm.org)<br>
<b>Subject:</b> Re: [PATCH] D24426: DebugInfo: Pass non-zero alignment to DIBuilder only if aligment was forced<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt"><o:p> </o:p></p>
<div>
<div>
<p class="MsoNormal">On Mon, Sep 12, 2016 at 6:01 PM Robinson, Paul <<a href="mailto:paul.robinson@sony.com">paul.robinson@sony.com</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">
<div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><a name="m_-8606035682448503423__MailEndCompose"><span class="gmailmsg"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">The text in the committee
 draft is different (e.g., the exhortation about non-default alignment is gone), with an example to the effect that a value of 8 means the entity's address is a multiple of 8 (not 2^8).  So, alignment is conceived in terms of address bits, whatever those represent
 (not always bytes). </span></span></a><o:p></o:p></p>
</div>
</div>
</blockquote>
<div>
<p class="MsoNormal">Not sure I quite follow. OK, so in an octet addressable world (which LLVM is - there have been some attempts to support non-octet addressing, but I don't think any have been near to successful) then DW_AT_alignment is byte alignment (1
 means there are no zero bits in the address, 2 means there's 1 trailing zero bit in the address, etc).<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">
<div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span class="gmailmsg"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">If Clang is being infested with more target knowledge, okay, but that means
 tolerating the weirder targets in these cases.  Dividing by CHAR_BITS makes an assumption that isn't necessarily correct.</span></span><o:p></o:p></p>
</div>
</div>
</blockquote>
<div>
<p class="MsoNormal">Clang has the knowledge already - it knows the alignment of the types its allocating, etc. So I'm not sure what infestation you're referring to.<br>
<br>
I've sort of lost track of what we're discussing here.<br>
<br>
Essentially what I'm suggesting is that Clang should put whatever number is going to go in the DWARF, into the metadata. I don't believe the LLVM backends have greater knowledge than the frontend does in this domain - have I missed something there, are there
 examples where that could/would be true?<br>
<br>
- David<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> <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">
<div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span class="gmailmsg"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">--paulr</span></span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span class="gmailmsg"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">P.S. The committee is hoping to get a draft out for public comment Real Soon
 Now.</span></span><o:p></o:p></p>
</div>
</div>
</blockquote>
<div>
<p class="MsoNormal">Looking forward to it :) <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">
<div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span class="gmailmsg"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"> </span></span><o:p></o:p></p>
<div style="border:none;border-left:solid blue 1.5pt;padding:0in 0in 0in 4.0pt">
<div>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span class="gmailmsg"><b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">From:</span></b></span><span class="gmailmsg"><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">
 cfe-commits [mailto:<a href="mailto:cfe-commits-bounces@lists.llvm.org" target="_blank">cfe-commits-bounces@lists.llvm.org</a>]
<b>On Behalf Of </b>David Blaikie via cfe-commits</span></span><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif""><br>
<span class="gmailmsg"><b>Sent:</b> Monday, September 12, 2016 5:12 PM</span><br>
<span class="gmailmsg"><b>To:</b> <a href="mailto:reviews%2BD24426%2Bpublic%2B6ee6274d38fdf0d6@reviews.llvm.org" target="_blank">
reviews+D24426+public+6ee6274d38fdf0d6@reviews.llvm.org</a>; <a href="mailto:vleschuk@accesssoftek.com" target="_blank">
vleschuk@accesssoftek.com</a>; <a href="mailto:echristo@gmail.com" target="_blank">
echristo@gmail.com</a>; <a href="mailto:aprantl@apple.com" target="_blank">aprantl@apple.com</a>;
<a href="mailto:mehdi.amini@apple.com" target="_blank">mehdi.amini@apple.com</a></span><br>
<span class="gmailmsg"><b>Cc:</b> <a href="mailto:cfe-commits@lists.llvm.org" target="_blank">
cfe-commits@lists.llvm.org</a></span><br>
<span class="gmailmsg"><b>Subject:</b> Re: [PATCH] D24426: DebugInfo: Pass non-zero alignment to DIBuilder only if aligment was forced</span></span><o:p></o:p></p>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div style="border:none;border-left:solid blue 1.5pt;padding:0in 0in 0in 4.0pt">
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"> <o:p></o:p></p>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;margin-bottom:12.0pt"> <o:p></o:p></p>
<div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">On Mon, Sep 12, 2016 at 5:00 PM Paul Robinson <<a href="mailto:paul.robinson@sony.com" target="_blank">paul.robinson@sony.com</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-top:5.0pt;margin-right:0in;margin-bottom:5.0pt">
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">probinson added a subscriber: probinson.<br>
<br>
================<br>
Comment at: lib/CodeGen/CGDebugInfo.cpp:3691<br>
@@ -3635,1 +3690,3 @@<br>
+  if (D->hasAttr<AlignedAttr>())<br>
+    AlignInBits = D->getMaxAlignment();<br>
   StringRef DeclName, LinkageName;<br>
----------------<br>
dblaikie wrote:<br>
> is max alignment the right thing here? Should it be min alignment?<br>
> (is alignment in bits the desired thing across all of this too? It looked like in the backend patch there was some division by CHAR_BITS, etc?)<br>
I should think bits is the right choice here; seems more the province of the backend to convert it into the appropriate addressable units (commonly but not universally chars).<o:p></o:p></p>
</blockquote>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><br>
The alternative thinking is that we've a generally sense we want to make more of this type information opaque to LLVM - so I'm somewhat inclined to make the frontend do the work of choosing what to emit and the backend just being as simple as possible.<br>
<br>
Hmm, seems like the DWARF spec details I can find: <a href="http://www.dwarfstd.org/ShowIssue.php?issue=140528.1" target="_blank">http://www.dwarfstd.org/ShowIssue.php?issue=140528.1</a> don't really specify what the value of DW_AT_alignment is, it's sort of
 assumed, by the looks of it? I'm assuming it's bytes, the same as the byte_size attribute.<br>
<br>
<br>
 <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-top:5.0pt;margin-right:0in;margin-bottom:5.0pt">
<p class="MsoNormal" style="mso-margin-top-alt:auto;margin-bottom:12.0pt"><br>
<br>
<a href="https://reviews.llvm.org/D24426" target="_blank">https://reviews.llvm.org/D24426</a><br>
<br>
<o:p></o:p></p>
</blockquote>
</div>
</div>
</div>
</div>
</div>
</blockquote>
</div>
</div>
</div>
</div>
</body>
</html>