Michael Kuperstein | 461aa57 | 2017-01-23 23:45:42 +0000 | [diff] [blame] | 1 | ; RUN: opt -loop-unroll -verify-loop-lcssa -S < %s | FileCheck %s |
| 2 | |
| 3 | target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" |
| 4 | target triple = "x86_64-unknown-linux-gnu" |
| 5 | |
| 6 | @b = external local_unnamed_addr global i32, align 4 |
| 7 | |
| 8 | ; CHECK-LABEL: @main |
| 9 | ; CHECK: exit.loopexit: |
| 10 | ; CHECK: {{.*}} = phi i32 [ %d.0, %h3 ] |
| 11 | ; CHECK: br label %exit |
| 12 | ; CHECK: exit.loopexit1: |
| 13 | ; CHECK: {{.*}} = phi i32 [ %d.0, %h3.1 ] |
| 14 | ; CHECK: br label %exit |
| 15 | |
| 16 | define void @main() local_unnamed_addr #0 { |
| 17 | ph1: |
| 18 | br label %h1 |
| 19 | |
| 20 | h1: |
| 21 | %d.0 = phi i32 [ %1, %latch1 ], [ undef, %ph1 ] |
| 22 | br label %ph2 |
| 23 | |
| 24 | ph2: |
| 25 | br label %h2 |
| 26 | |
| 27 | h2: |
| 28 | %0 = phi i32 [ 0, %ph2 ], [ %inc, %latch2 ] |
| 29 | br label %h3 |
| 30 | |
| 31 | h3: |
| 32 | br i1 undef, label %latch3, label %exit |
| 33 | |
| 34 | latch3: |
| 35 | br i1 false, label %exit3, label %h3 |
| 36 | |
| 37 | exit3: |
| 38 | br label %latch2 |
| 39 | |
| 40 | latch2: |
| 41 | %inc = add nuw nsw i32 %0, 1 |
| 42 | %cmp = icmp slt i32 %inc, 2 |
| 43 | br i1 %cmp, label %h2, label %exit2 |
| 44 | |
| 45 | exit2: |
| 46 | br i1 undef, label %latch1, label %ph2 |
| 47 | |
| 48 | latch1: ; preds = %exit2 |
| 49 | %1 = load i32, i32* @b, align 4 |
| 50 | br label %h1 |
| 51 | |
| 52 | exit: |
| 53 | %d.0.lcssa = phi i32 [ %d.0, %h3 ] |
| 54 | ret void |
| 55 | } |