Generalize target-independent folding rules for sizeof to handle more
[oota-llvm.git] / lib / VMCore / Instructions.cpp
index eee160e488b2c9ffd26dfd3c787657ff62188c83..a9b2cab28e9af20d1e041ad01d3f953119231f5d 100644 (file)
@@ -2504,7 +2504,8 @@ CastInst::castIsValid(Instruction::CastOps op, Value *S, const Type *DstTy) {
 
   // Check for type sanity on the arguments
   const Type *SrcTy = S->getType();
-  if (!SrcTy->isFirstClassType() || !DstTy->isFirstClassType())
+  if (!SrcTy->isFirstClassType() || !DstTy->isFirstClassType() ||
+      SrcTy->isAggregateType() || DstTy->isAggregateType())
     return false;
 
   // Get the size of the types in bits, we'll need this later