Page MenuHomePhabricator

[TRE] Allow elimination when the returned value is non-constant
ClosedPublic

Authored by laytonio on May 8 2020, 7:39 PM.

Details

Summary

Currently we can only eliminate call return pairs that either return the result of the call or a dynamic constant. This patch removes that limitation.

Diff Detail

Event Timeline

laytonio created this revision.May 8 2020, 7:39 PM
Herald added a project: Restricted Project. · View Herald TranscriptMay 8 2020, 7:39 PM
Herald added a subscriber: hiraditya. · View Herald Transcript

Can you add a few testcases for eliminating multiple tail calls?

llvm/lib/Transforms/Scalar/TailRecursionElimination.cpp
466

Maybe describe what specific instructions RetPN and RetKnownPN actually refer to?

600

Might as well use UndefValue::get here?

829

You can use dropAllReferences() to clear out the operands of an instruction before you erase it.

laytonio updated this revision to Diff 264363.May 15 2020, 3:30 PM

Address comments. Added a test for multiple eliminations.

laytonio marked 3 inline comments as done.May 15 2020, 3:31 PM
efriedma accepted this revision.May 16 2020, 1:34 PM

LGTM. (I'll merge this for you.)

This revision is now accepted and ready to land.May 16 2020, 1:34 PM

Thank you. I appreciate the help.

Was there anything else I needed to do for this?

Sorry about the delay; it's merged now.

This revision was automatically updated to reflect the committed changes.