[llvm-commits] [llvm] r172027 - in /llvm/trunk: include/llvm/CodeGen/MachineFrameInfo.h lib/CodeGen/MachineFunction.cpp lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp test/CodeGen/ARM/alloc-no-stack-realign-error.ll test/CodeGen/ARM/alloc-no-stack-realign.ll
Bob Wilson
bob.wilson at apple.com
Mon Jan 14 10:39:20 PST 2013
On Jan 9, 2013, at 5:10 PM, Manman Ren <mren at apple.com> wrote:
> Author: mren
> Date: Wed Jan 9 19:10:10 2013
> New Revision: 172027
>
> URL: http://llvm.org/viewvc/llvm-project?rev=172027&view=rev
> Log:
> Stack Alignment: throw error if we can't satisfy the minimal alignment
> requirement when creating stack objects in MachineFrameInfo.
>
> Add CreateStackObjectWithMinAlign to throw error when the minimal alignment
> can't be achieved and to clamp the alignment when the preferred alignment
> can't be achieved. Same is true for CreateVariableSizedObject.
> Will not emit error in CreateSpillStackObject or CreateStackObject.
>
> As long as callers of CreateStackObject do not assume the object will be
> aligned at the requested alignment, we should not have miscompile since
> later optimizations which look at the object's alignment will have the correct
> information.
>
> rdar://12713765
>
>
> Modified: llvm/trunk/lib/CodeGen/MachineFunction.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineFunction.cpp?rev=172027&r1=172026&r2=172027&view=diff
> ==============================================================================
> --- llvm/trunk/lib/CodeGen/MachineFunction.cpp (original)
> +++ llvm/trunk/lib/CodeGen/MachineFunction.cpp Wed Jan 9 19:10:10 2013
> @@ -473,24 +473,32 @@
> }
>
> /// clampStackAlignment - Clamp the alignment if requested and emit a warning.
> -static inline unsigned clampStackAlignment(bool ShouldClamp, unsigned Align,
> - unsigned StackAlign) {
> - if (!ShouldClamp || Align <= StackAlign)
> - return Align;
> - DEBUG(dbgs() << "Warning: requested alignment " << Align
> - << " exceeds the stack alignment " << StackAlign
> - << " when stack realignment is off" << '\n');
> +static inline unsigned clampStackAlignment(bool ShouldClamp, unsigned PrefAlign,
> + unsigned MinAlign, unsigned StackAlign,
> + const AllocaInst *Alloca = 0) {
> + if (!ShouldClamp || PrefAlign <= StackAlign)
> + return PrefAlign;
> + if (Alloca && MinAlign > StackAlign)
> + Alloca->getParent()->getContext().emitError(Alloca,
> + "Requested Minimal Alignment exceeds the Stack Alignment!");
> + else
> + assert(MinAlign <= StackAlign &&
> + "Requested Minimal Alignment exceeds the Stack Alignment!");
> return StackAlign;
> }
We don't usually capitalize diagnostic messages like that. Please change the message to be all lowercase. I think you could also drop the "minimal".
More information about the llvm-commits
mailing list