mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-01 12:24:24 +00:00
It's not necessary to do rounding for alloca operations when the requested
alignment is equal to the stack alignment. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40004 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -2327,13 +2327,13 @@ void SelectionDAGLowering::visitAlloca(AllocaInst &I) {
|
|||||||
AllocSize = DAG.getNode(ISD::MUL, IntPtr, AllocSize,
|
AllocSize = DAG.getNode(ISD::MUL, IntPtr, AllocSize,
|
||||||
getIntPtrConstant(TySize));
|
getIntPtrConstant(TySize));
|
||||||
|
|
||||||
// Handle alignment. If the requested alignment is less than or equal to the
|
// Handle alignment. If the requested alignment is less than the stack
|
||||||
// stack alignment, ignore it and round the size of the allocation up to the
|
// alignment, ignore it and round the size of the allocation up to the stack
|
||||||
// stack alignment size. If the size is greater than the stack alignment, we
|
// alignment size. If the size is greater than or equal to the stack
|
||||||
// note this in the DYNAMIC_STACKALLOC node.
|
// alignment, we note this in the DYNAMIC_STACKALLOC node.
|
||||||
unsigned StackAlign =
|
unsigned StackAlign =
|
||||||
TLI.getTargetMachine().getFrameInfo()->getStackAlignment();
|
TLI.getTargetMachine().getFrameInfo()->getStackAlignment();
|
||||||
if (Align <= StackAlign) {
|
if (Align < StackAlign) {
|
||||||
Align = 0;
|
Align = 0;
|
||||||
// Add SA-1 to the size.
|
// Add SA-1 to the size.
|
||||||
AllocSize = DAG.getNode(ISD::ADD, AllocSize.getValueType(), AllocSize,
|
AllocSize = DAG.getNode(ISD::ADD, AllocSize.getValueType(), AllocSize,
|
||||||
|
9
test/CodeGen/X86/alloca-align-rounding.ll
Normal file
9
test/CodeGen/X86/alloca-align-rounding.ll
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
; RUN: llvm-as < %s | llc -march=x86-64 | not grep and
|
||||||
|
|
||||||
|
declare void @bar(<2 x i64>* %n)
|
||||||
|
|
||||||
|
define void @foo(i32 %h) {
|
||||||
|
%p = alloca <2 x i64>, i32 %h
|
||||||
|
call void @bar(<2 x i64>* %p)
|
||||||
|
ret void
|
||||||
|
}
|
Reference in New Issue
Block a user