Implement TargetLowering callback mayBeEmittedAsTailCall for riscv in CodeGenPrepare,
which will duplicate return instructions to enable tailcall optimization.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Thanks, this seems like a good change. I haven't checked the source, but I wonder is it ever possible this hook triggers duplication of the returns but the tail calls don't get emitted for whatever reason? Other than that and the comment above I'd be happy with this.
llvm/test/CodeGen/RISCV/tail-calls.ll | ||
---|---|---|
177 | Perhaps these check lines should be simplified to just the checks for the tail calls, rather than using 'CHECK-NEXT' to check every line. Just to potentially reduce the chance of this test failing for unrelated reasons. Ideally we'd be able to check the tail calls in any order too but I'm not sure how that would be done with filecheck. |
llvm/test/CodeGen/RISCV/tail-calls.ll | ||
---|---|---|
177 | Since the called functions all have different names I guess a plain CHECK would do it? |
Perhaps these check lines should be simplified to just the checks for the tail calls, rather than using 'CHECK-NEXT' to check every line. Just to potentially reduce the chance of this test failing for unrelated reasons. Ideally we'd be able to check the tail calls in any order too but I'm not sure how that would be done with filecheck.