[PATCH] D86635: [Attributor] Add getter of abstract attributes for the manifestation stage
Shinji Okumura via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 26 10:40:16 PDT 2020
okura updated this revision to Diff 288036.
okura added a comment.
Herald added a subscriber: hiraditya.
- rename getter `getAADuringManifestFor`
- replace some existing `getAAFor` in manifest with this
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D86635/new/
https://reviews.llvm.org/D86635
Files:
llvm/include/llvm/Transforms/IPO/Attributor.h
llvm/lib/Transforms/IPO/AttributorAttributes.cpp
Index: llvm/lib/Transforms/IPO/AttributorAttributes.cpp
===================================================================
--- llvm/lib/Transforms/IPO/AttributorAttributes.cpp
+++ llvm/lib/Transforms/IPO/AttributorAttributes.cpp
@@ -3065,9 +3065,8 @@
auto *CB = dyn_cast<CallBase>(DeadEndI);
if (!CB)
continue;
- const auto &NoReturnAA = A.getAndUpdateAAFor<AANoReturn>(
- *this, IRPosition::callsite_function(*CB), /* TrackDependence */ true,
- DepClassTy::OPTIONAL);
+ const auto &NoReturnAA = A.getAADuringManifestFor<AANoReturn>(
+ IRPosition::callsite_function(*CB));
bool MayReturn = !NoReturnAA.isAssumedNoReturn();
if (MayReturn && (!Invoke2CallAllowed || !isa<InvokeInst>(CB)))
continue;
@@ -5540,7 +5539,8 @@
Argument *Arg = getAssociatedArgument();
// Query AAAlign attribute for alignment of associated argument to
// determine the best alignment of loads.
- const auto &AlignAA = A.getAAFor<AAAlign>(*this, IRPosition::value(*Arg));
+ const auto &AlignAA =
+ A.getAADuringManifestFor<AAAlign>(IRPosition::value(*Arg));
// Callback to repair the associated function. A new alloca is placed at the
// beginning and initialized with the values passed through arguments. The
Index: llvm/include/llvm/Transforms/IPO/Attributor.h
===================================================================
--- llvm/include/llvm/Transforms/IPO/Attributor.h
+++ llvm/include/llvm/Transforms/IPO/Attributor.h
@@ -965,6 +965,18 @@
/* ForceUpdate */ true);
}
+ /// Return abstract attribute of type \p AAType at position \p IRP. If the AA
+ /// has not been initialized, this initializes it and forces it to indicate
+ /// a pessimistic fixpoint. We should use this when we want to query abstract
+ /// attributes in AbstractAttribute::manifest.
+ template <typename AAType>
+ const AAType &getAADuringManifestFor(const IRPosition &IRP) {
+ return getOrCreateAAFor<AAType>(IRP, nullptr, /* TrackDependence */ false,
+ DepClassTy::OPTIONAL,
+ /* ForceUpdate */ false,
+ /* DuringManifest */ true);
+ }
+
/// The version of getAAFor that allows to omit a querying abstract
/// attribute. Using this after Attributor started running is restricted to
/// only the Attributor itself. Initial seeding of AAs can be done via this
@@ -974,10 +986,13 @@
const AbstractAttribute *QueryingAA = nullptr,
bool TrackDependence = false,
DepClassTy DepClass = DepClassTy::OPTIONAL,
- bool ForceUpdate = false) {
+ bool ForceUpdate = false,
+ bool DuringManifest = false) {
if (AAType *AAPtr = lookupAAFor<AAType>(IRP, QueryingAA, TrackDependence)) {
- if (ForceUpdate)
+ if (ForceUpdate) {
+ assert(!DuringManifest && "We cannot update AA during manifestation!");
updateAA(*AAPtr);
+ }
return *AAPtr;
}
@@ -1020,6 +1035,13 @@
return AA;
}
+ // If this is queried during manifestation, we immediately force it to
+ // indicate a pessimistic fixpoint.
+ if (DuringManifest) {
+ AA.getState().indicatePessimisticFixpoint();
+ return AA;
+ }
+
// Allow seeded attributes to declare dependencies.
// Remember the seeding state.
bool OldSeedingPeriod = SeedingPeriod;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D86635.288036.patch
Type: text/x-patch
Size: 3629 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200826/9122712b/attachment.bin>
More information about the llvm-commits
mailing list