[llvm] 54143e2 - [VectorCombine] do not use magic number for undef mask element; NFC

Sanjay Patel via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 22 18:05:07 PDT 2020


Author: Sanjay Patel
Date: 2020-06-22T20:47:09-04:00
New Revision: 54143e2bd557e97c5c9032ff87d73eec6fc63c67

URL: https://github.com/llvm/llvm-project/commit/54143e2bd557e97c5c9032ff87d73eec6fc63c67
DIFF: https://github.com/llvm/llvm-project/commit/54143e2bd557e97c5c9032ff87d73eec6fc63c67.diff

LOG: [VectorCombine] do not use magic number for undef mask element; NFC

Added: 
    

Modified: 
    llvm/lib/Transforms/Vectorize/VectorCombine.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/Vectorize/VectorCombine.cpp b/llvm/lib/Transforms/Vectorize/VectorCombine.cpp
index 5c25d04aaf39..eb9ae1e15552 100644
--- a/llvm/lib/Transforms/Vectorize/VectorCombine.cpp
+++ b/llvm/lib/Transforms/Vectorize/VectorCombine.cpp
@@ -196,7 +196,7 @@ static Value *createShiftShuffle(Value *Vec, unsigned OldIndex,
   // to the new element index. Example for OldIndex == 2 and NewIndex == 0:
   // ShufMask = { 2, undef, undef, undef }
   auto *VecTy = cast<FixedVectorType>(Vec->getType());
-  SmallVector<int, 32> ShufMask(VecTy->getNumElements(), -1);
+  SmallVector<int, 32> ShufMask(VecTy->getNumElements(), UndefMaskElem);
   ShufMask[NewIndex] = OldIndex;
   Value *Undef = UndefValue::get(VecTy);
   return Builder.CreateShuffleVector(Vec, Undef, ShufMask, "shift");


        


More information about the llvm-commits mailing list