<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Mar 30, 2015 at 10:47 AM, David Blaikie <span dir="ltr"><<a href="mailto:dblaikie@gmail.com" target="_blank">dblaikie@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote"><span class="">On Mon, Mar 30, 2015 at 10:45 AM, Duncan P. N. Exon Smith <span dir="ltr"><<a href="mailto:dexonsmith@apple.com" target="_blank">dexonsmith@apple.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span><br>
> On 2015-Mar-30, at 10:39, David Blaikie <<a href="mailto:dblaikie@gmail.com" target="_blank">dblaikie@gmail.com</a>> wrote:<br>
><br>
><br>
><br>
> On Mon, Mar 30, 2015 at 10:04 AM, Duncan P. N. Exon Smith <<a href="mailto:dexonsmith@apple.com" target="_blank">dexonsmith@apple.com</a>> wrote:<br>
> Author: dexonsmith<br>
> Date: Mon Mar 30 12:04:06 2015<br>
> New Revision: 233562<br>
><br>
> URL: <a href="http://llvm.org/viewvc/llvm-project?rev=233562&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=233562&view=rev</a><br>
> Log:<br>
> Verifier: Loosen r233559 check for 'function:' field in MDSubprogram<br>
><br>
> Stop worrying about what the `function:` field is in `MDSubprogram`,<br>
> since it could be a bitcast [1].  Just check its type and leave it at<br>
> that.<br>
><br>
> [1]: <a href="http://lab.llvm.org:8080/green/job/clang-stage2-configure-Rlto_build/3540/" target="_blank">http://lab.llvm.org:8080/green/job/clang-stage2-configure-Rlto_build/3540/</a><br>
><br>
> Is this an acceptable thing? How does this arise? Could we have a small test case demonstrating it? (and/or demonstrating how it comes about?)<br>
<br>
</span>I think it's from function merging, so we needed bitcasts from one<br>
function type to the other.<br>
<br>
Once your opaque pointer type work is complete, those bitcasts won't<br>
be necessary, so we can check that it's pointing at a `Function`.<br>
<br>
Maybe I can use `stripPointerCasts()` to do that even now?<br></blockquote></span><div><br>My concern is that since the function type has changed, we probably shouldn't be describing it in the debug info anymore - if the debugger tries to call it, it'll be using the function type described in the debug info which will no longer match the implementation... that seems... bad.</div></div></div></div></blockquote><div><br>FWIW ArgPromo and DAE are both setup to null out the llvm::Function pointers in this case - so as to ensure debug info no longer describes the function in such a way that a debugger might try to call it or print its arguments, etc. (there's no way in DWARF to describe the original type while telling the debugger to call the function in a different way (omitting arguments, etc) and we haven't taught LLVM about how to omit the location of certain variables, I don't think - maybe that bit just works?)<br><br>so I'm not sure which optimizations are creating this bitcast & not nulling out the MDSubprogram's llvm::Function* - but I /think/ whenever that is happening, it's a bug.<br><br>- David<br> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div><span class="HOEnZb"><font color="#888888"><br><br>- David<br> </font></span></div><span class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div><div><br>
><br>
><br>
><br>
> Modified:<br>
>     llvm/trunk/lib/IR/Verifier.cpp<br>
><br>
> Modified: llvm/trunk/lib/IR/Verifier.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/Verifier.cpp?rev=233562&r1=233561&r2=233562&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/Verifier.cpp?rev=233562&r1=233561&r2=233562&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/lib/IR/Verifier.cpp (original)<br>
> +++ llvm/trunk/lib/IR/Verifier.cpp Mon Mar 30 12:04:06 2015<br>
> @@ -846,9 +846,8 @@ void Verifier::visitMDSubprogram(const M<br>
>      auto *FMD = dyn_cast<ConstantAsMetadata>(RawF);<br>
>      auto *F = FMD ? FMD->getValue() : nullptr;<br>
>      auto *FT = F ? dyn_cast<PointerType>(F->getType()) : nullptr;<br>
> -    Assert(F && (isa<Function>(F) || isa<ConstantPointerNull>(F)) && FT &&<br>
> -               isa<FunctionType>(FT->getElementType()),<br>
> -           "invalid function", &N, F);<br>
> +    Assert(F && FT && isa<FunctionType>(FT->getElementType()),<br>
> +           "invalid function", &N, F, FT);<br>
>    }<br>
>    if (N.getRawTemplateParams()) {<br>
>      auto *Params = dyn_cast<MDTuple>(N.getRawTemplateParams());<br>
><br>
><br>
> _______________________________________________<br>
> llvm-commits mailing list<br>
> <a href="mailto:llvm-commits@cs.uiuc.edu" target="_blank">llvm-commits@cs.uiuc.edu</a><br>
> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
><br>
<br>
</div></div></blockquote></span></div><br></div></div>
</blockquote></div><br></div></div>