#include "llvm/ConstantHandling.h"
#include "llvm/Analysis/Expressions.h"
#include "Support/STLExtras.h"
-#include "Support/Statistic.h"
+#include "Support/Debug.h"
#include <algorithm>
using std::cerr;
// Get information about the base datatype being allocated, before & after
int ReqTypeSize = TD.getTypeSize(Ty);
+ if (ReqTypeSize == 0) return false;
unsigned OldTypeSize = TD.getTypeSize(MI->getType()->getElementType());
// Must have a scale or offset to analyze it...
ValueTypeCache::iterator CTMI = CTMap.find(V);
if (CTMI != CTMap.end()) return CTMI->second == Ty;
- // If it's a constant... all constants can be converted to a different type. We
- // just ask the constant propagator to see if it can convert the value...
+ // If it's a constant... all constants can be converted to a different
+ // type. We just ask the constant propagator to see if it can convert the
+ // value...
//
if (Constant *CPV = dyn_cast<Constant>(V))
return ConstantFoldCastInstruction(CPV, Ty);
-
CTMap[V] = Ty;
if (V->getType() == Ty) return true; // Expression already correct type!
if (CTMI != CTMap.end()) { // Operand #1 is in the table already?
// If so, check to see if it's Ty*, or, more importantly, if it is a
// pointer to a structure where the first element is a Ty... this code
- // is neccesary because we might be trying to change the source and
+ // is necessary because we might be trying to change the source and
// destination type of the store (they might be related) and the dest
// pointer type might be a pointer to structure. Below we allow pointer
// to structures where the 0th element is compatible with the value,
// Okay, at this point, we know that all of the arguments can be
// converted. We succeed if we can change the return type if
- // neccesary...
+ // necessary...
//
return ValueConvertibleToType(I, FTy->getReturnType(), CTMap, TD);
}