@@ -205,16 +205,17 @@ static bool isShortenableAtTheBeginning(Instruction *I) {
205
205
return isa<AnyMemSetInst>(I);
206
206
}
207
207
208
- static uint64_t getPointerSize (const Value *V, const DataLayout &DL,
209
- const TargetLibraryInfo &TLI,
210
- const Function *F) {
208
+ static std::optional<uint64_t > getPointerSize (const Value *V,
209
+ const DataLayout &DL,
210
+ const TargetLibraryInfo &TLI,
211
+ const Function *F) {
211
212
uint64_t Size;
212
213
ObjectSizeOpts Opts;
213
214
Opts.NullIsUnknownSize = NullPointerIsDefined (F);
214
215
215
216
if (getObjectSize (V, Size, DL, &TLI, Opts))
216
217
return Size;
217
- return MemoryLocation::UnknownSize ;
218
+ return std::nullopt ;
218
219
}
219
220
220
221
namespace {
@@ -951,9 +952,9 @@ struct DSEState {
951
952
// case the size/offset of the dead store does not matter.
952
953
if (DeadUndObj == KillingUndObj && KillingLocSize.isPrecise () &&
953
954
isIdentifiedObject (KillingUndObj)) {
954
- uint64_t KillingUndObjSize = getPointerSize (KillingUndObj, DL, TLI, &F);
955
- if (KillingUndObjSize != MemoryLocation::UnknownSize &&
956
- KillingUndObjSize == KillingLocSize.getValue ())
955
+ std::optional< uint64_t > KillingUndObjSize =
956
+ getPointerSize (KillingUndObj, DL, TLI, &F);
957
+ if (KillingUndObjSize && * KillingUndObjSize == KillingLocSize.getValue ())
957
958
return OW_Complete;
958
959
}
959
960
0 commit comments