blob: a7bd527e52abc4117a4d5d124e08d08c01c1b2d7 [file] [log] [blame]
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt -loop-reduce %s -o - -S | FileCheck %s --check-prefix=LEGACYPM
; RUN: opt -passes='loop(loop-reduce)' %s -o - -S | FileCheck %s --check-prefix=NEWPM
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
define dso_local i32 @test1() local_unnamed_addr {
; LEGACYPM-LABEL: @test1(
; LEGACYPM-NEXT: entry:
; LEGACYPM-NEXT: br label [[FOR_COND:%.*]]
; LEGACYPM: for.cond:
; LEGACYPM-NEXT: callbr void asm sideeffect "", "!i,!i,~{dirflag},~{fpsr},~{flags}"()
; LEGACYPM-NEXT: to label [[ASM_FALLTHROUGH_I_I:%.*]] [label [[COND_TRUE_I:%.*]], label %for.endsplit]
; LEGACYPM: asm.fallthrough.i.i:
; LEGACYPM-NEXT: unreachable
; LEGACYPM: cond.true.i:
; LEGACYPM-NEXT: br label [[DO_BODY_I_I_DO_BODY_I_I_CRIT_EDGE:%.*]]
; LEGACYPM: do.body.i.i.do.body.i.i_crit_edge:
; LEGACYPM-NEXT: [[LSR_IV:%.*]] = phi i64 [ [[LSR_IV_NEXT:%.*]], [[DO_BODY_I_I_DO_BODY_I_I_CRIT_EDGE]] ], [ undef, [[COND_TRUE_I]] ]
; LEGACYPM-NEXT: [[LSR_IV_NEXT]] = add i64 [[LSR_IV]], 1
; LEGACYPM-NEXT: br i1 true, label [[DO_BODY_I_I_RDRAND_INT_EXIT_I_CRIT_EDGE:%.*]], label [[DO_BODY_I_I_DO_BODY_I_I_CRIT_EDGE]]
; LEGACYPM: do.body.i.i.rdrand_int.exit.i_crit_edge:
; LEGACYPM-NEXT: br i1 true, label [[DO_BODY_I_I_RDRAND_INT_EXIT_I_CRIT_EDGE_FOR_END_CRIT_EDGE:%.*]], label [[FOR_INC:%.*]]
; LEGACYPM: do.body.i.i.rdrand_int.exit.i_crit_edge.for.end_crit_edge:
; LEGACYPM-NEXT: br label [[FOR_END:%.*]]
; LEGACYPM: for.inc:
; LEGACYPM-NEXT: br label [[FOR_COND]]
; LEGACYPM: for.endsplit:
; LEGACYPM-NEXT: br label [[FOR_END]]
; LEGACYPM: for.end:
; LEGACYPM-NEXT: [[PGOCOUNT_PROMOTED24:%.*]] = phi i64 [ [[LSR_IV_NEXT]], [[DO_BODY_I_I_RDRAND_INT_EXIT_I_CRIT_EDGE_FOR_END_CRIT_EDGE]] ], [ undef, [[FOR_ENDSPLIT:%.*]] ]
; LEGACYPM-NEXT: ret i32 undef
;
; NEWPM-LABEL: @test1(
; NEWPM-NEXT: entry:
; NEWPM-NEXT: br label [[FOR_COND:%.*]]
; NEWPM: for.cond:
; NEWPM-NEXT: callbr void asm sideeffect "", "!i,!i,~{dirflag},~{fpsr},~{flags}"()
; NEWPM-NEXT: to label [[ASM_FALLTHROUGH_I_I:%.*]] [label [[COND_TRUE_I:%.*]], label %for.end]
; NEWPM: asm.fallthrough.i.i:
; NEWPM-NEXT: unreachable
; NEWPM: cond.true.i:
; NEWPM-NEXT: br label [[DO_BODY_I_I_DO_BODY_I_I_CRIT_EDGE:%.*]]
; NEWPM: do.body.i.i.do.body.i.i_crit_edge:
; NEWPM-NEXT: br i1 true, label [[DO_BODY_I_I_RDRAND_INT_EXIT_I_CRIT_EDGE:%.*]], label [[DO_BODY_I_I_DO_BODY_I_I_CRIT_EDGE]]
; NEWPM: do.body.i.i.rdrand_int.exit.i_crit_edge:
; NEWPM-NEXT: [[TMP0:%.*]] = add i64 1, undef
; NEWPM-NEXT: br i1 true, label [[FOR_END:%.*]], label [[FOR_INC:%.*]]
; NEWPM: for.inc:
; NEWPM-NEXT: br label [[FOR_COND]]
; NEWPM: for.end:
; NEWPM-NEXT: [[PGOCOUNT_PROMOTED24:%.*]] = phi i64 [ undef, [[FOR_COND]] ], [ [[TMP0]], [[DO_BODY_I_I_RDRAND_INT_EXIT_I_CRIT_EDGE]] ]
; NEWPM-NEXT: ret i32 undef
;
entry:
br label %for.cond
for.cond: ; preds = %for.inc, %entry
; It's ok to modify this test in the future should we be able to split critical
; edges here, just noting that this is the critical edge that we care about.
callbr void asm sideeffect "", "!i,!i,~{dirflag},~{fpsr},~{flags}"()
to label %asm.fallthrough.i.i [label %cond.true.i, label %for.end]
asm.fallthrough.i.i: ; preds = %for.cond
unreachable
cond.true.i: ; preds = %for.cond
br label %do.body.i.i.do.body.i.i_crit_edge
do.body.i.i.do.body.i.i_crit_edge: ; preds = %do.body.i.i.do.body.i.i_crit_edge, %cond.true.i
%pgocount711 = phi i64 [ %0, %do.body.i.i.do.body.i.i_crit_edge ], [ 0, %cond.true.i ]
%0 = add nuw nsw i64 %pgocount711, 1
br i1 undef, label %do.body.i.i.rdrand_int.exit.i_crit_edge, label %do.body.i.i.do.body.i.i_crit_edge
do.body.i.i.rdrand_int.exit.i_crit_edge: ; preds = %do.body.i.i.do.body.i.i_crit_edge
%1 = add i64 %0, undef
br i1 undef, label %for.end, label %for.inc
for.inc: ; preds = %do.body.i.i.rdrand_int.exit.i_crit_edge
br label %for.cond
for.end: ; preds = %do.body.i.i.rdrand_int.exit.i_crit_edge, %for.cond
%pgocount.promoted24 = phi i64 [ undef, %for.cond ], [ %1, %do.body.i.i.rdrand_int.exit.i_crit_edge ]
ret i32 undef
}