llvm.org GIT mirror llvm / 63b1eba
[SDAG] Use ABI type alignment for constant pools when optimizing for size SelectionDAG::getConstantPool will automatically determine an appropriate alignment if one is not specified. It does this by querying the type's preferred alignment. This can end up creating quite a lot of padding when the preferred alignment for vectors is 128. In optimize-for-size mode, it makes sense to instead query the ABI type alignment which is often smaller and causes less padding. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@284381 91177308-0d34-0410-b5e6-96231b3b80d8 James Molloy 3 years ago
2 changed file(s) with 22 addition(s) and 1 deletion(s). Raw diff Collapse all Expand all
13141314 assert((TargetFlags == 0 || isTarget) &&
13151315 "Cannot set target flags on target-independent globals");
13161316 if (Alignment == 0)
1317 Alignment = getDataLayout().getPrefTypeAlignment(C->getType());
1317 Alignment = MF->getFunction()->optForSize()
1318 ? getDataLayout().getABITypeAlignment(C->getType())
1319 : getDataLayout().getPrefTypeAlignment(C->getType());
13181320 unsigned Opc = isTarget ? ISD::TargetConstantPool : ISD::ConstantPool;
13191321 FoldingSetNodeID ID;
13201322 AddNodeIDNode(ID, Opc, getVTList(VT), None);
0 ; RUN: llc < %s | FileCheck %s
1 target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64"
2 target triple = "thumbv7-arm-none-eabi"
3
4 ; CHECK-LABEL: f:
5 ; CHECK: vld1.64 {{.*}}, [r1:128]
6 ; CHECK: .p2align 4
7 define void @f(<4 x i32>* %p) {
8 store <4 x i32> , <4 x i32>* %p, align 4
9 ret void
10 }
11
12 ; CHECK-LABEL: f_optsize:
13 ; CHECK: vld1.64 {{.*}}, [r1]
14 ; CHECK: .p2align 3
15 define void @f_optsize(<4 x i32>* %p) optsize {
16 store <4 x i32> , <4 x i32>* %p, align 4
17 ret void
18 }