@@ -808,8 +808,7 @@ bool canSkipDef(MemoryDef *D, bool DefVisibleToCaller) {
808
808
809
809
// A memory location wrapper that represents a MemoryLocation, `MemLoc`,
810
810
// defined by `MemDef`.
811
- class MemoryLocationWrapper {
812
- public:
811
+ struct MemoryLocationWrapper {
813
812
MemoryLocationWrapper (MemoryLocation MemLoc, MemoryDef *MemDef)
814
813
: MemLoc(MemLoc), MemDef(MemDef) {
815
814
assert (MemLoc.Ptr && " MemLoc should be not null" );
@@ -825,8 +824,7 @@ class MemoryLocationWrapper {
825
824
826
825
// A memory def wrapper that represents a MemoryDef and the MemoryLocation(s)
827
826
// defined by this MemoryDef.
828
- class MemoryDefWrapper {
829
- public:
827
+ struct MemoryDefWrapper {
830
828
MemoryDefWrapper (MemoryDef *MemDef, std::optional<MemoryLocation> MemLoc) {
831
829
DefInst = MemDef->getMemoryInst ();
832
830
if (MemLoc.has_value ())
@@ -2176,15 +2174,15 @@ struct DSEState {
2176
2174
// killed by `KillingLocWrapper.MemDef`. Return whether
2177
2175
// any changes were made, and whether `KillingLocWrapper.DefInst` was deleted.
2178
2176
std::pair<bool , bool >
2179
- eliminateDeadDefs (MemoryLocationWrapper &KillingLocWrapper);
2177
+ eliminateDeadDefs (const MemoryLocationWrapper &KillingLocWrapper);
2180
2178
2181
2179
// Try to eliminate dead defs killed by `KillingDefWrapper` and return the
2182
2180
// change state: whether make any change.
2183
- bool eliminateDeadDefs (MemoryDefWrapper &KillingDefWrapper);
2181
+ bool eliminateDeadDefs (const MemoryDefWrapper &KillingDefWrapper);
2184
2182
};
2185
2183
2186
2184
std::pair<bool , bool >
2187
- DSEState::eliminateDeadDefs (MemoryLocationWrapper &KillingLocWrapper) {
2185
+ DSEState::eliminateDeadDefs (const MemoryLocationWrapper &KillingLocWrapper) {
2188
2186
bool Changed = false ;
2189
2187
bool DeletedKillingLoc = false ;
2190
2188
unsigned ScanLimit = MemorySSAScanLimit;
@@ -2304,7 +2302,7 @@ DSEState::eliminateDeadDefs(MemoryLocationWrapper &KillingLocWrapper) {
2304
2302
return {Changed, DeletedKillingLoc};
2305
2303
}
2306
2304
2307
- bool DSEState::eliminateDeadDefs (MemoryDefWrapper &KillingDefWrapper) {
2305
+ bool DSEState::eliminateDeadDefs (const MemoryDefWrapper &KillingDefWrapper) {
2308
2306
if (!KillingDefWrapper.DefinedLocation .has_value ()) {
2309
2307
LLVM_DEBUG (dbgs () << " Failed to find analyzable write location for "
2310
2308
<< *KillingDefWrapper.DefInst << " \n " );
0 commit comments