[llvm] be93505 - [LoopVectorize] use unary shuffle creator to reduce code duplication; NFC
Sanjay Patel via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 21 12:34:41 PDT 2020
Author: Sanjay Patel
Date: 2020-09-21T15:34:24-04:00
New Revision: be9350598668015edb72da8a1ad8313cb87e0eef
URL: https://github.com/llvm/llvm-project/commit/be9350598668015edb72da8a1ad8313cb87e0eef
DIFF: https://github.com/llvm/llvm-project/commit/be9350598668015edb72da8a1ad8313cb87e0eef.diff
LOG: [LoopVectorize] use unary shuffle creator to reduce code duplication; NFC
Added:
Modified:
llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
index b203dd88eb3d..90fcc1041d14 100644
--- a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
+++ b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
@@ -2272,8 +2272,7 @@ Value *InnerLoopVectorizer::reverseVector(Value *Vec) {
for (unsigned i = 0; i < VF.getKnownMinValue(); ++i)
ShuffleMask.push_back(VF.getKnownMinValue() - i - 1);
- return Builder.CreateShuffleVector(Vec, UndefValue::get(Vec->getType()),
- ShuffleMask, "reverse");
+ return Builder.CreateShuffleVector(Vec, ShuffleMask, "reverse");
}
// Return whether we allow using masked interleave-groups (for dealing with
@@ -2396,10 +2395,9 @@ void InnerLoopVectorizer::vectorizeInterleaveGroup(
Value *GroupMask = MaskForGaps;
if (BlockInMask) {
Value *BlockInMaskPart = State.get(BlockInMask, Part);
- auto *Undefs = UndefValue::get(BlockInMaskPart->getType());
assert(!VF.isScalable() && "scalable vectors not yet supported.");
Value *ShuffledMask = Builder.CreateShuffleVector(
- BlockInMaskPart, Undefs,
+ BlockInMaskPart,
createReplicatedMask(InterleaveFactor, VF.getKnownMinValue()),
"interleaved.mask");
GroupMask = MaskForGaps
@@ -2432,7 +2430,7 @@ void InnerLoopVectorizer::vectorizeInterleaveGroup(
createStrideMask(I, InterleaveFactor, VF.getKnownMinValue());
for (unsigned Part = 0; Part < UF; Part++) {
Value *StridedVec = Builder.CreateShuffleVector(
- NewLoads[Part], UndefVec, StrideMask, "strided.vec");
+ NewLoads[Part], StrideMask, "strided.vec");
// If this member has
diff erent type, cast the result type.
if (Member->getType() != ScalarTy) {
@@ -2482,16 +2480,14 @@ void InnerLoopVectorizer::vectorizeInterleaveGroup(
// Interleave the elements in the wide vector.
assert(!VF.isScalable() && "scalable vectors not yet supported.");
Value *IVec = Builder.CreateShuffleVector(
- WideVec, UndefVec,
- createInterleaveMask(VF.getKnownMinValue(), InterleaveFactor),
+ WideVec, createInterleaveMask(VF.getKnownMinValue(), InterleaveFactor),
"interleaved.vec");
Instruction *NewStoreInstr;
if (BlockInMask) {
Value *BlockInMaskPart = State.get(BlockInMask, Part);
- auto *Undefs = UndefValue::get(BlockInMaskPart->getType());
Value *ShuffledMask = Builder.CreateShuffleVector(
- BlockInMaskPart, Undefs,
+ BlockInMaskPart,
createReplicatedMask(InterleaveFactor, VF.getKnownMinValue()),
"interleaved.mask");
NewStoreInstr = Builder.CreateMaskedStore(
More information about the llvm-commits
mailing list