[llvm-dev] Recursive Structure Type

Mehdi Amini via llvm-dev llvm-dev at lists.llvm.org
Fri Sep 23 09:04:29 PDT 2016


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?).

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



More information about the llvm-dev mailing list