85 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py2; RUN: opt -loop-reduce %s -o - -S | FileCheck %s --check-prefix=LEGACYPM3; RUN: opt -passes='loop(loop-reduce)' %s -o - -S | FileCheck %s --check-prefix=NEWPM4 5target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"6 7define dso_local i32 @test1() local_unnamed_addr {8; LEGACYPM-LABEL: @test1(9; LEGACYPM-NEXT: entry:10; LEGACYPM-NEXT: br label [[FOR_COND:%.*]]11; LEGACYPM: for.cond:12; LEGACYPM-NEXT: callbr void asm sideeffect "", "!i,!i,~{dirflag},~{fpsr},~{flags}"()13; LEGACYPM-NEXT: to label [[ASM_FALLTHROUGH_I_I:%.*]] [label [[COND_TRUE_I:%.*]], label %for.endsplit]14; LEGACYPM: asm.fallthrough.i.i:15; LEGACYPM-NEXT: unreachable16; LEGACYPM: cond.true.i:17; LEGACYPM-NEXT: br label [[DO_BODY_I_I_DO_BODY_I_I_CRIT_EDGE:%.*]]18; LEGACYPM: do.body.i.i.do.body.i.i_crit_edge:19; 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]]20; LEGACYPM: do.body.i.i.rdrand_int.exit.i_crit_edge:21; LEGACYPM-NEXT: br i1 true, label [[DO_BODY_I_I_RDRAND_INT_EXIT_I_CRIT_EDGE_FOR_END_CRIT_EDGE:%.*]], label [[FOR_INC:%.*]]22; LEGACYPM: do.body.i.i.rdrand_int.exit.i_crit_edge.for.end_crit_edge:23; LEGACYPM-NEXT: [[LSR_IV_NEXT_LCSSA_LCSSA:%.*]] = phi i64 [ undef, [[DO_BODY_I_I_RDRAND_INT_EXIT_I_CRIT_EDGE]] ]24; LEGACYPM-NEXT: br label [[FOR_END:%.*]]25; LEGACYPM: for.inc:26; LEGACYPM-NEXT: br label [[FOR_COND]]27; LEGACYPM: for.endsplit:28; LEGACYPM-NEXT: br label [[FOR_END]]29; LEGACYPM: for.end:30; LEGACYPM-NEXT: [[PGOCOUNT_PROMOTED24:%.*]] = phi i64 [ [[LSR_IV_NEXT_LCSSA_LCSSA]], [[DO_BODY_I_I_RDRAND_INT_EXIT_I_CRIT_EDGE_FOR_END_CRIT_EDGE]] ], [ undef, [[FOR_ENDSPLIT:%.*]] ]31; LEGACYPM-NEXT: ret i32 undef32;33; NEWPM-LABEL: @test1(34; NEWPM-NEXT: entry:35; NEWPM-NEXT: br label [[FOR_COND:%.*]]36; NEWPM: for.cond:37; NEWPM-NEXT: callbr void asm sideeffect "", "!i,!i,~{dirflag},~{fpsr},~{flags}"()38; NEWPM-NEXT: to label [[ASM_FALLTHROUGH_I_I:%.*]] [label [[COND_TRUE_I:%.*]], label %for.end]39; NEWPM: asm.fallthrough.i.i:40; NEWPM-NEXT: unreachable41; NEWPM: cond.true.i:42; NEWPM-NEXT: br label [[DO_BODY_I_I_DO_BODY_I_I_CRIT_EDGE:%.*]]43; NEWPM: do.body.i.i.do.body.i.i_crit_edge:44; 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]]45; NEWPM: do.body.i.i.rdrand_int.exit.i_crit_edge:46; NEWPM-NEXT: [[TMP0:%.*]] = add i64 1, undef47; NEWPM-NEXT: br i1 true, label [[FOR_END:%.*]], label [[FOR_INC:%.*]]48; NEWPM: for.inc:49; NEWPM-NEXT: br label [[FOR_COND]]50; NEWPM: for.end:51; NEWPM-NEXT: [[PGOCOUNT_PROMOTED24:%.*]] = phi i64 [ undef, [[FOR_COND]] ], [ [[TMP0]], [[DO_BODY_I_I_RDRAND_INT_EXIT_I_CRIT_EDGE]] ]52; NEWPM-NEXT: ret i32 undef53;54entry:55 br label %for.cond56 57for.cond: ; preds = %for.inc, %entry58; It's ok to modify this test in the future should we be able to split critical59; edges here, just noting that this is the critical edge that we care about.60 callbr void asm sideeffect "", "!i,!i,~{dirflag},~{fpsr},~{flags}"()61 to label %asm.fallthrough.i.i [label %cond.true.i, label %for.end]62 63asm.fallthrough.i.i: ; preds = %for.cond64 unreachable65 66cond.true.i: ; preds = %for.cond67 br label %do.body.i.i.do.body.i.i_crit_edge68 69do.body.i.i.do.body.i.i_crit_edge: ; preds = %do.body.i.i.do.body.i.i_crit_edge, %cond.true.i70 %pgocount711 = phi i64 [ %0, %do.body.i.i.do.body.i.i_crit_edge ], [ 0, %cond.true.i ]71 %0 = add nuw nsw i64 %pgocount711, 172 br i1 true, label %do.body.i.i.rdrand_int.exit.i_crit_edge, label %do.body.i.i.do.body.i.i_crit_edge73 74do.body.i.i.rdrand_int.exit.i_crit_edge: ; preds = %do.body.i.i.do.body.i.i_crit_edge75 %1 = add i64 %0, undef76 br i1 true, label %for.end, label %for.inc77 78for.inc: ; preds = %do.body.i.i.rdrand_int.exit.i_crit_edge79 br label %for.cond80 81for.end: ; preds = %do.body.i.i.rdrand_int.exit.i_crit_edge, %for.cond82 %pgocount.promoted24 = phi i64 [ undef, %for.cond ], [ %1, %do.body.i.i.rdrand_int.exit.i_crit_edge ]83 ret i32 undef84}85