[llvm] 3d6df01 - [Attributor] Allow to skip the initial update for a new AA
Johannes Doerfert via llvm-commits
llvm-commits at lists.llvm.org
Thu Jun 17 23:10:54 PDT 2021
Author: Johannes Doerfert
Date: 2021-06-18T01:07:53-05:00
New Revision: 3d6df0108b48358b8cdc6cf3267300c217fe823c
URL: https://github.com/llvm/llvm-project/commit/3d6df0108b48358b8cdc6cf3267300c217fe823c
DIFF: https://github.com/llvm/llvm-project/commit/3d6df0108b48358b8cdc6cf3267300c217fe823c.diff
LOG: [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.
Added:
Modified:
llvm/include/llvm/Transforms/IPO/Attributor.h
Removed:
################################################################################
diff --git a/llvm/include/llvm/Transforms/IPO/Attributor.h b/llvm/include/llvm/Transforms/IPO/Attributor.h
index 539d1fd1e306..88b7848b45b2 100644
--- a/llvm/include/llvm/Transforms/IPO/Attributor.h
+++ b/llvm/include/llvm/Transforms/IPO/Attributor.h
@@ -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),
More information about the llvm-commits
mailing list