diff mbox series

[committed,tree-optimization] Don't clear ctrl-altering flag for IFN_UNIQUE

Message ID 20200910110132.GA3285@delia
State New
Headers show
Series [committed,tree-optimization] Don't clear ctrl-altering flag for IFN_UNIQUE | expand

Commit Message

Tom de Vries Sept. 10, 2020, 11:01 a.m. UTC
Hi,

There's an invariant for IFN_UNIQUE, listed here in
gimple_call_initialize_ctrl_altering:
...
      /* IFN_UNIQUE should be the last insn, to make checking for it
         as cheap as possible.  */
      || (gimple_call_internal_p (stmt)
          && gimple_call_internal_unique_p (stmt)))
    gimple_call_set_ctrl_altering (stmt, true);
...

Recent commit fab77644842 "tree-optimization/96931 - clear ctrl-altering flag
more aggressively" breaks this invariant, causing an ICE triggered during
libgomp testing for x86_64 with nvptx accelerator:
...
during RTL pass: mach
asyncwait-1.f90: In function ‘MAIN__._omp_fn.0’:
asyncwait-1.f90:19: internal compiler error: in nvptx_find_par, at \
  config/nvptx/nvptx.c:3293
...

Fix this by listing IFN_UNIQUE as exception in
cleanup_call_ctrl_altering_flag.

Build for x86_64 with nvptx accelerator, tested libgomp.

Committed to trunk.

Thanks,
- Tom

[tree-optimization] Don't clear ctrl-altering flag for IFN_UNIQUE

gcc/ChangeLog:

	PR tree-optimization/97000
	* tree-cfgcleanup.c (cleanup_call_ctrl_altering_flag): Don't clear
	flag for IFN_UNIQUE.

---
 gcc/tree-cfgcleanup.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/gcc/tree-cfgcleanup.c b/gcc/tree-cfgcleanup.c
index f8169eef781..f2edd3fd2e5 100644
--- a/gcc/tree-cfgcleanup.c
+++ b/gcc/tree-cfgcleanup.c
@@ -212,7 +212,11 @@  static void
 cleanup_call_ctrl_altering_flag (basic_block bb, gimple *bb_end)
 {
   if (!is_gimple_call (bb_end)
-      || !gimple_call_ctrl_altering_p (bb_end))
+      || !gimple_call_ctrl_altering_p (bb_end)
+      || (/* IFN_UNIQUE should be the last insn, to make checking for it
+	     as cheap as possible.  */
+	  gimple_call_internal_p (bb_end)
+	  && gimple_call_internal_unique_p (bb_end)))
     return;
 
   int flags = gimple_call_flags (bb_end);