1 ; RUN: opt -mem2reg < %s -S | FileCheck %s
6 ; Special case of a single-BB alloca does not apply here since the load
7 ; is affected by the following store. Expect this case to be identified
8 ; and a PHI node to be created.
10 ; CHECK-LABEL: @test1(
16 %v = load i32, i32* %t
17 %c = call i1 @use(i32 %v)
18 ; CHECK: [[PHI:%.*]] = phi i32 [ undef, %entry ], [ %n, %loop ]
19 ; CHECK: call i1 @use(i32 [[PHI]])
20 %n = call i32 @def(i32 7)
22 br i1 %c, label %loop, label %exit
28 ; Same as above, except there is no following store. The alloca should just be
29 ; replaced with an undef
30 define void @test2() {
31 ; CHECK-LABEL: @test2(
37 %v = load i32, i32* %t
38 %c = call i1 @use(i32 %v)
39 ; CHECK: %c = call i1 @use(i32 undef)
40 br i1 %c, label %loop, label %exit