[llvm] 7b78206 - [InstCombine] Simplify code. NFCI.

Benjamin Kramer via llvm-commits llvm-commits at lists.llvm.org
Sun Sep 27 10:12:12 PDT 2020


Author: Benjamin Kramer
Date: 2020-09-27T19:11:07+02:00
New Revision: 7b782062b4d580e48ab724e278f38cc3da763f02

URL: https://github.com/llvm/llvm-project/commit/7b782062b4d580e48ab724e278f38cc3da763f02
DIFF: https://github.com/llvm/llvm-project/commit/7b782062b4d580e48ab724e278f38cc3da763f02.diff

LOG: [InstCombine] Simplify code. NFCI.

Added: 
    

Modified: 
    llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp b/llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp
index cf3dcc91de0a..b789c8b26cc5 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp
@@ -2635,17 +2635,9 @@ Instruction *InstCombinerImpl::visitShuffleVectorInst(ShuffleVectorInst &SVI) {
   // If the result mask is equal to one of the original shuffle masks,
   // or is a splat, do the replacement.
   if (isSplat || newMask == LHSMask || newMask == RHSMask || newMask == Mask) {
-    SmallVector<Constant*, 16> Elts;
-    for (unsigned i = 0, e = newMask.size(); i != e; ++i) {
-      if (newMask[i] < 0) {
-        Elts.push_back(UndefValue::get(Int32Ty));
-      } else {
-        Elts.push_back(ConstantInt::get(Int32Ty, newMask[i]));
-      }
-    }
     if (!newRHS)
       newRHS = UndefValue::get(newLHS->getType());
-    return new ShuffleVectorInst(newLHS, newRHS, ConstantVector::get(Elts));
+    return new ShuffleVectorInst(newLHS, newRHS, newMask);
   }
 
   return MadeChange ? &SVI : nullptr;


        


More information about the llvm-commits mailing list