<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Oct 30, 2017 at 5:15 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"><div><div class="m_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="m_3515076279766131425gmail-m_-7207667922643354705Apple-interchange-newline"><div><br class="m_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="m_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="m_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="m_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="m_3515076279766131425gmail-m_-7207667922643354705Apple-converted-space"> </span>llvm/trunk/include/llvm/IR/D<wbr>IBuilder.h<br>   <span class="m_3515076279766131425gmail-m_-7207667922643354705Apple-converted-space"> </span>llvm/trunk/include/llvm/IR/D<wbr>ebugInfoMetadata.h<br>   <span class="m_3515076279766131425gmail-m_-7207667922643354705Apple-converted-space"> </span>llvm/trunk/lib/CodeGen/Selec<wbr>tionDAG/LegalizeTypes.cpp<br>   <span class="m_3515076279766131425gmail-m_-7207667922643354705Apple-converted-space"> </span>llvm/trunk/lib/IR/DIBuilder.<wbr>cpp<br>   <span class="m_3515076279766131425gmail-m_-7207667922643354705Apple-converted-space"> </span>llvm/trunk/lib/IR/DebugInfoM<wbr>etadata.cpp<br>   <span class="m_3515076279766131425gmail-m_-7207667922643354705Apple-converted-space"> </span>llvm/trunk/lib/Transforms/IP<wbr>O/GlobalOpt.cpp<br>   <span class="m_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="m_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/<wbr>DebugInfoMetadata.cpp?rev=3121<wbr>65&r1=312164&r2=312165&view=<wbr>diff</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="m_3515076279766131425gmail-HOEnZb"><font color="#888888"><div><br></div><div>-- adrian</div><div><br></div><br></font></span></div></blockquote><div>DAGTypeLegalizer::<wbr>SetExpandedInteger is the call site:</div><div><br></div></div><div class="gmail_extra"><div class="gmail_extra">  if (DAG.getDataLayout().<wbr>isBigEndian()) {</div><div class="gmail_extra">    transferDbgValues(DAG, Op, Hi, 0);</div><div class="gmail_extra">    transferDbgValues(DAG, Op, Lo, Hi.getValueSizeInBits());  // <--- assert </div><div class="gmail_extra">  } else {</div><div class="gmail_extra">    transferDbgValues(DAG, Op, Lo, 0);</div><div class="gmail_extra">    transferDbgValues(DAG, Op, Hi, Lo.getValueSizeInBits());</div><div class="gmail_extra">  }</div><div><br></div><div>The first call to transferDbgValues will create !DIExpression(DW_OP_<wbr>LLVM_fragment, 0, 32)</div><div>The second call will assert because OffsetInBits= 32 and SizeInBits=32<br></div><div><br></div><div>I believe the assert is only valid on little-endian target. </div></div><div><br></div></div></div>