public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "hubicka at ucw dot cz" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/110628] [14 regression] gcc.dg/tree-ssa/update-threading.c fails after r14-2383-g768f00e3e84123 Date: Thu, 17 Aug 2023 14:52:27 +0000 [thread overview] Message-ID: <bug-110628-4-8jcocXzgus@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-110628-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110628 --- Comment #6 from Jan Hubicka <hubicka at ucw dot cz> --- The mismatch happens on: void foo (unsigned int x) { if (x != 0x800 && x != 0x810) abort (); } It is bug in reassoc turning: void foo (unsigned int x) { ;; basic block 2, loop depth 0, count 1073741824 (estimated locally, freq 1.0000), maybe hot ;; prev block 0, next block 3, flags: (NEW, REACHABLE, VISITED) ;; pred: ENTRY [always] count:1073741824 (estimated locally, freq 1.0000) (FALLTHRU,EXECUTABLE) if (x_1(D) != 2048) goto <bb 3>; [66.00%] else goto <bb 5>; [34.00%] ;; succ: 3 [66.0% (guessed)] count:708669600 (estimated locally, freq 0.6600) (TRUE_VALUE,EXECUTABLE) ;; 5 [34.0% (guessed)] count:365072224 (estimated locally, freq 0.3400) (FALSE_VALUE,EXECUTABLE) ;; basic block 3, loop depth 0, count 708669600 (estimated locally, freq 0.6600), maybe hot ;; prev block 2, next block 4, flags: (NEW, REACHABLE, VISITED) ;; pred: 2 [66.0% (guessed)] count:708669600 (estimated locally, freq 0.6600) (TRUE_VALUE,EXECUTABLE) if (x_1(D) != 2064) goto <bb 4>; [0.00%] else goto <bb 5>; [100.00%] ;; succ: 4 [never] count:0 (precise, freq 0.0000) (TRUE_VALUE,EXECUTABLE) ;; 5 [always] count:708669600 (estimated locally, freq 0.6600) (FALSE_VALUE,EXECUTABLE) ;; basic block 4, loop depth 0, count 0 (precise, freq 0.0000), probably never executed ;; prev block 3, next block 5, flags: (NEW, REACHABLE, VISITED) ;; pred: 3 [never] count:0 (precise, freq 0.0000) (TRUE_VALUE,EXECUTABLE) abort (); ;; succ: to: void foo (unsigned int x) { unsigned int _4; _Bool _5; ;; basic block 2, loop depth 0, count 1073741824 (estimated locally, freq 1.0000), maybe hot ;; prev block 0, next block 3, flags: (NEW, REACHABLE, VISITED) ;; pred: ENTRY [always] count:1073741824 (estimated locally, freq 1.0000) (FALLTHRU,EXECUTABLE) _4 = x_1(D) & 4294967279; _5 = _4 != 2048; if (_5 != 0) goto <bb 3>; [66.00%] else goto <bb 4>; [34.00%] ;; succ: 3 [66.0% (guessed)] count:708669600 (estimated locally, freq 0.6600) (TRUE_VALUE,EXECUTABLE) ;; 4 [34.0% (guessed)] count:365072224 (estimated locally, freq 0.3400) (FALSE_VALUE,EXECUTABLE) ;; basic block 3, loop depth 0, count 0 (precise, freq 0.0000), probably never executed ;; Invalid sum of incoming counts 708669600 (estimated locally, freq 0.6600), should be 0 (precise, freq 0.0000) ;; prev block 2, next block 4, flags: (NEW, REACHABLE, VISITED) ;; pred: 2 [66.0% (guessed)] count:708669600 (estimated locally, freq 0.6600) (TRUE_VALUE,EXECUTABLE) abort (); ;; succ: ;; basic block 4, loop depth 0, count 1073741824 (estimated locally, freq 1.0000), maybe hot ;; Invalid sum of incoming counts 365072224 (estimated locally, freq 0.3400), should be 1073741824 (estimated locally, freq 1.0000) ;; prev block 3, next block 1, flags: (NEW, REACHABLE, VISITED) ;; pred: 2 [34.0% (guessed)] count:365072224 (estimated locally, freq 0.3400) (FALSE_VALUE,EXECUTABLE) return; So it combines two conditionals together but does not update the outgoing probabilitis of the conditional. On x86-64 we have already in cfg dump: _1 = x != 2048; _2 = x != 2064; _3 = _1 & _2; if (_3 != 0) goto <bb 3>; [INV] else I wonder why optimization diverges here?
next prev parent reply other threads:[~2023-08-17 14:52 UTC|newest] Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top 2023-07-11 12:50 [Bug other/110628] New: " seurer at gcc dot gnu.org 2023-07-11 13:06 ` [Bug tree-optimization/110628] " rguenth at gcc dot gnu.org 2023-07-11 14:42 ` hubicka at gcc dot gnu.org 2023-07-11 14:51 ` seurer at gcc dot gnu.org 2023-07-13 13:13 ` hubicka at ucw dot cz 2023-07-17 23:02 ` seurer at gcc dot gnu.org 2023-08-15 16:23 ` hp at gcc dot gnu.org 2023-08-17 14:52 ` hubicka at ucw dot cz [this message] 2023-08-24 1:14 ` hp at gcc dot gnu.org 2023-08-24 12:03 ` hubicka at ucw dot cz 2023-08-24 14:54 ` hp at gcc dot gnu.org 2023-08-25 1:22 ` hp at gcc dot gnu.org 2024-03-07 23:29 ` law at gcc dot gnu.org 2024-05-07 7:41 ` [Bug tree-optimization/110628] [14/15 " rguenth 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-110628-4-8jcocXzgus@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).