[llvm] f13e92d - [InstCombine] Use CreateVectorSplat(ElementCount) variant directly

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Sat Aug 8 11:26:18 PDT 2020


Author: Simon Pilgrim
Date: 2020-08-08T19:26:02+01:00
New Revision: f13e92d4b273db255c6955eb7f2269caf1eb60c3

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

LOG: [InstCombine] Use CreateVectorSplat(ElementCount) variant directly

This was introduced at rGe20223672100, and the CreateVectorSplat(unsigned NumElements) variant calls it internally

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp b/llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp
index 33da3c69ad91..275141a0e108 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp
@@ -2017,8 +2017,8 @@ static Instruction *canonicalizeScalarSelectOfVecs(SelectInst &Sel,
   // select (extelt V, Index), T, F --> select (splat V, Index), T, F
   // Splatting the extracted condition reduces code (we could directly create a
   // splat shuffle of the source vector to eliminate the intermediate step).
-  unsigned NumElts = Ty->getNumElements();
-  return IC.replaceOperand(Sel, 0, IC.Builder.CreateVectorSplat(NumElts, Cond));
+  return IC.replaceOperand(
+      Sel, 0, IC.Builder.CreateVectorSplat(Ty->getElementCount(), Cond));
 }
 
 /// Reuse bitcasted operands between a compare and select:


        


More information about the llvm-commits mailing list