[llvm-dev] status of IPO/IPCP?

Justin Bogner via llvm-dev llvm-dev at lists.llvm.org
Tue May 3 23:01:11 PDT 2016


Sean Silva via llvm-dev <llvm-dev at lists.llvm.org> writes:
> No tests fail with the patch below, so I would say it's pretty useless. It
> seems that the C bindings are the only user but we can probably just have them
> return IPSCCP instead.

I don't necessarily think your conclusion is wrong, but the patch isn't
proving what you think it's proving. In fact, the below passes all tests
as well. When you call passes through `opt` they don't end up calling
through the createXYZPass path.

diff --git a/lib/Transforms/IPO/IPConstantPropagation.cpp b/lib/Transforms/IPO/IPConstantPropagation.cpp
index b3ee499..8d70b98 100644
--- a/lib/Transforms/IPO/IPConstantPropagation.cpp
+++ b/lib/Transforms/IPO/IPConstantPropagation.cpp
@@ -253,7 +253,9 @@ char IPCP::ID = 0;
 INITIALIZE_PASS(IPCP, "ipconstprop",
                 "Interprocedural constant propagation", false, false)
 
-ModulePass *llvm::createIPConstantPropagationPass() { return new IPCP(); }
+ModulePass *llvm::createIPConstantPropagationPass() {
+  llvm_unreachable("fnord");
+}
 
 bool IPCP::runOnModule(Module &M) {
   if (skipModule(M))

> Any idea why this wasn't removed when IPSCCP was introduced? Probably worth
> understanding that before ripping it out, but in the current state of things I
> don't think removing it will be problematic.
>
> diff --git a/llvm/lib/Transforms/IPO/IPConstantPropagation.cpp b/llvm/lib/
> Transforms/IPO/IPConstantPropagation.cpp
> index a1533b3..24aea5c 100644
> --- a/llvm/lib/Transforms/IPO/IPConstantPropagation.cpp
> +++ b/llvm/lib/Transforms/IPO/IPConstantPropagation.cpp
> @@ -51,7 +51,9 @@ char IPCP::ID = 0;
>  INITIALIZE_PASS(IPCP, "ipconstprop",
>                  "Interprocedural constant propagation", false, false)
>  
> -ModulePass *llvm::createIPConstantPropagationPass() { return new IPCP(); }
> +ModulePass *llvm::createIPConstantPropagationPass() {
> +  return createIPSCCPPass();
> +}
>  
>  bool IPCP::runOnModule(Module &M) {
>    if (skipModule(M))
>
> -- Sean Silva
>
> On Tue, May 3, 2016 at 3:06 PM, Davide Italiano via llvm-dev <
> llvm-dev at lists.llvm.org> wrote:
>
>     The pass is pretty rudimental (as the comment at the top of the file
>     hints), and it seems LLVM already has IPSCCP (which should do a better
>     job at interprocedural constant propagation).
>     I'm also not entirely sure it's used anywhere.
>     Is there any reason to keep it around?
>    
>     Thanks,
>    
>     --
>     Davide
>    
>     "There are no solved problems; there are only problems that are more
>     or less solved" -- Henri Poincare
>     _______________________________________________
>     LLVM Developers mailing list
>     llvm-dev at lists.llvm.org
>     http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
>
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev


More information about the llvm-dev mailing list