[llvm-commits] [llvm] r135644 - in /llvm/trunk: lib/Transforms/Scalar/LoopStrengthReduce.cpp test/Transforms/LoopStrengthReduce/2011-07-20-DoubleIV.ll
Andrew Trick
atrick at apple.com
Wed Jul 20 17:40:04 PDT 2011
Author: atrick
Date: Wed Jul 20 19:40:04 2011
New Revision: 135644
URL: http://llvm.org/viewvc/llvm-project?rev=135644&view=rev
Log:
LSR crashes on an empty IVUsers list.
rdar://9786536
Added:
llvm/trunk/test/Transforms/LoopStrengthReduce/2011-07-20-DoubleIV.ll
Modified:
llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp
Modified: llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp?rev=135644&r1=135643&r2=135644&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp Wed Jul 20 19:40:04 2011
@@ -3740,6 +3740,9 @@
OptimizeShadowIV();
OptimizeLoopTermCond();
+ // If loop preparation eliminates all interesting IV users, bail.
+ if (IU.empty()) return;
+
// Start collecting data and preparing for the solver.
CollectInterestingTypesAndFactors();
CollectFixupsAndInitialFormulae();
Added: llvm/trunk/test/Transforms/LoopStrengthReduce/2011-07-20-DoubleIV.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/LoopStrengthReduce/2011-07-20-DoubleIV.ll?rev=135644&view=auto
==============================================================================
--- llvm/trunk/test/Transforms/LoopStrengthReduce/2011-07-20-DoubleIV.ll (added)
+++ llvm/trunk/test/Transforms/LoopStrengthReduce/2011-07-20-DoubleIV.ll Wed Jul 20 19:40:04 2011
@@ -0,0 +1,24 @@
+; RUN: opt < %s -loop-reduce -S | FileCheck %s
+;
+; Test LSR's OptimizeShadowIV. Handle a floating-point IV with a
+; nonzero initial value.
+; rdar://9786536
+
+; First, make sure LSR doesn't crash on an empty IVUsers list.
+; CHECK: @dummyIV
+; CHECK-NOT: phi
+; CHECK-NOT: sitofp
+; CHECK: br
+define void @dummyIV() nounwind {
+entry:
+ br label %loop
+
+loop:
+ %i.01 = phi i32 [ -39, %entry ], [ %inc, %loop ]
+ %conv7 = sitofp i32 %i.01 to double
+ %inc = add nsw i32 %i.01, 1
+ br i1 undef, label %loop, label %for.end
+
+for.end:
+ unreachable
+}
More information about the llvm-commits
mailing list