[VPlan] Introduce code to limit querying VPValues using IR references.
authorFlorian Hahn <flo@fhahn.com>
Mon, 30 Aug 2021 06:50:17 +0000 (08:50 +0200)
committerFlorian Hahn <flo@fhahn.com>
Mon, 30 Aug 2021 07:12:09 +0000 (09:12 +0200)
commitabd36fe512a6ba8de51bca7911322ae8fa1b0a78
treeab94d6ca5837ceec014bc25f118290ce176b2ab9
parent3a6b722db856cbd6279d0c6578c0d7cca12b18f6
[VPlan] Introduce code to limit querying VPValues using IR references.

After applying VPlan-to-VPlan transformations, using IR references to
query VPlan values may be incorrect, as the IR is not in sync with the
VPlan any longer.

To better detect such mis-matches, this patch introduces a new flag to
VPlans to indicate whether it is safe to query VPValues using IR values.

getVPValue is updated to assert if it is called when the flag indicates
it is not safe any longer.

There is an escape hatch via an extra argument, because there are 3
places that need to be fixed first. Those are

1. truncateToMinimalBitwidths
2. clearReductionWrapFlags
3. fixLCSSAPHIs

As a first step, this flag will help preventing new code from violating
this property.

Any suggestions with respect to naming very welcome!

Reviewed By: Ayal

Differential Revision: https://reviews.llvm.org/D108573
llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
llvm/lib/Transforms/Vectorize/VPlan.h