1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 03:02:36 +01:00

[VPlan] Support extracting lanes for defs managed in VPTransformState.

Currently extracting a lane for a VPValue def is not supported, if it is
managed directly by VPTransformState (e.g. because it is created by a
VPInstruction or an external VPValue def).

For now, simply extract the requested lane. In the future, we should
also cache the extracted scalar values, similar to LV.

Reviewers: Ayal, rengolin, gilr, SjoerdMeijer

Reviewed By: SjoerdMeijer

Differential Revision: https://reviews.llvm.org/D80787
This commit is contained in:
Florian Hahn 2020-06-03 11:30:06 +01:00
parent 8de1b296de
commit 06e94a3cd5

View File

@ -270,10 +270,20 @@ struct VPTransformState {
return Callback.getOrCreateVectorValues(VPValue2Value[Def], Part); return Callback.getOrCreateVectorValues(VPValue2Value[Def], Part);
} }
/// Get the generated Value for a given VPValue and given Part and Lane. Note /// Get the generated Value for a given VPValue and given Part and Lane.
/// that as per-lane Defs are still created by ILV and managed in its ValueMap
/// this method currently just delegates the call to ILV.
Value *get(VPValue *Def, const VPIteration &Instance) { Value *get(VPValue *Def, const VPIteration &Instance) {
// If the Def is managed directly by VPTransformState, extract the lane from
// the relevant part. Note that currently only VPInstructions and external
// defs are managed by VPTransformState. Other Defs are still created by ILV
// and managed in its ValueMap. For those this method currently just
// delegates the call to ILV below.
if (Data.PerPartOutput.count(Def)) {
auto *VecPart = Data.PerPartOutput[Def][Instance.Part];
// TODO: Cache created scalar values.
return Builder.CreateExtractElement(VecPart,
Builder.getInt32(Instance.Lane));
}
return Callback.getOrCreateScalarValue(VPValue2Value[Def], Instance); return Callback.getOrCreateScalarValue(VPValue2Value[Def], Instance);
} }