[llvm-dev] Recursive Structure Type

Pete Cooper via llvm-dev llvm-dev at lists.llvm.org
Fri Sep 23 09:25:46 PDT 2016


> On Sep 23, 2016, at 9:04 AM, Mehdi Amini via llvm-dev <llvm-dev at lists.llvm.org> wrote:
> 
> Hi,
> 
> I am wondering about this IR:
> 
> 
> %struct.__sFILE = type { %struct.__sFILE }
> 
> 
> This seems invalid to me (but one may consider that the structure it just empty maybe?), but test/Verifier/recursive-struct-param.ll was committed while back to ensure the verifier accepts it.
> 
> LangRef says "Identified types can be recursive”, which I always read as with an implicit “through a pointer”.
> 
> So, what is the intention here? Do we support this construct? (Bonus: what is the use case?).
I can’t imagine supporting it working when you actually try to use it.  

What would you return for DataLayout.getStructLayout()->getSizeInBytes() for example?

Pete
> 
> If we support this, we should fix the bitcode reader:
> 
> $ opt test/Verifier/recursive-struct-param.ll   | opt
> error: Invalid TYPE table: Only named structs can be forward referenced (Producer: 'LLVM4.0.0svn' Reader: 'LLVM 4.0.0svn’)
> 
> 
> 
>> Mehdi
> 
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev



More information about the llvm-dev mailing list