forked from OSchip/llvm-project
avoid making constant folding logic eliminate obviously dead bitcasts, speeding up PR3810
by ~2%. llvm-svn: 67434
This commit is contained in:
parent
316e1c19df
commit
9e8120e067
|
@ -824,7 +824,9 @@ llvm::Constant *CodeGenModule::GetAddrOfFunction(const FunctionDecl *D) {
|
|||
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::Value *CodeGenModule::getBuiltinLibFunction(unsigned BuiltinID) {
|
|||
|
||||
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 =
|
||||
|
|
Loading…
Reference in New Issue