[PATCH] D85668: [Attributor][NFC] Connect AAPotentialValues with AAValueSimplify
Shinji Okumura via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 10 18:25:45 PDT 2020
okura updated this revision to Diff 284542.
okura added a comment.
- fix the places that were pointed out
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D85668/new/
https://reviews.llvm.org/D85668
Files:
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
@@ -4474,23 +4474,34 @@
return true;
}
- bool askSimplifiedValueForAAValueConstantRange(Attributor &A) {
+ /// Returns a candidate is found or not
+ template <typename AAType> bool askSimplifiedValueFor(Attributor &A) {
if (!getAssociatedValue().getType()->isIntegerTy())
return false;
- const auto &ValueConstantRangeAA =
- A.getAAFor<AAValueConstantRange>(*this, getIRPosition());
+ const auto &AA =
+ A.getAAFor<AAType>(*this, getIRPosition(), /* TrackDependence */ true,
+ DepClassTy::OPTIONAL);
- Optional<ConstantInt *> COpt =
- ValueConstantRangeAA.getAssumedConstantInt(A);
- if (COpt.hasValue()) {
- if (auto *C = COpt.getValue())
+ Optional<ConstantInt *> COpt = AA.getAssumedConstantInt(A);
+
+ if (!COpt.hasValue()) {
+ SimplifiedAssociatedValue = llvm::None;
+ return true;
+ } else {
+ if (auto *C = COpt.getValue()) {
SimplifiedAssociatedValue = C;
- else
+ return true;
+ } else {
return false;
- } else {
- SimplifiedAssociatedValue = llvm::None;
+ }
}
+ }
+
+ bool askSimplifiedValueForOtherAAs(Attributor &A) {
+ if (!askSimplifiedValueFor<AAValueConstantRange>(A))
+ if (!askSimplifiedValueFor<AAPotentialValues>(A))
+ return false;
return true;
}
@@ -4598,7 +4609,7 @@
bool AllCallSitesKnown;
if (!A.checkForAllCallSites(PredForCallSite, *this, true,
AllCallSitesKnown))
- if (!askSimplifiedValueForAAValueConstantRange(A))
+ if (!askSimplifiedValueForOtherAAs(A))
return indicatePessimisticFixpoint();
// If a candicate was found in this update, return CHANGED.
@@ -4626,7 +4637,7 @@
};
if (!A.checkForAllReturnedValues(PredForReturned, *this))
- if (!askSimplifiedValueForAAValueConstantRange(A))
+ if (!askSimplifiedValueForOtherAAs(A))
return indicatePessimisticFixpoint();
// If a candicate was found in this update, return CHANGED.
@@ -4716,7 +4727,7 @@
if (!genericValueTraversal<AAValueSimplify, bool>(
A, getIRPosition(), *this, Dummy, VisitValueCB, getCtxI(),
/* UseValueSimplify */ false))
- if (!askSimplifiedValueForAAValueConstantRange(A))
+ if (!askSimplifiedValueForOtherAAs(A))
return indicatePessimisticFixpoint();
// If a candicate was found in this update, return CHANGED.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D85668.284542.patch
Type: text/x-patch
Size: 2705 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200811/ebf5b5ca/attachment.bin>
More information about the llvm-commits
mailing list