<div dir="ltr">I'm pretty sure it isn't because of the mutually recursive calls between between isSized and isSizedDerivedType. Having isSized create a  new SmallPtrSet each time would not allow for detecting infinite recursion in complex structures where there is a chain of structures that end up being recursive and probably incur more overhead than only having callers of isSized provide a SmallPtrSet when it cares about detecting the infinite loop. Also note that while the isSized interface includes a new argument, it is also optional so that the calls to isSized outside of the recursive chain are unchanged (unless I'm missing a nuance in what you are suggesting). Splitting isSized to isSized and isSizedImpl and having isSizedDerivedType always call isSizedImpl would also be a more invasive change, and would require all the logic of isSized be moved to isSizedImpl with isSized being a very simple wrapper around it (which I also suspect would be prone to more errors by functions calling the wrong version).</div>
<div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Dec 5, 2013 at 11:58 AM, Rafael Espíndola <span dir="ltr"><<a href="mailto:rafael.espindola@gmail.com" target="_blank">rafael.espindola@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Is it possible to avoid changing the isSized interface? Maybe it could<br>
be implemented as<br>
<br>
static bool isSizedImpl(const StructType &Ty, SmallPtrSet<const Type*,<br>
4> &Visited) {...}<br>
<br>
bool StructType::isSized() const {<br>
SmallPtrSet<const Type*, 4> Visited;<br>
return isSizedImple(*this, Visited);<br>
<div><div class="h5">}<br>
<br>
<br>
On 4 December 2013 16:09, Kaelyn Takata <<a href="mailto:rikka@google.com">rikka@google.com</a>> wrote:<br>
> Here's a patch that fixes the segfault in the verifier when trying to<br>
> determine the size of a type of the form "%rt = type { %rt }" while checking<br>
> an alloca of the type.<br>
><br>
> I suspect this is also a candidate for the release branch, as it is a<br>
> crasher that has apparently existed since the 3.0 release.<br>
><br>
> Cheers,<br>
> Kaelyn<br>
><br>
</div></div>> _______________________________________________<br>
> llvm-commits mailing list<br>
> <a href="mailto:llvm-commits@cs.uiuc.edu">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>
</blockquote></div><br></div>