[DSE] Only query object size for identified objects

This is supposed to be a fast heuristic primarily interested in
allocas. We should not call it for non-root objects where object
size needs to be determined recursively.
This commit is contained in:
Nikita Popov
2023-09-27 10:07:57 +02:00
parent 913286baed
commit 7aab12e1c5

View File

@@ -949,7 +949,8 @@ struct DSEState {
// Check whether the killing store overwrites the whole object, in which
// case the size/offset of the dead store does not matter.
if (DeadUndObj == KillingUndObj && KillingLocSize.isPrecise()) {
if (DeadUndObj == KillingUndObj && KillingLocSize.isPrecise() &&
isIdentifiedObject(KillingUndObj)) {
uint64_t KillingUndObjSize = getPointerSize(KillingUndObj, DL, TLI, &F);
if (KillingUndObjSize != MemoryLocation::UnknownSize &&
KillingUndObjSize == KillingLocSize.getValue())