[VPlan] Thread scalar types through VPInstruction and VPPhi. (NFC)#199378
Open
fhahn wants to merge 1 commit into
Open
[VPlan] Thread scalar types through VPInstruction and VPPhi. (NFC)#199378fhahn wants to merge 1 commit into
fhahn wants to merge 1 commit into
Conversation
|
@llvm/pr-subscribers-llvm-transforms @llvm/pr-subscribers-vectorizers Author: Florian Hahn (fhahn) ChangesUpdate VPInstruction and VPPhi to populate VPSingleDefValue's scalar type. For most opcodes, the scalar type is determine from the operands, via computeScalarTypeForInstruction, which roughly matches to removed inference code. For some opcodes, like FirstActiveLane, the type must be provided explicitly. Patch is 23.38 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/199378.diff 8 Files Affected:
diff --git a/llvm/lib/Transforms/Vectorize/LoopVectorizationPlanner.h b/llvm/lib/Transforms/Vectorize/LoopVectorizationPlanner.h
index adfe28e679a37..0ed9f8b5c1988 100644
--- a/llvm/lib/Transforms/Vectorize/LoopVectorizationPlanner.h
+++ b/llvm/lib/Transforms/Vectorize/LoopVectorizationPlanner.h
@@ -197,9 +197,10 @@ class VPBuilder {
const VPIRFlags &Flags = {},
const VPIRMetadata &MD = {},
DebugLoc DL = DebugLoc::getUnknown(),
- const Twine &Name = "") {
+ const Twine &Name = "",
+ Type *ResultTy = nullptr) {
VPInstruction *NewVPInst = tryInsertInstruction(
- new VPInstruction(Opcode, Operands, Flags, MD, DL, Name));
+ new VPInstruction(Opcode, Operands, Flags, MD, DL, Name, ResultTy));
NewVPInst->setUnderlyingValue(Inst);
return NewVPInst;
}
@@ -226,15 +227,19 @@ class VPBuilder {
VPInstruction *createFirstActiveLane(ArrayRef<VPValue *> Masks,
DebugLoc DL = DebugLoc::getUnknown(),
const Twine &Name = "") {
+ VPlan &Plan = getPlan();
+ Type *IndexTy = Plan.getDataLayout().getIndexType(Plan.getContext(), 0);
return tryInsertInstruction(new VPInstruction(
- VPInstruction::FirstActiveLane, Masks, {}, {}, DL, Name));
+ VPInstruction::FirstActiveLane, Masks, {}, {}, DL, Name, IndexTy));
}
VPInstruction *createLastActiveLane(ArrayRef<VPValue *> Masks,
DebugLoc DL = DebugLoc::getUnknown(),
const Twine &Name = "") {
- return tryInsertInstruction(new VPInstruction(VPInstruction::LastActiveLane,
- Masks, {}, {}, DL, Name));
+ VPlan &Plan = getPlan();
+ Type *IndexTy = Plan.getDataLayout().getIndexType(Plan.getContext(), 0);
+ return tryInsertInstruction(new VPInstruction(
+ VPInstruction::LastActiveLane, Masks, {}, {}, DL, Name, IndexTy));
}
VPInstruction *createOverflowingOp(
@@ -359,8 +364,10 @@ class VPBuilder {
VPPhi *createScalarPhi(ArrayRef<VPValue *> IncomingValues,
DebugLoc DL = DebugLoc::getUnknown(),
- const Twine &Name = "", const VPIRFlags &Flags = {}) {
- return tryInsertInstruction(new VPPhi(IncomingValues, Flags, DL, Name));
+ const Twine &Name = "", const VPIRFlags &Flags = {},
+ Type *ResultTy = nullptr) {
+ return tryInsertInstruction(
+ new VPPhi(IncomingValues, Flags, DL, Name, ResultTy));
}
VPWidenPHIRecipe *createWidenPhi(ArrayRef<VPValue *> IncomingValues,
diff --git a/llvm/lib/Transforms/Vectorize/VPlan.h b/llvm/lib/Transforms/Vectorize/VPlan.h
index 7025f39decaf5..2533968c565ee 100644
--- a/llvm/lib/Transforms/Vectorize/VPlan.h
+++ b/llvm/lib/Transforms/Vectorize/VPlan.h
@@ -604,6 +604,10 @@ class LLVM_ABI_FOR_TEST VPRecipeBase
/// types.
LLVM_ABI Type *getScalarTypeOrInfer(VPValue *V);
+/// Compute the scalar result type for an IR \p Opcode given \p Operands.
+LLVM_ABI Type *computeScalarTypeForInstruction(unsigned Opcode,
+ ArrayRef<VPValue *> Operands);
+
/// VPSingleDefRecipe is a base class for recipes that model a sequence of one
/// or more output IR that define a single result VPValue. Note that
/// VPSingleDefRecipe must inherit from VPRecipeBase before VPSingleDefValue.
@@ -1393,15 +1397,19 @@ class LLVM_ABI_FOR_TEST VPInstruction : public VPRecipeWithIRFlags,
public:
VPInstruction(unsigned Opcode, ArrayRef<VPValue *> Operands,
const VPIRFlags &Flags = {}, const VPIRMetadata &MD = {},
- DebugLoc DL = DebugLoc::getUnknown(), const Twine &Name = "");
+ DebugLoc DL = DebugLoc::getUnknown(), const Twine &Name = "",
+ Type *ResultTy = nullptr);
VP_CLASSOF_IMPL(VPRecipeBase::VPInstructionSC)
- VPInstruction *clone() override { return cloneWithOperands(operands()); }
+ VPInstruction *clone() override {
+ return cloneWithOperands(operands(), getScalarType());
+ }
- VPInstruction *cloneWithOperands(ArrayRef<VPValue *> NewOperands) {
+ VPInstruction *cloneWithOperands(ArrayRef<VPValue *> NewOperands,
+ Type *ResultTy = nullptr) {
auto *New = new VPInstruction(Opcode, NewOperands, *this, *this,
- getDebugLoc(), Name);
+ getDebugLoc(), Name, ResultTy);
if (getUnderlyingValue())
New->setUnderlyingValue(getUnderlyingInstr());
return New;
@@ -1521,18 +1529,15 @@ class LLVM_ABI_FOR_TEST VPInstruction : public VPRecipeWithIRFlags,
/// directly determine the result type. Note that there is no separate recipe ID
/// for VPInstructionWithType; it shares the same ID as VPInstruction and is
/// distinguished purely by the opcode.
+/// TODO: Merge with VPInstruction, now that VPRecipeValue provides the type.
class VPInstructionWithType : public VPInstruction {
- /// Scalar result type produced by the recipe.
- Type *ResultTy;
-
public:
VPInstructionWithType(unsigned Opcode, ArrayRef<VPValue *> Operands,
Type *ResultTy, const VPIRFlags &Flags = {},
const VPIRMetadata &Metadata = {},
DebugLoc DL = DebugLoc::getUnknown(),
const Twine &Name = "")
- : VPInstruction(Opcode, Operands, Flags, Metadata, DL, Name),
- ResultTy(ResultTy) {}
+ : VPInstruction(Opcode, Operands, Flags, Metadata, DL, Name, ResultTy) {}
static inline bool classof(const VPRecipeBase *R) {
// VPInstructionWithType are VPInstructions with specific opcodes requiring
@@ -1575,7 +1580,7 @@ class VPInstructionWithType : public VPInstruction {
return 0;
}
- Type *getResultType() const { return ResultTy; }
+ Type *getResultType() const { return getScalarType(); }
protected:
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
@@ -1652,8 +1657,9 @@ class VPPhiAccessors {
struct LLVM_ABI_FOR_TEST VPPhi : public VPInstruction, public VPPhiAccessors {
VPPhi(ArrayRef<VPValue *> Operands, const VPIRFlags &Flags, DebugLoc DL,
- const Twine &Name = "")
- : VPInstruction(Instruction::PHI, Operands, Flags, {}, DL, Name) {}
+ const Twine &Name = "", Type *ResultTy = nullptr)
+ : VPInstruction(Instruction::PHI, Operands, Flags, {}, DL, Name,
+ ResultTy) {}
static inline bool classof(const VPUser *U) {
auto *VPI = dyn_cast<VPInstruction>(U);
diff --git a/llvm/lib/Transforms/Vectorize/VPlanAnalysis.cpp b/llvm/lib/Transforms/Vectorize/VPlanAnalysis.cpp
index 40cce07557ab5..58ac22b955fb8 100644
--- a/llvm/lib/Transforms/Vectorize/VPlanAnalysis.cpp
+++ b/llvm/lib/Transforms/Vectorize/VPlanAnalysis.cpp
@@ -35,122 +35,6 @@ Type *VPTypeAnalysis::inferScalarTypeForRecipe(const VPBlendRecipe *R) {
return ResTy;
}
-Type *VPTypeAnalysis::inferScalarTypeForRecipe(const VPInstruction *R) {
- // Set the result type from the first operand, check if the types for all
- // other operands match and cache them.
- auto SetResultTyFromOp = [this, R]() {
- Type *ResTy = inferScalarType(R->getOperand(0));
- unsigned NumOperands = R->getNumOperandsWithoutMask();
- for (unsigned Op = 1; Op != NumOperands; ++Op) {
- VPValue *OtherV = R->getOperand(Op);
- assert(inferScalarType(OtherV) == ResTy &&
- "different types inferred for different operands");
- CachedTypes[OtherV] = ResTy;
- }
- return ResTy;
- };
-
- unsigned Opcode = R->getOpcode();
- if (Instruction::isBinaryOp(Opcode) || Instruction::isUnaryOp(Opcode))
- return SetResultTyFromOp();
-
- switch (Opcode) {
- case Instruction::PHI:
- for (VPValue *Op : R->operands()) {
- if (auto *VIR = dyn_cast<VPIRValue>(Op))
- return VIR->getType();
- if (auto *Ty = CachedTypes.lookup(Op))
- return Ty;
- }
- LLVM_FALLTHROUGH;
- case Instruction::ExtractElement:
- case Instruction::InsertElement:
- case Instruction::Freeze:
- case VPInstruction::Broadcast:
- case VPInstruction::ComputeReductionResult:
- case VPInstruction::ExitingIVValue:
- case VPInstruction::ExtractLastLane:
- case VPInstruction::ExtractPenultimateElement:
- case VPInstruction::ExtractLastPart:
- case VPInstruction::ExtractLastActive:
- case VPInstruction::PtrAdd:
- case VPInstruction::WidePtrAdd:
- case VPInstruction::ReductionStartVector:
- case VPInstruction::ResumeForEpilogue:
- case VPInstruction::Reverse:
- return inferScalarType(R->getOperand(0));
- case Instruction::Select: {
- Type *ResTy = inferScalarType(R->getOperand(1));
- VPValue *OtherV = R->getOperand(2);
- assert(inferScalarType(OtherV) == ResTy &&
- "different types inferred for different operands");
- CachedTypes[OtherV] = ResTy;
- return ResTy;
- }
- case Instruction::ICmp:
- case Instruction::FCmp:
- case VPInstruction::ActiveLaneMask:
- assert(inferScalarType(R->getOperand(0)) ==
- inferScalarType(R->getOperand(1)) &&
- "different types inferred for different operands");
- return IntegerType::get(Ctx, 1);
- case VPInstruction::ExplicitVectorLength:
- return Type::getIntNTy(Ctx, 32);
- case VPInstruction::FirstOrderRecurrenceSplice:
- case VPInstruction::Not:
- case VPInstruction::CalculateTripCountMinusVF:
- case VPInstruction::CanonicalIVIncrementForPart:
- case VPInstruction::AnyOf:
- case VPInstruction::BuildStructVector:
- case VPInstruction::BuildVector:
- case VPInstruction::Unpack:
- return SetResultTyFromOp();
- case VPInstruction::ExtractLane:
- return inferScalarType(R->getOperand(1));
- case VPInstruction::FirstActiveLane:
- case VPInstruction::LastActiveLane:
- // Assume that the maximum possible number of elements in a vector fits
- // within the index type for the default address space.
- return DL.getIndexType(Ctx, 0);
- case VPInstruction::LogicalAnd:
- case VPInstruction::LogicalOr:
- assert(inferScalarType(R->getOperand(0))->isIntegerTy(1) &&
- inferScalarType(R->getOperand(1))->isIntegerTy(1) &&
- "LogicalAnd/Or operands should be bool");
- return IntegerType::get(Ctx, 1);
- case VPInstruction::MaskedCond:
- assert(inferScalarType(R->getOperand(0))->isIntegerTy(1));
- return IntegerType::get(Ctx, 1);
- case VPInstruction::BranchOnCond:
- case VPInstruction::BranchOnTwoConds:
- case VPInstruction::BranchOnCount:
- case Instruction::Store:
- case Instruction::Switch:
- return Type::getVoidTy(Ctx);
- case Instruction::Load:
- return cast<LoadInst>(R->getUnderlyingValue())->getType();
- case Instruction::Alloca:
- return cast<AllocaInst>(R->getUnderlyingValue())->getType();
- case Instruction::Call: {
- unsigned CallIdx = R->getNumOperandsWithoutMask() - 1;
- return cast<Function>(R->getOperand(CallIdx)->getLiveInIRValue())
- ->getReturnType();
- }
- case Instruction::GetElementPtr:
- return inferScalarType(R->getOperand(0));
- case Instruction::ExtractValue:
- return cast<ExtractValueInst>(R->getUnderlyingValue())->getType();
- default:
- break;
- }
- // Type inference not implemented for opcode.
- LLVM_DEBUG({
- dbgs() << "LV: Found unhandled opcode for: ";
- R->getVPSingleValue()->dump();
- });
- llvm_unreachable("Unhandled opcode!");
-}
-
Type *VPTypeAnalysis::inferScalarTypeForRecipe(const VPWidenRecipe *R) {
unsigned Opcode = R->getOpcode();
if (Instruction::isBinaryOp(Opcode) || Instruction::isShift(Opcode) ||
@@ -260,7 +144,8 @@ Type *VPTypeAnalysis::inferScalarType(const VPValue *V) {
VPScalarIVStepsRecipe, VPWidenCanonicalIVRecipe, VPWidenCastRecipe,
VPWidenIntrinsicRecipe, VPWidenGEPRecipe, VPVectorPointerRecipe,
VPVectorEndPointerRecipe, VPWidenCallRecipe, VPWidenLoadRecipe,
- VPWidenLoadEVLRecipe, VPDerivedIVRecipe, VPHeaderPHIRecipe>(V)) {
+ VPWidenLoadEVLRecipe, VPDerivedIVRecipe, VPHeaderPHIRecipe,
+ VPInstruction>(V)) {
Type *Ty = V->getScalarType();
assert(Ty && "Scalar type must be set by recipe construction");
return Ty;
@@ -268,10 +153,7 @@ Type *VPTypeAnalysis::inferScalarType(const VPValue *V) {
Type *ResultTy =
TypeSwitch<const VPRecipeBase *, Type *>(V->getDefiningRecipe())
- // VPInstructionWithType must be handled before VPInstruction.
- .Case<VPInstructionWithType>(
- [](const auto *R) { return R->getResultType(); })
- .Case<VPBlendRecipe, VPInstruction, VPWidenRecipe, VPReplicateRecipe>(
+ .Case<VPBlendRecipe, VPWidenRecipe, VPReplicateRecipe>(
[this](const auto *R) { return inferScalarTypeForRecipe(R); })
.Case([this](const VPReductionRecipe *R) {
return inferScalarType(R->getChainOp());
diff --git a/llvm/lib/Transforms/Vectorize/VPlanAnalysis.h b/llvm/lib/Transforms/Vectorize/VPlanAnalysis.h
index 8832c85b1dd02..8f4bb5219d0ca 100644
--- a/llvm/lib/Transforms/Vectorize/VPlanAnalysis.h
+++ b/llvm/lib/Transforms/Vectorize/VPlanAnalysis.h
@@ -22,7 +22,6 @@ namespace llvm {
class LLVMContext;
class VPValue;
class VPBlendRecipe;
-class VPInstruction;
class VPWidenRecipe;
class VPReplicateRecipe;
class VPRecipeBase;
@@ -48,7 +47,6 @@ class VPTypeAnalysis {
const DataLayout &DL;
Type *inferScalarTypeForRecipe(const VPBlendRecipe *R);
- Type *inferScalarTypeForRecipe(const VPInstruction *R);
Type *inferScalarTypeForRecipe(const VPWidenRecipe *R);
Type *inferScalarTypeForRecipe(const VPReplicateRecipe *R);
diff --git a/llvm/lib/Transforms/Vectorize/VPlanConstruction.cpp b/llvm/lib/Transforms/Vectorize/VPlanConstruction.cpp
index 391c358b22fa3..0449d792adfec 100644
--- a/llvm/lib/Transforms/Vectorize/VPlanConstruction.cpp
+++ b/llvm/lib/Transforms/Vectorize/VPlanConstruction.cpp
@@ -225,8 +225,8 @@ void PlainCFGBuilder::createVPInstructionsForVPBB(VPBasicBlock *VPBB,
// Phi node's operands may not have been visited at this point. We create
// an empty VPInstruction that we will fix once the whole plain CFG has
// been built.
- NewR =
- VPIRBuilder.createScalarPhi({}, Phi->getDebugLoc(), "vec.phi", *Phi);
+ NewR = VPIRBuilder.createScalarPhi({}, Phi->getDebugLoc(), "vec.phi",
+ *Phi, Phi->getType());
NewR->setUnderlyingValue(Phi);
if (isHeaderBB(Phi->getParent(), LI->getLoopFor(Phi->getParent()))) {
// Header phis need to be fixed after the VPBB for the latch has been
@@ -275,9 +275,10 @@ void PlainCFGBuilder::createVPInstructionsForVPBB(VPBasicBlock *VPBB,
} else {
// Build VPInstruction for any arbitrary Instruction without specific
// representation in VPlan.
- NewR =
- VPIRBuilder.createNaryOp(Inst->getOpcode(), VPOperands, Inst,
- VPIRFlags(*Inst), MD, Inst->getDebugLoc());
+ NewR = VPIRBuilder.createNaryOp(Inst->getOpcode(), VPOperands, Inst,
+ VPIRFlags(*Inst), MD,
+ Inst->getDebugLoc(), "",
+ Inst->getType());
}
}
diff --git a/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp b/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp
index f9fc97794f997..f2c5778360033 100644
--- a/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp
+++ b/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp
@@ -437,10 +437,93 @@ VPExpandSCEVRecipe::VPExpandSCEVRecipe(const SCEV *Expr)
: VPSingleDefRecipe(VPRecipeBase::VPExpandSCEVSC, {}, Expr->getType()),
Expr(Expr) {}
+Type *llvm::computeScalarTypeForInstruction(unsigned Opcode,
+ ArrayRef<VPValue *> Operands) {
+ assert(!Operands.empty() &&
+ "zero-operand VPInstruction opcodes must pass explicit ResultTy");
+ // Assert operand \p Idx (if present and typed) has type \p ExpectedTy.
+ auto AssertOperandType = [&Operands]([[maybe_unused]] unsigned Idx,
+ [[maybe_unused]] Type *ExpectedTy) {
+#ifndef NDEBUG
+ if (!ExpectedTy || Operands.size() <= Idx)
+ return;
+ Type *OpTy = getScalarTypeOrInfer(Operands[Idx]);
+ assert((!OpTy || OpTy == ExpectedTy) &&
+ "different types inferred for different operands");
+#endif
+ };
+
+ Type *Op0Ty = getScalarTypeOrInfer(Operands[0]);
+ LLVMContext &Ctx = Op0Ty->getContext();
+ switch (Opcode) {
+ case VPInstruction::BranchOnCond:
+ case VPInstruction::BranchOnTwoConds:
+ case VPInstruction::BranchOnCount:
+ case Instruction::Store:
+ case Instruction::Switch:
+ return Type::getVoidTy(Ctx);
+ case Instruction::ICmp:
+ case Instruction::FCmp:
+ case VPInstruction::ActiveLaneMask:
+ AssertOperandType(1, Op0Ty);
+ return IntegerType::get(Ctx, 1);
+ case VPInstruction::LogicalAnd:
+ case VPInstruction::LogicalOr:
+ case VPInstruction::MaskedCond:
+ assert((!Op0Ty || Op0Ty->isIntegerTy(1)) && "expected bool operand");
+ AssertOperandType(1, Op0Ty);
+ return IntegerType::get(Ctx, 1);
+ case VPInstruction::ExplicitVectorLength:
+ return IntegerType::get(Ctx, 32);
+ case Instruction::Select: {
+ Type *Op1Ty = getScalarTypeOrInfer(Operands[1]);
+ AssertOperandType(2, Op1Ty);
+ return Op1Ty;
+ }
+ case VPInstruction::ExtractLane: {
+ assert(Operands.size() >= 2 && "ExtractLane requires a lane operand and "
+ "at least one source vector operand");
+ Type *Op1Ty = getScalarTypeOrInfer(Operands[1]);
+ for (unsigned Idx = 2; Idx != Operands.size(); ++Idx)
+ AssertOperandType(Idx, Op1Ty);
+ return Op1Ty;
+ }
+ case Instruction::ExtractValue:
+ case VPInstruction::FirstActiveLane:
+ case VPInstruction::LastActiveLane:
+ case Instruction::Load:
+ case Instruction::Alloca:
+ case Instruction::Call:
+ llvm_unreachable("type must be passed explicitly");
+ default:
+ break;
+ }
+
+ // Opcodes that require all operands to share the same scalar type as the
+ // result.
+ bool AllOperandsSameType =
+ Instruction::isBinaryOp(Opcode) ||
+ is_contained({VPInstruction::FirstOrderRecurrenceSplice,
+ VPInstruction::CalculateTripCountMinusVF,
+ VPInstruction::CanonicalIVIncrementForPart,
+ VPInstruction::AnyOf, VPInstruction::BuildVector,
+ VPInstruction::BuildStructVector},
+ Opcode);
+ if (AllOperandsSameType)
+ for (unsigned Idx = 1; Idx != Operands.size(); ++Idx)
+ AssertOperandType(Idx, Op0Ty);
+
+ return Op0Ty;
+}
+
VPInstruction::VPInstruction(unsigned Opcode, ArrayRef<VPValue *> Operands,
const VPIRFlags &Flags, const VPIRMetadata &MD,
- DebugLoc DL, const Twine &Name)
- : VPRecipeWithIRFlags(VPRecipeBase::VPInstructionSC, Operands, Flags, DL),
+ DebugLoc DL, const Twine &Name, Type *ResultTy)
+ : VPRecipeWithIRFlags(
+ VPRecipeBase::VPInstructionSC, Operands,
+ ResultTy ? ResultTy
+ : computeScalarTypeForInstruction(Opcode, Operands),
+ Flags, DL),
VPIRMetadata(MD), Opcode(Opcode), Name(Name.str()) {
assert(flagsValidForOpcode(getOpcode()) &&
"Set flags not supported for the provided opcode");
@@ -1617,6 +1700,7 @@ void VPInstruction::printRecipe(raw_ostream &O, const Twine &Indent,
#endif
void VPInstructionWithType::execute(VPTransformState &State) {
+ Type *ResultTy = getResultType();
if (Instruction::isCast(getOpcode())) {
Value *Op = State.get(getOperand(0), VPLane(0));
Value *Cast = State.Builder.CreateCast(Instruction::CastOps(getOpcode()),
@@ -1653,6 +1737,7 @@ void VPInstructionWithType::printRecipe(raw_ostream &O, const Twine &Indent,
printAsOperand(O, SlotTracker);
O << " = ";
+ Type *ResultTy = getResultType();
switch (getOpcode()) {
case VPInstruction::WideIVStep:
O << "wide-iv-step ";
@@ -1678,8 +1763,7 @@ void VPInstructionWithType::printRecipe(raw_ostream &O, const Twine &Indent,
#endif
void VPPhi::e...
[truncated]
|
2cecded to
523999f
Compare
🐧 Linux x64 Test Results
✅ The build succeeded and all tests passed. |
🪟 Windows x64 Test Results
✅ The build succeeded and all tests passed. |
523999f to
75c2bf9
Compare
|
✅ With the latest revision this PR passed the C/C++ code formatter. |
Update VPInstruction and VPPhi to populate VPSingleDefValue's scalar type. For most opcodes, the scalar type is determine from the operands, via computeScalarTypeForInstruction, which roughly matches to removed inference code. For some opcodes, like FirstActiveLane, the type must be provided explicitly.
75c2bf9 to
4f233a1
Compare
fhahn
added a commit
to fhahn/llvm-project
that referenced
this pull request
May 24, 2026
Update VPReplicateRecipe to populate VPSingleDefValue's scalar type. For most opcodes, the scalar type is determine from the operands, via computeScalarTypeForInstruction (from llvm#199378). For some opcodes, like Loads and casts, the type must be provided explicitly. Depends on llvm#199378 (included in PR).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Update VPInstruction and VPPhi to populate VPSingleDefValue's scalar type. For most opcodes, the scalar type is determine from the operands, via computeScalarTypeForInstruction, which roughly matches to removed inference code. For some opcodes, like FirstActiveLane, the type must be provided explicitly.