Fix pessimizations on sized arrays
authorChris Lattner <sabre@nondot.org>
Wed, 5 Dec 2001 19:40:32 +0000 (19:40 +0000)
committerChris Lattner <sabre@nondot.org>
Wed, 5 Dec 2001 19:40:32 +0000 (19:40 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@1423 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/LevelRaise.cpp

index f155c507097bda03703bb2a761c0a32bf008860f..19325b065c2bf6b424cbc988fea3b3ae61e828fe 100644 (file)
@@ -539,7 +539,9 @@ static bool DoInsertArrayCast(Value *V, BasicBlock *BB,
   if (!ThePtrType) return false;
 
   const Type *ElTy = ThePtrType->getElementType();
-  if (isa<MethodType>(ElTy) || isa<ArrayType>(ElTy)) return false;
+  if (isa<MethodType>(ElTy) ||
+      (isa<ArrayType>(ElTy) && cast<ArrayType>(ElTy)->isUnsized()))
+    return false;
 
   unsigned ElementSize = TD.getTypeSize(ElTy);
   bool InsertCast = false;
@@ -586,7 +588,7 @@ static bool DoInsertArrayCast(Value *V, BasicBlock *BB,
   //
   ValueTypeCache ConvertedTypes;
   if (!ValueConvertableToType(V, DestTy, ConvertedTypes)) {
-    cerr << "FAILED to convert types of values for " << V << "\n";
+    cerr << "FAILED to convert types of values for " << V << " to " << DestTy << "\n";
     ConvertedTypes.clear();
     ValueConvertableToType(V, DestTy, ConvertedTypes);
     return false;