[llvm-branch-commits] [llvm-branch] r309827 - Merging r309594:

Hans Wennborg via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Wed Aug 2 08:52:32 PDT 2017


Author: hans
Date: Wed Aug  2 08:52:32 2017
New Revision: 309827

URL: http://llvm.org/viewvc/llvm-project?rev=309827&view=rev
Log:
Merging r309594:
------------------------------------------------------------------------
r309594 | majnemer | 2017-07-31 10:47:07 -0700 (Mon, 31 Jul 2017) | 4 lines

[IPSCCP] Guard a user of getInitializer with hasDefinitiveInitializer

We are not allowed to reason about an initializer value without first
consulting hasDefinitiveInitializer.
------------------------------------------------------------------------

Added:
    llvm/branches/release_50/test/Transforms/SCCP/definite-initializer.ll
      - copied unchanged from r309594, llvm/trunk/test/Transforms/SCCP/definite-initializer.ll
Modified:
    llvm/branches/release_50/   (props changed)
    llvm/branches/release_50/lib/Transforms/Scalar/SCCP.cpp

Propchange: llvm/branches/release_50/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Aug  2 08:52:32 2017
@@ -1,3 +1,3 @@
 /llvm/branches/Apple/Pertwee:110850,110961
 /llvm/branches/type-system-rewrite:133420-134817
-/llvm/trunk:155241,308483-308484,308503,308808,308813,308891,308906,308950,308963,308978,308986,309113,309302,309321,309323,309325,309330,309343,309353,309355,309422,309481,309483,309495,309561
+/llvm/trunk:155241,308483-308484,308503,308808,308813,308891,308906,308950,308963,308978,308986,309113,309302,309321,309323,309325,309330,309343,309353,309355,309422,309481,309483,309495,309561,309594

Modified: llvm/branches/release_50/lib/Transforms/Scalar/SCCP.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_50/lib/Transforms/Scalar/SCCP.cpp?rev=309827&r1=309826&r2=309827&view=diff
==============================================================================
--- llvm/branches/release_50/lib/Transforms/Scalar/SCCP.cpp (original)
+++ llvm/branches/release_50/lib/Transforms/Scalar/SCCP.cpp Wed Aug  2 08:52:32 2017
@@ -1790,7 +1790,8 @@ static bool runIPSCCP(Module &M, const D
   // 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.




More information about the llvm-branch-commits mailing list