<div dir="ltr">(Obviously they don't have to be literals, you can concot all sorts of sad recursions where it's broken just with pointer, function, array, and struct type involved)<div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Feb 14, 2017 at 5:07 PM, Daniel Berlin via Phabricator <span dir="ltr"><<a href="mailto:reviews@reviews.llvm.org" target="_blank">reviews@reviews.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">dberlin added inline comments.<br>
<span class=""><br>
<br>
================<br>
Comment at: lib/IR/AutoUpgrade.cpp:492-493<br>
   }<br>
+  // Remangle our intrinsic since we upgrade the mangling<br>
+  auto Result = llvm::Intrinsic::<wbr>remangleIntrinsicFunction(F);<br>
+  if (Result != None) {<br>
----------------<br>
</span><span class="">chandlerc wrote:<br>
> Scan the types to see if any are pointers to structs before doing this?<br>
</span>Unfortunately, that won't work.<br>
In fact, that was my original workaround in predicateinfo that broke.<br>
There are two problems:<br>
<br>
1. ssa_copy is anytype, so it can take a literal struct directly, which will still hit the assert.<br>
<br>
But hey, we could special case that one.<br>
<br>
There's a much worse problem though:<br>
2. The mangling is recursive over array types, struct type, and function arguments/return types, so it's not enough to identify pointers to structs.<br>
They can be embedded *anywhere*.<br>
<br>
So, for example, a pointer to a function type that takes a literal struct as an argument would still hit the old assert (and still be changed in mangling)<br>
Or a pointer to function that has a return type of an array of pointers to functions that take literal structs ...<br>
;(<br>
<br>
<br>
Essentially, the only way to avoid this check is either:<br>
<br>
A. We try to name match all the broken intrinsics and add any we missed over time.<br>
B. We give up and just use it like it is.<br>
<br>
I am happy to do A if we are concerned about the compile time cost<br>
<br>
<br>
<a href="https://reviews.llvm.org/D29925" rel="noreferrer" target="_blank">https://reviews.llvm.org/<wbr>D29925</a><br>
<br>
<br>
<br>
</blockquote></div><br></div>