[llvm] d1d0e13 - [LV] Move packScalarIntoVectorValue to VPTransformState (NFC).
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 2 04:38:08 PDT 2023
Author: Florian Hahn
Date: 2023-08-02T12:36:48+01:00
New Revision: d1d0e135a16431001684ffd480da9ec6796c6659
URL: https://github.com/llvm/llvm-project/commit/d1d0e135a16431001684ffd480da9ec6796c6659
DIFF: https://github.com/llvm/llvm-project/commit/d1d0e135a16431001684ffd480da9ec6796c6659.diff
LOG: [LV] Move packScalarIntoVectorValue to VPTransformState (NFC).
This moves packScalarIntoVectorValue from ILV to the more approriate
VPTransformState.
Added:
Modified:
llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
llvm/lib/Transforms/Vectorize/VPlan.cpp
llvm/lib/Transforms/Vectorize/VPlan.h
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
index 66e9b0e6912a88..96680d16b5f25a 100644
--- a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
+++ b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
@@ -556,10 +556,6 @@ class InnerLoopVectorizer {
const VPIteration &Instance,
VPTransformState &State);
- /// Construct the vector value of a scalarized value \p V one lane at a time.
- void packScalarIntoVectorValue(VPValue *Def, const VPIteration &Instance,
- VPTransformState &State);
-
/// Try to vectorize interleaved access group \p Group with the base address
/// given in \p Addr, optionally masking the vector operations if \p
/// BlockInMask is non-null. Use \p State to translate given VPValues to IR
@@ -2524,17 +2520,6 @@ static bool isIndvarOverflowCheckKnownFalse(
return false;
}
-void InnerLoopVectorizer::packScalarIntoVectorValue(VPValue *Def,
- const VPIteration &Instance,
- VPTransformState &State) {
- Value *ScalarInst = State.get(Def, Instance);
- Value *VectorValue = State.get(Def, Instance.Part);
- VectorValue = Builder.CreateInsertElement(
- VectorValue, ScalarInst,
- Instance.Lane.getAsRuntimeExpr(State.Builder, VF));
- State.set(Def, VectorValue, Instance.Part);
-}
-
// Return whether we allow using masked interleave-groups (for dealing with
// strided loads/stores that reside in predicated blocks, or for dealing
// with gaps).
@@ -9619,7 +9604,7 @@ void VPReplicateRecipe::execute(VPTransformState &State) {
VectorType::get(UI->getType(), State.VF));
State.set(this, Poison, State.Instance->Part);
}
- State.ILV->packScalarIntoVectorValue(this, *State.Instance, State);
+ State.packScalarIntoVectorValue(this, *State.Instance);
}
return;
}
@@ -9929,7 +9914,7 @@ Value *VPTransformState::get(VPValue *Def, unsigned Part) {
Value *Undef = PoisonValue::get(VectorType::get(LastInst->getType(), VF));
set(Def, Undef, Part);
for (unsigned Lane = 0; Lane < VF.getKnownMinValue(); ++Lane)
- ILV->packScalarIntoVectorValue(Def, {Part, Lane}, *this);
+ packScalarIntoVectorValue(Def, {Part, Lane});
VectorValue = get(Def, Part);
}
Builder.restoreIP(OldIP);
diff --git a/llvm/lib/Transforms/Vectorize/VPlan.cpp b/llvm/lib/Transforms/Vectorize/VPlan.cpp
index e81b88fd80990d..4f2f21b91cd9d9 100644
--- a/llvm/lib/Transforms/Vectorize/VPlan.cpp
+++ b/llvm/lib/Transforms/Vectorize/VPlan.cpp
@@ -291,6 +291,15 @@ void VPTransformState::setDebugLocFromInst(const Value *V) {
Builder.SetCurrentDebugLocation(DIL);
}
+void VPTransformState::packScalarIntoVectorValue(VPValue *Def,
+ const VPIteration &Instance) {
+ Value *ScalarInst = get(Def, Instance);
+ Value *VectorValue = get(Def, Instance.Part);
+ VectorValue = Builder.CreateInsertElement(
+ VectorValue, ScalarInst, Instance.Lane.getAsRuntimeExpr(Builder, VF));
+ set(Def, VectorValue, Instance.Part);
+}
+
BasicBlock *
VPBasicBlock::createEmptyBasicBlock(VPTransformState::CFGState &CFG) {
// BB stands for IR BasicBlocks. VPBB stands for VPlan VPBasicBlocks.
diff --git a/llvm/lib/Transforms/Vectorize/VPlan.h b/llvm/lib/Transforms/Vectorize/VPlan.h
index 73313465adea99..1e833829fda414 100644
--- a/llvm/lib/Transforms/Vectorize/VPlan.h
+++ b/llvm/lib/Transforms/Vectorize/VPlan.h
@@ -352,6 +352,9 @@ struct VPTransformState {
/// Set the debug location in the builder using the debug location in \p V.
void setDebugLocFromInst(const Value *V);
+ /// Construct the vector value of a scalarized value \p V one lane at a time.
+ void packScalarIntoVectorValue(VPValue *Def, const VPIteration &Instance);
+
/// Hold state information used when constructing the CFG of the output IR,
/// traversing the VPBasicBlocks and generating corresponding IR BasicBlocks.
struct CFGState {
More information about the llvm-commits
mailing list