[cfe-commits] r67434 - /cfe/trunk/lib/CodeGen/CodeGenModule.cpp

Daniel Dunbar daniel at zuster.org
Sat Mar 21 08:59:45 PDT 2009


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 <sabre at nondot.org> 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
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20090321/84c88873/attachment.html>


More information about the cfe-commits mailing list