[llvm-branch-commits] [llvm] 0ce5f40 - [VPlan] Add getLiveInIRValue accessor to VPValue.
Florian Hahn via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Wed Jan 6 03:27:19 PST 2021
Author: Florian Hahn
Date: 2021-01-06T11:20:42Z
New Revision: 0ce5f402e0166a33bea01d577ce8ee32189d80e3
URL: https://github.com/llvm/llvm-project/commit/0ce5f402e0166a33bea01d577ce8ee32189d80e3
DIFF: https://github.com/llvm/llvm-project/commit/0ce5f402e0166a33bea01d577ce8ee32189d80e3.diff
LOG: [VPlan] Add getLiveInIRValue accessor to VPValue.
This patch adds a new getLiveInIRValue accessor to VPValue, which
returns the underlying value, if the VPValue is defined outside of
VPlan. This is required to handle scalars in VPTransformState, which
requires dealing with scalars defined outside of VPlan.
We can simply check VPValue::Def to determine if the value is defined
inside a VPlan.
Reviewed By: Ayal
Differential Revision: https://reviews.llvm.org/D92281
Added:
Modified:
llvm/lib/Transforms/Vectorize/VPlanValue.h
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/Vectorize/VPlanValue.h b/llvm/lib/Transforms/Vectorize/VPlanValue.h
index 5bafe220785d..fdedafef2edd 100644
--- a/llvm/lib/Transforms/Vectorize/VPlanValue.h
+++ b/llvm/lib/Transforms/Vectorize/VPlanValue.h
@@ -166,6 +166,15 @@ class VPValue {
void replaceAllUsesWith(VPValue *New);
VPDef *getDef() { return Def; }
+
+ /// Returns the underlying IR value, if this VPValue is defined outside the
+ /// scope of VPlan. Returns nullptr if the VPValue is defined by a VPDef
+ /// inside a VPlan.
+ Value *getLiveInIRValue() {
+ assert(!getDef() &&
+ "VPValue is not a live-in; it is defined by a VPDef inside a VPlan");
+ return getUnderlyingValue();
+ }
};
typedef DenseMap<Value *, VPValue *> Value2VPValueTy;
More information about the llvm-branch-commits
mailing list