This is an archive of the discontinued LLVM Phabricator instance.

[GlobalDCE] Simplify and return Changed = true less often
ClosedPublic

Authored by foad on Feb 17 2022, 6:23 AM.

Details

Summary

Removing dead constants should not count as making a change to the
module. This means that RemoveUnusedGlobalValue simplifies to just
calling removeDeadConstantUsers, so inline it.

Diff Detail

Event Timeline

foad created this revision.Feb 17 2022, 6:23 AM
foad requested review of this revision.Feb 17 2022, 6:23 AM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 17 2022, 6:23 AM
foad added a comment.Feb 17 2022, 6:26 AM

TBH I'm not even sure that any of these calls to removeDeadConstantUsers are required. Nothing seems to fail if I remove them. But I kept them for now to keep this patch conservative.

Yeah, better keep this conservative, and this patch looks good. If you're brave you could try to craft an extra .ll that have multiple constant users and see if the algorithm can get rid of them without the calls to removeDeadConstantUsers.

This revision is now accepted and ready to land.Feb 17 2022, 7:29 AM
This revision was landed with ongoing or failed builds.Feb 17 2022, 8:03 AM
This revision was automatically updated to reflect the committed changes.