Skip to content

Commit

Permalink
[VP] Update uses of select instructions used as masks.
Browse files Browse the repository at this point in the history
  • Loading branch information
AinsleySnow committed May 17, 2024
1 parent 3ff1963 commit ead5fae
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions llvm/lib/Transforms/Vectorize/VectorPredication.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,13 @@ void VectorPredicationPass::transformCandidateVectorOperations(
// Ignore the select: the vector length operand already takes care of
// keeping track of the active elements.
I->replaceAllUsesWith(I->getOperand(1));
// If a select instruction is to be deleted, replace
// its uses as mask in VecOpsToTransform as well.
for (auto Iter = BBInfo.VecOpsToTransform.begin();
Iter != BBInfo.VecOpsToTransform.end(); ++Iter) {
if (Iter->second.first == I)
Iter->second.first = I->getOperand(1);
}
OldInstructionsToRemove.insert(std::make_pair(I, nullptr));

continue;
Expand Down

0 comments on commit ead5fae

Please sign in to comment.