[llvm] [VPlan] Simplify PlainCFG VPI construction (NFC) (PR #216435)
Ramkumar Ramachandra via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 9 00:55:12 PDT 2026
https://github.com/artagnon updated https://github.com/llvm/llvm-project/pull/216435
>From 9c71642223f413a9f382bdb167fe1130adc81f3f Mon Sep 17 00:00:00 2001
From: Ramkumar Ramachandra <artagnon at tenstorrent.com>
Date: Sat, 15 Aug 2026 00:38:46 +0100
Subject: [PATCH] [VPlan] Simplify PlainCFG VPI construction (NFC)
---
.../Vectorize/LoopVectorizationPlanner.h | 6 ------
.../Vectorize/VPlanConstruction.cpp | 20 +++----------------
2 files changed, 3 insertions(+), 23 deletions(-)
diff --git a/llvm/lib/Transforms/Vectorize/LoopVectorizationPlanner.h b/llvm/lib/Transforms/Vectorize/LoopVectorizationPlanner.h
index 4ceac108ae8c7..25726d6e92361 100644
--- a/llvm/lib/Transforms/Vectorize/LoopVectorizationPlanner.h
+++ b/llvm/lib/Transforms/Vectorize/LoopVectorizationPlanner.h
@@ -418,12 +418,6 @@ class VPBuilder {
new VPDerivedIVRecipe(Kind, FPBinOp, Start, Current, Step, Flags));
}
- VPInstruction *createScalarLoad(Type *ResultTy, VPValue *Addr, DebugLoc DL,
- const VPIRMetadata &Metadata = {}) {
- return tryInsertInstruction(new VPInstruction(Instruction::Load, Addr, {},
- Metadata, DL, "", ResultTy));
- }
-
VPInstruction *createScalarCast(Instruction::CastOps Opcode, VPValue *Op,
Type *ResultTy, DebugLoc DL,
std::optional<VPIRFlags> Flags = std::nullopt,
diff --git a/llvm/lib/Transforms/Vectorize/VPlanConstruction.cpp b/llvm/lib/Transforms/Vectorize/VPlanConstruction.cpp
index c0c63f3e87842..f2167b9c8cfb4 100644
--- a/llvm/lib/Transforms/Vectorize/VPlanConstruction.cpp
+++ b/llvm/lib/Transforms/Vectorize/VPlanConstruction.cpp
@@ -265,23 +265,9 @@ void PlainCFGBuilder::createVPInstructionsForVPBB(VPBasicBlock *VPBB,
SmallVector<VPValue *, 4> VPOperands;
for (Value *Op : Inst->operands())
VPOperands.push_back(getOrCreateVPOperand(Op));
-
- if (auto *CI = dyn_cast<CastInst>(Inst)) {
- NewR = VPIRBuilder.createScalarCast(CI->getOpcode(), VPOperands[0],
- CI->getType(), CI->getDebugLoc(),
- VPIRFlags(*CI), MD);
- NewR->setUnderlyingValue(CI);
- } else if (auto *LI = dyn_cast<LoadInst>(Inst)) {
- NewR = VPIRBuilder.createScalarLoad(LI->getType(), VPOperands[0],
- LI->getDebugLoc(), MD);
- NewR->setUnderlyingValue(LI);
- } else {
- // Build VPInstruction for any arbitrary Instruction without specific
- // representation in VPlan.
- NewR = VPIRBuilder.createNaryOp(
- Inst->getOpcode(), VPOperands, Inst, VPIRFlags(*Inst), MD,
- Inst->getDebugLoc(), "", Inst->getType());
- }
+ NewR = VPIRBuilder.createNaryOp(Inst->getOpcode(), VPOperands, Inst,
+ VPIRFlags(*Inst), MD, Inst->getDebugLoc(),
+ "", Inst->getType());
}
IRDef2VPValue[Inst] = NewR;
More information about the llvm-commits
mailing list