[llvm-branch-commits] [llvm] 221c3b1 - [InstSimplify] Canonicalize non-demanded shuffle op to poison (NFCI)

Nikita Popov via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Wed Jan 6 12:33:49 PST 2021


Author: Nikita Popov
Date: 2021-01-06T21:22:27+01:00
New Revision: 221c3b174b15855ec941ef60a551f22ac96a254e

URL: https://github.com/llvm/llvm-project/commit/221c3b174b15855ec941ef60a551f22ac96a254e
DIFF: https://github.com/llvm/llvm-project/commit/221c3b174b15855ec941ef60a551f22ac96a254e.diff

LOG: [InstSimplify] Canonicalize non-demanded shuffle op to poison (NFCI)

I don't believe this has an observable effect, because the only
thing we care about here is replacing the operand with a constant
so following folds can apply. This change is just to make the
representation follow canonical unary shuffle form.

Added: 
    

Modified: 
    llvm/lib/Analysis/InstructionSimplify.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Analysis/InstructionSimplify.cpp b/llvm/lib/Analysis/InstructionSimplify.cpp
index 4de9085e82330..5c251452e96d1 100644
--- a/llvm/lib/Analysis/InstructionSimplify.cpp
+++ b/llvm/lib/Analysis/InstructionSimplify.cpp
@@ -4631,7 +4631,7 @@ static Value *SimplifyShuffleVectorInst(Value *Op0, Value *Op1,
   Indices.assign(Mask.begin(), Mask.end());
 
   // Canonicalization: If mask does not select elements from an input vector,
-  // replace that input vector with undef.
+  // replace that input vector with poison.
   if (!Scalable) {
     bool MaskSelects0 = false, MaskSelects1 = false;
     unsigned InVecNumElts = InVecEltCount.getKnownMinValue();
@@ -4644,9 +4644,9 @@ static Value *SimplifyShuffleVectorInst(Value *Op0, Value *Op1,
         MaskSelects1 = true;
     }
     if (!MaskSelects0)
-      Op0 = UndefValue::get(InVecTy);
+      Op0 = PoisonValue::get(InVecTy);
     if (!MaskSelects1)
-      Op1 = UndefValue::get(InVecTy);
+      Op1 = PoisonValue::get(InVecTy);
   }
 
   auto *Op0Const = dyn_cast<Constant>(Op0);


        


More information about the llvm-branch-commits mailing list