[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
This commit is contained in:
Florian Hahn 2021-01-06 10:57:46 +00:00
parent 74438eff51
commit 0ce5f402e0
No known key found for this signature in database
GPG Key ID: 61D7554B5CECDC0D
1 changed files with 9 additions and 0 deletions

View File

@ -166,6 +166,15 @@ public:
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;