<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">I don’t think dropping from “must tail” to “tail” is a legal thing to do in the IR, isn’t there a bug in InstCombine here?<div class=""><br class=""></div><div class="">— </div><div class="">Mehdi</div><div class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Nov 27, 2016, at 12:57 PM, David Majnemer via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" class="">llvm-dev@lists.llvm.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class="">Try using the "thunk" attribute: <a href="http://llvm.org/docs/LangRef.html#function-attributes" class="">http://llvm.org/docs/LangRef.html#function-attributes</a><div class=""><br class=""></div><div class="">InstCombine has logic to avoid getting rid of the cast in such situations: <a href="https://github.com/llvm-mirror/llvm/blob/master/lib/Transforms/InstCombine/InstCombineCalls.cpp#L2821" class="">https://github.com/llvm-mirror/llvm/blob/master/lib/Transforms/InstCombine/InstCombineCalls.cpp#L2821</a></div><div class=""><br class=""></div><div class=""><br class=""></div></div><div class="gmail_extra"><br class=""><div class="gmail_quote">On Sun, Nov 27, 2016 at 7:40 AM, Carlo Kok <span dir="ltr" class=""><<a href="mailto:ck@remobjects.com" target="_blank" class="">ck@remobjects.com</a>></span> wrote:<br class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="">Inst combine yes. However it shouldn't drop this bit cast in the first place, since the last parameter isn't available. (It only works because of this must tail)<div class=""><div class="h5"><br class=""><br class=""><div class="gmail_quote">On 27 November 2016 01:37:43 CET, Sean Silva <<a href="mailto:chisophugis@gmail.com" target="_blank" class="">chisophugis@gmail.com</a>> wrote:<blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div dir="ltr" class="">r287955 seems like it might be related.<br class=""><div class=""><br class=""></div><div class="">-- Sean Silva</div></div><div class="gmail_extra"><br class=""><div class="gmail_quote">On Sat, Nov 26, 2016 at 4:06 PM, Sean Silva <span dir="ltr" class=""><<a href="mailto:chisophugis@gmail.com" target="_blank" class="">chisophugis@gmail.com</a>></span> wrote:<br class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr" class="">This sounds buggy to me. What pass is doing this?<span class="m_5789166602044079281HOEnZb"><font color="#888888" class=""></font><div class=""><font color="#888888" class=""><br class=""></font></div><div class="">-- Sean Silva</div></span></div><div class="m_5789166602044079281HOEnZb"><div class="m_5789166602044079281h5"><div class="gmail_extra"><br class=""><div class="gmail_quote">On Thu, Nov 24, 2016 at 5:39 AM, Carlo Kok via llvm-dev <span dir="ltr" class=""><<a href="mailto:llvm-dev@lists.llvm.org" target="_blank" class="">llvm-dev@lists.llvm.org</a>></span> wrote:<br class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br class="">
I've got some calls like:<br class="">
<br class="">
musttail call void bitcast (i32 (i32, i8*, %Type*)* @MyMethod to void (i32, i8*)*)(i32 %0, i8* %1)<br class="">
ret void<br class="">
<br class="">
Into something like:<br class="">
%8 = tail call i32 @MyMethod(i32 %0, i8* %1, %Type* null)<br class="">
ret void<br class="">
<br class="">
I realize I'm losing a parameter there, but this is an interface jump trick I use and relies on the end code being a 'jmp' (x86). I realize i can probably use noopt & noinline to do this trick, but I do want llvm to optimize and inline calls if it can prove it always calls a given method. Any way i can do this?<span class="m_5789166602044079281m_-1275284221095516395HOEnZb"><font color="#888888" class=""><br class="">
<br class="">
-- <br class="">
Carlo Kok<br class="">
RemObjects Software<br class="">
______________________________<wbr class="">_________________<br class="">
LLVM Developers mailing list<br class="">
<a href="mailto:llvm-dev@lists.llvm.org" target="_blank" class="">llvm-dev@lists.llvm.org</a><br class="">
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank" class="">http://lists.llvm.org/cgi-bin/<wbr class="">mailman/listinfo/llvm-dev</a><br class="">
</font></span></blockquote></div><br class=""></div>
</div></div></blockquote></div><br class=""></div>
</blockquote></div><br class="">
-- <br class="">
Carlo Kok<br class="">
RemObjects Software </div></div></div></blockquote></div><br class=""></div>
_______________________________________________<br class="">LLVM Developers mailing list<br class=""><a href="mailto:llvm-dev@lists.llvm.org" class="">llvm-dev@lists.llvm.org</a><br class="">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev<br class=""></div></blockquote></div><br class=""></div></body></html>