[opaque pointer type] Pass explicit pointee type in another case of GEP constant...
[oota-llvm.git] / lib / IR / ConstantFold.cpp
index 16b113df1b80ed51cf4fb93eaac7c91a338ac896..3f64c43e902dcfbe9c89e0958dd45a3cc573012e 100644 (file)
@@ -2221,7 +2221,7 @@ static Constant *ConstantFoldGetElementPtrImpl(Type *PointeeTy, Constant *C,
   if (!NewIdxs.empty()) {
     for (unsigned i = 0, e = Idxs.size(); i != e; ++i)
       if (!NewIdxs[i]) NewIdxs[i] = cast<Constant>(Idxs[i]);
-    return ConstantExpr::getGetElementPtr(nullptr, C, NewIdxs, inBounds);
+    return ConstantExpr::getGetElementPtr(PointeeTy, C, NewIdxs, inBounds);
   }
 
   // If all indices are known integers and normalized, we can do a simple