[llvm-commits] [llvm] r40004 - in /llvm/trunk: lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp test/CodeGen/X86/alloca-align-rounding.ll
Dan Gohman
djg at cray.com
Wed Jul 18 09:29:49 PDT 2007
Author: djg
Date: Wed Jul 18 11:29:46 2007
New Revision: 40004
URL: http://llvm.org/viewvc/llvm-project?rev=40004&view=rev
Log:
It's not necessary to do rounding for alloca operations when the requested
alignment is equal to the stack alignment.
Added:
llvm/trunk/test/CodeGen/X86/alloca-align-rounding.ll
Modified:
llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp?rev=40004&r1=40003&r2=40004&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Wed Jul 18 11:29:46 2007
@@ -2327,13 +2327,13 @@
AllocSize = DAG.getNode(ISD::MUL, IntPtr, AllocSize,
getIntPtrConstant(TySize));
- // Handle alignment. If the requested alignment is less than or equal to the
- // stack alignment, ignore it and round the size of the allocation up to the
- // stack alignment size. If the size is greater than the stack alignment, we
- // note this in the DYNAMIC_STACKALLOC node.
+ // Handle alignment. If the requested alignment is less than the stack
+ // alignment, ignore it and round the size of the allocation up to the stack
+ // alignment size. If the size is greater than or equal to the stack
+ // alignment, we note this in the DYNAMIC_STACKALLOC node.
unsigned StackAlign =
TLI.getTargetMachine().getFrameInfo()->getStackAlignment();
- if (Align <= StackAlign) {
+ if (Align < StackAlign) {
Align = 0;
// Add SA-1 to the size.
AllocSize = DAG.getNode(ISD::ADD, AllocSize.getValueType(), AllocSize,
Added: llvm/trunk/test/CodeGen/X86/alloca-align-rounding.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/alloca-align-rounding.ll?rev=40004&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/X86/alloca-align-rounding.ll (added)
+++ llvm/trunk/test/CodeGen/X86/alloca-align-rounding.ll Wed Jul 18 11:29:46 2007
@@ -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
+}
More information about the llvm-commits
mailing list