If this matters, can we make the regular code path faster? Or make this be a separate function, for example on IRBuilder? - Daniel
On Fri, Mar 20, 2009 at 11:53 PM, Chris Lattner <[email protected]> wrote: > Author: lattner > Date: Sat Mar 21 01:53:34 2009 > New Revision: 67434 > > URL: http://llvm.org/viewvc/llvm-project?rev=67434&view=rev > Log: > avoid making constant folding logic eliminate obviously dead bitcasts, > speeding up PR3810 > by ~2%. > > Modified: > cfe/trunk/lib/CodeGen/CodeGenModule.cpp > > Modified: cfe/trunk/lib/CodeGen/CodeGenModule.cpp > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenModule.cpp?rev=67434&r1=67433&r2=67434&view=diff > > > ============================================================================== > --- cfe/trunk/lib/CodeGen/CodeGenModule.cpp (original) > +++ cfe/trunk/lib/CodeGen/CodeGenModule.cpp Sat Mar 21 01:53:34 2009 > @@ -824,7 +824,9 @@ > if (!Entry) > Entry = EmitForwardFunctionDefinition(D, 0); > > - return llvm::ConstantExpr::getBitCast(Entry, PTy); > + if (Entry->getType() != PTy) > + return llvm::ConstantExpr::getBitCast(Entry, PTy); > + return Entry; > } > > void CodeGenModule::EmitGlobalFunctionDefinition(const FunctionDecl *D) { > @@ -954,8 +956,11 @@ > > llvm::GlobalValue *&ExistingFn = > GlobalDeclMap[getContext().Idents.get(Name).getName()]; > - if (ExistingFn) > + if (ExistingFn) { > + if (ExistingFn->getType() == Ty) > + return FunctionSlot = ExistingFn; > return FunctionSlot = llvm::ConstantExpr::getBitCast(ExistingFn, Ty); > + } > > // FIXME: param attributes for sext/zext etc. > return FunctionSlot = ExistingFn = > > > _______________________________________________ > cfe-commits mailing list > [email protected] > http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits >
_______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
