Skip to content

Commit adaf8c4

Browse files
committed
Mark eliminateDeadDefs() parameter with const
1 parent ed91944 commit adaf8c4

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -808,8 +808,7 @@ bool canSkipDef(MemoryDef *D, bool DefVisibleToCaller) {
808808

809809
// A memory location wrapper that represents a MemoryLocation, `MemLoc`,
810810
// defined by `MemDef`.
811-
class MemoryLocationWrapper {
812-
public:
811+
struct MemoryLocationWrapper {
813812
MemoryLocationWrapper(MemoryLocation MemLoc, MemoryDef *MemDef)
814813
: MemLoc(MemLoc), MemDef(MemDef) {
815814
assert(MemLoc.Ptr && "MemLoc should be not null");
@@ -825,8 +824,7 @@ class MemoryLocationWrapper {
825824

826825
// A memory def wrapper that represents a MemoryDef and the MemoryLocation(s)
827826
// defined by this MemoryDef.
828-
class MemoryDefWrapper {
829-
public:
827+
struct MemoryDefWrapper {
830828
MemoryDefWrapper(MemoryDef *MemDef, std::optional<MemoryLocation> MemLoc) {
831829
DefInst = MemDef->getMemoryInst();
832830
if (MemLoc.has_value())
@@ -2176,15 +2174,15 @@ struct DSEState {
21762174
// killed by `KillingLocWrapper.MemDef`. Return whether
21772175
// any changes were made, and whether `KillingLocWrapper.DefInst` was deleted.
21782176
std::pair<bool, bool>
2179-
eliminateDeadDefs(MemoryLocationWrapper &KillingLocWrapper);
2177+
eliminateDeadDefs(const MemoryLocationWrapper &KillingLocWrapper);
21802178

21812179
// Try to eliminate dead defs killed by `KillingDefWrapper` and return the
21822180
// change state: whether make any change.
2183-
bool eliminateDeadDefs(MemoryDefWrapper &KillingDefWrapper);
2181+
bool eliminateDeadDefs(const MemoryDefWrapper &KillingDefWrapper);
21842182
};
21852183

21862184
std::pair<bool, bool>
2187-
DSEState::eliminateDeadDefs(MemoryLocationWrapper &KillingLocWrapper) {
2185+
DSEState::eliminateDeadDefs(const MemoryLocationWrapper &KillingLocWrapper) {
21882186
bool Changed = false;
21892187
bool DeletedKillingLoc = false;
21902188
unsigned ScanLimit = MemorySSAScanLimit;
@@ -2304,7 +2302,7 @@ DSEState::eliminateDeadDefs(MemoryLocationWrapper &KillingLocWrapper) {
23042302
return {Changed, DeletedKillingLoc};
23052303
}
23062304

2307-
bool DSEState::eliminateDeadDefs(MemoryDefWrapper &KillingDefWrapper) {
2305+
bool DSEState::eliminateDeadDefs(const MemoryDefWrapper &KillingDefWrapper) {
23082306
if (!KillingDefWrapper.DefinedLocation.has_value()) {
23092307
LLVM_DEBUG(dbgs() << "Failed to find analyzable write location for "
23102308
<< *KillingDefWrapper.DefInst << "\n");

0 commit comments

Comments
 (0)