[llvm-commits] [llvm] r160757 - /llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp

Nuno Lopes nunoplopes at sapo.pt
Wed Jul 25 14:35:48 PDT 2012


You can just replace the invoke with a branch, and then let  
SimplifyCFG do its magic..  In this pass there's no worries about  
modifying the CFG.

Nuno

Quoting Nick Lewycky <nicholas at mxc.ca>:

> Author: nicholas
> Date: Wed Jul 25 16:19:40 2012
> New Revision: 160757
>
> URL: http://llvm.org/viewvc/llvm-project?rev=160757&view=rev
> Log:
> It's not safe to blindly remove invoke instructions. This happens when we
> encounter an invoke of an allocation function. This should fix the dragonegg
> bootstrap. Testcase to follow, later.
>
> Modified:
>     llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp
>
> Modified: llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp
> URL:  
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp?rev=160757&r1=160756&r2=160757&view=diff
> ==============================================================================
> --- llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp (original)
> +++ llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp Wed Jul 25 16:19:40 2012
> @@ -352,7 +352,8 @@
>        return true;
>      if (!V->hasOneUse())
>        return false;
> -    if (isa<LoadInst>(V) || isa<Argument>(V) || isa<GlobalValue>(V))
> +    if (isa<LoadInst>(V) || isa<InvokeInst>(V) || isa<Argument>(V) ||
> +        isa<GlobalValue>(V))
>        return false;
>      if (isAllocationFn(V))
>        return true;
>



More information about the llvm-commits mailing list