[llvm] r237587 - indvars cruft: don't replace phi nodes for no reason.

Andrew Trick atrick at apple.com
Mon May 18 09:49:34 PDT 2015


Author: atrick
Date: Mon May 18 11:49:34 2015
New Revision: 237587

URL: http://llvm.org/viewvc/llvm-project?rev=237587&view=rev
Log:
indvars cruft: don't replace phi nodes for no reason.

Don't replace a phi with an identical phi. This was done long ago to
"preserve" IVUsers analysis. The code has already called
SE->forgetValue(PN) so I see no purpose in creating a new value for
the phi.

Modified:
    llvm/trunk/lib/Transforms/Scalar/IndVarSimplify.cpp

Modified: llvm/trunk/lib/Transforms/Scalar/IndVarSimplify.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/IndVarSimplify.cpp?rev=237587&r1=237586&r2=237587&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/IndVarSimplify.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/IndVarSimplify.cpp Mon May 18 11:49:34 2015
@@ -621,16 +621,6 @@ void IndVarSimplify::RewriteLoopExitValu
           PN->eraseFromParent();
         }
       }
-
-      // If we were unable to completely replace the PHI node, clone the PHI and
-      // delete the original one. This purges the original phi.
-      if (!LCSSASafePhiForRAUW) {
-        PHINode *NewPN = cast<PHINode>(PN->clone());
-        NewPN->takeName(PN);
-        NewPN->insertBefore(PN);
-        PN->replaceAllUsesWith(NewPN);
-        PN->eraseFromParent();
-      }
     }
   }
 





More information about the llvm-commits mailing list