[llvm-commits] [llvm] r106267 - in /llvm/trunk: lib/Transforms/Scalar/IndVarSimplify.cpp test/Transforms/IndVarSimplify/indirectbr.ll
Dan Gohman
gohman at apple.com
Thu Jun 17 18:35:11 PDT 2010
Author: djg
Date: Thu Jun 17 20:35:11 2010
New Revision: 106267
URL: http://llvm.org/viewvc/llvm-project?rev=106267&view=rev
Log:
Disable indvars on loops when LoopSimplify form is not available.
This fixes PR7333.
Modified:
llvm/trunk/lib/Transforms/Scalar/IndVarSimplify.cpp
llvm/trunk/test/Transforms/IndVarSimplify/indirectbr.ll
Modified: llvm/trunk/lib/Transforms/Scalar/IndVarSimplify.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/IndVarSimplify.cpp?rev=106267&r1=106266&r2=106267&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/IndVarSimplify.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/IndVarSimplify.cpp Thu Jun 17 20:35:11 2010
@@ -467,6 +467,17 @@
}
bool IndVarSimplify::runOnLoop(Loop *L, LPPassManager &LPM) {
+ // 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"
+ // afterwards.
+ // - We depend on having a preheader; in particular,
+ // Loop::getCanonicalInductionVariable only supports loops with preheaders,
+ // and we're in trouble if we can't find the induction variable even when
+ // we've manually inserted one.
+ if (!L->isLoopSimplifyForm())
+ return false;
+
IU = &getAnalysis<IVUsers>();
LI = &getAnalysis<LoopInfo>();
SE = &getAnalysis<ScalarEvolution>();
Modified: llvm/trunk/test/Transforms/IndVarSimplify/indirectbr.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/IndVarSimplify/indirectbr.ll?rev=106267&r1=106266&r2=106267&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/IndVarSimplify/indirectbr.ll (original)
+++ llvm/trunk/test/Transforms/IndVarSimplify/indirectbr.ll Thu Jun 17 20:35:11 2010
@@ -1,6 +1,6 @@
; RUN: opt < %s -indvars -S -disable-output
-; PR5758
+; PR5758
define zeroext i1 @foo() nounwind {
entry:
indirectbr i8* undef, [label %"202", label %"133"]
@@ -20,3 +20,20 @@
"202": ; preds = %entry
ret i1 false
}
+
+; PR7333
+define void @__atomvec_module__put_vrml_bonds() nounwind {
+bb7.preheader: ; preds = %entry
+ indirectbr i8* undef, [label %bb14, label %bb16]
+
+bb14: ; preds = %bb14, %bb7.preheader
+ br label %bb16
+
+bb16: ; preds = %bb16, %bb14, %bb7.preheader
+ %S.31.0 = phi i64 [ %3, %bb16 ], [ 1, %bb7.preheader ], [ 1, %bb14 ] ; <i64> [#uses=2]
+ %0 = add nsw i64 %S.31.0, -1 ; <i64> [#uses=1]
+ %1 = getelementptr inbounds [3 x double]* undef, i64 0, i64 %0 ; <double*> [#uses=1]
+ %2 = load double* %1, align 8 ; <double> [#uses=0]
+ %3 = add nsw i64 %S.31.0, 1 ; <i64> [#uses=1]
+ br label %bb16
+}
More information about the llvm-commits
mailing list