[VectorCombine] Mark function as changed if shuffle is created.

777d6b5de9 exposed a code path where a function is modified but not
marked accordingly. Make sure we return true from foldShuffleFromReductions
if only a shuffle has been inserted/replaced.

Should fix    https://lab.llvm.org/buildbot/#/builders/187/builds/7578.
This commit is contained in:
Florian Hahn
2025-07-01 21:35:25 +01:00
parent ac76e4d8a9
commit 829f2f2448

View File

@@ -2979,17 +2979,20 @@ bool VectorCombine::foldShuffleFromReductions(Instruction &I) {
<< "\n");
LLVM_DEBUG(dbgs() << " OldCost: " << OldCost << " vs NewCost: " << NewCost
<< "\n");
bool MadeChanges = false;
if (NewCost < OldCost) {
Builder.SetInsertPoint(Shuffle);
Value *NewShuffle = Builder.CreateShuffleVector(
Shuffle->getOperand(0), Shuffle->getOperand(1), ConcatMask);
LLVM_DEBUG(dbgs() << "Created new shuffle: " << *NewShuffle << "\n");
replaceValue(*Shuffle, *NewShuffle);
MadeChanges = true;
}
// See if we can re-use foldSelectShuffle, getting it to reduce the size of
// the shuffle into a nicer order, as it can ignore the order of the shuffles.
return foldSelectShuffle(*Shuffle, true);
MadeChanges |= foldSelectShuffle(*Shuffle, true);
return MadeChanges;
}
/// Determine if its more efficient to fold: