[PATCH] D100101: [VPlan] Add VPBasicBlock::phis() helper (NFC).
Florian Hahn via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sun May 2 11:20:56 PDT 2021
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG942e068d7a98: [VPlan] Add VPBasicBlock::phis() helper (NFC). (authored by fhahn).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D100101/new/
https://reviews.llvm.org/D100101
Files:
llvm/lib/Transforms/Vectorize/VPlan.cpp
llvm/lib/Transforms/Vectorize/VPlan.h
Index: llvm/lib/Transforms/Vectorize/VPlan.h
===================================================================
--- llvm/lib/Transforms/Vectorize/VPlan.h
+++ llvm/lib/Transforms/Vectorize/VPlan.h
@@ -685,6 +685,12 @@
/// Returns true if the recipe may have side-effects.
bool mayHaveSideEffects() const;
+
+ /// Returns true for PHI-like recipes.
+ bool isPhi() const {
+ return getVPDefID() == VPWidenIntOrFpInductionSC || getVPDefID() == VPWidenPHISC ||
+ getVPDefID() == VPPredInstPHISC || getVPDefID() == VPWidenCanonicalIVSC;
+ }
};
inline bool VPUser::classof(const VPDef *Def) {
@@ -1430,7 +1436,7 @@
/// VPBasicBlock serves as the leaf of the Hierarchical Control-Flow Graph. It
/// holds a sequence of zero or more VPRecipe's each representing a sequence of
-/// output IR instructions.
+/// output IR instructions. All PHI-like recipes must come before any non-PHI recipes.
class VPBasicBlock : public VPBlockBase {
public:
using RecipeListTy = iplist<VPRecipeBase>;
@@ -1508,6 +1514,11 @@
/// Return the position of the first non-phi node recipe in the block.
iterator getFirstNonPhi();
+ /// Returns an iterator range over the PHI-like recipes in the block.
+ iterator_range<iterator> phis() {
+ return make_range(begin(), getFirstNonPhi());
+ }
+
void dropAllReferences(VPValue *NewValue) override;
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
Index: llvm/lib/Transforms/Vectorize/VPlan.cpp
===================================================================
--- llvm/lib/Transforms/Vectorize/VPlan.cpp
+++ llvm/lib/Transforms/Vectorize/VPlan.cpp
@@ -249,10 +249,7 @@
VPBasicBlock::iterator VPBasicBlock::getFirstNonPhi() {
iterator It = begin();
- while (It != end() && (isa<VPWidenPHIRecipe>(&*It) ||
- isa<VPWidenIntOrFpInductionRecipe>(&*It) ||
- isa<VPPredInstPHIRecipe>(&*It) ||
- isa<VPWidenCanonicalIVRecipe>(&*It)))
+ while (It != end() && It->isPhi())
It++;
return It;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D100101.342252.patch
Type: text/x-patch
Size: 2041 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210502/d83629a2/attachment.bin>
More information about the llvm-commits
mailing list