1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt -S -o - -structurizecfg -verify-dom-info < %s | FileCheck %s
4 ; This test hits a limitation in StructurizeCFG: it doesn't handle infinite-loops.
5 ; In this case, the IR remains unchanged.
7 define void @infinite_loop_false(ptr addrspace(1) %out, i1 %cond) {
8 ; CHECK-LABEL: @infinite_loop_false(
10 ; CHECK-NEXT: br i1 [[COND:%.*]], label [[FOR_END:%.*]], label [[FOR_BODY:%.*]]
12 ; CHECK-NEXT: store volatile i32 999, ptr addrspace(1) [[OUT:%.*]], align 4
13 ; CHECK-NEXT: br label [[FOR_BODY]]
15 ; CHECK-NEXT: ret void
18 br i1 %cond, label %for.end, label %for.body
21 store volatile i32 999, ptr addrspace(1) %out, align 4
28 define void @infinite_loop_on_branch(ptr addrspace(1) %out, i1 %cond) {
29 ; CHECK-LABEL: @infinite_loop_on_branch(
31 ; CHECK-NEXT: br i1 [[COND:%.*]], label [[IF_THEN:%.*]], label [[IF_ELSE:%.*]]
33 ; CHECK-NEXT: br label [[FOR_BODY:%.*]]
35 ; CHECK-NEXT: store volatile i32 999, ptr addrspace(1) [[OUT:%.*]], align 4
36 ; CHECK-NEXT: br label [[FOR_BODY]]
38 ; CHECK-NEXT: store volatile i32 111, ptr addrspace(1) [[OUT]], align 4
39 ; CHECK-NEXT: br label [[EXIT:%.*]]
41 ; CHECK-NEXT: ret void
44 br i1 %cond, label %if.then, label %if.else
50 store volatile i32 999, ptr addrspace(1) %out, align 4
54 store volatile i32 111, ptr addrspace(1) %out, align 4