summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorDavid Majnemer <david.majnemer@gmail.com>2017-07-31 17:47:07 +0000
committerDavid Majnemer <david.majnemer@gmail.com>2017-07-31 17:47:07 +0000
commit91c6330c96aaf14605f7d520af72c62c1284ae45 (patch)
tree156f8edcd3b58e46086c0916bd0d802afe947a49 /llvm/lib
parentcb0e74975a516d1fbc83e674c36e4cca3fee7731 (diff)
downloadbcm5719-llvm-91c6330c96aaf14605f7d520af72c62c1284ae45.tar.gz
bcm5719-llvm-91c6330c96aaf14605f7d520af72c62c1284ae45.zip
[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
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Transforms/Scalar/SCCP.cpp3
1 files changed, 2 insertions, 1 deletions
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.
OpenPOWER on IntegriCloud