Give GetUnderlyingObject a TargetData, to keep it in sync
[oota-llvm.git] / lib / Analysis / ConstantFolding.cpp
index 55a10d716b95503c59e0a8c5791198d4f88394e2..243611053c2965e4dbe9dad38329d7f13579b1cf 100644 (file)
@@ -467,7 +467,8 @@ Constant *llvm::ConstantFoldLoadFromConstPtr(Constant *C,
   
   // If this load comes from anywhere in a constant global, and if the global
   // is all undef or zero, we know what it loads.
-  if (GlobalVariable *GV = dyn_cast<GlobalVariable>(GetUnderlyingObject(CE))){
+  if (GlobalVariable *GV =
+        dyn_cast<GlobalVariable>(GetUnderlyingObject(CE, TD))) {
     if (GV->isConstant() && GV->hasDefinitiveInitializer()) {
       const Type *ResTy = cast<PointerType>(C->getType())->getElementType();
       if (GV->getInitializer()->isNullValue())