aboutsummaryrefslogtreecommitdiff
path: root/contrib/llvm-project/llvm/lib/Transforms/Vectorize/VPlanValue.h
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/llvm-project/llvm/lib/Transforms/Vectorize/VPlanValue.h')
-rw-r--r--contrib/llvm-project/llvm/lib/Transforms/Vectorize/VPlanValue.h30
1 files changed, 19 insertions, 11 deletions
diff --git a/contrib/llvm-project/llvm/lib/Transforms/Vectorize/VPlanValue.h b/contrib/llvm-project/llvm/lib/Transforms/Vectorize/VPlanValue.h
index ac110bb3b0ef..116acad8e8f3 100644
--- a/contrib/llvm-project/llvm/lib/Transforms/Vectorize/VPlanValue.h
+++ b/contrib/llvm-project/llvm/lib/Transforms/Vectorize/VPlanValue.h
@@ -121,18 +121,11 @@ public:
/// Remove a single \p User from the list of users.
void removeUser(VPUser &User) {
- bool Found = false;
// The same user can be added multiple times, e.g. because the same VPValue
// is used twice by the same VPUser. Remove a single one.
- erase_if(Users, [&User, &Found](VPUser *Other) {
- if (Found)
- return false;
- if (Other == &User) {
- Found = true;
- return true;
- }
- return false;
- });
+ auto *I = find(Users, &User);
+ if (I != Users.end())
+ Users.erase(I);
}
typedef SmallVectorImpl<VPUser *>::iterator user_iterator;
@@ -163,6 +156,13 @@ public:
void replaceAllUsesWith(VPValue *New);
+ /// Go through the uses list for this VPValue and make each use point to \p
+ /// New if the callback ShouldReplace returns true for the given use specified
+ /// by a pair of (VPUser, the use index).
+ void replaceUsesWithIf(
+ VPValue *New,
+ llvm::function_ref<bool(VPUser &U, unsigned Idx)> ShouldReplace);
+
/// Returns the recipe defining this VPValue or nullptr if it is not defined
/// by a recipe, i.e. is a live-in.
VPRecipeBase *getDefiningRecipe();
@@ -296,6 +296,14 @@ public:
"Op must be an operand of the recipe");
return false;
}
+
+ /// Returns true if the VPUser only uses the first part of operand \p Op.
+ /// Conservatively returns false.
+ virtual bool onlyFirstPartUsed(const VPValue *Op) const {
+ assert(is_contained(operands(), Op) &&
+ "Op must be an operand of the recipe");
+ return false;
+ }
};
/// This class augments a recipe with a set of VPValues defined by the recipe.
@@ -325,7 +333,7 @@ class VPDef {
assert(V->Def == this && "can only remove VPValue linked with this VPDef");
assert(is_contained(DefinedValues, V) &&
"VPValue to remove must be in DefinedValues");
- erase_value(DefinedValues, V);
+ llvm::erase(DefinedValues, V);
V->Def = nullptr;
}