This is an archive of the discontinued LLVM Phabricator instance.

[DSE] Check for whole object overwrite even if dead store size not known
ClosedPublic

Authored by nikic on Dec 24 2021, 5:08 AM.

Details

Summary

If the killing store overwrites the whole object, we know that the preceding store is dead, regardless of the accessed offset or size. This case was previously only handled if the size of the dead store was also known.

This allows us to perform conventional DSE for calls that write to an argument (but without known size).

Diff Detail

Event Timeline

nikic created this revision.Dec 24 2021, 5:08 AM
nikic requested review of this revision.Dec 24 2021, 5:08 AM
Herald added a project: Restricted Project. · View Herald TranscriptDec 24 2021, 5:08 AM
reames accepted this revision.Jan 2 2022, 9:33 AM

LGTM, and thanks for following up on my observation on the other review.

The old code would leave around a write larger than the object size even if the entire object was killed later. That in theory would let us discover the UB, but I think that was purely an accident in the code. We could explicitly handle the UB case before checking for deadness if desired.

This revision is now accepted and ready to land.Jan 2 2022, 9:33 AM
This revision was landed with ongoing or failed builds.Jan 3 2022, 12:36 AM
This revision was automatically updated to reflect the committed changes.