Factorize out a concept - no functionality change.
llvm-svn: 67454
diff --git a/llvm/lib/Transforms/Utils/CloneFunction.cpp b/llvm/lib/Transforms/Utils/CloneFunction.cpp
index 5dc2d1c..d7b4bd3 100644
--- a/llvm/lib/Transforms/Utils/CloneFunction.cpp
+++ b/llvm/lib/Transforms/Utils/CloneFunction.cpp
@@ -335,8 +335,7 @@
if (ConstantExpr *CE = dyn_cast<ConstantExpr>(Ops[0]))
if (!LI->isVolatile() && CE->getOpcode() == Instruction::GetElementPtr)
if (GlobalVariable *GV = dyn_cast<GlobalVariable>(CE->getOperand(0)))
- if (GV->isConstant() && !GV->isDeclaration() &&
- !GV->mayBeOverridden())
+ if (GV->isConstant() && GV->hasDefinitiveInitializer())
return ConstantFoldLoadThroughGEPConstantExpr(GV->getInitializer(),
CE);