[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
Sun Oct 5 01:33:17 PDT 2008


On Saturday 04 October 2008 22:19:10 Chris Lattner wrote:
> 
> 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;

I made the comment about this bit of code, but if you take a look
you will see that every use of hasFnAttr(Attribute::OptimizeForSize)
everywhere is protected by a !F->isDeclaration() check.

Ciao,

Duncan.



More information about the llvm-commits mailing list