File tree Expand file tree Collapse file tree 2 files changed +14
-7
lines changed
llvm/lib/Transforms/Vectorize Expand file tree Collapse file tree 2 files changed +14
-7
lines changed Original file line number Diff line number Diff line change @@ -4117,13 +4117,21 @@ class VPBlockUtils {
4117
4117
// / the successors of \p From and \p From to the predecessors of \p To. Both
4118
4118
// / VPBlockBases must have the same parent, which can be null. Both
4119
4119
// / VPBlockBases can be already connected to other VPBlockBases.
4120
- static void connectBlocks (VPBlockBase *From, VPBlockBase *To) {
4120
+ static void connectBlocks (VPBlockBase *From, VPBlockBase *To,
4121
+ unsigned PredIdx = -1u , unsigned SuccIdx = -1u ) {
4121
4122
assert ((From->getParent () == To->getParent ()) &&
4122
4123
" Can't connect two block with different parents" );
4123
- assert (From->getNumSuccessors () < 2 &&
4124
+ assert ((SuccIdx != - 1u || From->getNumSuccessors () < 2 ) &&
4124
4125
" Blocks can't have more than two successors." );
4125
- From->appendSuccessor (To);
4126
- To->appendPredecessor (From);
4126
+ if (SuccIdx == -1u )
4127
+ From->appendSuccessor (To);
4128
+ else
4129
+ From->getSuccessors ()[SuccIdx] = To;
4130
+
4131
+ if (PredIdx == -1u )
4132
+ To->appendPredecessor (From);
4133
+ else
4134
+ To->getPredecessors ()[PredIdx] = From;
4127
4135
}
4128
4136
4129
4137
// / Disconnect VPBlockBases \p From and \p To bi-directionally. Remove \p To
Original file line number Diff line number Diff line change @@ -360,9 +360,8 @@ static void addReplicateRegions(VPlan &Plan) {
360
360
// Record predicated instructions for above packing optimizations.
361
361
VPBlockBase *Region = createReplicateRegion (RepR, Plan);
362
362
Region->setParent (CurrentBlock->getParent ());
363
- VPBlockUtils::disconnectBlocks (CurrentBlock, SplitBlock);
364
- VPBlockUtils::connectBlocks (CurrentBlock, Region);
365
- VPBlockUtils::connectBlocks (Region, SplitBlock);
363
+ VPBlockUtils::connectBlocks (CurrentBlock, Region, -1 , 0 );
364
+ VPBlockUtils::connectBlocks (Region, SplitBlock, 0 , -1 );
366
365
}
367
366
}
368
367
You can’t perform that action at this time.
0 commit comments