[PATCH] D78259: [TailCallElim] Add handling of readonly functions
Layton Kifer via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 23 15:47:41 PDT 2020
laytonio marked 2 inline comments as done.
laytonio added inline comments.
================
Comment at: llvm/lib/Transforms/Scalar/TailRecursionElimination.cpp:391
if (SI->getCondition() == V)
return SI->getDefaultDest() != RI->getParent();
----------------
efriedma wrote:
> While you're in this area, the following currently crashes `opt -tailcallelim`:
>
> ```
> define i32 @f() local_unnamed_addr {
> entry:
> %call = call i32 @g()
> switch i32 %call, label %sw.default [
> i32 1, label %cleanup
> i32 5, label %cleanup
> i32 7, label %cleanup
> ]
>
> sw.default:
> %call1 = call i32 @f()
> %add = add nsw i32 %call1, 1
> br label %cleanup
>
> cleanup:
> %retval.0 = phi i32 [ %add, %sw.default ], [ %call, %entry ], [ %call, %entry ], [ %call, %entry ]
> ret i32 %retval.0
> }
>
> declare i32 @g()
> ```
>
> Please take a look, since it seems related to what you're doing.
I created a separate diff for this fix. https://reviews.llvm.org/D78765
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D78259/new/
https://reviews.llvm.org/D78259
More information about the llvm-commits
mailing list