1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 10:42:39 +01:00

[Attributor] Allow to skip the initial update for a new AA

Users might want to run initialize for a set of AAs without an
intermediate update step. Running update eagerly is not a requirement
anyway so we make it optional.
This commit is contained in:
Johannes Doerfert 2021-06-17 19:01:22 -05:00
parent c50c80812f
commit 4b0523df3a

View File

@ -1146,9 +1146,10 @@ struct Attributor {
/// function.
/// NOTE: ForceUpdate is ignored in any stage other than the update stage.
template <typename AAType>
const AAType &
getOrCreateAAFor(IRPosition IRP, const AbstractAttribute *QueryingAA,
DepClassTy DepClass, bool ForceUpdate = false) {
const AAType &getOrCreateAAFor(IRPosition IRP,
const AbstractAttribute *QueryingAA,
DepClassTy DepClass, bool ForceUpdate = false,
bool UpdateAfterInit = true) {
if (!shouldPropagateCallBaseContext(IRP))
IRP = IRP.stripCallBaseContext();
@ -1216,12 +1217,14 @@ struct Attributor {
// Allow seeded attributes to declare dependencies.
// Remember the seeding state.
AttributorPhase OldPhase = Phase;
Phase = AttributorPhase::UPDATE;
if (UpdateAfterInit) {
AttributorPhase OldPhase = Phase;
Phase = AttributorPhase::UPDATE;
updateAA(AA);
updateAA(AA);
Phase = OldPhase;
Phase = OldPhase;
}
if (QueryingAA && AA.getState().isValidState())
recordDependence(AA, const_cast<AbstractAttribute &>(*QueryingAA),