diff options
author | Feng Xue <fxue@os.amperecomputing.com> | 2019-06-13 04:17:42 +0000 |
---|---|---|
committer | Feng Xue <fxue@gcc.gnu.org> | 2019-06-13 04:17:42 +0000 |
commit | c29c92c789d93848cc1c929838771bfc68cb272c (patch) | |
tree | 10a08875fb9bec9119ac6c0fa419923b9ac48654 /gcc/omp-offload.c | |
parent | 9b884225bfc609606f9b169b021c4da93feba48e (diff) |
PR tree-optimization/89713 - Assume loop with an exit is finite
gcc/ChangeLog:
* doc/invoke.texi (-ffinite-loops): Document new option.
* common.opt (-ffinite-loops): New option.
* tree-ssa-dce.c (mark_stmt_if_obviously_necessary): Mark
IFN_GOACC_LOOP calls as necessary.
* tree-ssa-loop-niter.c (finite_loop_p): Assume loop with an exit
is finite.
* omp-offload.c (oacc_xform_loop): Skip lowering if return value of
IFN_GOACC_LOOP call is not used.
* opts.c (default_options_table): Enable -ffinite-loops at -O2+.
gcc/testsuite/ChangeLog:
* g++.dg/tree-ssa/empty-loop.C: New test.
* gcc.dg/tree-ssa/dce-2.c: New test.
* gcc.dg/const-1.c: Add -fno-finite-loops option.
* gcc.dg/graphite/graphite.exp: Likewise.
* gcc.dg/loop-unswitch-1.c: Likewise.
* gcc.dg/predict-9.c: Likewise.
* gcc.dg/pure-2.c: Likewise.
* gcc.dg/tree-ssa/20040211-1.c: Likewise.
* gcc.dg/tree-ssa/loop-10.c: Likewise.
* gcc.dg/tree-ssa/split-path-6.c: Likewise.
* gcc.dg/tree-ssa/ssa-thread-12.c: Likewise.
libgomp/ChangeLog:
* testsuite/libgomp.oacc-c-c++-common/pr84955-1.c: New test.
From-SVN: r272234
Diffstat (limited to 'gcc/omp-offload.c')
-rw-r--r-- | gcc/omp-offload.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/gcc/omp-offload.c b/gcc/omp-offload.c index 97ae47b3135..c8a281c6d28 100644 --- a/gcc/omp-offload.c +++ b/gcc/omp-offload.c @@ -300,7 +300,7 @@ oacc_xform_loop (gcall *call) tree chunk_size = NULL_TREE; unsigned mask = (unsigned) TREE_INT_CST_LOW (gimple_call_arg (call, 5)); tree lhs = gimple_call_lhs (call); - tree type = TREE_TYPE (lhs); + tree type = NULL_TREE; tree diff_type = TREE_TYPE (range); tree r = NULL_TREE; gimple_seq seq = NULL; @@ -308,6 +308,15 @@ oacc_xform_loop (gcall *call) unsigned outer_mask = mask & (~mask + 1); // Outermost partitioning unsigned inner_mask = mask & ~outer_mask; // Inner partitioning (if any) + /* Skip lowering if return value of IFN_GOACC_LOOP call is not used. */ + if (!lhs) + { + gsi_replace_with_seq (&gsi, seq, true); + return; + } + + type = TREE_TYPE (lhs); + #ifdef ACCEL_COMPILER chunk_size = gimple_call_arg (call, 4); if (integer_minus_onep (chunk_size) /* Force static allocation. */ |