[llvm-bugs] [Bug 25631] New: failure to remove redundant global without 'norecurse'
via llvm-bugs
llvm-bugs at lists.llvm.org
Tue Nov 24 17:19:36 PST 2015
https://llvm.org/bugs/show_bug.cgi?id=25631
Bug ID: 25631
Summary: failure to remove redundant global without 'norecurse'
Product: libraries
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: Core LLVM classes
Assignee: unassignedbugs at nondot.org
Reporter: richard-llvm at metafoo.co.uk
CC: llvm-bugs at lists.llvm.org
Classification: Unclassified
In bug#25629, we have this testcase:
int printf (const char *, ...);
int a, d;
static char b = 48, c;
int
main ()
{
c = b;
for (; c < 45; c++)
a = a ? d : d < a;
b = 0;
printf ("%d\n", c);
return 0;
}
When built as C++, we can completely delete the global variable 'c'. When built
as C++, we cannot. The difference is that 'main' is implicitly 'norecurse' in
C++.
It should be possible to do the same optimization whether or not 'main' is
marked 'norecurse' -- within the entire program, there are only stores and no
loads to @c.
(Running opt over the output a second time results in @c being removed.)
--
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/20151125/71824f36/attachment.html>
More information about the llvm-bugs
mailing list