[llvm-commits] [llvm] r95055 - in /llvm/trunk: lib/Transforms/Scalar/LoopUnswitch.cpp test/Transforms/LoopUnswitch/crash.ll
Chris Lattner
sabre at nondot.org
Mon Feb 1 18:26:55 PST 2010
Author: lattner
Date: Mon Feb 1 20:26:54 2010
New Revision: 95055
URL: http://llvm.org/viewvc/llvm-project?rev=95055&view=rev
Log:
fix a crash in loop unswitch on a loop invariant vector condition.
Modified:
llvm/trunk/lib/Transforms/Scalar/LoopUnswitch.cpp
llvm/trunk/test/Transforms/LoopUnswitch/crash.ll
Modified: llvm/trunk/lib/Transforms/Scalar/LoopUnswitch.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LoopUnswitch.cpp?rev=95055&r1=95054&r2=95055&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/LoopUnswitch.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/LoopUnswitch.cpp Mon Feb 1 20:26:54 2010
@@ -169,6 +169,10 @@
/// invariant in the loop, or has an invariant piece, return the invariant.
/// Otherwise, return null.
static Value *FindLIVLoopCondition(Value *Cond, Loop *L, bool &Changed) {
+ // We can never unswitch on vector conditions.
+ if (isa<VectorType>(Cond->getType()))
+ return 0;
+
// Constants should be folded, not unswitched on!
if (isa<Constant>(Cond)) return 0;
@@ -401,7 +405,7 @@
/// UnswitchIfProfitable - We have found that we can unswitch currentLoop when
/// LoopCond == Val to simplify the loop. If we decide that this is profitable,
/// unswitch the loop, reprocess the pieces, then return true.
-bool LoopUnswitch::UnswitchIfProfitable(Value *LoopCond, Constant *Val){
+bool LoopUnswitch::UnswitchIfProfitable(Value *LoopCond, Constant *Val) {
initLoopData();
Modified: llvm/trunk/test/Transforms/LoopUnswitch/crash.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/LoopUnswitch/crash.ll?rev=95055&r1=95054&r2=95055&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/LoopUnswitch/crash.ll (original)
+++ llvm/trunk/test/Transforms/LoopUnswitch/crash.ll Mon Feb 1 20:26:54 2010
@@ -1,6 +1,6 @@
; RUN: opt < %s -loop-unswitch -disable-output
-define void @sort_Eq(i32* %S2) {
+define void @test1(i32* %S2) {
entry:
br i1 false, label %list_Length.exit, label %cond_true.i
cond_true.i: ; preds = %entry
@@ -30,3 +30,18 @@
ret void
}
+define void @test2(i32 %x1, i32 %y1, i32 %z1, i32 %r1) nounwind {
+entry:
+ br label %bb.nph
+
+bb.nph: ; preds = %entry
+ %and.i13521 = and <4 x i1> undef, undef ; <<4 x i1>> [#uses=1]
+ br label %for.body
+
+for.body: ; preds = %for.body, %bb.nph
+ %or.i = select <4 x i1> %and.i13521, <4 x i32> undef, <4 x i32> undef ; <<4 x i32>> [#uses=0]
+ br i1 false, label %for.body, label %for.end
+
+for.end: ; preds = %for.body, %entry
+ ret void
+}
More information about the llvm-commits
mailing list