From 5814d9d9dabb8e7d59e3d94b04ee22210f5217c7 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Tue, 20 Apr 2010 05:09:16 +0000 Subject: RewriteLoopBodyWithConditionConstant can end up rewriting the condition we're unswitching on. In this case, don't try to simplify the second copy of the loop which may be dead or not, but is probably a constant now. This fixes PR6879 llvm-svn: 101870 --- llvm/test/Transforms/LoopUnswitch/crash.ll | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'llvm/test/Transforms/LoopUnswitch/crash.ll') diff --git a/llvm/test/Transforms/LoopUnswitch/crash.ll b/llvm/test/Transforms/LoopUnswitch/crash.ll index fac55a6bb1a..101fb7a2c2c 100644 --- a/llvm/test/Transforms/LoopUnswitch/crash.ll +++ b/llvm/test/Transforms/LoopUnswitch/crash.ll @@ -45,3 +45,22 @@ for.body: ; preds = %for.body, %bb.nph for.end: ; preds = %for.body, %entry ret void } + +; PR6879 +define i32* @test3(i32** %p_45, i16 zeroext %p_46, i64 %p_47, i64 %p_48, i16 signext %p_49) nounwind { +entry: + br label %for.cond + +for.cond: ; preds = %for.cond4, %entry + br i1 false, label %for.cond4, label %for.end88 + +for.cond4: ; preds = %for.cond + %conv46 = trunc i32 0 to i8 ; [#uses=2] + %cmp60 = icmp sgt i8 %conv46, 124 ; [#uses=1] + %or.cond = and i1 undef, %cmp60 ; [#uses=1] + %cond = select i1 %or.cond, i8 %conv46, i8 undef ; [#uses=0] + br label %for.cond + +for.end88: ; preds = %for.cond + ret i32* undef +} -- cgit v1.2.3