This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/85509] fails to promote local static to const
- From: "rguenth at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 24 Apr 2018 08:12:49 +0000
- Subject: [Bug tree-optimization/85509] fails to promote local static to const
- Auto-submitted: auto-generated
- References: <bug-85509-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85509
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |missed-optimization
Status|UNCONFIRMED |NEW
Last reconfirmed| |2018-04-24
CC| |hubicka at gcc dot gnu.org,
| |rguenth at gcc dot gnu.org
Component|c++ |tree-optimization
Summary|auto (function pointer) |fails to promote local
|undermining inline |static to const
|expansion with GCC but not |
|LLVM |
Ever confirmed|0 |1
--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
The issue is you fail to make PerformQuickly and PerformSafely const and GCC
doesn't have local analysis to promote it so and IPA analysis is too late
for that since it is also the last inlining point.
Slight complication is nested functions and OMP outlining which may refer to
these variables. But even the initial cgraph build should be able to figure
out the const-ness, no?
Workaround: make the vars const.