[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

Devang Patel dpatel at apple.com
Mon Oct 6 10:56:52 PDT 2008


On Oct 6, 2008, at 10:36 AM, Chris Lattner wrote:

>>>> =
>>>> ===================================================================
>>>> --- 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.

Yes, this is a bug.

>  Plus the declaration check is dead.  I'd go with unconditional code:
>
> const Function *F = CurDAG->getMachineFunction().getFunction();
> OptForSize = F->hasFnAttr(Attribute::OptimizeForSize);

Makes sense.

-
Devang






More information about the llvm-commits mailing list