[opaque pointer type] Use GlobalVariable::getValueType rather than accessing it through the GV's pointee type
llvm-svn: 237311
diff --git a/llvm/lib/IR/ConstantFold.cpp b/llvm/lib/IR/ConstantFold.cpp
index ec3414d..16b113d 100644
--- a/llvm/lib/IR/ConstantFold.cpp
+++ b/llvm/lib/IR/ConstantFold.cpp
@@ -1385,7 +1385,7 @@
if (GV->hasExternalWeakLinkage() || GV->hasWeakAnyLinkage())
return true;
if (const auto *GVar = dyn_cast<GlobalVariable>(GV)) {
- Type *Ty = GVar->getType()->getPointerElementType();
+ Type *Ty = GVar->getValueType();
// A global with opaque type might end up being zero sized.
if (!Ty->isSized())
return true;