erichkeane marked an inline comment as done. erichkeane added a comment. @rnk: I looked into the EmitMustTailThunk code, and don't terribly see what I'm doing wrong. I clearly cannot CALL that function (since this works with non-CXXMethodDecls), so I looked into using it. However, I saw that it does a couple of small things that seem useful, but not anything that seems to fix your concerns.
Can you espouse a bit for me? I'm likely missing something, but am out of ideas on what it could be. ================ Comment at: lib/CodeGen/CodeGenFunction.cpp:2395 + + llvm::CallInst *Result = Builder.CreateCall(FuncToReturn, Args); + ---------------- erichkeane wrote: > rnk wrote: > > This approach is... not going to work in the general case. Consider, for > > example, varargs. Then consider 32-bit x86 inalloca, which is quite > > widespread. Any non-trivially copyable object is not going to be passable > > through such a thunk. You might consider looking at > > CodeGenFunction::EmitMustTailThunk instead. > Oh dear... > I'm unfamiliar with EmitMustTailThunk, is it self explanatory? Any chance > you can expound? Should I call/use that function, or copy out of it? I looked through that function, and it seems to do very similar things to this... It FIRST does the small-vector conversion to a value* array like I do. Second, it 'adjusts' the 'this' parameter. This doesn't seem like it needs to happen, because the type isn't changing, right? my 'this' pointer is still pass-on-able. Third, it creates the call, then marks it TCK_MustTail. Forth, it sets the attributes/calling convention of the 'call' object, but I'd expect that to come from the llvm::Function object in the 'CreateCall', right? I can add them after the fact I guess, if we see value.*(see below) Finally, it does the CreateRetVoid/CreateRet like this function does below. *I DO have a test that claims that my IR is broken if I set the call attributes. Curiously only 1 of my tests, but the error is: "cannot guarantee tail call due to mismatched ABI impacting function attributes" The only difference in attributes is target-features and target-cpu though, so I don't know what causes this. Repository: rC Clang https://reviews.llvm.org/D53586 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits