diff --git a/llvm/test/Transforms/PhaseOrdering/reassociate-after-unroll.ll b/llvm/test/Transforms/PhaseOrdering/reassociate-after-unroll.ll index 20333a5a2f8c..17df35d3eee4 100644 --- a/llvm/test/Transforms/PhaseOrdering/reassociate-after-unroll.ll +++ b/llvm/test/Transforms/PhaseOrdering/reassociate-after-unroll.ll @@ -9,100 +9,11 @@ target triple = "powerpc64le-unknown-linux-gnu" define dso_local i64 @func(i64 %blah, i64 %limit) #0 { ; OLDPM-LABEL: @func( ; OLDPM-NEXT: entry: -; OLDPM-NEXT: [[CMP4:%.*]] = icmp eq i64 [[LIMIT:%.*]], 0 -; OLDPM-NEXT: br i1 [[CMP4]], label [[FOR_COND_CLEANUP:%.*]], label [[FOR_BODY_LR_PH:%.*]] -; OLDPM: for.body.lr.ph: -; OLDPM-NEXT: [[CONV:%.*]] = and i64 [[BLAH:%.*]], 4294967295 -; OLDPM-NEXT: [[TMP0:%.*]] = add i64 [[LIMIT]], -1 -; OLDPM-NEXT: [[XTRAITER:%.*]] = and i64 [[LIMIT]], 7 -; OLDPM-NEXT: [[TMP1:%.*]] = icmp ult i64 [[TMP0]], 7 -; OLDPM-NEXT: br i1 [[TMP1]], label [[FOR_COND_CLEANUP_LOOPEXIT_UNR_LCSSA:%.*]], label [[FOR_BODY_LR_PH_NEW:%.*]] -; OLDPM: for.body.lr.ph.new: -; OLDPM-NEXT: [[UNROLL_ITER:%.*]] = and i64 [[LIMIT]], -8 -; OLDPM-NEXT: br label [[FOR_BODY:%.*]] -; OLDPM: for.cond.cleanup.loopexit.unr-lcssa: -; OLDPM-NEXT: [[ADD_LCSSA_PH:%.*]] = phi i64 [ undef, [[FOR_BODY_LR_PH]] ], [ [[ADD_7:%.*]], [[FOR_BODY]] ] -; OLDPM-NEXT: [[K_05_UNR:%.*]] = phi i64 [ 1, [[FOR_BODY_LR_PH]] ], [ [[AND:%.*]], [[FOR_BODY]] ] -; OLDPM-NEXT: [[LCMP_MOD:%.*]] = icmp eq i64 [[XTRAITER]], 0 -; OLDPM-NEXT: br i1 [[LCMP_MOD]], label [[FOR_COND_CLEANUP]], label [[FOR_BODY_EPIL:%.*]] -; OLDPM: for.body.epil: -; OLDPM-NEXT: [[G_06_EPIL:%.*]] = phi i64 [ [[ADD_EPIL:%.*]], [[FOR_BODY_EPIL]] ], [ [[ADD_LCSSA_PH]], [[FOR_COND_CLEANUP_LOOPEXIT_UNR_LCSSA]] ] -; OLDPM-NEXT: [[K_05_EPIL:%.*]] = phi i64 [ [[AND_EPIL:%.*]], [[FOR_BODY_EPIL]] ], [ [[K_05_UNR]], [[FOR_COND_CLEANUP_LOOPEXIT_UNR_LCSSA]] ] -; OLDPM-NEXT: [[EPIL_ITER:%.*]] = phi i64 [ [[EPIL_ITER_SUB:%.*]], [[FOR_BODY_EPIL]] ], [ [[XTRAITER]], [[FOR_COND_CLEANUP_LOOPEXIT_UNR_LCSSA]] ] -; OLDPM-NEXT: [[AND_EPIL]] = and i64 [[CONV]], [[K_05_EPIL]] -; OLDPM-NEXT: [[ADD_EPIL]] = add i64 [[AND_EPIL]], [[G_06_EPIL]] -; OLDPM-NEXT: [[EPIL_ITER_SUB]] = add i64 [[EPIL_ITER]], -1 -; OLDPM-NEXT: [[EPIL_ITER_CMP:%.*]] = icmp eq i64 [[EPIL_ITER_SUB]], 0 -; OLDPM-NEXT: br i1 [[EPIL_ITER_CMP]], label [[FOR_COND_CLEANUP]], label [[FOR_BODY_EPIL]], !llvm.loop !0 -; OLDPM: for.cond.cleanup: -; OLDPM-NEXT: [[G_0_LCSSA:%.*]] = phi i64 [ undef, [[ENTRY:%.*]] ], [ [[ADD_LCSSA_PH]], [[FOR_COND_CLEANUP_LOOPEXIT_UNR_LCSSA]] ], [ [[ADD_EPIL]], [[FOR_BODY_EPIL]] ] -; OLDPM-NEXT: ret i64 [[G_0_LCSSA]] -; OLDPM: for.body: -; OLDPM-NEXT: [[G_06:%.*]] = phi i64 [ undef, [[FOR_BODY_LR_PH_NEW]] ], [ [[ADD_7]], [[FOR_BODY]] ] -; OLDPM-NEXT: [[K_05:%.*]] = phi i64 [ 1, [[FOR_BODY_LR_PH_NEW]] ], [ [[AND]], [[FOR_BODY]] ] -; OLDPM-NEXT: [[NITER:%.*]] = phi i64 [ [[UNROLL_ITER]], [[FOR_BODY_LR_PH_NEW]] ], [ [[NITER_NSUB_7:%.*]], [[FOR_BODY]] ] -; OLDPM-NEXT: [[AND]] = and i64 [[CONV]], [[K_05]] -; OLDPM-NEXT: [[REASS_ADD:%.*]] = shl nuw nsw i64 [[AND]], 1 -; OLDPM-NEXT: [[ADD_1:%.*]] = add i64 [[G_06]], [[REASS_ADD]] -; OLDPM-NEXT: [[REASS_ADD9:%.*]] = shl nuw nsw i64 [[AND]], 1 -; OLDPM-NEXT: [[ADD_3:%.*]] = add i64 [[ADD_1]], [[REASS_ADD9]] -; OLDPM-NEXT: [[REASS_ADD10:%.*]] = shl nuw nsw i64 [[AND]], 1 -; OLDPM-NEXT: [[ADD_5:%.*]] = add i64 [[ADD_3]], [[REASS_ADD10]] -; OLDPM-NEXT: [[REASS_ADD11:%.*]] = shl nuw nsw i64 [[AND]], 1 -; OLDPM-NEXT: [[ADD_7]] = add i64 [[ADD_5]], [[REASS_ADD11]] -; OLDPM-NEXT: [[NITER_NSUB_7]] = add i64 [[NITER]], -8 -; OLDPM-NEXT: [[NITER_NCMP_7:%.*]] = icmp eq i64 [[NITER_NSUB_7]], 0 -; OLDPM-NEXT: br i1 [[NITER_NCMP_7]], label [[FOR_COND_CLEANUP_LOOPEXIT_UNR_LCSSA]], label [[FOR_BODY]] +; OLDPM-NEXT: ret i64 undef ; ; NEWPM-LABEL: @func( ; NEWPM-NEXT: entry: -; NEWPM-NEXT: [[CMP4:%.*]] = icmp eq i64 [[LIMIT:%.*]], 0 -; NEWPM-NEXT: br i1 [[CMP4]], label [[FOR_COND_CLEANUP:%.*]], label [[FOR_BODY_LR_PH:%.*]] -; NEWPM: for.body.lr.ph: -; NEWPM-NEXT: [[CONV:%.*]] = and i64 [[BLAH:%.*]], 4294967295 -; NEWPM-NEXT: [[TMP0:%.*]] = add i64 [[LIMIT]], -1 -; NEWPM-NEXT: [[XTRAITER:%.*]] = and i64 [[LIMIT]], 7 -; NEWPM-NEXT: [[TMP1:%.*]] = icmp ult i64 [[TMP0]], 7 -; NEWPM-NEXT: br i1 [[TMP1]], label [[FOR_COND_CLEANUP_LOOPEXIT_UNR_LCSSA:%.*]], label [[FOR_BODY_LR_PH_NEW:%.*]] -; NEWPM: for.body.lr.ph.new: -; NEWPM-NEXT: [[UNROLL_ITER:%.*]] = and i64 [[LIMIT]], -8 -; NEWPM-NEXT: [[AND_0:%.*]] = and i64 [[CONV]], 1 -; NEWPM-NEXT: br label [[FOR_BODY:%.*]] -; NEWPM: for.cond.cleanup.loopexit.unr-lcssa: -; NEWPM-NEXT: [[ADD_LCSSA_PH:%.*]] = phi i64 [ undef, [[FOR_BODY_LR_PH]] ], [ [[ADD_7:%.*]], [[FOR_BODY]] ] -; NEWPM-NEXT: [[K_05_UNR:%.*]] = phi i64 [ 1, [[FOR_BODY_LR_PH]] ], [ [[AND_PHI:%.*]], [[FOR_BODY]] ] -; NEWPM-NEXT: [[LCMP_MOD:%.*]] = icmp eq i64 [[XTRAITER]], 0 -; NEWPM-NEXT: br i1 [[LCMP_MOD]], label [[FOR_COND_CLEANUP]], label [[FOR_BODY_EPIL:%.*]] -; NEWPM: for.body.epil: -; NEWPM-NEXT: [[G_06_EPIL:%.*]] = phi i64 [ [[ADD_EPIL:%.*]], [[FOR_BODY_EPIL]] ], [ [[ADD_LCSSA_PH]], [[FOR_COND_CLEANUP_LOOPEXIT_UNR_LCSSA]] ] -; NEWPM-NEXT: [[K_05_EPIL:%.*]] = phi i64 [ [[AND_EPIL:%.*]], [[FOR_BODY_EPIL]] ], [ [[K_05_UNR]], [[FOR_COND_CLEANUP_LOOPEXIT_UNR_LCSSA]] ] -; NEWPM-NEXT: [[EPIL_ITER:%.*]] = phi i64 [ [[EPIL_ITER_SUB:%.*]], [[FOR_BODY_EPIL]] ], [ [[XTRAITER]], [[FOR_COND_CLEANUP_LOOPEXIT_UNR_LCSSA]] ] -; NEWPM-NEXT: [[AND_EPIL]] = and i64 [[CONV]], [[K_05_EPIL]] -; NEWPM-NEXT: [[ADD_EPIL]] = add i64 [[AND_EPIL]], [[G_06_EPIL]] -; NEWPM-NEXT: [[EPIL_ITER_SUB]] = add i64 [[EPIL_ITER]], -1 -; NEWPM-NEXT: [[EPIL_ITER_CMP:%.*]] = icmp eq i64 [[EPIL_ITER_SUB]], 0 -; NEWPM-NEXT: br i1 [[EPIL_ITER_CMP]], label [[FOR_COND_CLEANUP]], label [[FOR_BODY_EPIL]], !llvm.loop !0 -; NEWPM: for.cond.cleanup: -; NEWPM-NEXT: [[G_0_LCSSA:%.*]] = phi i64 [ undef, [[ENTRY:%.*]] ], [ [[ADD_LCSSA_PH]], [[FOR_COND_CLEANUP_LOOPEXIT_UNR_LCSSA]] ], [ [[ADD_EPIL]], [[FOR_BODY_EPIL]] ] -; NEWPM-NEXT: ret i64 [[G_0_LCSSA]] -; NEWPM: for.body: -; NEWPM-NEXT: [[G_06:%.*]] = phi i64 [ undef, [[FOR_BODY_LR_PH_NEW]] ], [ [[ADD_7]], [[FOR_BODY_FOR_BODY_CRIT_EDGE:%.*]] ] -; NEWPM-NEXT: [[AND_PHI]] = phi i64 [ [[AND_0]], [[FOR_BODY_LR_PH_NEW]] ], [ [[AND_1:%.*]], [[FOR_BODY_FOR_BODY_CRIT_EDGE]] ] -; NEWPM-NEXT: [[NITER:%.*]] = phi i64 [ [[UNROLL_ITER]], [[FOR_BODY_LR_PH_NEW]] ], [ [[NITER_NSUB_7:%.*]], [[FOR_BODY_FOR_BODY_CRIT_EDGE]] ] -; NEWPM-NEXT: [[REASS_ADD:%.*]] = shl nuw nsw i64 [[AND_PHI]], 1 -; NEWPM-NEXT: [[ADD_1:%.*]] = add i64 [[G_06]], [[REASS_ADD]] -; NEWPM-NEXT: [[REASS_ADD9:%.*]] = shl nuw nsw i64 [[AND_PHI]], 1 -; NEWPM-NEXT: [[ADD_3:%.*]] = add i64 [[ADD_1]], [[REASS_ADD9]] -; NEWPM-NEXT: [[REASS_ADD10:%.*]] = shl nuw nsw i64 [[AND_PHI]], 1 -; NEWPM-NEXT: [[ADD_5:%.*]] = add i64 [[ADD_3]], [[REASS_ADD10]] -; NEWPM-NEXT: [[REASS_ADD11:%.*]] = shl nuw nsw i64 [[AND_PHI]], 1 -; NEWPM-NEXT: [[ADD_7]] = add i64 [[ADD_5]], [[REASS_ADD11]] -; NEWPM-NEXT: [[NITER_NSUB_7]] = add i64 [[NITER]], -8 -; NEWPM-NEXT: [[NITER_NCMP_7:%.*]] = icmp eq i64 [[NITER_NSUB_7]], 0 -; NEWPM-NEXT: br i1 [[NITER_NCMP_7]], label [[FOR_COND_CLEANUP_LOOPEXIT_UNR_LCSSA]], label [[FOR_BODY_FOR_BODY_CRIT_EDGE]] -; NEWPM: for.body.for.body_crit_edge: -; NEWPM-NEXT: [[AND_1]] = and i64 [[CONV]], [[AND_PHI]] -; NEWPM-NEXT: br label [[FOR_BODY]] +; NEWPM-NEXT: ret i64 undef ; entry: %blah.addr = alloca i64, align 8