This is an archive of the discontinued LLVM Phabricator instance.

[AMDGPU] SIFoldOperands: eagerly delete dead copies
ClosedPublic

Authored by foad on Apr 8 2021, 8:42 AM.

Details

Summary

This is cheap to implement, means less work for future passes like
MachineDCE, and slightly improves the folding in some cases.

Diff Detail

Event Timeline

foad created this revision.Apr 8 2021, 8:42 AM
foad requested review of this revision.Apr 8 2021, 8:42 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 8 2021, 8:42 AM
arsenm added inline comments.Apr 8 2021, 8:45 AM
llvm/lib/Target/AMDGPU/SIFoldOperands.cpp
1789

Slightly worried about the case where the only remaining copy user is a debug instruction

foad added inline comments.Apr 8 2021, 8:47 AM
llvm/lib/Target/AMDGPU/SIFoldOperands.cpp
1789

Good point. What can you do in that case?

foad updated this revision to Diff 336152.Apr 8 2021, 9:41 AM

Use eraseFromParentAndMarkDBGValuesForRemoval.

Can you add a test for the DBG_VALUE case?

LGTM with the DBG_VALUE test requested by Matt.

foad updated this revision to Diff 336346.Apr 9 2021, 1:48 AM

Add a DBG_VALUE test case.

arsenm accepted this revision.Apr 9 2021, 5:28 AM
This revision is now accepted and ready to land.Apr 9 2021, 5:28 AM
This revision was landed with ongoing or failed builds.Apr 9 2021, 5:57 AM
This revision was automatically updated to reflect the committed changes.