[llvm] [VPlan] Materialize VF and VFxUF using VPInstructions. (PR #152879)
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 11 04:06:28 PDT 2025
================
@@ -276,6 +276,20 @@ class VPBuilder {
return tryInsertInstruction(new VPPhi(IncomingValues, DL, Name));
}
+ VPValue *createElementCount(Type *Ty, ElementCount EC) {
+ VPlan &Plan = *getInsertBlock()->getPlan();
+ VPValue *RuntimeEC =
+ Plan.getOrAddLiveIn(ConstantInt::get(Ty, EC.getKnownMinValue()));
+ if (EC.isScalable()) {
+ VPValue *VScale = createNaryOp(VPInstruction::VScale, {}, Ty);
+ RuntimeEC = EC.getKnownMinValue() == 1
+ ? VScale
+ : createNaryOp(Instruction::Mul, {VScale, RuntimeEC},
+ VPIRFlags::WrapFlagsTy(true, false));
----------------
fhahn wrote:
Yeah, I've updated it to use createOverflowingOp, although it may be clearer to spell out the wrap flags type.
https://github.com/llvm/llvm-project/pull/152879
More information about the llvm-commits
mailing list