[PATCH] D131989: [VPlan] Verify that header only contains header phi recipes.
Florian Hahn via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 16 12:54:31 PDT 2022
fhahn created this revision.
fhahn added reviewers: Ayal, gilr, rengolin.
Herald added subscribers: tschuett, psnobl, rogfer01, bollu, hiraditya.
Herald added a project: All.
fhahn requested review of this revision.
Herald added a subscriber: vkmr.
Herald added a project: LLVM.
Add verification that VPHeaderPHIRecipes are only in header VPBBs. Also
adds missing checks for VPPointerInductionRecipe to
VPHeaderPHIRecipe::classof.
Split off from D119661 <https://reviews.llvm.org/D119661>.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D131989
Files:
llvm/lib/Transforms/Vectorize/VPlan.h
llvm/lib/Transforms/Vectorize/VPlanVerifier.cpp
Index: llvm/lib/Transforms/Vectorize/VPlanVerifier.cpp
===================================================================
--- llvm/lib/Transforms/Vectorize/VPlanVerifier.cpp
+++ llvm/lib/Transforms/Vectorize/VPlanVerifier.cpp
@@ -141,9 +141,31 @@
auto RecipeI = VPBB->begin();
auto End = VPBB->end();
unsigned NumActiveLaneMaskPhiRecipes = 0;
+ const VPRegionBlock *ParentR = VPBB->getParent();
+ bool IsHeaderVPBB = ParentR && !ParentR->isReplicator() &&
+ ParentR->getEntryBasicBlock() == VPBB;
while (RecipeI != End && RecipeI->isPhi()) {
if (isa<VPActiveLaneMaskPHIRecipe>(RecipeI))
NumActiveLaneMaskPhiRecipes++;
+
+ if (IsHeaderVPBB && !isa<VPHeaderPHIRecipe>(*RecipeI)) {
+ errs() << "Found non-header PHI recipe in header VPBB";
+#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
+ errs() << ": ";
+ RecipeI->dump();
+#endif
+ return false;
+ }
+
+ if (!IsHeaderVPBB && isa<VPHeaderPHIRecipe>(*RecipeI)) {
+ errs() << "Found header PHI recipe in non-header VPBB";
+#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
+ errs() << ": ";
+ RecipeI->dump();
+#endif
+ return false;
+ }
+
RecipeI++;
}
Index: llvm/lib/Transforms/Vectorize/VPlan.h
===================================================================
--- llvm/lib/Transforms/Vectorize/VPlan.h
+++ llvm/lib/Transforms/Vectorize/VPlan.h
@@ -1139,6 +1139,7 @@
B->getVPDefID() == VPRecipeBase::VPFirstOrderRecurrencePHISC ||
B->getVPDefID() == VPRecipeBase::VPReductionPHISC ||
B->getVPDefID() == VPRecipeBase::VPWidenIntOrFpInductionSC ||
+ B->getVPDefID() == VPRecipeBase::VPWidenPointerInductionSC ||
B->getVPDefID() == VPRecipeBase::VPWidenPHISC;
}
static inline bool classof(const VPValue *V) {
@@ -1147,6 +1148,7 @@
V->getVPValueID() == VPValue::VPVFirstOrderRecurrencePHISC ||
V->getVPValueID() == VPValue::VPVReductionPHISC ||
V->getVPValueID() == VPValue::VPVWidenIntOrFpInductionSC ||
+ V->getVPValueID() == VPValue::VPVWidenPointerInductionSC ||
V->getVPValueID() == VPValue::VPVWidenPHISC;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D131989.453099.patch
Type: text/x-patch
Size: 2202 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220816/08b781e8/attachment.bin>
More information about the llvm-commits
mailing list