Dan Gohman | 1880092 | 2009-09-11 18:01:28 +0000 | [diff] [blame] | 1 | ; RUN: opt < %s -instcombine -S | grep {insertelement <4 x float> undef} |
Dan Gohman | 86fb5b4 | 2008-09-09 18:11:14 +0000 | [diff] [blame] | 2 | |
| 3 | ; Instcombine should be able to prove that none of the |
| 4 | ; insertelement's first operand's elements are needed. |
| 5 | |
| 6 | define internal void @""(i8*) { |
| 7 | ; <label>:1 |
| 8 | bitcast i8* %0 to i32* ; <i32*>:2 [#uses=1] |
| 9 | load i32* %2, align 1 ; <i32>:3 [#uses=1] |
| 10 | getelementptr i8* %0, i32 4 ; <i8*>:4 [#uses=1] |
| 11 | bitcast i8* %4 to i32* ; <i32*>:5 [#uses=1] |
| 12 | load i32* %5, align 1 ; <i32>:6 [#uses=1] |
| 13 | br label %7 |
| 14 | |
| 15 | ; <label>:7 ; preds = %9, %1 |
| 16 | %.01 = phi <4 x float> [ undef, %1 ], [ %12, %9 ] ; <<4 x float>> [#uses=1] |
| 17 | %.0 = phi i32 [ %3, %1 ], [ %15, %9 ] ; <i32> [#uses=3] |
| 18 | icmp slt i32 %.0, %6 ; <i1>:8 [#uses=1] |
| 19 | br i1 %8, label %9, label %16 |
| 20 | |
| 21 | ; <label>:9 ; preds = %7 |
| 22 | sitofp i32 %.0 to float ; <float>:10 [#uses=1] |
| 23 | insertelement <4 x float> %.01, float %10, i32 0 ; <<4 x float>>:11 [#uses=1] |
| 24 | shufflevector <4 x float> %11, <4 x float> undef, <4 x i32> zeroinitializer ; <<4 x float>>:12 [#uses=2] |
| 25 | getelementptr i8* %0, i32 48 ; <i8*>:13 [#uses=1] |
| 26 | bitcast i8* %13 to <4 x float>* ; <<4 x float>*>:14 [#uses=1] |
| 27 | store <4 x float> %12, <4 x float>* %14, align 16 |
| 28 | add i32 %.0, 2 ; <i32>:15 [#uses=1] |
| 29 | br label %7 |
| 30 | |
| 31 | ; <label>:16 ; preds = %7 |
| 32 | ret void |
| 33 | } |