mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-07-21 02:29:22 +00:00
[LoopVectorizer] Move some code around to ease further refactoring. NFCI.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@241739 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
a8e8640a65
commit
ca6e363f1d
@ -2615,6 +2615,19 @@ void InnerLoopVectorizer::createEmptyLoop() {
|
|||||||
// times the unroll factor (num of SIMD instructions).
|
// times the unroll factor (num of SIMD instructions).
|
||||||
Constant *Step = ConstantInt::get(IdxTy, VF * UF);
|
Constant *Step = ConstantInt::get(IdxTy, VF * UF);
|
||||||
|
|
||||||
|
// Generate code to check that the loop's trip count that we computed by
|
||||||
|
// adding one to the backedge-taken count will not overflow.
|
||||||
|
auto PastOverflowCheck = std::next(BasicBlock::iterator(OverflowCheckAnchor));
|
||||||
|
BasicBlock *CheckBlock =
|
||||||
|
BypassBlock->splitBasicBlock(PastOverflowCheck, "overflow.checked");
|
||||||
|
if (ParentLoop)
|
||||||
|
ParentLoop->addBasicBlockToLoop(CheckBlock, *LI);
|
||||||
|
LoopBypassBlocks.push_back(CheckBlock);
|
||||||
|
ReplaceInstWithInst(
|
||||||
|
BypassBlock->getTerminator(),
|
||||||
|
BranchInst::Create(ScalarPH, CheckBlock, CheckBCOverflow));
|
||||||
|
BypassBlock = CheckBlock;
|
||||||
|
|
||||||
// This is the IR builder that we use to add all of the logic for bypassing
|
// This is the IR builder that we use to add all of the logic for bypassing
|
||||||
// the new vector loop.
|
// the new vector loop.
|
||||||
IRBuilder<> BypassBuilder(BypassBlock->getTerminator());
|
IRBuilder<> BypassBuilder(BypassBlock->getTerminator());
|
||||||
@ -2647,22 +2660,6 @@ void InnerLoopVectorizer::createEmptyLoop() {
|
|||||||
Value *Cmp =
|
Value *Cmp =
|
||||||
BypassBuilder.CreateICmpEQ(IdxEndRoundDown, StartIdx, "cmp.zero");
|
BypassBuilder.CreateICmpEQ(IdxEndRoundDown, StartIdx, "cmp.zero");
|
||||||
|
|
||||||
// Generate code to check that the loops trip count that we computed by adding
|
|
||||||
// one to the backedge-taken count will not overflow.
|
|
||||||
{
|
|
||||||
auto PastOverflowCheck =
|
|
||||||
std::next(BasicBlock::iterator(OverflowCheckAnchor));
|
|
||||||
BasicBlock *CheckBlock =
|
|
||||||
BypassBlock->splitBasicBlock(PastOverflowCheck, "overflow.checked");
|
|
||||||
if (ParentLoop)
|
|
||||||
ParentLoop->addBasicBlockToLoop(CheckBlock, *LI);
|
|
||||||
LoopBypassBlocks.push_back(CheckBlock);
|
|
||||||
ReplaceInstWithInst(
|
|
||||||
BypassBlock->getTerminator(),
|
|
||||||
BranchInst::Create(ScalarPH, CheckBlock, CheckBCOverflow));
|
|
||||||
BypassBlock = CheckBlock;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Generate the code to check that the strides we assumed to be one are really
|
// Generate the code to check that the strides we assumed to be one are really
|
||||||
// one. We want the new basic block to start at the first instruction in a
|
// one. We want the new basic block to start at the first instruction in a
|
||||||
// sequence of instructions that form a check.
|
// sequence of instructions that form a check.
|
||||||
|
Loading…
Reference in New Issue
Block a user