1 ; RUN: opt -S -o - -structurizecfg < %s | FileCheck %s
3 ; CHECK-LABEL: @invert_branch_on_arg_inf_loop(
5 ; CHECK: %arg.inv = xor i1 %arg, true
6 define void @invert_branch_on_arg_inf_loop(ptr addrspace(1) %out, i1 %arg) {
8 br i1 %arg, label %for.end, label %sesestart
12 for.body: ; preds = %entry, %for.body
13 store i32 999, ptr addrspace(1) %out, align 4
14 br i1 %arg, label %for.body, label %seseend
18 for.end: ; preds = %Flow
23 ; CHECK-LABEL: @invert_branch_on_arg_jump_into_loop(
25 ; CHECK: %arg.inv = xor i1 %arg, true
28 define void @invert_branch_on_arg_jump_into_loop(ptr addrspace(1) %out, i32 %n, i1 %arg) {
33 %i = phi i32 [0, %entry], [%i.inc, %end.loop]
34 %ptr = getelementptr i32, ptr addrspace(1) %out, i32 %i
35 store i32 %i, ptr addrspace(1) %ptr, align 4
36 br i1 %arg, label %mid.loop, label %end.loop
39 store i32 333, ptr addrspace(1) %out, align 4
43 %i.inc = add i32 %i, 1
44 %cmp = icmp ne i32 %i.inc, %n
45 br i1 %cmp, label %for.body, label %for.end