On Mar 17, 2010, at 2:58 PM, Jianzhou Zhao wrote:
> Hi LLVM,
>
> In lib/VMCare/Verifier.cpp::visitInstruction, we have such code
>
> 1287 // Check that the return value of the instruction is either
> void or a legal
> 1288 // value type.
> 1289 Assert1(I.getType() == Type::getVoidTy(I.getContext()) ||
> 1290 I.getType()->isFirstClassType()
> 1291 || ((isa<CallInst>(I) || isa<InvokeInst>(I))
> 1292 && isa<StructType>(I.getType())),
> 1293 "Instruction returns a non-scalar type!", &I);
Mainline and LLVM 2.7 don't have this code.
> line 1291-1292 allows the return type to be struct typ.
> But are these two lines redundant? The isFirstClassType()
> only disallows function types, void, and opaque:
>
> 236 inline bool isFirstClassType() const {
> 237 // There are more first-class kinds than non-first-class kinds, so
a
> 238 // negative test is simpler than a positive one.
> 239 return ID != FunctionTyID && ID != VoidTyID && ID
!= OpaqueTyID;
> 240 }
>
> Is struct typ also a first class type?
Yes.
-Chris