[PATCH] D80844: [TRE] Allow accumulator elimination when base case returns non-constant

Layton Kifer via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 2 15:56:26 PDT 2020


laytonio updated this revision to Diff 268004.
laytonio added a comment.

I added your example as a test case. It is worth noting that even at -O1 clang hoists and merges the recursive calls and then branches to the correct accumulator, which would prevent either from getting removed. Also, the multiply by 2 gets converted to a shift, which would also prevent that path from getting removed. I'm going to take a look at creating another patch after this to convert shifts back to multiplies if it would enable an elimination.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D80844/new/

https://reviews.llvm.org/D80844

Files:
  llvm/lib/Transforms/Scalar/TailRecursionElimination.cpp
  llvm/test/Transforms/TailCallElim/accum_recursion.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D80844.268004.patch
Type: text/x-patch
Size: 22006 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200602/b59cefb2/attachment.bin>


More information about the llvm-commits mailing list