[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
Thu Oct 2 10:03:16 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)?
>
> If so, how about not setting the OptimizeForSize attribute on
> declarations in the first place?

That's what we do. Initially, in notes implementation we had assertion  
check somewhere to catch this.

> After all, there doesn't seem
> to be much point to it if it's going to be ignored everywhere
> anyway - indeed it's just a trap to fall into: checking for a
> declaration is easily forgotten.
> Another possibility is to have hasFnAttr check itself whether
> F is a declaration, and not return true in that case.

That's what I did. But, Chris preferred that clients check F- 
 >isDeclaration().

-
Devang



More information about the llvm-commits mailing list