From 91c6330c96aaf14605f7d520af72c62c1284ae45 Mon Sep 17 00:00:00 2001 From: David Majnemer Date: Mon, 31 Jul 2017 17:47:07 +0000 Subject: [IPSCCP] Guard a user of getInitializer with hasDefinitiveInitializer We are not allowed to reason about an initializer value without first consulting hasDefinitiveInitializer. llvm-svn: 309594 --- llvm/lib/Transforms/Scalar/SCCP.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'llvm/lib') diff --git a/llvm/lib/Transforms/Scalar/SCCP.cpp b/llvm/lib/Transforms/Scalar/SCCP.cpp index a738ebb4607..4822cf7cce0 100644 --- a/llvm/lib/Transforms/Scalar/SCCP.cpp +++ b/llvm/lib/Transforms/Scalar/SCCP.cpp @@ -1790,7 +1790,8 @@ static bool runIPSCCP(Module &M, const DataLayout &DL, // variables that do not have their 'addresses taken'. If they don't have // their addresses taken, we can propagate constants through them. for (GlobalVariable &G : M.globals()) - if (!G.isConstant() && G.hasLocalLinkage() && !AddressIsTaken(&G)) + if (!G.isConstant() && G.hasLocalLinkage() && + G.hasDefinitiveInitializer() && !AddressIsTaken(&G)) Solver.TrackValueOfGlobalVariable(&G); // Solve for constants. -- cgit v1.2.3