Avoid assertion failure when taking size of unsized array. Todo item herE
llvm-svn: 1286
diff --git a/llvm/lib/Transforms/LevelRaise.cpp b/llvm/lib/Transforms/LevelRaise.cpp
index 310c797..03d7acf 100644
--- a/llvm/lib/Transforms/LevelRaise.cpp
+++ b/llvm/lib/Transforms/LevelRaise.cpp
@@ -214,6 +214,11 @@
}
const Type *DestTy = cast<PointerType>(CI->getType())->getValueType();
+ if (isa<ArrayType>(DestTy)) {
+ cerr << "Avoided malloc conversion because of type: " << DestTy
+ << " TODO.\n";
+ return false;
+ }
if (TD.getTypeSize(DestTy) == Size && DestTy != ResultTy) {
// Does the size of the allocated type match the number of bytes
// allocated?
@@ -444,6 +449,7 @@
}
#endif
+#if 1
} else if (MallocInst *MI = dyn_cast<MallocInst>(I)) {
if (PeepholeMallocInst(BB, BI)) return true;
@@ -623,6 +629,7 @@
PRINT_PEEPHOLE2("add-to-gep:out", GEP, I);
return true;
}
+#endif
}
return false;