[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

Duncan Sands baldrick at free.fr
Thu Oct 2 01:37:35 PDT 2008


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

Ciao,

Duncan.



More information about the llvm-commits mailing list