llvm.org GIT mirror llvm / 4ae641f
Remove OptimizeForSize global. Use function attribute optsize. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56937 91177308-0d34-0410-b5e6-96231b3b80d8 Devang Patel 12 years ago
10 changed file(s) with 26 addition(s) and 16 deletion(s). Raw diff Collapse all Expand all
8282 /// optimization (pop the caller's stack) providing it supports it.
8383 extern bool PerformTailCallOpt;
8484
85 /// OptimizeForSize - When this flag is set, the code generator avoids
86 /// optimizations that increase size.
87 extern bool OptimizeForSize;
88
8985 /// StackAlignment - Override default stack alignment for target.
9086 extern unsigned StackAlignment;
9187
8080 if (addPreEmitPass(PM, Fast) && PrintMachineCode)
8181 PM.add(createMachineFunctionPrinterPass(cerr));
8282
83 if (!Fast && !OptimizeForSize)
83 if (!Fast)
8484 PM.add(createLoopAlignerPass());
8585
8686 switch (FileType) {
5757 if (!Align)
5858 return false; // Don't care about loop alignment.
5959
60 const Function *F = MF.getFunction();
61 if (!F->isDeclaration() && F->hasFnAttr(Attribute::OptimizeForSize))
62 return false;
63
6064 for (MachineFunction::iterator I = MF.begin(), E = MF.end(); I != E; ++I) {
6165 MachineBasicBlock *MBB = I;
6266 if (MLI->isLoopHeader(MBB))
775775
776776 printVisibility(CurrentFnName, F->getVisibility());
777777
778 EmitAlignment(OptimizeForSize ? 2 : 4, F);
778 EmitAlignment(F->hasFnAttr(Attribute::OptimizeForSize) ? 2 : 4, F);
779779 O << CurrentFnName << ":\n";
780780
781781 // Emit pre-function debug information.
3434 Reloc::Model RelocationModel;
3535 CodeModel::Model CMModel;
3636 bool PerformTailCallOpt;
37 bool OptimizeForSize;
3837 unsigned StackAlignment;
3938 bool RealignStack;
4039 bool VerboseAsm;
133132 cl::desc("Turn on tail call optimization."),
134133 cl::location(PerformTailCallOpt),
135134 cl::init(false));
136 static cl::opt
137 EnableOptimizeForSize("optimize-size",
138 cl::desc("Optimize for size."),
139 cl::location(OptimizeForSize),
140 cl::init(false));
141135
142136 static cl::opt
143137 OverrideStackAlignment("stack-alignment",
152152
153153 SwitchToSection(TAI->SectionForGlobal(F));
154154
155 unsigned FnAlign = OptimizeForSize ? 1 : 4;
155 unsigned FnAlign = 4;
156156 if (!F->isDeclaration() && F->hasFnAttr(Attribute::OptimizeForSize))
157157 FnAlign = 1;
158158 switch (F->getLinkage()) {
139139
140140 SwitchToTextSection("_text", F);
141141
142 unsigned FnAlign = OptimizeForSize ? 1 : 4;
142 unsigned FnAlign = 4;
143143 if (!F->isDeclaration() && F->hasFnAttr(Attribute::OptimizeForSize))
144144 FnAlign = 1;
145145 switch (F->getLinkage()) {
136136 ContainsFPCode(false), TM(tm),
137137 X86Lowering(*TM.getTargetLowering()),
138138 Subtarget(&TM.getSubtarget()),
139 OptForSize(OptimizeForSize) {}
139 OptForSize(false) {}
140140
141141 virtual const char *getPassName() const {
142142 return "X86 DAG->DAG Instruction Selection";
0 ; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse2 | not grep punpck
11 ; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse2 | grep pshufd
2 ; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse2 -optimize-size | grep punpck
32
43 define i32 @t() nounwind {
54 entry:
0 ; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse2 | grep punpck
1
2 define i32 @t() nounwind optsize {
3 entry:
4 %a = alloca <4 x i32> ; <<4 x i32>*> [#uses=2]
5 %b = alloca <4 x i32> ; <<4 x i32>*> [#uses=5]
6 volatile store <4 x i32> < i32 0, i32 1, i32 2, i32 3 >, <4 x i32>* %a
7 %tmp = load <4 x i32>* %a ; <<4 x i32>> [#uses=1]
8 store <4 x i32> %tmp, <4 x i32>* %b
9 %tmp1 = load <4 x i32>* %b ; <<4 x i32>> [#uses=1]
10 %tmp2 = load <4 x i32>* %b ; <<4 x i32>> [#uses=1]
11 %punpckldq = shufflevector <4 x i32> %tmp1, <4 x i32> %tmp2, <4 x i32> < i32 0, i32 4, i32 1, i32 5 > ; <<4 x i32>> [#uses=1]
12 store <4 x i32> %punpckldq, <4 x i32>* %b
13 %tmp3 = load <4 x i32>* %b ; <<4 x i32>> [#uses=1]
14 %result = extractelement <4 x i32> %tmp3, i32 0 ; [#uses=1]
15 ret i32 %result
16 }