| 1 |
; RUN: opt -passes=loop-distribute -enable-loop-distribute \ |
| 2 |
; RUN: -debug-only=loop-distribute -disable-output 2>&1 %s | FileCheck %s |
| 3 |
|
| 4 |
define void @ldist(i1 %cond, ptr %A, ptr %B, ptr %C) { |
| 5 |
entry: |
| 6 |
br label %for.body |
| 7 |
|
| 8 |
for.body: ; preds = %if.end, %entry |
| 9 |
%iv = phi i16 [ 0, %entry ], [ %iv.next, %if.end ] |
| 10 |
%lv = load i16, ptr %A, align 1 |
| 11 |
store i16 %lv, ptr %A, align 1 |
| 12 |
br i1 %cond, label %if.then, label %if.end |
| 13 |
|
| 14 |
if.then: ; preds = %for.body |
| 15 |
%lv2 = load i16, ptr %A, align 1 |
| 16 |
br label %if.end |
| 17 |
|
| 18 |
if.end: ; preds = %if.then, %for.body |
| 19 |
%c.sink = phi ptr [ %B, %if.then ], [ %C, %for.body ] |
| 20 |
%lv3 = load i16, ptr %c.sink |
| 21 |
%add = add i16 %lv3, 10 |
| 22 |
store i16 %add, ptr %c.sink, align 1 |
| 23 |
%iv.next = add nuw nsw i16 %iv, 1 |
| 24 |
%tobool.not = icmp eq i16 %iv.next, 1000 |
| 25 |
br i1 %tobool.not, label %for.end.loopexit, label %for.body |
| 26 |
|
| 27 |
for.end.loopexit: ; preds = %if.end |
| 28 |
ret void |
| 29 |
} |