[llvm-commits] [llvm] r124100 - in /llvm/trunk: lib/Transforms/Utils/SSAUpdater.cpp test/Transforms/ScalarRepl/crash.ll
Chris Lattner
sabre at nondot.org
Sun Jan 23 19:29:07 PST 2011
Author: lattner
Date: Sun Jan 23 21:29:07 2011
New Revision: 124100
URL: http://llvm.org/viewvc/llvm-project?rev=124100&view=rev
Log:
fix PR9017, a bug where we'd assert when promoting in unreachable
code.
Added:
llvm/trunk/test/Transforms/ScalarRepl/crash.ll
Modified:
llvm/trunk/lib/Transforms/Utils/SSAUpdater.cpp
Modified: llvm/trunk/lib/Transforms/Utils/SSAUpdater.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/SSAUpdater.cpp?rev=124100&r1=124099&r2=124100&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Utils/SSAUpdater.cpp (original)
+++ llvm/trunk/lib/Transforms/Utils/SSAUpdater.cpp Sun Jan 23 21:29:07 2011
@@ -469,6 +469,9 @@
LoadInst *ALoad = LiveInLoads[i];
Value *NewVal = SSA.GetValueInMiddleOfBlock(ALoad->getParent());
replaceLoadWithValue(ALoad, NewVal);
+
+ // Avoid assertions in unreachable code.
+ if (NewVal == ALoad) NewVal = UndefValue::get(NewVal->getType());
ALoad->replaceAllUsesWith(NewVal);
ReplacedLoads[ALoad] = NewVal;
}
Added: llvm/trunk/test/Transforms/ScalarRepl/crash.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/ScalarRepl/crash.ll?rev=124100&view=auto
==============================================================================
--- llvm/trunk/test/Transforms/ScalarRepl/crash.ll (added)
+++ llvm/trunk/test/Transforms/ScalarRepl/crash.ll Sun Jan 23 21:29:07 2011
@@ -0,0 +1,20 @@
+; RUN: opt -scalarrepl %s -disable-output
+; RUN: opt -scalarrepl-ssa %s -disable-output
+
+target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64"
+target triple = "x86_64-apple-darwin10.0.0"
+
+; PR9017
+define void @test1() nounwind readnone ssp {
+entry:
+ %l_72 = alloca i32*, align 8
+ unreachable
+
+for.cond: ; preds = %for.cond
+ %tmp1.i = load i32** %l_72, align 8
+ store i32* %tmp1.i, i32** %l_72, align 8
+ br label %for.cond
+
+if.end: ; No predecessors!
+ ret void
+}
More information about the llvm-commits
mailing list