<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Oct 30, 2017 at 5:39 PM, Adrian Prantl <span dir="ltr"><<a href="mailto:aprantl@apple.com" target="_blank">aprantl@apple.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div style="word-wrap:break-word"><br><div><div><div class="gmail-h5"><br><blockquote type="cite"><div>On Oct 30, 2017, at 2:25 PM, Francois Pichet <<a href="mailto:pichet2000@gmail.com" target="_blank">pichet2000@gmail.com</a>> wrote:</div><br class="gmail-m_-3995178823218292809Apple-interchange-newline"><div><br class="gmail-m_-3995178823218292809Apple-interchange-newline"><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><div class="gmail_quote" style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">On Mon, Oct 30, 2017 at 5:15 PM, Adrian Prantl<span class="gmail-m_-3995178823218292809Apple-converted-space"> </span><span dir="ltr"><<a href="mailto:aprantl@apple.com" target="_blank">aprantl@apple.com</a>></span><span class="gmail-m_-3995178823218292809Apple-converted-space"> </span>wro<wbr>te:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div style="word-wrap:break-word"><div><div class="gmail-m_-3995178823218292809m_3515076279766131425gmail-h5"><br><div><br><blockquote type="cite"><div>On Oct 30, 2017, at 2:12 PM, Francois Pichet <<a href="mailto:pichet2000@gmail.com" target="_blank">pichet2000@gmail.com</a>> wrote:</div><br class="gmail-m_-3995178823218292809m_3515076279766131425gmail-m_-7207667922643354705Apple-interchange-newline"><div><br class="gmail-m_-3995178823218292809m_3515076279766131425gmail-m_-7207667922643354705Apple-interchange-newline"><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><div class="gmail_quote" style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">On Wed, Aug 30, 2017 at 4:04 PM, Adrian Prantl via llvm-commits<span class="gmail-m_-3995178823218292809m_3515076279766131425gmail-m_-7207667922643354705Apple-converted-space"> </span><span dir="ltr"><<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lis<wbr>ts.llvm.org</a>></span><span class="gmail-m_-3995178823218292809m_3515076279766131425gmail-m_-7207667922643354705Apple-converted-space"> </span>wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Author: adrian<br>Date: Wed Aug 30 13:04:17 2017<br>New Revision: 312165<br><br>URL:<span class="gmail-m_-3995178823218292809m_3515076279766131425gmail-m_-7207667922643354705Apple-converted-space"> </span><a href="http://llvm.org/viewvc/llvm-project?rev=312165&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/ll<wbr>vm-project?rev=312165&view=rev</a><br>Log:<br>Refactor DIBuilder::createFragmentExpre<wbr>ssion into a static DIExpression member<br><br>NFC<br><br>Modified:<br>   <span class="gmail-m_-3995178823218292809m_3515076279766131425gmail-m_-7207667922643354705Apple-converted-space"> </span>llvm/trunk/include/llvm/IR/D<wbr>IBuilder.h<br>   <span class="gmail-m_-3995178823218292809m_3515076279766131425gmail-m_-7207667922643354705Apple-converted-space"> </span>llvm/trunk/include/llvm/IR/D<wbr>ebugInfoMetadata.h<br>   <span class="gmail-m_-3995178823218292809m_3515076279766131425gmail-m_-7207667922643354705Apple-converted-space"> </span>llvm/trunk/lib/CodeGen/Selec<wbr>tionDAG/LegalizeTypes.cpp<br>   <span class="gmail-m_-3995178823218292809m_3515076279766131425gmail-m_-7207667922643354705Apple-converted-space"> </span>llvm/trunk/lib/IR/DIBuilder.<wbr>cpp<br>   <span class="gmail-m_-3995178823218292809m_3515076279766131425gmail-m_-7207667922643354705Apple-converted-space"> </span>llvm/trunk/lib/IR/DebugInfoM<wbr>etadata.cpp<br>   <span class="gmail-m_-3995178823218292809m_3515076279766131425gmail-m_-7207667922643354705Apple-converted-space"> </span>llvm/trunk/lib/Transforms/IP<wbr>O/GlobalOpt.cpp<br>   <span class="gmail-m_-3995178823218292809m_3515076279766131425gmail-m_-7207667922643354705Apple-converted-space"> </span>llvm/trunk/lib/Transforms/Sc<wbr>alar/SROA.cpp<br><br><br><br>Modified: llvm/trunk/lib/IR/DebugInfoMet<wbr>adata.cpp<br>URL:<span class="gmail-m_-3995178823218292809m_3515076279766131425gmail-m_-7207667922643354705Apple-converted-space"> </span><a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/DebugInfoMetadata.cpp?rev=312165&r1=312164&r2=312165&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/ll<wbr>vm-project/llvm/trunk/lib/IR/D<wbr>ebugInfoMetadata.cpp?rev=31216<wbr>5&r1=312164&r2=312165&view=dif<wbr>f</a><br>==============================<wbr>==============================<wbr>==================<br>--- llvm/trunk/lib/IR/DebugInfoMet<wbr>adata.cpp (original)<br>+++ llvm/trunk/lib/IR/DebugInfoMet<wbr>adata.cpp Wed Aug 30 13:04:17 2017<br>@@ -724,6 +724,34 @@ DIExpression *DIExpression::prepend(cons<br>   return DIExpression::get(Expr->getCon<wbr>text(), Ops);<br> }<br><br>+DIExpression *DIExpression::createFragmentE<wbr>xpression(const DIExpression *Expr,<br>+                                                     unsigned OffsetInBits,<br>+                                                     unsigned SizeInBits) {<br>+  SmallVector<uint64_t, 8> Ops;<br>+  // Copy over the expression, but leave off any trailing DW_OP_LLVM_fragment.<br>+  if (Expr) {<br>+    for (auto Op : Expr->expr_ops()) {<br>+      if (Op.getOp() == dwarf::DW_OP_LLVM_fragment) {<br>+        // Make the new offset point into the existing fragment.<br>+        uint64_t FragmentOffsetInBits = Op.getArg(0);<br>+        // Op.getArg(0) is FragmentOffsetInBits.<br>+        // Op.getArg(1) is FragmentSizeInBits.<br>+        assert((OffsetInBits + SizeInBits <= Op.getArg(0) + Op.getArg(1)) &&<br>+               "new fragment outside of original fragment");<br></blockquote><div><br></div><div><br></div><div> Hi, </div><div><br></div><div>I am getting an assert here on an (out of tree) big-endian target where 64-bit variables are splitted on 2 32-bit variables.</div><div>assert where: OffsetInBits=32, SizeInBits=32 and Expr: !DIExpression(DW_OP_LLVM<wbr>_fragment, 0, 32)</div><div>so 32 + 32 <= 32 is not true.</div><div><br></div><div>I might be wrong but I think the assert is only valid on little endian target?</div></div></div></blockquote><br></div></div></div><div>I'm not sure I understand your example. Are you saying that you are calling createFragmentExpression on something that is already 32-bit fragment? Which pass is calling it? It seems more likely that there is something wrong with the call site.</div><span class="gmail-m_-3995178823218292809m_3515076279766131425gmail-HOEnZb"><font color="#888888"><div><br></div><div>-- adrian</div><div><br></div><br></font></span></div></blockquote><div>DAGTypeLegalizer::SetExpandedI<wbr>nteger is the call site:</div><div><br></div></div></div></blockquote></div></div><div>createFragmentExpression creates a fragment of and existing value at a given offset, and with a given size. If the existing value already is a fragment the offset and size are *within* the existing fragment. The assert verifies this. It should be endianness-neutral. Can you explain why you believe the assertion is wrong for big-endian targets?</div><span class="gmail-"><div><br></div><br><blockquote type="cite"><div><div class="gmail_extra" style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><div class="gmail_extra">  if (DAG.getDataLayout().isBigEndi<wbr>an()) {</div><div class="gmail_extra">    transferDbgValues(DAG, Op, Hi, 0);</div><div class="gmail_extra">    transferDbgValues(DAG, Op, Lo, Hi.getValueSizeInBits());  // <--- assert </div></div></div></blockquote><div><br></div></span><div>This code was added in <a href="https://reviews.llvm.org/D38172" target="_blank">https://reviews.llvm.org/<wbr>D38172</a>. This is splitting the debug info into one part describing the Hi bits (at offset 0) and the Lo bits (at sizeof(Hi)). Since you are seeing the assertion I assume that you have a value that is split twice, is that correct? Can you explain why createFragmentExpression is called with a !DIExpression(DW_OP_LLVM_<wbr>fragment, 0, 32)?</div><div><br></div><div>thanks,</div><div><br></div></div></div></blockquote><div><br></div><div>Hi,</div><div><br></div><div>The problem happen when Op = ISD::build_pair and Lo and Hi already have fragment created by SROA.cpp.</div><div><br></div><div>More detail here: <a href="https://gist.github.com/anonymous/5d72495c77f28269fe3c01715e770e19">https://gist.github.com/anonymous/5d72495c77f28269fe3c01715e770e19</a></div><div><br></div></div>Not sure what the solution is.</div></div>