[llvm] 91720ee - [X86] combineX86ShufflesRecursively - fix use after move warning. NFCI.
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Sun Sep 20 06:18:02 PDT 2020
Author: Simon Pilgrim
Date: 2020-09-20T14:06:50+01:00
New Revision: 91720ee561b2da4161df6abaddfd8a677aebb504
URL: https://github.com/llvm/llvm-project/commit/91720ee561b2da4161df6abaddfd8a677aebb504
DIFF: https://github.com/llvm/llvm-project/commit/91720ee561b2da4161df6abaddfd8a677aebb504.diff
LOG: [X86] combineX86ShufflesRecursively - fix use after move warning. NFCI.
After moving WidenedMask is in an undefined state, so reduce scope of the variable so its reinitialized every iteration - we should still retain any memory allocation savings.
Added:
Modified:
llvm/lib/Target/X86/X86ISelLowering.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Target/X86/X86ISelLowering.cpp b/llvm/lib/Target/X86/X86ISelLowering.cpp
index 6ad912892a73..3a4f09bc6c9f 100644
--- a/llvm/lib/Target/X86/X86ISelLowering.cpp
+++ b/llvm/lib/Target/X86/X86ISelLowering.cpp
@@ -36147,8 +36147,10 @@ static SDValue combineX86ShufflesRecursively(
// elements, and shrink them to the half-width mask. It does this in a loop
// so it will reduce the size of the mask to the minimal width mask which
// performs an equivalent shuffle.
- SmallVector<int, 64> WidenedMask;
- while (Mask.size() > 1 && canWidenShuffleElements(Mask, WidenedMask)) {
+ while (Mask.size() > 1) {
+ SmallVector<int, 64> WidenedMask;
+ if (!canWidenShuffleElements(Mask, WidenedMask))
+ break;
Mask = std::move(WidenedMask);
}
More information about the llvm-commits
mailing list