[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
Sat Oct 4 13:19:10 PDT 2008


On Oct 2, 2008, at 1:37 AM, Duncan Sands wrote:

> Hi Devang,
>
>> +  const Function *F = MF.getFunction();
>> +  if (!F->isDeclaration() && F- 
>> >hasFnAttr(Attribute::OptimizeForSize))
>> +    return false;
>
> why the test !F->isDeclaration()?  Is this because if you declare
> a function F in a file which is being optimized for size, then
> the declaration gets the OptimizeForSize attribute, even though
> the function definition may not (because in another file compiled
> differently)?

No, you guys are overthinking this.  You never have to check for  
isDeclaration() here because you would never codegen a function that  
is a declaration. MF.getFunction() can never return a prototype.   
Devang, please remove this check.  Something like this should be  
sufficient:

if (MF.getFunction()->hasFnAttr(Attribute::OptimizeForSize))
   return false;

-Chris



More information about the llvm-commits mailing list