forked from OSchip/llvm-project
[LV] Unconditionally branch from middle to scalar preheader if the scalar loop must execute
This is a resubmit of 3e5ce4 (which was reverted by7fe41ac
). The original commit caused a PPC build bot failure we never really got to the bottom of. I can't reproduce the issue, and the bot owner was non-responsive. In the meantime, we stumbled across an issue which seems possibly related, and worked around a latent bug in80e8025
. My best guess is that the original patch exposed that latent issue at higher frequency, but it really is just a guess. Original commit message follows... If we know that the scalar epilogue is required to run, modify the CFG to end the middle block with an unconditional branch to scalar preheader. This is instead of a conditional branch to either the preheader or the exit block. The motivation to do this is to support multiple exit blocks. Specifically, the current structure forces us to identify immediate dominators and *which* exit block to branch from in the middle terminator. For the multiple exit case - where we know require scalar will hold - these questions are ill formed. This is the last change needed to support multiple exit loops, but since the diffs are already large enough, I'm going to land this, and then enable separately. You can think of this as being NFCIish prep work, but the changes are a bit too involved for me to feel comfortable tagging the review that way. Differential Revision: https://reviews.llvm.org/D94892
This commit is contained in:
parent
3cf7983cbe
commit
c23ce54b36
|
@ -44,11 +44,11 @@ LoopVersioning::LoopVersioning(const LoopAccessInfo &LAI,
|
|||
AliasChecks(Checks.begin(), Checks.end()),
|
||||
Preds(LAI.getPSE().getUnionPredicate()), LAI(LAI), LI(LI), DT(DT),
|
||||
SE(SE) {
|
||||
assert(L->getUniqueExitBlock() && "No single exit block");
|
||||
}
|
||||
|
||||
void LoopVersioning::versionLoop(
|
||||
const SmallVectorImpl<Instruction *> &DefsUsedOutside) {
|
||||
assert(VersionedLoop->getUniqueExitBlock() && "No single exit block");
|
||||
assert(VersionedLoop->isLoopSimplifyForm() &&
|
||||
"Loop is not in loop-simplify form");
|
||||
|
||||
|
|
|
@ -819,7 +819,7 @@ protected:
|
|||
/// Middle Block between the vector and the scalar.
|
||||
BasicBlock *LoopMiddleBlock;
|
||||
|
||||
/// The (unique) ExitBlock of the scalar loop. Note that
|
||||
/// The unique ExitBlock of the scalar loop if one exists. Note that
|
||||
/// there can be multiple exiting edges reaching this block.
|
||||
BasicBlock *LoopExitBlock;
|
||||
|
||||
|
@ -3249,9 +3249,13 @@ void InnerLoopVectorizer::emitMinimumIterationCountCheck(Loop *L,
|
|||
DT->getNode(Bypass)->getIDom()) &&
|
||||
"TC check is expected to dominate Bypass");
|
||||
|
||||
// Update dominator for Bypass & LoopExit.
|
||||
// Update dominator for Bypass & LoopExit (if needed).
|
||||
DT->changeImmediateDominator(Bypass, TCCheckBlock);
|
||||
DT->changeImmediateDominator(LoopExitBlock, TCCheckBlock);
|
||||
if (!Cost->requiresScalarEpilogue())
|
||||
// If there is an epilogue which must run, there's no edge from the
|
||||
// middle block to exit blocks and thus no need to update the immediate
|
||||
// dominator of the exit blocks.
|
||||
DT->changeImmediateDominator(LoopExitBlock, TCCheckBlock);
|
||||
|
||||
ReplaceInstWithInst(
|
||||
TCCheckBlock->getTerminator(),
|
||||
|
@ -3275,7 +3279,11 @@ BasicBlock *InnerLoopVectorizer::emitSCEVChecks(Loop *L, BasicBlock *Bypass) {
|
|||
// Update dominator only if this is first RT check.
|
||||
if (LoopBypassBlocks.empty()) {
|
||||
DT->changeImmediateDominator(Bypass, SCEVCheckBlock);
|
||||
DT->changeImmediateDominator(LoopExitBlock, SCEVCheckBlock);
|
||||
if (!Cost->requiresScalarEpilogue())
|
||||
// If there is an epilogue which must run, there's no edge from the
|
||||
// middle block to exit blocks and thus no need to update the immediate
|
||||
// dominator of the exit blocks.
|
||||
DT->changeImmediateDominator(LoopExitBlock, SCEVCheckBlock);
|
||||
}
|
||||
|
||||
LoopBypassBlocks.push_back(SCEVCheckBlock);
|
||||
|
@ -3428,9 +3436,10 @@ Value *InnerLoopVectorizer::emitTransformedIndex(
|
|||
Loop *InnerLoopVectorizer::createVectorLoopSkeleton(StringRef Prefix) {
|
||||
LoopScalarBody = OrigLoop->getHeader();
|
||||
LoopVectorPreHeader = OrigLoop->getLoopPreheader();
|
||||
LoopExitBlock = OrigLoop->getUniqueExitBlock();
|
||||
assert(LoopExitBlock && "Must have an exit block");
|
||||
assert(LoopVectorPreHeader && "Invalid loop structure");
|
||||
LoopExitBlock = OrigLoop->getUniqueExitBlock(); // may be nullptr
|
||||
assert((LoopExitBlock || Cost->requiresScalarEpilogue()) &&
|
||||
"multiple exit loop without required epilogue?");
|
||||
|
||||
LoopMiddleBlock =
|
||||
SplitBlock(LoopVectorPreHeader, LoopVectorPreHeader->getTerminator(), DT,
|
||||
|
@ -3439,12 +3448,20 @@ Loop *InnerLoopVectorizer::createVectorLoopSkeleton(StringRef Prefix) {
|
|||
SplitBlock(LoopMiddleBlock, LoopMiddleBlock->getTerminator(), DT, LI,
|
||||
nullptr, Twine(Prefix) + "scalar.ph");
|
||||
|
||||
// Set up branch from middle block to the exit and scalar preheader blocks.
|
||||
// completeLoopSkeleton will update the condition to use an iteration check,
|
||||
// if required to decide whether to execute the remainder.
|
||||
BranchInst *BrInst =
|
||||
BranchInst::Create(LoopExitBlock, LoopScalarPreHeader, Builder.getTrue());
|
||||
auto *ScalarLatchTerm = OrigLoop->getLoopLatch()->getTerminator();
|
||||
|
||||
// Set up the middle block terminator. Two cases:
|
||||
// 1) If we know that we must execute the scalar epilogue, emit an
|
||||
// unconditional branch.
|
||||
// 2) Otherwise, we must have a single unique exit block (due to how we
|
||||
// implement the multiple exit case). In this case, set up a conditonal
|
||||
// branch from the middle block to the loop scalar preheader, and the
|
||||
// exit block. completeLoopSkeleton will update the condition to use an
|
||||
// iteration check, if required to decide whether to execute the remainder.
|
||||
BranchInst *BrInst = Cost->requiresScalarEpilogue() ?
|
||||
BranchInst::Create(LoopScalarPreHeader) :
|
||||
BranchInst::Create(LoopExitBlock, LoopScalarPreHeader,
|
||||
Builder.getTrue());
|
||||
BrInst->setDebugLoc(ScalarLatchTerm->getDebugLoc());
|
||||
ReplaceInstWithInst(LoopMiddleBlock->getTerminator(), BrInst);
|
||||
|
||||
|
@ -3456,7 +3473,11 @@ Loop *InnerLoopVectorizer::createVectorLoopSkeleton(StringRef Prefix) {
|
|||
nullptr, nullptr, Twine(Prefix) + "vector.body");
|
||||
|
||||
// Update dominator for loop exit.
|
||||
DT->changeImmediateDominator(LoopExitBlock, LoopMiddleBlock);
|
||||
if (!Cost->requiresScalarEpilogue())
|
||||
// If there is an epilogue which must run, there's no edge from the
|
||||
// middle block to exit blocks and thus no need to update the immediate
|
||||
// dominator of the exit blocks.
|
||||
DT->changeImmediateDominator(LoopExitBlock, LoopMiddleBlock);
|
||||
|
||||
// Create and register the new vector loop.
|
||||
Loop *Lp = LI->AllocateLoop();
|
||||
|
@ -3558,10 +3579,14 @@ BasicBlock *InnerLoopVectorizer::completeLoopSkeleton(Loop *L,
|
|||
auto *ScalarLatchTerm = OrigLoop->getLoopLatch()->getTerminator();
|
||||
|
||||
// Add a check in the middle block to see if we have completed
|
||||
// all of the iterations in the first vector loop.
|
||||
// If (N - N%VF) == N, then we *don't* need to run the remainder.
|
||||
// If tail is to be folded, we know we don't need to run the remainder.
|
||||
if (!Cost->foldTailByMasking()) {
|
||||
// all of the iterations in the first vector loop. Three cases:
|
||||
// 1) If we require a scalar epilogue, there is no conditional branch as
|
||||
// we unconditionally branch to the scalar preheader. Do nothing.
|
||||
// 2) If (N - N%VF) == N, then we *don't* need to run the remainder.
|
||||
// Thus if tail is to be folded, we know we don't need to run the
|
||||
// remainder and we can use the previous value for the condition (true).
|
||||
// 3) Otherwise, construct a runtime check.
|
||||
if (!Cost->requiresScalarEpilogue() && !Cost->foldTailByMasking()) {
|
||||
Instruction *CmpN = CmpInst::Create(Instruction::ICmp, CmpInst::ICMP_EQ,
|
||||
Count, VectorTripCount, "cmp.n",
|
||||
LoopMiddleBlock->getTerminator());
|
||||
|
@ -3625,17 +3650,17 @@ BasicBlock *InnerLoopVectorizer::createVectorizedLoopSkeleton() {
|
|||
| [ ]_| <-- vector loop.
|
||||
| |
|
||||
| v
|
||||
| -[ ] <--- middle-block.
|
||||
| / |
|
||||
| / v
|
||||
-|- >[ ] <--- new preheader.
|
||||
\ -[ ] <--- middle-block.
|
||||
\/ |
|
||||
/\ v
|
||||
| ->[ ] <--- new preheader.
|
||||
| |
|
||||
| v
|
||||
(opt) v <-- edge from middle to exit iff epilogue is not required.
|
||||
| [ ] \
|
||||
| [ ]_| <-- old scalar loop to handle remainder.
|
||||
| [ ]_| <-- old scalar loop to handle remainder (scalar epilogue).
|
||||
\ |
|
||||
\ v
|
||||
>[ ] <-- exit block.
|
||||
>[ ] <-- exit block(s).
|
||||
...
|
||||
*/
|
||||
|
||||
|
@ -4072,13 +4097,19 @@ void InnerLoopVectorizer::fixVectorizedLoop(VPTransformState &State) {
|
|||
// Forget the original basic block.
|
||||
PSE.getSE()->forgetLoop(OrigLoop);
|
||||
|
||||
// Fix-up external users of the induction variables.
|
||||
for (auto &Entry : Legal->getInductionVars())
|
||||
fixupIVUsers(Entry.first, Entry.second,
|
||||
getOrCreateVectorTripCount(LI->getLoopFor(LoopVectorBody)),
|
||||
IVEndValues[Entry.first], LoopMiddleBlock);
|
||||
// If we inserted an edge from the middle block to the unique exit block,
|
||||
// update uses outside the loop (phis) to account for the newly inserted
|
||||
// edge.
|
||||
if (!Cost->requiresScalarEpilogue()) {
|
||||
// Fix-up external users of the induction variables.
|
||||
for (auto &Entry : Legal->getInductionVars())
|
||||
fixupIVUsers(Entry.first, Entry.second,
|
||||
getOrCreateVectorTripCount(LI->getLoopFor(LoopVectorBody)),
|
||||
IVEndValues[Entry.first], LoopMiddleBlock);
|
||||
|
||||
fixLCSSAPHIs(State);
|
||||
}
|
||||
|
||||
fixLCSSAPHIs(State);
|
||||
for (Instruction *PI : PredicatedInstructions)
|
||||
sinkScalarOperands(&*PI);
|
||||
|
||||
|
@ -4299,12 +4330,13 @@ void InnerLoopVectorizer::fixFirstOrderRecurrence(PHINode *Phi,
|
|||
// recurrence in the exit block, and then add an edge for the middle block.
|
||||
// Note that LCSSA does not imply single entry when the original scalar loop
|
||||
// had multiple exiting edges (as we always run the last iteration in the
|
||||
// scalar epilogue); in that case, the exiting path through middle will be
|
||||
// dynamically dead and the value picked for the phi doesn't matter.
|
||||
for (PHINode &LCSSAPhi : LoopExitBlock->phis())
|
||||
if (any_of(LCSSAPhi.incoming_values(),
|
||||
[Phi](Value *V) { return V == Phi; }))
|
||||
LCSSAPhi.addIncoming(ExtractForPhiUsedOutsideLoop, LoopMiddleBlock);
|
||||
// scalar epilogue); in that case, there is no edge from middle to exit and
|
||||
// and thus no phis which needed updated.
|
||||
if (!Cost->requiresScalarEpilogue())
|
||||
for (PHINode &LCSSAPhi : LoopExitBlock->phis())
|
||||
if (any_of(LCSSAPhi.incoming_values(),
|
||||
[Phi](Value *V) { return V == Phi; }))
|
||||
LCSSAPhi.addIncoming(ExtractForPhiUsedOutsideLoop, LoopMiddleBlock);
|
||||
}
|
||||
|
||||
static bool useOrderedReductions(RecurrenceDescriptor &RdxDesc) {
|
||||
|
@ -4482,10 +4514,11 @@ void InnerLoopVectorizer::fixReduction(VPWidenPHIRecipe *PhiR,
|
|||
// We know that the loop is in LCSSA form. We need to update the PHI nodes
|
||||
// in the exit blocks. See comment on analogous loop in
|
||||
// fixFirstOrderRecurrence for a more complete explaination of the logic.
|
||||
for (PHINode &LCSSAPhi : LoopExitBlock->phis())
|
||||
if (any_of(LCSSAPhi.incoming_values(),
|
||||
[LoopExitInst](Value *V) { return V == LoopExitInst; }))
|
||||
LCSSAPhi.addIncoming(ReducedPartRdx, LoopMiddleBlock);
|
||||
if (!Cost->requiresScalarEpilogue())
|
||||
for (PHINode &LCSSAPhi : LoopExitBlock->phis())
|
||||
if (any_of(LCSSAPhi.incoming_values(),
|
||||
[LoopExitInst](Value *V) { return V == LoopExitInst; }))
|
||||
LCSSAPhi.addIncoming(ReducedPartRdx, LoopMiddleBlock);
|
||||
|
||||
// Fix the scalar loop reduction variable with the incoming reduction sum
|
||||
// from the vector body and from the backedge value.
|
||||
|
@ -8290,7 +8323,11 @@ BasicBlock *EpilogueVectorizerMainLoop::emitMinimumIterationCountCheck(
|
|||
|
||||
// Update dominator for Bypass & LoopExit.
|
||||
DT->changeImmediateDominator(Bypass, TCCheckBlock);
|
||||
DT->changeImmediateDominator(LoopExitBlock, TCCheckBlock);
|
||||
if (!Cost->requiresScalarEpilogue())
|
||||
// For loops with multiple exits, there's no edge from the middle block
|
||||
// to exit blocks (as the epilogue must run) and thus no need to update
|
||||
// the immediate dominator of the exit blocks.
|
||||
DT->changeImmediateDominator(LoopExitBlock, TCCheckBlock);
|
||||
|
||||
LoopBypassBlocks.push_back(TCCheckBlock);
|
||||
|
||||
|
@ -8354,7 +8391,12 @@ EpilogueVectorizerEpilogueLoop::createEpilogueVectorizedLoopSkeleton() {
|
|||
|
||||
DT->changeImmediateDominator(LoopScalarPreHeader,
|
||||
EPI.EpilogueIterationCountCheck);
|
||||
DT->changeImmediateDominator(LoopExitBlock, EPI.EpilogueIterationCountCheck);
|
||||
if (!Cost->requiresScalarEpilogue())
|
||||
// If there is an epilogue which must run, there's no edge from the
|
||||
// middle block to exit blocks and thus no need to update the immediate
|
||||
// dominator of the exit blocks.
|
||||
DT->changeImmediateDominator(LoopExitBlock,
|
||||
EPI.EpilogueIterationCountCheck);
|
||||
|
||||
// Keep track of bypass blocks, as they feed start values to the induction
|
||||
// phis in the scalar loop preheader.
|
||||
|
|
|
@ -38,7 +38,7 @@ define void @can_sink_after_store(i32 %x, i32* %ptr, i64 %tc) local_unnamed_addr
|
|||
; CHECK-NEXT: store <4 x i32> [[TMP6]], <4 x i32>* [[TMP9]], align 4
|
||||
; CHECK-NEXT: [[INDEX_NEXT]] = add i64 [[INDEX]], 4
|
||||
; CHECK-NEXT: [[TMP10:%.*]] = icmp eq i64 [[INDEX_NEXT]], 1996
|
||||
; CHECK-NEXT: br i1 [[TMP10]], label [[MIDDLE_BLOCK:%.*]], label [[VECTOR_BODY]], [[LOOP0:!llvm.loop !.*]]
|
||||
; CHECK-NEXT: br i1 [[TMP10]], label [[MIDDLE_BLOCK:%.*]], label [[VECTOR_BODY]], !llvm.loop [[LOOP0:![0-9]+]]
|
||||
; CHECK: middle.block:
|
||||
; CHECK-NEXT: [[CMP_N:%.*]] = icmp eq i64 1999, 1996
|
||||
; CHECK-NEXT: [[VECTOR_RECUR_EXTRACT:%.*]] = extractelement <4 x i32> [[WIDE_LOAD]], i32 3
|
||||
|
@ -59,7 +59,7 @@ define void @can_sink_after_store(i32 %x, i32* %ptr, i64 %tc) local_unnamed_addr
|
|||
; CHECK-NEXT: store i32 [[ADD_2]], i32* [[IDX_2]], align 4
|
||||
; CHECK-NEXT: [[IV_NEXT]] = add nuw nsw i64 [[IV]], 1
|
||||
; CHECK-NEXT: [[EXITCOND:%.*]] = icmp eq i64 [[IV_NEXT]], 2000
|
||||
; CHECK-NEXT: br i1 [[EXITCOND]], label [[EXIT]], label [[FOR]], [[LOOP2:!llvm.loop !.*]]
|
||||
; CHECK-NEXT: br i1 [[EXITCOND]], label [[EXIT]], label [[FOR]], !llvm.loop [[LOOP2:![0-9]+]]
|
||||
; CHECK: exit:
|
||||
; CHECK-NEXT: ret void
|
||||
;
|
||||
|
@ -122,7 +122,7 @@ define void @sink_sdiv(i32 %x, i32* %ptr, i64 %tc) local_unnamed_addr #0 {
|
|||
; CHECK-NEXT: store <4 x i32> [[TMP6]], <4 x i32>* [[TMP9]], align 4
|
||||
; CHECK-NEXT: [[INDEX_NEXT]] = add i64 [[INDEX]], 4
|
||||
; CHECK-NEXT: [[TMP10:%.*]] = icmp eq i64 [[INDEX_NEXT]], 1996
|
||||
; CHECK-NEXT: br i1 [[TMP10]], label [[MIDDLE_BLOCK:%.*]], label [[VECTOR_BODY]], [[LOOP4:!llvm.loop !.*]]
|
||||
; CHECK-NEXT: br i1 [[TMP10]], label [[MIDDLE_BLOCK:%.*]], label [[VECTOR_BODY]], !llvm.loop [[LOOP4:![0-9]+]]
|
||||
; CHECK: middle.block:
|
||||
; CHECK-NEXT: [[CMP_N:%.*]] = icmp eq i64 1999, 1996
|
||||
; CHECK-NEXT: [[VECTOR_RECUR_EXTRACT:%.*]] = extractelement <4 x i32> [[WIDE_LOAD]], i32 3
|
||||
|
@ -143,7 +143,7 @@ define void @sink_sdiv(i32 %x, i32* %ptr, i64 %tc) local_unnamed_addr #0 {
|
|||
; CHECK-NEXT: store i32 [[ADD_2]], i32* [[IDX_2]], align 4
|
||||
; CHECK-NEXT: [[IV_NEXT]] = add nuw nsw i64 [[IV]], 1
|
||||
; CHECK-NEXT: [[EXITCOND:%.*]] = icmp eq i64 [[IV_NEXT]], 2000
|
||||
; CHECK-NEXT: br i1 [[EXITCOND]], label [[EXIT]], label [[FOR]], [[LOOP5:!llvm.loop !.*]]
|
||||
; CHECK-NEXT: br i1 [[EXITCOND]], label [[EXIT]], label [[FOR]], !llvm.loop [[LOOP5:![0-9]+]]
|
||||
; CHECK: exit:
|
||||
; CHECK-NEXT: ret void
|
||||
;
|
||||
|
@ -467,12 +467,11 @@ define i16 @multiple_exit(i16* %p, i32 %n) {
|
|||
; CHECK-NEXT: [[INDEX_NEXT]] = add i32 [[INDEX]], 4
|
||||
; CHECK-NEXT: [[VEC_IND_NEXT]] = add <4 x i32> [[VEC_IND]], <i32 4, i32 4, i32 4, i32 4>
|
||||
; CHECK-NEXT: [[TMP13:%.*]] = icmp eq i32 [[INDEX_NEXT]], [[N_VEC]]
|
||||
; CHECK-NEXT: br i1 [[TMP13]], label [[MIDDLE_BLOCK:%.*]], label [[VECTOR_BODY]], [[LOOP6:!llvm.loop !.*]]
|
||||
; CHECK-NEXT: br i1 [[TMP13]], label [[MIDDLE_BLOCK:%.*]], label [[VECTOR_BODY]], !llvm.loop [[LOOP6:![0-9]+]]
|
||||
; CHECK: middle.block:
|
||||
; CHECK-NEXT: [[CMP_N:%.*]] = icmp eq i32 [[TMP0]], [[N_VEC]]
|
||||
; CHECK-NEXT: [[VECTOR_RECUR_EXTRACT:%.*]] = extractelement <4 x i16> [[WIDE_LOAD]], i32 3
|
||||
; CHECK-NEXT: [[VECTOR_RECUR_EXTRACT_FOR_PHI:%.*]] = extractelement <4 x i16> [[WIDE_LOAD]], i32 2
|
||||
; CHECK-NEXT: br i1 [[CMP_N]], label [[IF_END:%.*]], label [[SCALAR_PH]]
|
||||
; CHECK-NEXT: br label [[SCALAR_PH]]
|
||||
; CHECK: scalar.ph:
|
||||
; CHECK-NEXT: [[SCALAR_RECUR_INIT:%.*]] = phi i16 [ 0, [[ENTRY:%.*]] ], [ [[VECTOR_RECUR_EXTRACT]], [[MIDDLE_BLOCK]] ]
|
||||
; CHECK-NEXT: [[BC_RESUME_VAL:%.*]] = phi i32 [ [[N_VEC]], [[MIDDLE_BLOCK]] ], [ 0, [[ENTRY]] ]
|
||||
|
@ -484,14 +483,14 @@ define i16 @multiple_exit(i16* %p, i32 %n) {
|
|||
; CHECK-NEXT: [[B:%.*]] = getelementptr inbounds i16, i16* [[P]], i64 [[IPROM]]
|
||||
; CHECK-NEXT: [[REC_NEXT]] = load i16, i16* [[B]], align 2
|
||||
; CHECK-NEXT: [[CMP:%.*]] = icmp slt i32 [[I]], [[N]]
|
||||
; CHECK-NEXT: br i1 [[CMP]], label [[FOR_BODY]], label [[IF_END]]
|
||||
; CHECK-NEXT: br i1 [[CMP]], label [[FOR_BODY]], label [[IF_END:%.*]]
|
||||
; CHECK: for.body:
|
||||
; CHECK-NEXT: store i16 [[SCALAR_RECUR]], i16* [[B]], align 4
|
||||
; CHECK-NEXT: [[INC]] = add nsw i32 [[I]], 1
|
||||
; CHECK-NEXT: [[CMP2:%.*]] = icmp slt i32 [[I]], 2096
|
||||
; CHECK-NEXT: br i1 [[CMP2]], label [[FOR_COND]], label [[IF_END]], [[LOOP7:!llvm.loop !.*]]
|
||||
; CHECK-NEXT: br i1 [[CMP2]], label [[FOR_COND]], label [[IF_END]], !llvm.loop [[LOOP7:![0-9]+]]
|
||||
; CHECK: if.end:
|
||||
; CHECK-NEXT: [[REC_LCSSA:%.*]] = phi i16 [ [[SCALAR_RECUR]], [[FOR_BODY]] ], [ [[SCALAR_RECUR]], [[FOR_COND]] ], [ [[VECTOR_RECUR_EXTRACT_FOR_PHI]], [[MIDDLE_BLOCK]] ]
|
||||
; CHECK-NEXT: [[REC_LCSSA:%.*]] = phi i16 [ [[SCALAR_RECUR]], [[FOR_BODY]] ], [ [[SCALAR_RECUR]], [[FOR_COND]] ]
|
||||
; CHECK-NEXT: ret i16 [[REC_LCSSA]]
|
||||
;
|
||||
entry:
|
||||
|
@ -552,12 +551,11 @@ define i16 @multiple_exit2(i16* %p, i32 %n) {
|
|||
; CHECK-NEXT: [[INDEX_NEXT]] = add i32 [[INDEX]], 4
|
||||
; CHECK-NEXT: [[VEC_IND_NEXT]] = add <4 x i32> [[VEC_IND]], <i32 4, i32 4, i32 4, i32 4>
|
||||
; CHECK-NEXT: [[TMP13:%.*]] = icmp eq i32 [[INDEX_NEXT]], [[N_VEC]]
|
||||
; CHECK-NEXT: br i1 [[TMP13]], label [[MIDDLE_BLOCK:%.*]], label [[VECTOR_BODY]], [[LOOP8:!llvm.loop !.*]]
|
||||
; CHECK-NEXT: br i1 [[TMP13]], label [[MIDDLE_BLOCK:%.*]], label [[VECTOR_BODY]], !llvm.loop [[LOOP8:![0-9]+]]
|
||||
; CHECK: middle.block:
|
||||
; CHECK-NEXT: [[CMP_N:%.*]] = icmp eq i32 [[TMP0]], [[N_VEC]]
|
||||
; CHECK-NEXT: [[VECTOR_RECUR_EXTRACT:%.*]] = extractelement <4 x i16> [[WIDE_LOAD]], i32 3
|
||||
; CHECK-NEXT: [[VECTOR_RECUR_EXTRACT_FOR_PHI:%.*]] = extractelement <4 x i16> [[WIDE_LOAD]], i32 2
|
||||
; CHECK-NEXT: br i1 [[CMP_N]], label [[IF_END:%.*]], label [[SCALAR_PH]]
|
||||
; CHECK-NEXT: br label [[SCALAR_PH]]
|
||||
; CHECK: scalar.ph:
|
||||
; CHECK-NEXT: [[SCALAR_RECUR_INIT:%.*]] = phi i16 [ 0, [[ENTRY:%.*]] ], [ [[VECTOR_RECUR_EXTRACT]], [[MIDDLE_BLOCK]] ]
|
||||
; CHECK-NEXT: [[BC_RESUME_VAL:%.*]] = phi i32 [ [[N_VEC]], [[MIDDLE_BLOCK]] ], [ 0, [[ENTRY]] ]
|
||||
|
@ -569,14 +567,14 @@ define i16 @multiple_exit2(i16* %p, i32 %n) {
|
|||
; CHECK-NEXT: [[B:%.*]] = getelementptr inbounds i16, i16* [[P]], i64 [[IPROM]]
|
||||
; CHECK-NEXT: [[REC_NEXT]] = load i16, i16* [[B]], align 2
|
||||
; CHECK-NEXT: [[CMP:%.*]] = icmp slt i32 [[I]], [[N]]
|
||||
; CHECK-NEXT: br i1 [[CMP]], label [[FOR_BODY]], label [[IF_END]]
|
||||
; CHECK-NEXT: br i1 [[CMP]], label [[FOR_BODY]], label [[IF_END:%.*]]
|
||||
; CHECK: for.body:
|
||||
; CHECK-NEXT: store i16 [[SCALAR_RECUR]], i16* [[B]], align 4
|
||||
; CHECK-NEXT: [[INC]] = add nsw i32 [[I]], 1
|
||||
; CHECK-NEXT: [[CMP2:%.*]] = icmp slt i32 [[I]], 2096
|
||||
; CHECK-NEXT: br i1 [[CMP2]], label [[FOR_COND]], label [[IF_END]], [[LOOP9:!llvm.loop !.*]]
|
||||
; CHECK-NEXT: br i1 [[CMP2]], label [[FOR_COND]], label [[IF_END]], !llvm.loop [[LOOP9:![0-9]+]]
|
||||
; CHECK: if.end:
|
||||
; CHECK-NEXT: [[REC_LCSSA:%.*]] = phi i16 [ [[SCALAR_RECUR]], [[FOR_COND]] ], [ 10, [[FOR_BODY]] ], [ [[VECTOR_RECUR_EXTRACT_FOR_PHI]], [[MIDDLE_BLOCK]] ]
|
||||
; CHECK-NEXT: [[REC_LCSSA:%.*]] = phi i16 [ [[SCALAR_RECUR]], [[FOR_COND]] ], [ 10, [[FOR_BODY]] ]
|
||||
; CHECK-NEXT: ret i16 [[REC_LCSSA]]
|
||||
;
|
||||
entry:
|
||||
|
|
|
@ -443,7 +443,7 @@ define void @even_load_static_tc(i32* noalias nocapture readonly %A, i32* noalia
|
|||
; CHECK-NEXT: [[TMP6:%.*]] = icmp eq i64 [[INDEX_NEXT]], 508
|
||||
; CHECK-NEXT: br i1 [[TMP6]], label [[MIDDLE_BLOCK:%.*]], label [[VECTOR_BODY]], !llvm.loop [[LOOP12:![0-9]+]]
|
||||
; CHECK: middle.block:
|
||||
; CHECK-NEXT: br i1 false, label [[FOR_COND_CLEANUP:%.*]], label [[SCALAR_PH]]
|
||||
; CHECK-NEXT: br label [[SCALAR_PH]]
|
||||
; CHECK: scalar.ph:
|
||||
; CHECK-NEXT: [[BC_RESUME_VAL:%.*]] = phi i64 [ 1016, [[MIDDLE_BLOCK]] ], [ 0, [[ENTRY:%.*]] ]
|
||||
; CHECK-NEXT: br label [[FOR_BODY:%.*]]
|
||||
|
@ -459,7 +459,7 @@ define void @even_load_static_tc(i32* noalias nocapture readonly %A, i32* noalia
|
|||
; CHECK-NEXT: store i32 [[MUL]], i32* [[ARRAYIDX2]], align 4
|
||||
; CHECK-NEXT: [[INDVARS_IV_NEXT]] = add nuw nsw i64 [[INDVARS_IV]], 2
|
||||
; CHECK-NEXT: [[CMP:%.*]] = icmp ult i64 [[INDVARS_IV]], 1022
|
||||
; CHECK-NEXT: br i1 [[CMP]], label [[FOR_BODY]], label [[FOR_COND_CLEANUP]], !llvm.loop [[LOOP13:![0-9]+]]
|
||||
; CHECK-NEXT: br i1 [[CMP]], label [[FOR_BODY]], label [[FOR_COND_CLEANUP:%.*]], !llvm.loop [[LOOP13:![0-9]+]]
|
||||
;
|
||||
entry:
|
||||
br label %for.body
|
||||
|
@ -523,7 +523,7 @@ define void @even_load_dynamic_tc(i32* noalias nocapture readonly %A, i32* noali
|
|||
; CHECK-NEXT: [[TMP11:%.*]] = icmp eq i64 [[INDEX_NEXT]], [[N_VEC]]
|
||||
; CHECK-NEXT: br i1 [[TMP11]], label [[MIDDLE_BLOCK:%.*]], label [[VECTOR_BODY]], !llvm.loop [[LOOP14:![0-9]+]]
|
||||
; CHECK: middle.block:
|
||||
; CHECK-NEXT: br i1 false, label [[FOR_COND_CLEANUP:%.*]], label [[SCALAR_PH]]
|
||||
; CHECK-NEXT: br label [[SCALAR_PH]]
|
||||
; CHECK: scalar.ph:
|
||||
; CHECK-NEXT: [[BC_RESUME_VAL:%.*]] = phi i64 [ [[IND_END]], [[MIDDLE_BLOCK]] ], [ 0, [[ENTRY:%.*]] ]
|
||||
; CHECK-NEXT: br label [[FOR_BODY:%.*]]
|
||||
|
@ -539,7 +539,7 @@ define void @even_load_dynamic_tc(i32* noalias nocapture readonly %A, i32* noali
|
|||
; CHECK-NEXT: store i32 [[MUL]], i32* [[ARRAYIDX2]], align 4
|
||||
; CHECK-NEXT: [[INDVARS_IV_NEXT]] = add nuw nsw i64 [[INDVARS_IV]], 2
|
||||
; CHECK-NEXT: [[CMP:%.*]] = icmp ult i64 [[INDVARS_IV_NEXT]], [[N]]
|
||||
; CHECK-NEXT: br i1 [[CMP]], label [[FOR_BODY]], label [[FOR_COND_CLEANUP]], !llvm.loop [[LOOP15:![0-9]+]]
|
||||
; CHECK-NEXT: br i1 [[CMP]], label [[FOR_BODY]], label [[FOR_COND_CLEANUP:%.*]], !llvm.loop [[LOOP15:![0-9]+]]
|
||||
;
|
||||
entry:
|
||||
br label %for.body
|
||||
|
@ -959,7 +959,7 @@ define void @PR27626_0(%pair.i32 *%p, i32 %z, i64 %n) {
|
|||
; CHECK-NEXT: [[TMP18:%.*]] = icmp eq i64 [[INDEX_NEXT]], [[N_VEC]]
|
||||
; CHECK-NEXT: br i1 [[TMP18]], label [[MIDDLE_BLOCK:%.*]], label [[VECTOR_BODY]], !llvm.loop [[LOOP24:![0-9]+]]
|
||||
; CHECK: middle.block:
|
||||
; CHECK-NEXT: br i1 false, label [[FOR_END:%.*]], label [[SCALAR_PH]]
|
||||
; CHECK-NEXT: br label [[SCALAR_PH]]
|
||||
; CHECK: scalar.ph:
|
||||
; CHECK-NEXT: [[BC_RESUME_VAL:%.*]] = phi i64 [ [[N_VEC]], [[MIDDLE_BLOCK]] ], [ 0, [[ENTRY:%.*]] ]
|
||||
; CHECK-NEXT: br label [[FOR_BODY:%.*]]
|
||||
|
@ -971,7 +971,7 @@ define void @PR27626_0(%pair.i32 *%p, i32 %z, i64 %n) {
|
|||
; CHECK-NEXT: store i32 [[Z]], i32* [[P_I_Y]], align 4
|
||||
; CHECK-NEXT: [[I_NEXT]] = add nuw nsw i64 [[I]], 1
|
||||
; CHECK-NEXT: [[COND:%.*]] = icmp slt i64 [[I_NEXT]], [[N]]
|
||||
; CHECK-NEXT: br i1 [[COND]], label [[FOR_BODY]], label [[FOR_END]], !llvm.loop [[LOOP25:![0-9]+]]
|
||||
; CHECK-NEXT: br i1 [[COND]], label [[FOR_BODY]], label [[FOR_END:%.*]], !llvm.loop [[LOOP25:![0-9]+]]
|
||||
; CHECK: for.end:
|
||||
; CHECK-NEXT: ret void
|
||||
;
|
||||
|
@ -1047,7 +1047,7 @@ define i32 @PR27626_1(%pair.i32 *%p, i64 %n) {
|
|||
; CHECK-NEXT: br i1 [[TMP17]], label [[MIDDLE_BLOCK:%.*]], label [[VECTOR_BODY]], !llvm.loop [[LOOP26:![0-9]+]]
|
||||
; CHECK: middle.block:
|
||||
; CHECK-NEXT: [[TMP18:%.*]] = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> [[TMP16]])
|
||||
; CHECK-NEXT: br i1 false, label [[FOR_END:%.*]], label [[SCALAR_PH]]
|
||||
; CHECK-NEXT: br label [[SCALAR_PH]]
|
||||
; CHECK: scalar.ph:
|
||||
; CHECK-NEXT: [[BC_RESUME_VAL:%.*]] = phi i64 [ [[N_VEC]], [[MIDDLE_BLOCK]] ], [ 0, [[ENTRY:%.*]] ]
|
||||
; CHECK-NEXT: [[BC_MERGE_RDX:%.*]] = phi i32 [ [[TMP18]], [[MIDDLE_BLOCK]] ], [ 0, [[ENTRY]] ]
|
||||
|
@ -1062,10 +1062,9 @@ define i32 @PR27626_1(%pair.i32 *%p, i64 %n) {
|
|||
; CHECK-NEXT: [[TMP20]] = add nsw i32 [[TMP19]], [[S]]
|
||||
; CHECK-NEXT: [[I_NEXT]] = add nuw nsw i64 [[I]], 1
|
||||
; CHECK-NEXT: [[COND:%.*]] = icmp slt i64 [[I_NEXT]], [[N]]
|
||||
; CHECK-NEXT: br i1 [[COND]], label [[FOR_BODY]], label [[FOR_END]], !llvm.loop [[LOOP27:![0-9]+]]
|
||||
; CHECK-NEXT: br i1 [[COND]], label [[FOR_BODY]], label [[FOR_END:%.*]], !llvm.loop [[LOOP27:![0-9]+]]
|
||||
; CHECK: for.end:
|
||||
; CHECK-NEXT: [[TMP21:%.*]] = phi i32 [ [[TMP20]], [[FOR_BODY]] ], [ [[TMP18]], [[MIDDLE_BLOCK]] ]
|
||||
; CHECK-NEXT: ret i32 [[TMP21]]
|
||||
; CHECK-NEXT: ret i32 [[TMP20]]
|
||||
;
|
||||
entry:
|
||||
br label %for.body
|
||||
|
@ -1143,7 +1142,7 @@ define void @PR27626_2(%pair.i32 *%p, i64 %n, i32 %z) {
|
|||
; CHECK-NEXT: [[TMP19:%.*]] = icmp eq i64 [[INDEX_NEXT]], [[N_VEC]]
|
||||
; CHECK-NEXT: br i1 [[TMP19]], label [[MIDDLE_BLOCK:%.*]], label [[VECTOR_BODY]], !llvm.loop [[LOOP28:![0-9]+]]
|
||||
; CHECK: middle.block:
|
||||
; CHECK-NEXT: br i1 false, label [[FOR_END:%.*]], label [[SCALAR_PH]]
|
||||
; CHECK-NEXT: br label [[SCALAR_PH]]
|
||||
; CHECK: scalar.ph:
|
||||
; CHECK-NEXT: [[BC_RESUME_VAL:%.*]] = phi i64 [ [[N_VEC]], [[MIDDLE_BLOCK]] ], [ 0, [[ENTRY:%.*]] ]
|
||||
; CHECK-NEXT: br label [[FOR_BODY:%.*]]
|
||||
|
@ -1157,7 +1156,7 @@ define void @PR27626_2(%pair.i32 *%p, i64 %n, i32 %z) {
|
|||
; CHECK-NEXT: store i32 [[TMP20]], i32* [[P_I_Y]], align 4
|
||||
; CHECK-NEXT: [[I_NEXT]] = add nuw nsw i64 [[I]], 1
|
||||
; CHECK-NEXT: [[COND:%.*]] = icmp slt i64 [[I_NEXT]], [[N]]
|
||||
; CHECK-NEXT: br i1 [[COND]], label [[FOR_BODY]], label [[FOR_END]], !llvm.loop [[LOOP29:![0-9]+]]
|
||||
; CHECK-NEXT: br i1 [[COND]], label [[FOR_BODY]], label [[FOR_END:%.*]], !llvm.loop [[LOOP29:![0-9]+]]
|
||||
; CHECK: for.end:
|
||||
; CHECK-NEXT: ret void
|
||||
;
|
||||
|
@ -1239,7 +1238,7 @@ define i32 @PR27626_3(%pair.i32 *%p, i64 %n, i32 %z) {
|
|||
; CHECK-NEXT: br i1 [[TMP20]], label [[MIDDLE_BLOCK:%.*]], label [[VECTOR_BODY]], !llvm.loop [[LOOP30:![0-9]+]]
|
||||
; CHECK: middle.block:
|
||||
; CHECK-NEXT: [[TMP21:%.*]] = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> [[TMP19]])
|
||||
; CHECK-NEXT: br i1 false, label [[FOR_END:%.*]], label [[SCALAR_PH]]
|
||||
; CHECK-NEXT: br label [[SCALAR_PH]]
|
||||
; CHECK: scalar.ph:
|
||||
; CHECK-NEXT: [[BC_RESUME_VAL:%.*]] = phi i64 [ [[N_VEC]], [[MIDDLE_BLOCK]] ], [ 0, [[ENTRY:%.*]] ]
|
||||
; CHECK-NEXT: [[BC_MERGE_RDX:%.*]] = phi i32 [ [[TMP21]], [[MIDDLE_BLOCK]] ], [ 0, [[ENTRY]] ]
|
||||
|
@ -1257,10 +1256,9 @@ define i32 @PR27626_3(%pair.i32 *%p, i64 %n, i32 %z) {
|
|||
; CHECK-NEXT: [[TMP24]] = add nsw i32 [[TMP23]], [[S]]
|
||||
; CHECK-NEXT: [[I_NEXT]] = add nuw nsw i64 [[I]], 1
|
||||
; CHECK-NEXT: [[COND:%.*]] = icmp slt i64 [[I_NEXT]], [[N]]
|
||||
; CHECK-NEXT: br i1 [[COND]], label [[FOR_BODY]], label [[FOR_END]], !llvm.loop [[LOOP31:![0-9]+]]
|
||||
; CHECK-NEXT: br i1 [[COND]], label [[FOR_BODY]], label [[FOR_END:%.*]], !llvm.loop [[LOOP31:![0-9]+]]
|
||||
; CHECK: for.end:
|
||||
; CHECK-NEXT: [[TMP25:%.*]] = phi i32 [ [[TMP24]], [[FOR_BODY]] ], [ [[TMP21]], [[MIDDLE_BLOCK]] ]
|
||||
; CHECK-NEXT: ret i32 [[TMP25]]
|
||||
; CHECK-NEXT: ret i32 [[TMP24]]
|
||||
;
|
||||
entry:
|
||||
br label %for.body
|
||||
|
|
|
@ -25,7 +25,7 @@ define void @bottom_tested(i16* %p, i32 %n) {
|
|||
; CHECK-NEXT: store <2 x i16> zeroinitializer, <2 x i16>* [[TMP5]], align 4
|
||||
; CHECK-NEXT: [[INDEX_NEXT]] = add i32 [[INDEX]], 2
|
||||
; CHECK-NEXT: [[TMP6:%.*]] = icmp eq i32 [[INDEX_NEXT]], [[N_VEC]]
|
||||
; CHECK-NEXT: br i1 [[TMP6]], label [[MIDDLE_BLOCK:%.*]], label [[VECTOR_BODY]], [[LOOP0:!llvm.loop !.*]]
|
||||
; CHECK-NEXT: br i1 [[TMP6]], label [[MIDDLE_BLOCK:%.*]], label [[VECTOR_BODY]], !llvm.loop [[LOOP0:![0-9]+]]
|
||||
; CHECK: middle.block:
|
||||
; CHECK-NEXT: [[CMP_N:%.*]] = icmp eq i32 [[TMP0]], [[N_VEC]]
|
||||
; CHECK-NEXT: br i1 [[CMP_N]], label [[IF_END:%.*]], label [[SCALAR_PH]]
|
||||
|
@ -39,7 +39,7 @@ define void @bottom_tested(i16* %p, i32 %n) {
|
|||
; CHECK-NEXT: store i16 0, i16* [[B]], align 4
|
||||
; CHECK-NEXT: [[INC]] = add nsw i32 [[I]], 1
|
||||
; CHECK-NEXT: [[CMP:%.*]] = icmp slt i32 [[I]], [[N]]
|
||||
; CHECK-NEXT: br i1 [[CMP]], label [[FOR_COND]], label [[IF_END]], [[LOOP2:!llvm.loop !.*]]
|
||||
; CHECK-NEXT: br i1 [[CMP]], label [[FOR_COND]], label [[IF_END]], !llvm.loop [[LOOP2:![0-9]+]]
|
||||
; CHECK: if.end:
|
||||
; CHECK-NEXT: ret void
|
||||
;
|
||||
|
@ -82,7 +82,7 @@ define void @bottom_tested(i16* %p, i32 %n) {
|
|||
; TAILFOLD-NEXT: [[INDEX_NEXT]] = add i32 [[INDEX]], 2
|
||||
; TAILFOLD-NEXT: [[VEC_IND_NEXT]] = add <2 x i32> [[VEC_IND]], <i32 2, i32 2>
|
||||
; TAILFOLD-NEXT: [[TMP11:%.*]] = icmp eq i32 [[INDEX_NEXT]], [[N_VEC]]
|
||||
; TAILFOLD-NEXT: br i1 [[TMP11]], label [[MIDDLE_BLOCK:%.*]], label [[VECTOR_BODY]], [[LOOP0:!llvm.loop !.*]]
|
||||
; TAILFOLD-NEXT: br i1 [[TMP11]], label [[MIDDLE_BLOCK:%.*]], label [[VECTOR_BODY]], !llvm.loop [[LOOP0:![0-9]+]]
|
||||
; TAILFOLD: middle.block:
|
||||
; TAILFOLD-NEXT: br i1 true, label [[IF_END:%.*]], label [[SCALAR_PH]]
|
||||
; TAILFOLD: scalar.ph:
|
||||
|
@ -95,7 +95,7 @@ define void @bottom_tested(i16* %p, i32 %n) {
|
|||
; TAILFOLD-NEXT: store i16 0, i16* [[B]], align 4
|
||||
; TAILFOLD-NEXT: [[INC]] = add nsw i32 [[I]], 1
|
||||
; TAILFOLD-NEXT: [[CMP:%.*]] = icmp slt i32 [[I]], [[N]]
|
||||
; TAILFOLD-NEXT: br i1 [[CMP]], label [[FOR_COND]], label [[IF_END]], [[LOOP2:!llvm.loop !.*]]
|
||||
; TAILFOLD-NEXT: br i1 [[CMP]], label [[FOR_COND]], label [[IF_END]], !llvm.loop [[LOOP2:![0-9]+]]
|
||||
; TAILFOLD: if.end:
|
||||
; TAILFOLD-NEXT: ret void
|
||||
;
|
||||
|
@ -141,23 +141,22 @@ define void @early_exit(i16* %p, i32 %n) {
|
|||
; CHECK-NEXT: [[INDEX_NEXT]] = add i32 [[INDEX]], 2
|
||||
; CHECK-NEXT: [[VEC_IND_NEXT]] = add <2 x i32> [[VEC_IND]], <i32 2, i32 2>
|
||||
; CHECK-NEXT: [[TMP9:%.*]] = icmp eq i32 [[INDEX_NEXT]], [[N_VEC]]
|
||||
; CHECK-NEXT: br i1 [[TMP9]], label [[MIDDLE_BLOCK:%.*]], label [[VECTOR_BODY]], [[LOOP4:!llvm.loop !.*]]
|
||||
; CHECK-NEXT: br i1 [[TMP9]], label [[MIDDLE_BLOCK:%.*]], label [[VECTOR_BODY]], !llvm.loop [[LOOP4:![0-9]+]]
|
||||
; CHECK: middle.block:
|
||||
; CHECK-NEXT: [[CMP_N:%.*]] = icmp eq i32 [[TMP0]], [[N_VEC]]
|
||||
; CHECK-NEXT: br i1 [[CMP_N]], label [[IF_END:%.*]], label [[SCALAR_PH]]
|
||||
; CHECK-NEXT: br label [[SCALAR_PH]]
|
||||
; CHECK: scalar.ph:
|
||||
; CHECK-NEXT: [[BC_RESUME_VAL:%.*]] = phi i32 [ [[N_VEC]], [[MIDDLE_BLOCK]] ], [ 0, [[ENTRY:%.*]] ]
|
||||
; CHECK-NEXT: br label [[FOR_COND:%.*]]
|
||||
; CHECK: for.cond:
|
||||
; CHECK-NEXT: [[I:%.*]] = phi i32 [ [[BC_RESUME_VAL]], [[SCALAR_PH]] ], [ [[INC:%.*]], [[FOR_BODY:%.*]] ]
|
||||
; CHECK-NEXT: [[CMP:%.*]] = icmp slt i32 [[I]], [[N]]
|
||||
; CHECK-NEXT: br i1 [[CMP]], label [[FOR_BODY]], label [[IF_END]]
|
||||
; CHECK-NEXT: br i1 [[CMP]], label [[FOR_BODY]], label [[IF_END:%.*]]
|
||||
; CHECK: for.body:
|
||||
; CHECK-NEXT: [[IPROM:%.*]] = sext i32 [[I]] to i64
|
||||
; CHECK-NEXT: [[B:%.*]] = getelementptr inbounds i16, i16* [[P]], i64 [[IPROM]]
|
||||
; CHECK-NEXT: store i16 0, i16* [[B]], align 4
|
||||
; CHECK-NEXT: [[INC]] = add nsw i32 [[I]], 1
|
||||
; CHECK-NEXT: br label [[FOR_COND]], [[LOOP5:!llvm.loop !.*]]
|
||||
; CHECK-NEXT: br label [[FOR_COND]], !llvm.loop [[LOOP5:![0-9]+]]
|
||||
; CHECK: if.end:
|
||||
; CHECK-NEXT: ret void
|
||||
;
|
||||
|
@ -279,24 +278,23 @@ define void @multiple_unique_exit(i16* %p, i32 %n) {
|
|||
; CHECK-NEXT: [[INDEX_NEXT]] = add i32 [[INDEX]], 2
|
||||
; CHECK-NEXT: [[VEC_IND_NEXT]] = add <2 x i32> [[VEC_IND]], <i32 2, i32 2>
|
||||
; CHECK-NEXT: [[TMP9:%.*]] = icmp eq i32 [[INDEX_NEXT]], [[N_VEC]]
|
||||
; CHECK-NEXT: br i1 [[TMP9]], label [[MIDDLE_BLOCK:%.*]], label [[VECTOR_BODY]], [[LOOP6:!llvm.loop !.*]]
|
||||
; CHECK-NEXT: br i1 [[TMP9]], label [[MIDDLE_BLOCK:%.*]], label [[VECTOR_BODY]], !llvm.loop [[LOOP6:![0-9]+]]
|
||||
; CHECK: middle.block:
|
||||
; CHECK-NEXT: [[CMP_N:%.*]] = icmp eq i32 [[TMP0]], [[N_VEC]]
|
||||
; CHECK-NEXT: br i1 [[CMP_N]], label [[IF_END:%.*]], label [[SCALAR_PH]]
|
||||
; CHECK-NEXT: br label [[SCALAR_PH]]
|
||||
; CHECK: scalar.ph:
|
||||
; CHECK-NEXT: [[BC_RESUME_VAL:%.*]] = phi i32 [ [[N_VEC]], [[MIDDLE_BLOCK]] ], [ 0, [[ENTRY:%.*]] ]
|
||||
; CHECK-NEXT: br label [[FOR_COND:%.*]]
|
||||
; CHECK: for.cond:
|
||||
; CHECK-NEXT: [[I:%.*]] = phi i32 [ [[BC_RESUME_VAL]], [[SCALAR_PH]] ], [ [[INC:%.*]], [[FOR_BODY:%.*]] ]
|
||||
; CHECK-NEXT: [[CMP:%.*]] = icmp slt i32 [[I]], [[N]]
|
||||
; CHECK-NEXT: br i1 [[CMP]], label [[FOR_BODY]], label [[IF_END]]
|
||||
; CHECK-NEXT: br i1 [[CMP]], label [[FOR_BODY]], label [[IF_END:%.*]]
|
||||
; CHECK: for.body:
|
||||
; CHECK-NEXT: [[IPROM:%.*]] = sext i32 [[I]] to i64
|
||||
; CHECK-NEXT: [[B:%.*]] = getelementptr inbounds i16, i16* [[P]], i64 [[IPROM]]
|
||||
; CHECK-NEXT: store i16 0, i16* [[B]], align 4
|
||||
; CHECK-NEXT: [[INC]] = add nsw i32 [[I]], 1
|
||||
; CHECK-NEXT: [[CMP2:%.*]] = icmp slt i32 [[I]], 2096
|
||||
; CHECK-NEXT: br i1 [[CMP2]], label [[FOR_COND]], label [[IF_END]], [[LOOP7:!llvm.loop !.*]]
|
||||
; CHECK-NEXT: br i1 [[CMP2]], label [[FOR_COND]], label [[IF_END]], !llvm.loop [[LOOP7:![0-9]+]]
|
||||
; CHECK: if.end:
|
||||
; CHECK-NEXT: ret void
|
||||
;
|
||||
|
@ -365,28 +363,25 @@ define i32 @multiple_unique_exit2(i16* %p, i32 %n) {
|
|||
; CHECK-NEXT: [[INDEX_NEXT]] = add i32 [[INDEX]], 2
|
||||
; CHECK-NEXT: [[VEC_IND_NEXT]] = add <2 x i32> [[VEC_IND]], <i32 2, i32 2>
|
||||
; CHECK-NEXT: [[TMP9:%.*]] = icmp eq i32 [[INDEX_NEXT]], [[N_VEC]]
|
||||
; CHECK-NEXT: br i1 [[TMP9]], label [[MIDDLE_BLOCK:%.*]], label [[VECTOR_BODY]], [[LOOP8:!llvm.loop !.*]]
|
||||
; CHECK-NEXT: br i1 [[TMP9]], label [[MIDDLE_BLOCK:%.*]], label [[VECTOR_BODY]], !llvm.loop [[LOOP8:![0-9]+]]
|
||||
; CHECK: middle.block:
|
||||
; CHECK-NEXT: [[CMP_N:%.*]] = icmp eq i32 [[TMP0]], [[N_VEC]]
|
||||
; CHECK-NEXT: [[IND_ESCAPE:%.*]] = sub i32 [[N_VEC]], 1
|
||||
; CHECK-NEXT: [[IND_ESCAPE1:%.*]] = sub i32 [[N_VEC]], 1
|
||||
; CHECK-NEXT: br i1 [[CMP_N]], label [[IF_END:%.*]], label [[SCALAR_PH]]
|
||||
; CHECK-NEXT: br label [[SCALAR_PH]]
|
||||
; CHECK: scalar.ph:
|
||||
; CHECK-NEXT: [[BC_RESUME_VAL:%.*]] = phi i32 [ [[N_VEC]], [[MIDDLE_BLOCK]] ], [ 0, [[ENTRY:%.*]] ]
|
||||
; CHECK-NEXT: br label [[FOR_COND:%.*]]
|
||||
; CHECK: for.cond:
|
||||
; CHECK-NEXT: [[I:%.*]] = phi i32 [ [[BC_RESUME_VAL]], [[SCALAR_PH]] ], [ [[INC:%.*]], [[FOR_BODY:%.*]] ]
|
||||
; CHECK-NEXT: [[CMP:%.*]] = icmp slt i32 [[I]], [[N]]
|
||||
; CHECK-NEXT: br i1 [[CMP]], label [[FOR_BODY]], label [[IF_END]]
|
||||
; CHECK-NEXT: br i1 [[CMP]], label [[FOR_BODY]], label [[IF_END:%.*]]
|
||||
; CHECK: for.body:
|
||||
; CHECK-NEXT: [[IPROM:%.*]] = sext i32 [[I]] to i64
|
||||
; CHECK-NEXT: [[B:%.*]] = getelementptr inbounds i16, i16* [[P]], i64 [[IPROM]]
|
||||
; CHECK-NEXT: store i16 0, i16* [[B]], align 4
|
||||
; CHECK-NEXT: [[INC]] = add nsw i32 [[I]], 1
|
||||
; CHECK-NEXT: [[CMP2:%.*]] = icmp slt i32 [[I]], 2096
|
||||
; CHECK-NEXT: br i1 [[CMP2]], label [[FOR_COND]], label [[IF_END]], [[LOOP9:!llvm.loop !.*]]
|
||||
; CHECK-NEXT: br i1 [[CMP2]], label [[FOR_COND]], label [[IF_END]], !llvm.loop [[LOOP9:![0-9]+]]
|
||||
; CHECK: if.end:
|
||||
; CHECK-NEXT: [[I_LCSSA:%.*]] = phi i32 [ [[I]], [[FOR_BODY]] ], [ [[I]], [[FOR_COND]] ], [ [[IND_ESCAPE1]], [[MIDDLE_BLOCK]] ]
|
||||
; CHECK-NEXT: [[I_LCSSA:%.*]] = phi i32 [ [[I]], [[FOR_BODY]] ], [ [[I]], [[FOR_COND]] ]
|
||||
; CHECK-NEXT: ret i32 [[I_LCSSA]]
|
||||
;
|
||||
; TAILFOLD-LABEL: @multiple_unique_exit2(
|
||||
|
@ -455,26 +450,25 @@ define i32 @multiple_unique_exit3(i16* %p, i32 %n) {
|
|||
; CHECK-NEXT: [[INDEX_NEXT]] = add i32 [[INDEX]], 2
|
||||
; CHECK-NEXT: [[VEC_IND_NEXT]] = add <2 x i32> [[VEC_IND]], <i32 2, i32 2>
|
||||
; CHECK-NEXT: [[TMP9:%.*]] = icmp eq i32 [[INDEX_NEXT]], [[N_VEC]]
|
||||
; CHECK-NEXT: br i1 [[TMP9]], label [[MIDDLE_BLOCK:%.*]], label [[VECTOR_BODY]], [[LOOP10:!llvm.loop !.*]]
|
||||
; CHECK-NEXT: br i1 [[TMP9]], label [[MIDDLE_BLOCK:%.*]], label [[VECTOR_BODY]], !llvm.loop [[LOOP10:![0-9]+]]
|
||||
; CHECK: middle.block:
|
||||
; CHECK-NEXT: [[CMP_N:%.*]] = icmp eq i32 [[TMP0]], [[N_VEC]]
|
||||
; CHECK-NEXT: br i1 [[CMP_N]], label [[IF_END:%.*]], label [[SCALAR_PH]]
|
||||
; CHECK-NEXT: br label [[SCALAR_PH]]
|
||||
; CHECK: scalar.ph:
|
||||
; CHECK-NEXT: [[BC_RESUME_VAL:%.*]] = phi i32 [ [[N_VEC]], [[MIDDLE_BLOCK]] ], [ 0, [[ENTRY:%.*]] ]
|
||||
; CHECK-NEXT: br label [[FOR_COND:%.*]]
|
||||
; CHECK: for.cond:
|
||||
; CHECK-NEXT: [[I:%.*]] = phi i32 [ [[BC_RESUME_VAL]], [[SCALAR_PH]] ], [ [[INC:%.*]], [[FOR_BODY:%.*]] ]
|
||||
; CHECK-NEXT: [[CMP:%.*]] = icmp slt i32 [[I]], [[N]]
|
||||
; CHECK-NEXT: br i1 [[CMP]], label [[FOR_BODY]], label [[IF_END]]
|
||||
; CHECK-NEXT: br i1 [[CMP]], label [[FOR_BODY]], label [[IF_END:%.*]]
|
||||
; CHECK: for.body:
|
||||
; CHECK-NEXT: [[IPROM:%.*]] = sext i32 [[I]] to i64
|
||||
; CHECK-NEXT: [[B:%.*]] = getelementptr inbounds i16, i16* [[P]], i64 [[IPROM]]
|
||||
; CHECK-NEXT: store i16 0, i16* [[B]], align 4
|
||||
; CHECK-NEXT: [[INC]] = add nsw i32 [[I]], 1
|
||||
; CHECK-NEXT: [[CMP2:%.*]] = icmp slt i32 [[I]], 2096
|
||||
; CHECK-NEXT: br i1 [[CMP2]], label [[FOR_COND]], label [[IF_END]], [[LOOP11:!llvm.loop !.*]]
|
||||
; CHECK-NEXT: br i1 [[CMP2]], label [[FOR_COND]], label [[IF_END]], !llvm.loop [[LOOP11:![0-9]+]]
|
||||
; CHECK: if.end:
|
||||
; CHECK-NEXT: [[EXIT:%.*]] = phi i32 [ 0, [[FOR_COND]] ], [ 1, [[FOR_BODY]] ], [ 0, [[MIDDLE_BLOCK]] ]
|
||||
; CHECK-NEXT: [[EXIT:%.*]] = phi i32 [ 0, [[FOR_COND]] ], [ 1, [[FOR_BODY]] ]
|
||||
; CHECK-NEXT: ret i32 [[EXIT]]
|
||||
;
|
||||
; TAILFOLD-LABEL: @multiple_unique_exit3(
|
||||
|
@ -989,10 +983,9 @@ define void @scalar_predication(float* %addr) {
|
|||
; CHECK-NEXT: [[INDEX_NEXT]] = add i64 [[INDEX]], 2
|
||||
; CHECK-NEXT: [[VEC_IND_NEXT]] = add <2 x i64> [[VEC_IND]], <i64 2, i64 2>
|
||||
; CHECK-NEXT: [[TMP10:%.*]] = icmp eq i64 [[INDEX_NEXT]], 200
|
||||
; CHECK-NEXT: br i1 [[TMP10]], label [[MIDDLE_BLOCK:%.*]], label [[VECTOR_BODY]], [[LOOP12:!llvm.loop !.*]]
|
||||
; CHECK-NEXT: br i1 [[TMP10]], label [[MIDDLE_BLOCK:%.*]], label [[VECTOR_BODY]], !llvm.loop [[LOOP12:![0-9]+]]
|
||||
; CHECK: middle.block:
|
||||
; CHECK-NEXT: [[CMP_N:%.*]] = icmp eq i64 201, 200
|
||||
; CHECK-NEXT: br i1 [[CMP_N]], label [[EXIT:%.*]], label [[SCALAR_PH]]
|
||||
; CHECK-NEXT: br label [[SCALAR_PH]]
|
||||
; CHECK: scalar.ph:
|
||||
; CHECK-NEXT: [[BC_RESUME_VAL:%.*]] = phi i64 [ 200, [[MIDDLE_BLOCK]] ], [ 0, [[ENTRY:%.*]] ]
|
||||
; CHECK-NEXT: br label [[LOOP_HEADER:%.*]]
|
||||
|
@ -1000,7 +993,7 @@ define void @scalar_predication(float* %addr) {
|
|||
; CHECK-NEXT: [[IV:%.*]] = phi i64 [ [[BC_RESUME_VAL]], [[SCALAR_PH]] ], [ [[IV_NEXT:%.*]], [[LOOP_LATCH:%.*]] ]
|
||||
; CHECK-NEXT: [[GEP:%.*]] = getelementptr float, float* [[ADDR]], i64 [[IV]]
|
||||
; CHECK-NEXT: [[EXITCOND_NOT:%.*]] = icmp eq i64 [[IV]], 200
|
||||
; CHECK-NEXT: br i1 [[EXITCOND_NOT]], label [[EXIT]], label [[LOOP_BODY:%.*]]
|
||||
; CHECK-NEXT: br i1 [[EXITCOND_NOT]], label [[EXIT:%.*]], label [[LOOP_BODY:%.*]]
|
||||
; CHECK: loop.body:
|
||||
; CHECK-NEXT: [[TMP11:%.*]] = load float, float* [[GEP]], align 4
|
||||
; CHECK-NEXT: [[PRED:%.*]] = fcmp oeq float [[TMP11]], 0.000000e+00
|
||||
|
@ -1010,7 +1003,7 @@ define void @scalar_predication(float* %addr) {
|
|||
; CHECK-NEXT: br label [[LOOP_LATCH]]
|
||||
; CHECK: loop.latch:
|
||||
; CHECK-NEXT: [[IV_NEXT]] = add nuw nsw i64 [[IV]], 1
|
||||
; CHECK-NEXT: br label [[LOOP_HEADER]], [[LOOP13:!llvm.loop !.*]]
|
||||
; CHECK-NEXT: br label [[LOOP_HEADER]], !llvm.loop [[LOOP13:![0-9]+]]
|
||||
; CHECK: exit:
|
||||
; CHECK-NEXT: ret void
|
||||
;
|
||||
|
@ -1081,11 +1074,10 @@ define i32 @me_reduction(i32* %addr) {
|
|||
; CHECK-NEXT: [[INDEX_NEXT]] = add i64 [[INDEX]], 2
|
||||
; CHECK-NEXT: [[VEC_IND_NEXT]] = add <2 x i64> [[VEC_IND]], <i64 2, i64 2>
|
||||
; CHECK-NEXT: [[TMP6:%.*]] = icmp eq i64 [[INDEX_NEXT]], 200
|
||||
; CHECK-NEXT: br i1 [[TMP6]], label [[MIDDLE_BLOCK:%.*]], label [[VECTOR_BODY]], [[LOOP14:!llvm.loop !.*]]
|
||||
; CHECK-NEXT: br i1 [[TMP6]], label [[MIDDLE_BLOCK:%.*]], label [[VECTOR_BODY]], !llvm.loop [[LOOP14:![0-9]+]]
|
||||
; CHECK: middle.block:
|
||||
; CHECK-NEXT: [[TMP7:%.*]] = call i32 @llvm.vector.reduce.add.v2i32(<2 x i32> [[TMP5]])
|
||||
; CHECK-NEXT: [[CMP_N:%.*]] = icmp eq i64 201, 200
|
||||
; CHECK-NEXT: br i1 [[CMP_N]], label [[EXIT:%.*]], label [[SCALAR_PH]]
|
||||
; CHECK-NEXT: br label [[SCALAR_PH]]
|
||||
; CHECK: scalar.ph:
|
||||
; CHECK-NEXT: [[BC_RESUME_VAL:%.*]] = phi i64 [ 200, [[MIDDLE_BLOCK]] ], [ 0, [[ENTRY:%.*]] ]
|
||||
; CHECK-NEXT: [[BC_MERGE_RDX:%.*]] = phi i32 [ 0, [[ENTRY]] ], [ [[TMP7]], [[MIDDLE_BLOCK]] ]
|
||||
|
@ -1095,15 +1087,15 @@ define i32 @me_reduction(i32* %addr) {
|
|||
; CHECK-NEXT: [[ACCUM:%.*]] = phi i32 [ [[BC_MERGE_RDX]], [[SCALAR_PH]] ], [ [[ACCUM_NEXT:%.*]], [[LOOP_LATCH]] ]
|
||||
; CHECK-NEXT: [[GEP:%.*]] = getelementptr i32, i32* [[ADDR]], i64 [[IV]]
|
||||
; CHECK-NEXT: [[EXITCOND_NOT:%.*]] = icmp eq i64 [[IV]], 200
|
||||
; CHECK-NEXT: br i1 [[EXITCOND_NOT]], label [[EXIT]], label [[LOOP_LATCH]]
|
||||
; CHECK-NEXT: br i1 [[EXITCOND_NOT]], label [[EXIT:%.*]], label [[LOOP_LATCH]]
|
||||
; CHECK: loop.latch:
|
||||
; CHECK-NEXT: [[TMP8:%.*]] = load i32, i32* [[GEP]], align 4
|
||||
; CHECK-NEXT: [[ACCUM_NEXT]] = add i32 [[ACCUM]], [[TMP8]]
|
||||
; CHECK-NEXT: [[IV_NEXT]] = add nuw nsw i64 [[IV]], 1
|
||||
; CHECK-NEXT: [[EXITCOND2_NOT:%.*]] = icmp eq i64 [[IV]], 400
|
||||
; CHECK-NEXT: br i1 [[EXITCOND2_NOT]], label [[EXIT]], label [[LOOP_HEADER]], [[LOOP15:!llvm.loop !.*]]
|
||||
; CHECK-NEXT: br i1 [[EXITCOND2_NOT]], label [[EXIT]], label [[LOOP_HEADER]], !llvm.loop [[LOOP15:![0-9]+]]
|
||||
; CHECK: exit:
|
||||
; CHECK-NEXT: [[LCSSA:%.*]] = phi i32 [ 0, [[LOOP_HEADER]] ], [ [[ACCUM_NEXT]], [[LOOP_LATCH]] ], [ [[TMP7]], [[MIDDLE_BLOCK]] ]
|
||||
; CHECK-NEXT: [[LCSSA:%.*]] = phi i32 [ 0, [[LOOP_HEADER]] ], [ [[ACCUM_NEXT]], [[LOOP_LATCH]] ]
|
||||
; CHECK-NEXT: ret i32 [[LCSSA]]
|
||||
;
|
||||
; TAILFOLD-LABEL: @me_reduction(
|
||||
|
|
Loading…
Reference in New Issue