]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Fix recursion discovery in ipa-pure-const
authorJan Hubicka <jh@suse.cz>
Thu, 11 Nov 2021 13:39:19 +0000 (14:39 +0100)
committerJan Hubicka <jh@suse.cz>
Thu, 11 Nov 2021 13:39:19 +0000 (14:39 +0100)
We make self recursive functions as looping of fear of endless recursion.
This is done correctly for local pure/const and for non-trivial SCCs in
callgraph, but for trivial SCCs we miss the flag.

I think it is bad decision since infinite recursion will run out of stack,
but changing it upsets some testcases and should be done independently.
So this patch is fixing current behaviour to be consistent.

gcc/ChangeLog:

2021-11-11  Jan Hubicka  <hubicka@ucw.cz>

* ipa-pure-const.c (propagate_pure_const): Self recursion is
a side effects.

gcc/ipa-pure-const.c

index 84a028bcf8e8d5217ba44ae0f05dc895c43d0f7e..422b52fba4be1ad5d0dfec65c885582fdc1e51fb 100644 (file)
@@ -1513,6 +1513,9 @@ propagate_pure_const (void)
              enum pure_const_state_e edge_state = IPA_CONST;
              bool edge_looping = false;
 
+             if (e->recursive_p ())
+               looping = true;
+
              if (dump_file && (dump_flags & TDF_DETAILS))
                {
                  fprintf (dump_file, "    Call to %s",