[llvm-commits] [llvm] r56937 - in /llvm/trunk: include/llvm/Target/TargetOptions.h lib/CodeGen/LLVMTargetMachine.cpp lib/CodeGen/LoopAligner.cpp lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp lib/Target/TargetMachine.cpp lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp lib/Target/X86/AsmPrinter/X86IntelAsmPrinter.cpp lib/Target/X86/X86ISelDAGToDAG.cpp test/CodeGen/X86/vec_shuffle-23.ll test/CodeGen/X86/vec_shuffle-24.ll

Chris Lattner clattner at apple.com
Mon Oct 6 10:36:23 PDT 2008


On Oct 6, 2008, at 10:31 AM, Devang Patel wrote:
>> On Oct 1, 2008, at 4:18 PM, Devang Patel wrote:
>>> URL: http://llvm.org/viewvc/llvm-project?rev=56937&view=rev
>>> Log:
>>> Remove OptimizeForSize global. Use function attribute optsize.
>>
>> Cool.
>>> =
>>> =
>>> =
>>> =
>>> =
>>> =
>>> =
>>> =
>>> =
>>> =
>>> ====================================================================
>>> --- llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp (original)
>>> +++ llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp Wed Oct  1  
>>> 18:18:38 2008
>>> @@ -137,7 +137,7 @@
>>>       ContainsFPCode(false), TM(tm),
>>>       X86Lowering(*TM.getTargetLowering()),
>>>       Subtarget(&TM.getSubtarget<X86Subtarget>()),
>>> -        OptForSize(OptimizeForSize) {}
>>> +        OptForSize(false) {}
>>
>> Is OptForSize dead now?  Please remove it.
>
> Yes, OptForSize is used by X86 instrction selector for SelectionDAG.

Aha, I see, thanks Devang.  Isn't this a bug though?

void X86DAGToDAGISel::InstructionSelect() {
   CurBB = BB;  // BB can change as result of isel.
   if (!OptForSize) {
     const Function *F = CurDAG->getMachineFunction().getFunction();
     OptForSize = !F->isDeclaration() &&
                  F->hasFnAttr(Attribute::OptimizeForSize);
   }


If you have two functions in a module and the first one is marked opt- 
for-size, they will both be optimized for size.  Plus the declaration  
check is dead.  I'd go with unconditional code:

const Function *F = CurDAG->getMachineFunction().getFunction();
OptForSize = F->hasFnAttr(Attribute::OptimizeForSize);

-Chris



More information about the llvm-commits mailing list