<div dir="ltr">I see, that makes sense.<div><br></div><div>Would it be worthwhile checking that caller/callee's match as part of the verifier or is there a reason that it simply emits undefined behavior?</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Jun 28, 2019 at 1:26 AM Craig Topper <<a href="mailto:craig.topper@gmail.com">craig.topper@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">I think the issue here is that callee is declared with the fastcc calling convention, but the call in caller doesn't use fastcc. So InstCombine deleted the call and is emitting the store i1 true, i1* undef, align 1 to indicate to a different pass that this code is unreachable.<div><br clear="all"><div><div dir="ltr" class="gmail-m_751919388251091641gmail_signature">~Craig</div></div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Jun 28, 2019 at 12:52 AM William Moses via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Hi all,<br><div><br></div><div>I was playing around with LLVM 7 and I discovered something that seems to me to be a bug -- or at least something that I don't understand.</div><div><br></div><div>Take the following valid simple program and run -instcombine on it</div><div><br></div><div>declare i8* @malloc(i64)<br><br>define void @caller() {<br>entry:<br> call void @callee()<br> ret void<br>}<br><br>define fastcc void @callee() {<br>entry:<br> %malloccall = call i8* @malloc(i64 9)<br> store i8 0, i8* %malloccall<br> ret void<br>}<br><br></div><div><br></div><div>It get's transformed into the following invalid code after the optimization (now having an illegal store):</div><div><br></div><div>; ModuleID = 'blarg.ll'<br>source_filename = "blarg.ll"<br><br>declare i8* @malloc(i64)<br><br>define void @caller() {<br>entry:<br> store i1 true, i1* undef, align 1<br> ret void<br>}<br><br>define fastcc void @callee() {<br>entry:<br> ret void<br>}<br><br>Anyone seen this before and/or could shed some light on this behavior.</div></div>
_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br>
<a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
</blockquote></div>
</blockquote></div>