]> git.ipfire.org Git - thirdparty/gcc.git/commit
Fix some side cases of side effects discovery
authorJan Hubicka <jh@suse.cz>
Thu, 11 Nov 2021 15:06:48 +0000 (16:06 +0100)
committerJan Hubicka <jh@suse.cz>
Thu, 11 Nov 2021 15:07:47 +0000 (16:07 +0100)
commit8d3abf42d5c2ccd5c5e879088fdf6e071c3d1b9e
tree13251c4e2b5b00ad45b96c51eb6ca3a8f2ea6ae9
parentfac4c4bdab1735bd8a87e37c519f0260e4769f2a
Fix some side cases of side effects discovery

I wrote script comparing modref pure/const discovery with ipa-pure-const
and found mistakes on both ends.  This plugs the modref differences in handling
looping pure consts which were previously missed due to early exits on
ECF_CONST | ECF_PURE.  Those early exists are bit anoying and I think as
a cleanup I may just drop some of them as premature optimizations coming from
time modref was very simplistic on what it propagates.

gcc/ChangeLog:

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

* ipa-modref.c (modref_summary::useful_p): Check also for side-effects
with looping const/pure.
(modref_summary_lto::useful_p): Likewise.
(merge_call_side_effects): Merge side effects before early exit
for pure/const.
(process_fnspec): Also handle pure functions.
(analyze_call): Do not early exit on looping pure const.
(propagate_unknown_call): Also handle nontrivial SCC as side-effect.
(modref_propagate_in_scc): Update.
gcc/ipa-modref.c