Page MenuHomePhabricator

Allow machine dce to remove uses in the same instruction

Authored by rampitec on Mar 19 2019, 2:52 PM.



Machine DCE cannot remove a dead definition if there are non-dbg uses.
A use however can be in the same instruction:

dead %0 = INST %0

Such instructions sometimes created by Detect dead lanes pass.

Allow this instruction to be deleted despite the use if the only use
belongs to the same instruction.

Diff Detail


Event Timeline

rampitec created this revision.Mar 19 2019, 2:52 PM
arsenm added inline comments.
84–85 ↗(On Diff #191401)

This needs a search limit in case of huge numbers of uses?
This can also use use_nodbg_instructions

rampitec updated this revision to Diff 191405.Mar 19 2019, 3:08 PM
rampitec marked 2 inline comments as done.

Use use_nodbg_instructions().

84–85 ↗(On Diff #191401)

It does need a limit. The only way it can run into a very long loop if all huge amount of uses will belong to the same instruction. Otherwise it will immediately return false at the first use from any other place.

rampitec marked an inline comment as done.Mar 19 2019, 3:11 PM
rampitec added inline comments.
84–85 ↗(On Diff #191401)

I mean it does not need a limit.

arsenm accepted this revision.Mar 19 2019, 3:42 PM


This revision is now accepted and ready to land.Mar 19 2019, 3:42 PM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptMar 20 2019, 2:40 PM