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
Don't parallelize loops if libgomp not supported
2016-01-07 Tom de Vries <t...@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);