public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "hubicka at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/103680] Jump threading and switch corrupts profile Date: Sat, 09 Apr 2022 21:27:52 +0000 [thread overview] Message-ID: <bug-103680-4-ZkKI2m33RK@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-103680-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103680 --- Comment #5 from Jan Hubicka <hubicka at gcc dot gnu.org> --- The cfgcleanup logic is consistent assuming that your profile was consistent on the input (i.e. read from profile feedback). If you 1) read profile 2) do optimization and prove that given if conditional is true then you should also have 100% probability on the "true" edge so doing nothing in cfgcleanup is correct. Now of course what can happen is that you guess profile or 1) read profile 2) duplicate code 3) prove if conditonal always true in one of the copy. In this case fixing up profile locally is not possible (since it is also wrong in the other copy), so we opt doing nothing which keeps errors sort of contained and we need to live that profile is somethimes inconsistent. So cfgcleanup behaviour is by design. However if you do threading there is way to update the profile and logic for that iis n update_bb_profile_for_threading. If guessed profile was consistent with the thread, it will update profile well and it will drop message to a dump file otherwise. Now the problem is that each time profiling code is updated the interface to this function is lost. I tried to get it fixed but got lost in the new code. /* An edge originally destinating BB of COUNT has been proved to leave the block by TAKEN_EDGE. Update profile of BB such that edge E can be redirected to destination of TAKEN_EDGE. This function may leave the profile inconsistent in the case TAKEN_EDGE frequency or count is believed to be lower than COUNT respectively. */ void update_bb_profile_for_threading (basic_block bb, profile_count count, edge taken_edge) So the interface is quite simple. I have to re-read the new updating code since I no longer recall where I got lost, but perhaps if you are familiar with it, you can write in the update?
next prev parent reply other threads:[~2022-04-09 21:27 UTC|newest] Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-12-13 10:51 [Bug tree-optimization/103680] New: " hubicka at gcc dot gnu.org 2021-12-13 10:55 ` [Bug tree-optimization/103680] " hubicka at gcc dot gnu.org 2021-12-13 12:26 ` marxin at gcc dot gnu.org 2021-12-13 13:56 ` pinskia at gcc dot gnu.org 2022-01-04 9:54 ` rguenth at gcc dot gnu.org 2022-04-09 21:27 ` hubicka at gcc dot gnu.org [this message] 2022-11-30 13:04 ` cvs-commit at gcc dot gnu.org 2023-06-28 9:16 ` hubicka at gcc dot gnu.org 2023-06-28 16:47 ` pinskia at gcc dot gnu.org 2023-06-28 21:30 ` hubicka at gcc dot gnu.org 2023-06-30 16:18 ` hubicka at gcc dot gnu.org 2023-06-30 16:22 ` hubicka at gcc dot gnu.org 2023-07-01 7:11 ` cvs-commit at gcc dot gnu.org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-103680-4-ZkKI2m33RK@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).