Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1 | ; Promoting some values allows promotion of other values. |
Dan Gohman | 3c7d308 | 2009-09-11 18:01:28 +0000 | [diff] [blame^] | 2 | ; RUN: opt < %s -mem2reg -S | not grep alloca |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3 | |
Tanya Lattner | 9792837 | 2008-03-19 07:28:33 +0000 | [diff] [blame] | 4 | define i32 @test2() { |
| 5 | %result = alloca i32 ; <i32*> [#uses=2] |
| 6 | %a = alloca i32 ; <i32*> [#uses=2] |
| 7 | %p = alloca i32* ; <i32**> [#uses=2] |
| 8 | store i32 0, i32* %a |
| 9 | store i32* %a, i32** %p |
| 10 | %tmp.0 = load i32** %p ; <i32*> [#uses=1] |
| 11 | %tmp.1 = load i32* %tmp.0 ; <i32> [#uses=1] |
| 12 | store i32 %tmp.1, i32* %result |
| 13 | %tmp.2 = load i32* %result ; <i32> [#uses=1] |
| 14 | ret i32 %tmp.2 |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 15 | } |
| 16 | |