[llvm] [VPlan] Support live-ins without underlying IR in type analysis. (PR #80723)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Feb 20 13:39:47 PST 2024
================
@@ -203,6 +198,16 @@ Type *VPTypeAnalysis::inferScalarTypeForRecipe(const VPReplicateRecipe *R) {
llvm_unreachable("Unhandled opcode");
}
+VPTypeAnalysis::VPTypeAnalysis(VPlan &Plan, LLVMContext &Ctx) : Ctx(Ctx) {
+ auto *CanIV = Plan.getCanonicalIV();
+ Type *CanIVTy = inferScalarType(CanIV);
+ CachedTypes[&Plan.getVectorTripCount()] = CanIVTy;
+ CachedTypes[&Plan.getVFxUF()] = CanIVTy;
+ CachedTypes[Plan.getTripCount()] = CanIVTy;
+ if (auto *BTC = Plan.getBackedgeTakenCount())
+ CachedTypes[BTC] = CanIVTy;
+}
+
Type *VPTypeAnalysis::inferScalarType(const VPValue *V) {
if (Type *CachedTy = CachedTypes.lookup(V))
return CachedTy;
----------------
ayalz wrote:
An alternative to caching the pre-computed type for all live-ins-w/o-underlying-value, as raised above, may be to change below into:
```
if (V->isLiveIn()) {
if (auto *IRValue = V->getLiveInIRValue())
return IRValue->getType();
return CanonicalType;
}
```
https://github.com/llvm/llvm-project/pull/80723
More information about the llvm-commits
mailing list