Skip to content

Commit 0985554

Browse files
committed
[Attributor][NFC] Split AbstractAttributes out of Attributor.cpp
Attributor.cpp became quite big and we need to start provide structure. The Attributor code is now in Attributor.cpp and the classes derived from AbstractAttribute are in AttributorAttributes.cpp. Minor changes were required but no intended functional changes. We also minimized includes as part of this. Reviewed By: baziotis Differential Revision: https://reviews.llvm.org/D76873
1 parent 21605a1 commit 0985554

File tree

5 files changed

+7337
-7327
lines changed

5 files changed

+7337
-7327
lines changed

llvm/include/llvm/Transforms/IPO/Attributor.h

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -894,6 +894,12 @@ struct Attributor {
894894
/// Record that \p F is deleted after information was manifested.
895895
void deleteAfterManifest(Function &F) { ToBeDeletedFunctions.insert(&F); }
896896

897+
/// If \p V is assumed to be a constant, return it, if it is unclear yet,
898+
/// return None, otherwise return `nullptr`.
899+
Optional<Constant *> getAssumedConstant(const Value &V,
900+
const AbstractAttribute &AA,
901+
bool &UsedAssumedInformation);
902+
897903
/// Return true if \p AA (or its context instruction) is assumed dead.
898904
///
899905
/// If \p LivenessAA is not provided it is queried.
@@ -1916,7 +1922,10 @@ raw_ostream &operator<<(raw_ostream &OS, const AbstractState &State);
19161922
template <typename base_ty, base_ty BestState, base_ty WorstState>
19171923
raw_ostream &
19181924
operator<<(raw_ostream &OS,
1919-
const IntegerStateBase<base_ty, BestState, WorstState> &State);
1925+
const IntegerStateBase<base_ty, BestState, WorstState> &S) {
1926+
return OS << "(" << S.getKnown() << "-" << S.getAssumed() << ")"
1927+
<< static_cast<const AbstractState &>(S);
1928+
}
19201929
raw_ostream &operator<<(raw_ostream &OS, const IntegerRangeState &State);
19211930
///}
19221931

@@ -2233,6 +2242,11 @@ struct AAIsDead : public StateWrapper<BooleanState, AbstractAttribute>,
22332242
/// Create an abstract attribute view for the position \p IRP.
22342243
static AAIsDead &createForPosition(const IRPosition &IRP, Attributor &A);
22352244

2245+
/// Determine if \p F might catch asynchronous exceptions.
2246+
static bool mayCatchAsynchronousExceptions(const Function &F) {
2247+
return F.hasPersonalityFn() && !canSimplifyInvokeNoUnwind(&F);
2248+
}
2249+
22362250
/// Unique ID (due to the unique address)
22372251
static const char ID;
22382252

0 commit comments

Comments
 (0)