This is an archive of the discontinued LLVM Phabricator instance.

[NFC][DAGCombiner]: Only consider nodes with no uses for pruning when forming initial worklist
ClosedPublic

Authored by 0xdc03 on May 25 2023, 3:01 AM.

Details

Summary

When the worklist is initially being formed, there is no need to
consider all nodes for pruning. This is because the first time calling
getNextWorklistEntry will only clear those nodes which have no uses,
with their operands being added to the worklist. However, when the worklist is
created for the first time all nodes are added anyways, so this operation
actually ends up adding no nodes.

This patch adds a parameter IsCandidateForPruning to AddToWorklist with a
default value of true to avoid having to update every call site.

Diff Detail

Event Timeline

0xdc03 created this revision.May 25 2023, 3:01 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 25 2023, 3:01 AM
0xdc03 requested review of this revision.May 25 2023, 3:01 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 25 2023, 3:01 AM
0xdc03 updated this revision to Diff 525516.May 25 2023, 3:04 AM
  • Removed unnecessary braces
nikic added inline comments.May 25 2023, 3:10 AM
llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
181

I'd move this comment next to the initial population of the worklist.

1781
0xdc03 updated this revision to Diff 525521.May 25 2023, 3:16 AM
  • Address reviewer comment
0xdc03 updated this revision to Diff 525522.May 25 2023, 3:18 AM
  • Address missed reviewer comment
llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
181

Done!

1781

Done!

nikic accepted this revision.May 25 2023, 3:47 AM

LGTM

This revision is now accepted and ready to land.May 25 2023, 3:47 AM
This revision was landed with ongoing or failed builds.May 25 2023, 7:23 AM
This revision was automatically updated to reflect the committed changes.