Page MenuHomePhabricator

[AMDGPU] SIFoldOperands: eagerly delete dead copies
ClosedPublic

Authored by foad on Thu, Apr 8, 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.Thu, Apr 8, 8:42 AM
foad requested review of this revision.Thu, Apr 8, 8:42 AM
Herald added a project: Restricted Project. · View Herald TranscriptThu, Apr 8, 8:42 AM
arsenm added inline comments.Thu, Apr 8, 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.Thu, Apr 8, 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.Thu, Apr 8, 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.Fri, Apr 9, 1:48 AM

Add a DBG_VALUE test case.

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