TCReturn instructions would occassionally sneak through to AsmWriter
as GHC does not use our epilogue.
Details
- Reviewers
t.p.northover
Diff Detail
Event Timeline
Hi Ben,
The code itself looks reasonable, but it'd be good to have a test here. Probably a .ll file living in test/CodeGen/ARM that makes sure the TCRETURNs are lowered and tail calls are emitted when using the ghc calling convention.
Cheers.
Tim.
A little bit of an arcanist mix-up there. All is well now.
I've added a very rudimentary testcase. It makes no attempt at ensuring that the tailcalls are lowered correctly. I think I'll have another look at this in the morning and try to add some more thorough checks.
Thanks for updating the test. It's usually better to test the actual output rather than just that a function doesn't crash though.
I'd suggest something like (untested):
; RUN: llc -mtriple=thumbv7-eabi -o - %s | FileCheck %s declare cc 10 void @g() define cc 10 void @test_direct_tail() { ; CHECK-LABEL: test_direct_tail: ; CHECK: b g tail call cc10 void @g() ret void } @ind_func = global void()* zeroinitializer define cc 10 void @test_indirect_tail() { ; CHECK-LABEL: test_indirect_tail: ; CHECK: b {{r[0-9]+}} %func = load void()** @ind_func tail call cc10 void()* @%func() ret void }
This also avoids leaving a stray .s file in the source directory and tests both TCRETURNdi and TCRETURNri.
Thanks Ben. I think this looks fine now. Do you have commit access or shall I do it?
Tim.