1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt -S -passes=licm < %s | FileCheck %s
7 ; CHECK-NEXT: br label [[FOR_COND:%.*]]
9 ; CHECK-NEXT: callbr void asm sideeffect "", "!i,~{dirflag},~{fpsr},~{flags}"()
10 ; CHECK-NEXT: to label [[COND_TRUE_I:%.*]] [label %for.end.split.loop.exit1]
12 ; CHECK-NEXT: br i1 true, label [[FOR_END_SPLIT_LOOP_EXIT:%.*]], label [[FOR_COND]]
13 ; CHECK: for.end.split.loop.exit:
14 ; CHECK-NEXT: [[ASMRESULT1_I_I_LE:%.*]] = extractvalue { i8, i32 } zeroinitializer, 1
15 ; CHECK-NEXT: br label [[FOR_END:%.*]]
16 ; CHECK: for.end.split.loop.exit1:
17 ; CHECK-NEXT: [[PHI_PH2:%.*]] = phi i32 [ undef, [[FOR_COND]] ]
18 ; CHECK-NEXT: br label [[FOR_END]]
20 ; CHECK-NEXT: [[PHI:%.*]] = phi i32 [ [[ASMRESULT1_I_I_LE]], [[FOR_END_SPLIT_LOOP_EXIT]] ], [ [[PHI_PH2]], [[FOR_END_SPLIT_LOOP_EXIT1:%.*]] ]
21 ; CHECK-NEXT: ret i32 [[PHI]]
26 for.cond: ; preds = %cond.true.i, %entry
27 callbr void asm sideeffect "", "!i,~{dirflag},~{fpsr},~{flags}"()
28 to label %cond.true.i [label %for.end]
30 cond.true.i: ; preds = %for.cond
31 %asmresult1.i.i = extractvalue { i8, i32 } zeroinitializer, 1
32 br i1 undef, label %for.end, label %for.cond
34 for.end: ; preds = %cond.true.i, %for.cond
35 %phi = phi i32 [ %asmresult1.i.i, %cond.true.i ], [ undef, %for.cond ]
39 declare void @use_i32(i32)
41 define void @pr64215() {
42 ; CHECK-LABEL: @pr64215(
44 ; CHECK-NEXT: [[X:%.*]] = callbr i32 asm sideeffect "", "=r"()
45 ; CHECK-NEXT: to label [[LOOP_PREHEADER:%.*]] []
46 ; CHECK: loop.preheader:
47 ; CHECK-NEXT: [[ADD:%.*]] = add i32 [[X]], 1
48 ; CHECK-NEXT: br label [[LOOP:%.*]]
50 ; CHECK-NEXT: call void @use_i32(i32 [[ADD]])
51 ; CHECK-NEXT: br label [[LOOP]]
54 %x = callbr i32 asm sideeffect "", "=r"()
59 call void @use_i32(i32 %add)