public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "aldyh at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/103192] [12 Regression] ICE on libgomp target-in-reduction-2.{C,c}
Date: Fri, 12 Nov 2021 13:28:06 +0000	[thread overview]
Message-ID: <bug-103192-4-JmxMzwwek7@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-103192-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103192

--- Comment #10 from Aldy Hernandez <aldyh at gcc dot gnu.org> ---
The guard seems to be removed by the vrp2 pass, not by jump threading.

a.ii.195t.vrp2:Folding predicate iftmp.2373_1515 != 0B to 1

For some bizarre reason, ranger thinks iftmp.2373_1515 is nonzero and removes
the check against zero:

=========== BB 219 ============
region_type_1384(D)     unsigned int VARYING
ctx_1386        struct gimplify_omp_ctx * [1B, +INF]
code_1387(D)    tree_code [0, 65535]
outer_ctx_1389  struct gimplify_omp_ctx * VARYING
_2620   bool VARYING
c_3771  union tree_node * [1B, +INF]
_3783   bool VARYING
    <bb 219> [local count: 105119385]:
    iftmp.2340_1256 = code_1387(D) == 199 ? 81 : 80;
    iftmp.2304_1247 = code_1387(D) == 195 ? 81 : 80;
    check_non_private_1152 = code_1387(D) != 177 ? "lastprivate" : 0B;
    iftmp.2373_1515 = code_1387(D) != 181 ? ctx_1386 : outer_ctx_1389;

iftmp.2304_1247 : gomp_map_kind [80, 81]
iftmp.2340_1256 : gomp_map_kind [80, 81]
iftmp.2373_1515 : struct gimplify_omp_ctx * [1B, +INF]

Notice the non-zero range on exit.

To reproduce:

tmcc1plus a.ii -O2 -fdisable-tree-threadfull2 -fdisable-tree-threadfull1
-fdisable-tree-thread2 -fdisable-tree-thread1
-fdbg-cnt=registered_jump_thread:543-543:544-544:550-550:551-551:552-552:553-553:554-554:555-555
-fno-PIE -fno-exceptions -fno-rtti -fasynchronous-unwind-tables -fno-common
-fdump-tree-all-lineno 

and search for:

:10070:.*omp_add_variable

...in the vrp2 dump.  There's no guard on iftmp.2373_1515 because the check was
removed.

It is possible that threadfull2, which uses the ranger engine and runs before
vrp2, was threading the check, since ranger obviously thinks it's a constant. 
This is why removing threadfull2 didn't fix the problem, since vrp2 (which is
now using ranger) will make the same conclusion, albeit with a different
approach (remove the conditional instead of thread the path).

And indeed, if I add --param=vrp2-mode=vrp, to the above steps, the problem
goes away.

So, this is ranger...not the threader.  I'm going to put this aside while I
take a look at the other P1s that are completely the threader's fault, and if
Andrew doesn't get to it before, I'll come back to this.

  parent reply	other threads:[~2021-11-12 13:28 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-11 14:39 [Bug tree-optimization/103192] New: " jakub at gcc dot gnu.org
2021-11-11 15:31 ` [Bug tree-optimization/103192] " jakub at gcc dot gnu.org
2021-11-11 17:28 ` pinskia at gcc dot gnu.org
2021-11-12  7:28 ` rguenth at gcc dot gnu.org
2021-11-12  8:15 ` aldyh at gcc dot gnu.org
2021-11-12 10:28 ` aldyh at gcc dot gnu.org
2021-11-12 11:13 ` jamborm at gcc dot gnu.org
2021-11-12 11:22 ` aldyh at gcc dot gnu.org
2021-11-12 11:31 ` jakub at gcc dot gnu.org
2021-11-12 11:38 ` aldyh at gcc dot gnu.org
2021-11-12 11:40 ` jakub at gcc dot gnu.org
2021-11-12 13:28 ` aldyh at gcc dot gnu.org [this message]
2021-11-12 13:30 ` aldyh at gcc dot gnu.org
2021-11-13 18:27 ` jakub at gcc dot gnu.org
2021-11-13 19:07 ` hubicka at gcc dot gnu.org
2021-11-15 20:30 ` amacleod at redhat dot com
2021-11-15 22:08 ` amacleod at redhat dot com
2021-11-16  3:12 ` law at gcc dot gnu.org
2021-11-16  8:37 ` jakub at gcc dot gnu.org
2021-11-16 12:17 ` aldyh at gcc dot gnu.org
2021-11-16 13:34 ` jakub at gcc dot gnu.org
2021-11-16 13:51 ` jakub at gcc dot gnu.org
2021-11-17 13:19 ` cvs-commit at gcc dot gnu.org
2021-11-22 17:45 ` jakub at gcc dot gnu.org
2021-11-29  8:49 ` cvs-commit at gcc dot gnu.org
2022-05-10  8:21 ` cvs-commit at gcc dot gnu.org
2022-05-11  6:23 ` 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-103192-4-JmxMzwwek7@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: link
Be 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).