public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [Committed, PR69058] Don't parallelize loops if libgomp not supported
@ 2016-01-11  9:08 Tom de Vries
  0 siblings, 0 replies; only message in thread
From: Tom de Vries @ 2016-01-11  9:08 UTC (permalink / raw)
  To: gcc-patches, Richard Biener

[-- Attachment #1: Type: text/plain, Size: 527 bytes --]

Hi,

when doing an ftree-parallelize-loops=2 build (PR68967), I ran into an 
ICE building libgo.

The ICE can be reproduced using a regular toolchain using this command:
...
$ gccgo src/libgo/go/strconv/decimal.go -O2 -ftree-parallelize-loops=2 -S
...

The problem is that parloops is trying to use libgomp builtins, while 
they're not available.

This patch fixes the ICE by doing an early-out in parloops if the 
libgomp builtins are not available.

Bootstrapped and reg-tested on x86_64.

Committed to trunk.

Thanks,
- Tom

[-- Attachment #2: 0001-Don-t-parallelize-loops-if-libgomp-not-supported.patch --]
[-- Type: text/x-patch, Size: 755 bytes --]

Don't parallelize loops if libgomp not supported

2016-01-07  Tom de Vries  <tom@codesourcery.com>

	PR tree-optimization/69058
	* tree-parloops.c (pass_parallelize_loops::execute): Return 0 if libgomp
	not supported.

---
 gcc/tree-parloops.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/gcc/tree-parloops.c b/gcc/tree-parloops.c
index 5bd9c06..e05cc47 100644
--- a/gcc/tree-parloops.c
+++ b/gcc/tree-parloops.c
@@ -2836,6 +2836,10 @@ pass_parallelize_loops::execute (function *fun)
   if (number_of_loops (fun) <= 1)
     return 0;
 
+  tree nthreads = builtin_decl_explicit (BUILT_IN_OMP_GET_NUM_THREADS);
+  if (nthreads == NULL_TREE)
+    return 0;
+
   if (parallelize_loops ())
     {
       fun->curr_properties &= ~(PROP_gimple_eomp);

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2016-01-11  9:08 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-01-11  9:08 [Committed, PR69058] Don't parallelize loops if libgomp not supported Tom de Vries

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).