Skip to content

Commit 2891b00

Browse files
committed
[Attributor][NFC] Add const and missing state constructors
1 parent 5948daf commit 2891b00

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

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

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1360,6 +1360,9 @@ struct IntegerStateBase : public AbstractState {
13601360

13611361
/// Return the worst possible representable state.
13621362
static constexpr base_t getWorstState() { return WorstState; }
1363+
static constexpr base_t getWorstState(const IntegerStateBase &) {
1364+
return getWorstState();
1365+
}
13631366

13641367
/// See AbstractState::isValidState()
13651368
/// NOTE: For now we simply pretend that the worst possible state is invalid.
@@ -2273,6 +2276,16 @@ struct DerefState : AbstractState {
22732276
static DerefState getBestState() { return DerefState(); }
22742277
static DerefState getBestState(const DerefState &) { return getBestState(); }
22752278

2279+
/// Return the worst possible representable state.
2280+
static DerefState getWorstState() {
2281+
DerefState DS;
2282+
DS.indicatePessimisticFixpoint();
2283+
return DS;
2284+
}
2285+
static DerefState getWorstState(const DerefState &) {
2286+
return getWorstState();
2287+
}
2288+
22762289
/// State representing for dereferenceable bytes.
22772290
IncIntegerState<> DerefBytesState;
22782291

@@ -2363,13 +2376,13 @@ struct DerefState : AbstractState {
23632376
}
23642377

23652378
/// Equality for DerefState.
2366-
bool operator==(const DerefState &R) {
2379+
bool operator==(const DerefState &R) const {
23672380
return this->DerefBytesState == R.DerefBytesState &&
23682381
this->GlobalState == R.GlobalState;
23692382
}
23702383

23712384
/// Inequality for DerefState.
2372-
bool operator!=(const DerefState &R) { return !(*this == R); }
2385+
bool operator!=(const DerefState &R) const { return !(*this == R); }
23732386

23742387
/// See IntegerStateBase::operator^=
23752388
DerefState operator^=(const DerefState &R) {

0 commit comments

Comments
 (0)