From 500233aef94a5ea910efcd171ddf54e59b939ace Mon Sep 17 00:00:00 2001
From: Dan Gohman
The 'bitcast' instruction takes a value to cast, which must be -a first class value, and a type to cast it to, which must also be a first class type. The bit sizes of value +a non-aggregate first class value, and a type to cast it to, which must also be +a non-aggregate first class type. The bit sizes of +value and the destination type, ty2, must be identical. If the source type is a pointer, the destination type must also be a pointer. This instruction supports bitwise conversion of vectors to integers and to vectors diff --git a/lib/VMCore/Verifier.cpp b/lib/VMCore/Verifier.cpp index aa6963d94a2..805fb2564a4 100644 --- a/lib/VMCore/Verifier.cpp +++ b/lib/VMCore/Verifier.cpp @@ -883,6 +883,12 @@ void Verifier::visitBitCastInst(BitCastInst &I) { "Bitcast requires both operands to be pointer or neither", &I); Assert1(SrcBitSize == DestBitSize, "Bitcast requies types of same width", &I); + // Disallow aggregates. + Assert1(!SrcTy->isAggregateType(), + "Bitcast operand must not be aggregate", &I); + Assert1(!DestTy->isAggregateType(), + "Bitcast type must not be aggregate", &I); + visitInstruction(I); }