This is an archive of the discontinued LLVM Phabricator instance.

[MemorySSA] Don't create new memory accesses for dbg intrinsics in MemorySSA
AbandonedPublic

Authored by ChuanqiXu on Jul 20 2022, 1:55 AM.

Details

Summary

After we landed https://reviews.llvm.org/D127383, the compiler may crash at: https://github.com/llvm/llvm-project/blob/051738b08cf5e39fd274dd379147d1c19e2b5b20/llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp#L687-L691.

This is because the dbg intrinsics are readnone originally and the MemorySSA would refuse to create a new memory access at https://github.com/llvm/llvm-project/blob/051738b08cf5e39fd274dd379147d1c19e2b5b20/llvm/lib/Analysis/MemorySSA.cpp#L1830-L1831

But after D127383, it wouldn't be true for the dbg intrinsics in presplit coroutine. So here is the crash.

Diff Detail

Event Timeline

ChuanqiXu created this revision.Jul 20 2022, 1:55 AM
ChuanqiXu requested review of this revision.Jul 20 2022, 1:55 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 20 2022, 1:55 AM
ChuanqiXu retitled this revision from [DRAFT] Don't create new memory accesses for dbg intrinsics in MemorySSA to Don't create new memory accesses for dbg intrinsics in MemorySSA.Jul 20 2022, 2:49 AM
ChuanqiXu added a reviewer: nikic.
ChuanqiXu retitled this revision from Don't create new memory accesses for dbg intrinsics in MemorySSA to [NFC] Don't create new memory accesses for dbg intrinsics in MemorySSA.Jul 20 2022, 2:52 AM
ChuanqiXu edited the summary of this revision. (Show Details)
ChuanqiXu retitled this revision from [NFC] Don't create new memory accesses for dbg intrinsics in MemorySSA to [MemorySSA] Don't create new memory accesses for dbg intrinsics in MemorySSA.

Add unit tests.

ChuanqiXu edited the summary of this revision. (Show Details)Jul 24 2022, 11:31 PM
ChuanqiXu added inline comments.
llvm/lib/Analysis/MemorySSA.cpp
1780–1782

Given these comments, the following changes look reasonable.

asbirlea accepted this revision.Jul 25 2022, 4:14 PM

LGTM.

This revision is now accepted and ready to land.Jul 25 2022, 4:14 PM