<html><head><meta http-equiv="Content-Type" content="text/html charset=windows-1252"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div><br></div>There are some discussions in thread<div>Re: [llvm-commits] [llvm] r169197 - in /llvm/trunk: include/llvm/CodeGen/MachineFrameInfo.h include/llvm/Target/TargetFrameLowering.h lib/CodeGen/MachineFunction.cpp test/CodeGen/ARM/alloc-no-stack-realign.ll</div><div><br></div><div><br></div><div><div><blockquote type="cite" style="font-size: 12px; margin: 0px;"><blockquote type="cite" style="margin: 0px; border-left-color: rgb(0, 99, 18); color: rgb(0, 99, 18);">When creating stack object, we use Align<br>Align = std::max((unsigned)TLI.getDataLayout()->getPrefTypeAlignment(Ty),<br>                 AI->getAlignment());<br>The preferred alignment may be too big for the target, and it makes sense to give a warning instead of a fatal error.<br></blockquote><br>If we can't realign the stack, we should print an error if<br>AI->getAlignment() is too large and simply ignore the return of<br>getPrefTypeAlignment if it's too large.<br></blockquote><br style="font-size: 12px;"><span style="font-size: 12px;">This means going through the call sites of these functions CreateStackObject … and checking the alignment there instead of</span><br style="font-size: 12px;"><span style="font-size: 12px;">wrapping it up in these functions.</span><br style="font-size: 12px;"><br style="font-size: 12px;"><span style="font-size: 12px;">Another option is to pass in an extra argument for the minimal alignment that must be satisfied.</span></div><div><span style="font-size: 12px;"><br></span></div><div><span style="font-size: 12px;">//////////////////////////////////////////////</span></div><div>--> I will pass an extra argument for the minimal alignment and will use emitError if the minimal alignment can't be satisfied and</div><div>will ignore the case where getPrefTypeAlignment is too large.</div><div>--> If that does not sound right, please let me know,</div><div><br></div><div>Thanks,</div><div>Manman</div><div><span style="font-size: 12px;"><br></span></div><div><div>On Dec 18, 2012, at 11:15 AM, Chris Lattner <<a href="mailto:clattner@apple.com">clattner@apple.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><br>On Dec 18, 2012, at 11:06 AM, Bob Wilson <<a href="mailto:bob.wilson@apple.com">bob.wilson@apple.com</a>> wrote:<br><br><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><br>Hi Manman,<br><br>Could you move the functions from MachineFrameInfo.h first and then add the clamping code? Also, the debug output you emit should be within 'DEBUG()' macro. Like this:<br></blockquote>Hi Bill,<br>Sure, I will submit it as two patches and guard with DEBUG.<br><blockquote type="cite"><br><span class="Apple-tab-span" style="white-space:pre">       </span>DEBUG(dbgs() << "Warning: requested alignment " << Align<br><span class="Apple-tab-span" style="white-space:pre">    </span>         << " exceeds the stack alignment " << StackAlign<br><span class="Apple-tab-span" style="white-space:pre">   </span>         << " when stack realignment is off\n");<br><br>Or better yet make it an 'assert' if you don't expect this situation to ever occur:<br></blockquote>This can actually happen if the user specified a large alignment or the data type has a large alignment.<br></blockquote><br>In that case, using DEBUG is absolutely the wrong thing.  The warning won't be produced in a compiler built without debugging.  Is there any way you could detect this in the front-end and produce a proper diagnostic?  (I haven't thought about that and haven't looked at the code, so forgive me if that's a stupid idea.)  Otherwise, you just have to print out the warning to "errs()".  In the long term, we need to figure out how to let the optimizer and code-gen produce real diagnostics (tracked at Apple in <<a href="rdar://problem/12867368">rdar://problem/12867368</a>>).<br></blockquote><br>Backend errors like this should be reported with LLVMContext::emitError.</blockquote></div><div><blockquote type="cite"><br>-Chris</blockquote></div><br></div></body></html>