[llvm-bugs] [Bug 44681] Missed optimization opportunity with globals that are never written to

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Jan 27 09:21:02 PST 2020


David Blaikie <dblaikie at gmail.com> changed:

           What    |Removed                     |Added
             Status|NEW                         |RESOLVED
                 CC|                            |dblaikie at gmail.com
         Resolution|---                         |INVALID

--- Comment #1 from David Blaikie <dblaikie at gmail.com> ---
That variable 'z' has external linkage, I believe - so it could be modified
from some other file.

If you give it local linkage (make it "static" or "const") then the variable
will be optimized away and the test() function will get the constant value
inlined into it.

You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20200127/23e2ea84/attachment.html>

More information about the llvm-bugs mailing list