Matt Arsenault | c8fc08c | 2014-05-30 18:34:43 +0000 | [diff] [blame] | 1 | ; RUN: opt -S -simplifycfg < %s | FileCheck %s |
| 2 | |
| 3 | define i32 @speculate_vector_extract(i32 %d, <4 x i32> %v) #0 { |
| 4 | ; CHECK-LABEL: @speculate_vector_extract( |
| 5 | ; CHECK-NOT: br |
| 6 | entry: |
| 7 | %conv = insertelement <4 x i32> undef, i32 %d, i32 0 |
| 8 | %conv2 = insertelement <4 x i32> %conv, i32 %d, i32 1 |
| 9 | %conv3 = insertelement <4 x i32> %conv2, i32 %d, i32 2 |
| 10 | %conv4 = insertelement <4 x i32> %conv3, i32 %d, i32 3 |
| 11 | %tmp6 = add nsw <4 x i32> %conv4, <i32 0, i32 -1, i32 -2, i32 -3> |
| 12 | %cmp = icmp eq <4 x i32> %tmp6, zeroinitializer |
| 13 | %cmp.ext = sext <4 x i1> %cmp to <4 x i32> |
| 14 | %tmp8 = extractelement <4 x i32> %cmp.ext, i32 0 |
| 15 | %tobool = icmp eq i32 %tmp8, 0 |
| 16 | br i1 %tobool, label %cond.else, label %cond.then |
| 17 | |
| 18 | return: ; preds = %cond.end28 |
| 19 | ret i32 %cond32 |
| 20 | |
| 21 | cond.then: ; preds = %entry |
| 22 | %tmp10 = extractelement <4 x i32> %v, i32 0 |
| 23 | br label %cond.end |
| 24 | |
| 25 | cond.else: ; preds = %entry |
| 26 | %tmp12 = extractelement <4 x i32> %v, i32 3 |
| 27 | br label %cond.end |
| 28 | |
| 29 | cond.end: ; preds = %cond.else, %cond.then |
| 30 | %cond = phi i32 [ %tmp10, %cond.then ], [ %tmp12, %cond.else ] |
| 31 | %tmp14 = extractelement <4 x i32> %cmp.ext, i32 1 |
| 32 | %tobool15 = icmp eq i32 %tmp14, 0 |
| 33 | br i1 %tobool15, label %cond.else17, label %cond.then16 |
| 34 | |
| 35 | cond.then16: ; preds = %cond.end |
| 36 | %tmp20 = extractelement <4 x i32> %v, i32 1 |
| 37 | br label %cond.end18 |
| 38 | |
| 39 | cond.else17: ; preds = %cond.end |
| 40 | br label %cond.end18 |
| 41 | |
| 42 | cond.end18: ; preds = %cond.else17, %cond.then16 |
| 43 | %cond22 = phi i32 [ %tmp20, %cond.then16 ], [ %cond, %cond.else17 ] |
| 44 | %tmp24 = extractelement <4 x i32> %cmp.ext, i32 2 |
| 45 | %tobool25 = icmp eq i32 %tmp24, 0 |
| 46 | br i1 %tobool25, label %cond.else27, label %cond.then26 |
| 47 | |
| 48 | cond.then26: ; preds = %cond.end18 |
| 49 | %tmp30 = extractelement <4 x i32> %v, i32 2 |
| 50 | br label %cond.end28 |
| 51 | |
| 52 | cond.else27: ; preds = %cond.end18 |
| 53 | br label %cond.end28 |
| 54 | |
| 55 | cond.end28: ; preds = %cond.else27, %cond.then26 |
| 56 | %cond32 = phi i32 [ %tmp30, %cond.then26 ], [ %cond22, %cond.else27 ] |
| 57 | br label %return |
| 58 | } |
| 59 | |
| 60 | attributes #0 = { nounwind } |