blob: 655549f79402cb8735d205403451523c9143376f [file] [log] [blame]
Chris Lattner321b5722009-09-21 22:39:35 +00001; RUN: opt < %s -mem2reg -S
2; PR5023
3
Chris Lattnerc9661b62009-11-02 04:37:17 +00004declare i32 @test1f()
Chris Lattner321b5722009-09-21 22:39:35 +00005
Chris Lattnerc9661b62009-11-02 04:37:17 +00006define i32 @test1() {
Chris Lattner321b5722009-09-21 22:39:35 +00007entry:
8 %whichFlag = alloca i32
Chris Lattnerc9661b62009-11-02 04:37:17 +00009 %A = invoke i32 @test1f()
Chris Lattner321b5722009-09-21 22:39:35 +000010 to label %invcont2 unwind label %lpad86
11
12invcont2:
13 store i32 %A, i32* %whichFlag
14 br label %bb15
15
16bb15:
17 %B = load i32* %whichFlag
18 ret i32 %B
19
20lpad86:
21 br label %bb15
22
23}
24
Chris Lattnerc9661b62009-11-02 04:37:17 +000025
26
27define i32 @test2() {
28entry:
29 %whichFlag = alloca i32
30 br label %bb15
31
32bb15:
33 %B = load i32* %whichFlag
34 ret i32 %B
35
36invcont2:
37 %C = load i32* %whichFlag
38 store i32 %C, i32* %whichFlag
39 br label %bb15
40}
41