<html><head><meta http-equiv="Content-Type" content="text/html; charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><br class=""><div><br class=""><blockquote type="cite" class=""><div class="">On Oct 30, 2017, at 2:25 PM, Francois Pichet <<a href="mailto:pichet2000@gmail.com" class="">pichet2000@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><br class="Apple-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; -webkit-text-stroke-width: 0px;" class=""><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; -webkit-text-stroke-width: 0px;">On Mon, Oct 30, 2017 at 5:15 PM, Adrian Prantl<span class="Apple-converted-space"> </span><span dir="ltr" class=""><<a href="mailto:aprantl@apple.com" target="_blank" class="">aprantl@apple.com</a>></span><span class="Apple-converted-space"> </span>wrote:<br class=""><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-style: solid; border-left-color: rgb(204, 204, 204); padding-left: 1ex;"><div style="word-wrap: break-word;" class=""><div class=""><div class="m_3515076279766131425gmail-h5"><br class=""><div class=""><br class=""><blockquote type="cite" class=""><div class="">On Oct 30, 2017, at 2:12 PM, Francois Pichet <<a href="mailto:pichet2000@gmail.com" target="_blank" class="">pichet2000@gmail.com</a>> wrote:</div><br class="m_3515076279766131425gmail-m_-7207667922643354705Apple-interchange-newline"><div class=""><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;" class=""><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" class=""><<a href="mailto:llvm-commits@lists.llvm.org" target="_blank" class="">llvm-commits@lis<wbr class="">ts.llvm.org</a>></span><span class="m_3515076279766131425gmail-m_-7207667922643354705Apple-converted-space"> </span>wrote:<br class=""><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-style: solid; border-left-color: rgb(204, 204, 204); padding-left: 1ex;">Author: adrian<br class="">Date: Wed Aug 30 13:04:17 2017<br class="">New Revision: 312165<br class=""><br class="">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" class="">http://llvm.org/viewvc/ll<wbr class="">vm-project?rev=312165&view=rev</a><br class="">Log:<br class="">Refactor DIBuilder::createFragmentExpre<wbr class="">ssion into a static DIExpression member<br class=""><br class="">NFC<br class=""><br class="">Modified:<br class="">   <span class="m_3515076279766131425gmail-m_-7207667922643354705Apple-converted-space"> </span>llvm/trunk/include/llvm/IR/D<wbr class="">IBuilder.h<br class="">   <span class="m_3515076279766131425gmail-m_-7207667922643354705Apple-converted-space"> </span>llvm/trunk/include/llvm/IR/D<wbr class="">ebugInfoMetadata.h<br class="">   <span class="m_3515076279766131425gmail-m_-7207667922643354705Apple-converted-space"> </span>llvm/trunk/lib/CodeGen/Selec<wbr class="">tionDAG/LegalizeTypes.cpp<br class="">   <span class="m_3515076279766131425gmail-m_-7207667922643354705Apple-converted-space"> </span>llvm/trunk/lib/IR/DIBuilder.<wbr class="">cpp<br class="">   <span class="m_3515076279766131425gmail-m_-7207667922643354705Apple-converted-space"> </span>llvm/trunk/lib/IR/DebugInfoM<wbr class="">etadata.cpp<br class="">   <span class="m_3515076279766131425gmail-m_-7207667922643354705Apple-converted-space"> </span>llvm/trunk/lib/Transforms/IP<wbr class="">O/GlobalOpt.cpp<br class="">   <span class="m_3515076279766131425gmail-m_-7207667922643354705Apple-converted-space"> </span>llvm/trunk/lib/Transforms/Sc<wbr class="">alar/SROA.cpp<br class=""><br class=""><br class=""><br class="">Modified: llvm/trunk/lib/IR/DebugInfoMet<wbr class="">adata.cpp<br class="">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" class="">http://llvm.org/viewvc/ll<wbr class="">vm-project/llvm/trunk/lib/IR/<wbr class="">DebugInfoMetadata.cpp?rev=3121<wbr class="">65&r1=312164&r2=312165&view=<wbr class="">diff</a><br class="">==============================<wbr class="">==============================<wbr class="">==================<br class="">--- llvm/trunk/lib/IR/DebugInfoMet<wbr class="">adata.cpp (original)<br class="">+++ llvm/trunk/lib/IR/DebugInfoMet<wbr class="">adata.cpp Wed Aug 30 13:04:17 2017<br class="">@@ -724,6 +724,34 @@ DIExpression *DIExpression::prepend(cons<br class="">   return DIExpression::get(Expr->getCon<wbr class="">text(), Ops);<br class=""> }<br class=""><br class="">+DIExpression *DIExpression::createFragmentE<wbr class="">xpression(const DIExpression *Expr,<br class="">+                                                     unsigned OffsetInBits,<br class="">+                                                     unsigned SizeInBits) {<br class="">+  SmallVector<uint64_t, 8> Ops;<br class="">+  // Copy over the expression, but leave off any trailing DW_OP_LLVM_fragment.<br class="">+  if (Expr) {<br class="">+    for (auto Op : Expr->expr_ops()) {<br class="">+      if (Op.getOp() == dwarf::DW_OP_LLVM_fragment) {<br class="">+        // Make the new offset point into the existing fragment.<br class="">+        uint64_t FragmentOffsetInBits = Op.getArg(0);<br class="">+        // Op.getArg(0) is FragmentOffsetInBits.<br class="">+        // Op.getArg(1) is FragmentSizeInBits.<br class="">+        assert((OffsetInBits + SizeInBits <= Op.getArg(0) + Op.getArg(1)) &&<br class="">+               "new fragment outside of original fragment");<br class=""></blockquote><div class=""><br class=""></div><div class=""><br class=""></div><div class=""> Hi, </div><div class=""><br class=""></div><div class="">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 class="">assert where: OffsetInBits=32, SizeInBits=32 and Expr: !DIExpression(DW_OP_LLVM<wbr class="">_fragment, 0, 32)</div><div class="">so 32 + 32 <= 32 is not true.</div><div class=""><br class=""></div><div class="">I might be wrong but I think the assert is only valid on little endian target?</div></div></div></blockquote><br class=""></div></div></div><div class="">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" class=""><div class=""><br class=""></div><div class="">-- adrian</div><div class=""><br class=""></div><br class=""></font></span></div></blockquote><div class="">DAGTypeLegalizer::<wbr class="">SetExpandedInteger is the call site:</div><div class=""><br class=""></div></div></div></blockquote><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><div class=""><br class=""></div><br class=""><blockquote type="cite" class=""><div class=""><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; -webkit-text-stroke-width: 0px;"><div class="gmail_extra">  if (DAG.getDataLayout().<wbr class="">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></div></blockquote><div><br class=""></div><div>This code was added in <a href="https://reviews.llvm.org/D38172" class="">https://reviews.llvm.org/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_<wbr class="">LLVM_fragment, 0, 32)?</div><div><br class=""></div><div>thanks,</div><div>adrian</div><div><br class=""></div><blockquote type="cite" class=""><div class=""><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; -webkit-text-stroke-width: 0px;"><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"> <span class="Apple-converted-space"> </span>}</div><div class=""><br class=""></div><div class="">The first call to transferDbgValues will create !DIExpression(DW_OP_<wbr class="">LLVM_fragment, 0, 32)</div><div class="">The second call will assert because OffsetInBits= 32 and SizeInBits=32<br class=""></div><div class=""><br class=""></div><div class="">I believe the assert is only valid on little-endian target. </div></div></div></blockquote><br class=""></div><div><br class=""></div></body></html>