summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2005-05-13 23:14:17 +0000
committerChris Lattner <sabre@nondot.org>2005-05-13 23:14:17 +0000
commitcbefe72fb280e298f79745c3be041957762b1cea (patch)
treeed9b90a3816bc0f8cca372343afd534aa42ac600 /llvm/lib/CodeGen
parent77b220f3d5afba1bdd6c36c391ae286d5b48abf2 (diff)
downloadbcm5719-llvm-cbefe72fb280e298f79745c3be041957762b1cea.tar.gz
bcm5719-llvm-cbefe72fb280e298f79745c3be041957762b1cea.zip
Align doubles on 8-byte boundaries if possible.
llvm-svn: 21993
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
index e088845daa8..d2cde348960 100644
--- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
@@ -140,6 +140,15 @@ FunctionLoweringInfo::FunctionLoweringInfo(TargetLowering &tli,
const Type *Ty = AI->getAllocatedType();
uint64_t TySize = TLI.getTargetData().getTypeSize(Ty);
unsigned Align = TLI.getTargetData().getTypeAlignment(Ty);
+
+ // If the alignment of the value is smaller than the size of the value,
+ // and if the size of the value is particularly small (<= 8 bytes),
+ // round up to the size of the value for potentially better performance.
+ //
+ // FIXME: This could be made better with a preferred alignment hook in
+ // TargetData. It serves primarily to 8-byte align doubles for X86.
+ if (Align < TySize && TySize <= 8) Align = TySize;
+
TySize *= CUI->getValue(); // Get total allocated size.
StaticAllocaMap[AI] =
MF.getFrameInfo()->CreateStackObject((unsigned)TySize, Align);
OpenPOWER on IntegriCloud