From 91720ee561b2da4161df6abaddfd8a677aebb504 Mon Sep 17 00:00:00 2001 From: Simon Pilgrim Date: Sun, 20 Sep 2020 14:06:50 +0100 Subject: [PATCH] [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. --- llvm/lib/Target/X86/X86ISelLowering.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/llvm/lib/Target/X86/X86ISelLowering.cpp b/llvm/lib/Target/X86/X86ISelLowering.cpp index 6ad9128..3a4f09b 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 WidenedMask; - while (Mask.size() > 1 && canWidenShuffleElements(Mask, WidenedMask)) { + while (Mask.size() > 1) { + SmallVector WidenedMask; + if (!canWidenShuffleElements(Mask, WidenedMask)) + break; Mask = std::move(WidenedMask); } -- 2.7.4