[llvm] r271196 - [IndVars] Assert that the incoming IR is in LCSSA

Sanjoy Das via llvm-commits llvm-commits at lists.llvm.org
Sun May 29 18:37:41 PDT 2016

Author: sanjoy
Date: Sun May 29 20:37:39 2016
New Revision: 271196

URL: http://llvm.org/viewvc/llvm-project?rev=271196&view=rev
[IndVars] Assert that the incoming IR is in LCSSA

Since we already assert that the outgoing IR is in LCSSA, it is easy to
get misled into thinking that -indvars broke LCSSA if the incoming IR is
non-LCSSA.  Checking this pre-condition will make such cases break in
more obvious ways.

Inspired by (but does _not_ fix) PR26682.


Modified: llvm/trunk/lib/Transforms/Scalar/IndVarSimplify.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/IndVarSimplify.cpp?rev=271196&r1=271195&r2=271196&view=diff
--- llvm/trunk/lib/Transforms/Scalar/IndVarSimplify.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/IndVarSimplify.cpp Sun May 29 20:37:39 2016
@@ -2101,6 +2101,9 @@ void IndVarSimplify::sinkUnusedInvariant
 bool IndVarSimplify::run(Loop *L) {
+  // We need (and expect!) the incoming loop to be in LCSSA.
+  assert(L->isRecursivelyLCSSAForm(*DT) && "LCSSA required to run indvars!");
   // If LoopSimplify form is not available, stay out of trouble. Some notes:
   //  - LSR currently only supports LoopSimplify-form loops. Indvars'
   //    canonicalization can be a pessimization without LSR to "clean up"

More information about the llvm-commits mailing list