Page MenuHomePhabricator

Use less stack in DAGISelMatcherOpt
ClosedPublic

Authored by JonChesterfield on Jan 24 2017, 5:53 AM.

Details

Summary

Refactor a helper function, FactorNodes, to search for a push node in constant space. This resolves a problem in a not-yet-upstreamed backend where a recursive pattern blew the call stack (at a depth of 255) under a debug build of tablegen. No functional change so no new test coverage. The change is minimal to avoid disturbing existing behaviour.

Diff Detail

Repository
rL LLVM

Event Timeline

JonChesterfield edited the summary of this revision. (Show Details)Jan 24 2017, 5:54 AM
stoklund accepted this revision.Jan 25 2017, 11:14 AM

Looks good. I'm all for eliminating recursion.

utils/TableGen/DAGISelMatcherOpt.cpp
188 ↗(On Diff #85577)

while (!Scope) {?

This revision is now accepted and ready to land.Jan 25 2017, 11:14 AM
  • Change for to while
JonChesterfield marked an inline comment as done.Jan 26 2017, 6:36 AM

Thank you for the review. Could you commit the patch? I don't have write access to the repo.

Sorry, I don't have an LLVM sandbox these days. Maybe ask on llvm-commits?

Thanks, I hadn't spotted llvm-commits. I'll send them a message.

This revision was automatically updated to reflect the committed changes.