[Bug tree-optimization/49217] Wrong optimization of code
rguenth at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Sun May 29 11:01:00 GMT 2011
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49217
Richard Guenther <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |hubicka at gcc dot gnu.org
--- Comment #2 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-05-29 10:56:58 UTC ---
Partial inlining is responsible for this. With -fdump-tree-all-details we
ICE in CFG-cleanup that runs after fnsplit.
Then IPA pure-const computes garbage so alias analysis is confused. Hmm.
main calls DFS:
void DFS(int)/83(71) @0x1429ec580 (asm: _Z3DFSi) availability:available
analyzed 12 time, 13 benefit (114 after inlining) 8 size, 5 benefit (17 after
inlining) needed reachable body externally_visible finalized inlinable
called by: int main()/84 (0.58 per call) void _Z3DFSi.part.0(int)/97 (6.17
per call)
calls: void _Z3DFSi.part.0(int)/97 (inlined) (0.61 per call)
References: var:bool visited [2] (read)
Refering this function:
void _Z3DFSi.part.0(int)/97(-1) @0x101764dc0 (asm: _Z3DFSi.part.0) (inline copy
in void DFS(int)/83) availability:local analyzed 181 time, 13 benefit 14 size,
5 benefit reachable body local prevailing_def_ironly finalized inlinable
called by: void DFS(int)/83 (0.61 per call) (inlined)
calls: void DFS(int)/83 (6.17 per call) (nested in 2 loops)
References: var:bool visited [2] (write) var:std::vector<int> g [2] (addr)
var:std::vector<int> g [2] (addr)
Refering this function:
but
Starting cycle
Visiting void DFS(int)/83 state:const looping 0
Call to void _Z3DFSi.part.0(int)/97 state:pure looping:1
nonreadonly global var read
Visiting void _Z3DFSi.part.0(int)/97 state:pure looping 1
Call to void DFS(int)/83 state:const looping:0
nonreadonly global var read
Result pure looping 1Function found to be looping pure: void DFS(int)Function
found to be looping pure: void _Z3DFSi.part.0(int)
so it seems, contrary to the comment from local analysis code, at IPA
propagation time the IPA references are _not_ taken into account.
Shouldn't bot indirect call processing and ipa reference walking use
w and not node?
Thus, the bug seems to be fixed with
Index: ipa-pure-const.c
===================================================================
--- ipa-pure-const.c (revision 174393)
+++ ipa-pure-const.c (working copy)
@@ -1223,7 +1223,7 @@
break;
/* Now process the indirect call. */
- for (ie = node->indirect_calls; ie; ie = ie->next_callee)
+ for (ie = w->indirect_calls; ie; ie = ie->next_callee)
{
enum pure_const_state_e edge_state = IPA_CONST;
bool edge_looping = false;
@@ -1246,7 +1246,7 @@
break;
/* And finally all loads and stores. */
- for (i = 0; ipa_ref_list_reference_iterate (&node->ref_list, i, ref);
i++)
+ for (i = 0; ipa_ref_list_reference_iterate (&w->ref_list, i, ref); i++)
{
enum pure_const_state_e ref_state = IPA_CONST;
bool ref_looping = false;
More information about the Gcc-bugs
mailing list