[llvm-commits] [PATCH] Stack Alignment: clamp the alignment of stack objects in MachineFrameInfo

Chris Lattner clattner at apple.com
Tue Dec 18 11:15:07 PST 2012


On Dec 18, 2012, at 11:06 AM, Bob Wilson <bob.wilson at apple.com> wrote:

>>> 
>>> Hi Manman,
>>> 
>>> 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:
>> Hi Bill,
>> Sure, I will submit it as two patches and guard with DEBUG.
>>> 
>>> 	DEBUG(dbgs() << "Warning: requested alignment " << Align
>>> 	         << " exceeds the stack alignment " << StackAlign
>>> 	         << " when stack realignment is off\n");
>>> 
>>> Or better yet make it an 'assert' if you don't expect this situation to ever occur:
>> This can actually happen if the user specified a large alignment or the data type has a large alignment.
> 
> 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 <rdar://problem/12867368>).

Backend errors like this should be reported with LLVMContext::emitError.

-Chris



More information about the llvm-commits mailing list