Commit 597a8ab9 by Tom de Vries Committed by Tom de Vries

Add pass_oacc_ipa

2015-12-16  Tom de Vries  <tom@codesourcery.com>

	* opts.c (default_options_optimization): Set fipa-pta on by default for
	fopenacc.
	* passes.def: Move kernels pass group to pass_ipa_oacc.
	* tree-pass.h (make_pass_oacc_kernels2): Remove.
	(make_pass_ipa_oacc, make_pass_ipa_oacc_kernels): Declare.
	* tree-ssa-loop.c (pass_oacc_kernels2, make_pass_oacc_kernels2): Remove.
	(pass_ipa_oacc, pass_ipa_oacc_kernels): New pass.
	(make_pass_ipa_oacc, make_pass_ipa_oacc_kernels): New function.
	* tree-ssa-structalias.c (pass_ipa_pta::clone): New function.

	* g++.dg/ipa/devirt-37.C: Update for new fre2 pass.
	* g++.dg/ipa/devirt-40.C: Same.
	* g++.dg/tree-ssa/pr61034.C: Same.
	* gcc.dg/ipa/ipa-pta-1.c: Update for new pta1 pass.
	* gcc.dg/ipa/ipa-pta-10.c: Same.
	* gcc.dg/ipa/ipa-pta-11.c: Same.
	* gcc.dg/ipa/ipa-pta-14.c: Same.
	* gcc.dg/ipa/ipa-pta-16.c: Same.
	* gcc.dg/ipa/ipa-pta-2.c: Same.
	* gcc.dg/ipa/ipa-pta-5.c: Same.
	* gcc.dg/ipa/ipa-pta-6.c: Same.
	* gcc.dg/torture/ipa-pta-1.c: Same.
	* gcc.dg/ipa/ipa-pta-13.c: Update for new fre2 and pta1 pass.
	* gcc.dg/ipa/ipa-pta-3.c: Same.
	* gcc.dg/ipa/ipa-pta-4.c: Same.

From-SVN: r231690
parent f47cda24
2015-12-16 Tom de Vries <tom@codesourcery.com>
* opts.c (default_options_optimization): Set fipa-pta on by default for
fopenacc.
* passes.def: Move kernels pass group to pass_ipa_oacc.
* tree-pass.h (make_pass_oacc_kernels2): Remove.
(make_pass_ipa_oacc, make_pass_ipa_oacc_kernels): Declare.
* tree-ssa-loop.c (pass_oacc_kernels2, make_pass_oacc_kernels2): Remove.
(pass_ipa_oacc, pass_ipa_oacc_kernels): New pass.
(make_pass_ipa_oacc, make_pass_ipa_oacc_kernels): New function.
* tree-ssa-structalias.c (pass_ipa_pta::clone): New function.
2015-12-16 Richard Biener <rguenther@suse.de> 2015-12-16 Richard Biener <rguenther@suse.de>
PR tree-optimization/68861 PR tree-optimization/68861
...@@ -560,6 +560,7 @@ default_options_optimization (struct gcc_options *opts, ...@@ -560,6 +560,7 @@ default_options_optimization (struct gcc_options *opts,
{ {
unsigned int i; unsigned int i;
int opt2; int opt2;
bool openacc_mode = false;
/* Scan to see what optimization level has been specified. That will /* Scan to see what optimization level has been specified. That will
determine the default value of many flags. */ determine the default value of many flags. */
...@@ -619,6 +620,11 @@ default_options_optimization (struct gcc_options *opts, ...@@ -619,6 +620,11 @@ default_options_optimization (struct gcc_options *opts,
opts->x_optimize_debug = 1; opts->x_optimize_debug = 1;
break; break;
case OPT_fopenacc:
if (opt->value)
openacc_mode = true;
break;
default: default:
/* Ignore other options in this prescan. */ /* Ignore other options in this prescan. */
break; break;
...@@ -633,6 +639,10 @@ default_options_optimization (struct gcc_options *opts, ...@@ -633,6 +639,10 @@ default_options_optimization (struct gcc_options *opts,
/* -O2 param settings. */ /* -O2 param settings. */
opt2 = (opts->x_optimize >= 2); opt2 = (opts->x_optimize >= 2);
if (openacc_mode
&& !opts_set->x_flag_ipa_pta)
opts->x_flag_ipa_pta = true;
/* Track fields in field-sensitive alias analysis. */ /* Track fields in field-sensitive alias analysis. */
maybe_set_param_value maybe_set_param_value
(PARAM_MAX_FIELDS_FOR_FIELD_SENSITIVE, (PARAM_MAX_FIELDS_FOR_FIELD_SENSITIVE,
......
...@@ -88,24 +88,7 @@ along with GCC; see the file COPYING3. If not see ...@@ -88,24 +88,7 @@ along with GCC; see the file COPYING3. If not see
/* pass_build_ealias is a dummy pass that ensures that we /* pass_build_ealias is a dummy pass that ensures that we
execute TODO_rebuild_alias at this point. */ execute TODO_rebuild_alias at this point. */
NEXT_PASS (pass_build_ealias); NEXT_PASS (pass_build_ealias);
/* Pass group that runs when the function is an offloaded function
containing oacc kernels loops. Part 1. */
NEXT_PASS (pass_oacc_kernels);
PUSH_INSERT_PASSES_WITHIN (pass_oacc_kernels)
NEXT_PASS (pass_ch);
POP_INSERT_PASSES ()
NEXT_PASS (pass_fre); NEXT_PASS (pass_fre);
/* Pass group that runs when the function is an offloaded function
containing oacc kernels loops. Part 2. */
NEXT_PASS (pass_oacc_kernels2);
PUSH_INSERT_PASSES_WITHIN (pass_oacc_kernels2)
/* We use pass_lim to rewrite in-memory iteration and reduction
variable accesses in loops into local variables accesses. */
NEXT_PASS (pass_lim);
NEXT_PASS (pass_dominator, false /* may_peel_loop_headers_p */);
NEXT_PASS (pass_dce);
NEXT_PASS (pass_expand_omp_ssa);
POP_INSERT_PASSES ()
NEXT_PASS (pass_merge_phi); NEXT_PASS (pass_merge_phi);
NEXT_PASS (pass_dse); NEXT_PASS (pass_dse);
NEXT_PASS (pass_cd_dce); NEXT_PASS (pass_cd_dce);
...@@ -124,6 +107,30 @@ along with GCC; see the file COPYING3. If not see ...@@ -124,6 +107,30 @@ along with GCC; see the file COPYING3. If not see
NEXT_PASS (pass_rebuild_cgraph_edges); NEXT_PASS (pass_rebuild_cgraph_edges);
NEXT_PASS (pass_inline_parameters); NEXT_PASS (pass_inline_parameters);
POP_INSERT_PASSES () POP_INSERT_PASSES ()
NEXT_PASS (pass_ipa_oacc);
PUSH_INSERT_PASSES_WITHIN (pass_ipa_oacc)
NEXT_PASS (pass_ipa_pta);
/* Pass group that runs when the function is an offloaded function
containing oacc kernels loops. */
NEXT_PASS (pass_ipa_oacc_kernels);
PUSH_INSERT_PASSES_WITHIN (pass_ipa_oacc_kernels)
NEXT_PASS (pass_oacc_kernels);
PUSH_INSERT_PASSES_WITHIN (pass_oacc_kernels)
NEXT_PASS (pass_ch);
NEXT_PASS (pass_fre);
/* We use pass_lim to rewrite in-memory iteration and reduction
variable accesses in loops into local variables accesses. */
NEXT_PASS (pass_lim);
NEXT_PASS (pass_dominator, false /* may_peel_loop_headers_p */);
NEXT_PASS (pass_dce);
/* pass_parallelize_loops_oacc_kernels */
NEXT_PASS (pass_expand_omp_ssa);
NEXT_PASS (pass_rebuild_cgraph_edges);
POP_INSERT_PASSES ()
POP_INSERT_PASSES ()
POP_INSERT_PASSES ()
NEXT_PASS (pass_ipa_chkp_produce_thunks); NEXT_PASS (pass_ipa_chkp_produce_thunks);
NEXT_PASS (pass_ipa_auto_profile); NEXT_PASS (pass_ipa_auto_profile);
NEXT_PASS (pass_ipa_free_inline_summary); NEXT_PASS (pass_ipa_free_inline_summary);
......
2015-12-16 Tom de Vries <tom@codesourcery.com>
* g++.dg/ipa/devirt-37.C: Update for new fre2 pass.
* g++.dg/ipa/devirt-40.C: Same.
* g++.dg/tree-ssa/pr61034.C: Same.
* gcc.dg/ipa/ipa-pta-1.c: Update for new pta1 pass.
* gcc.dg/ipa/ipa-pta-10.c: Same.
* gcc.dg/ipa/ipa-pta-11.c: Same.
* gcc.dg/ipa/ipa-pta-14.c: Same.
* gcc.dg/ipa/ipa-pta-16.c: Same.
* gcc.dg/ipa/ipa-pta-2.c: Same.
* gcc.dg/ipa/ipa-pta-5.c: Same.
* gcc.dg/ipa/ipa-pta-6.c: Same.
* gcc.dg/torture/ipa-pta-1.c: Same.
* gcc.dg/ipa/ipa-pta-13.c: Update for new fre2 and pta1 pass.
* gcc.dg/ipa/ipa-pta-3.c: Same.
* gcc.dg/ipa/ipa-pta-4.c: Same.
2015-12-16 Richard Biener <rguenther@suse.de> 2015-12-16 Richard Biener <rguenther@suse.de>
PR testsuite/68915 PR testsuite/68915
......
/* { dg-options "-fpermissive -O2 -fno-indirect-inlining -fno-devirtualize-speculatively -fdump-tree-fre2-details -fno-early-inlining" } */ /* { dg-options "-fpermissive -O2 -fno-indirect-inlining -fno-devirtualize-speculatively -fdump-tree-fre3-details -fno-early-inlining" } */
#include <stdlib.h> #include <stdlib.h>
struct A {virtual void test() {abort ();}}; struct A {virtual void test() {abort ();}};
struct B:A struct B:A
...@@ -30,7 +30,7 @@ t() ...@@ -30,7 +30,7 @@ t()
/* After inlining the call within constructor needs to be checked to not go into a basetype. /* After inlining the call within constructor needs to be checked to not go into a basetype.
We should see the vtbl store and we should notice extcall as possibly clobbering the We should see the vtbl store and we should notice extcall as possibly clobbering the
type but ignore it because b is in static storage. */ type but ignore it because b is in static storage. */
/* { dg-final { scan-tree-dump "No dynamic type change found." "fre2" } } */ /* { dg-final { scan-tree-dump "No dynamic type change found." "fre3" } } */
/* { dg-final { scan-tree-dump "Checking vtbl store:" "fre2" } } */ /* { dg-final { scan-tree-dump "Checking vtbl store:" "fre3" } } */
/* { dg-final { scan-tree-dump "Function call may change dynamic type:extcall" "fre2" } } */ /* { dg-final { scan-tree-dump "Function call may change dynamic type:extcall" "fre3" } } */
/* { dg-final { scan-tree-dump "converting indirect call to function virtual void" "fre2" } } */ /* { dg-final { scan-tree-dump "converting indirect call to function virtual void" "fre3" } } */
/* { dg-options "-O2 -fdump-tree-fre2-details" } */ /* { dg-options "-O2 -fdump-tree-fre3-details" } */
typedef enum typedef enum
{ {
} UErrorCode; } UErrorCode;
...@@ -19,4 +19,4 @@ A::m_fn1 (UnicodeString &, int &p2, UErrorCode &) const ...@@ -19,4 +19,4 @@ A::m_fn1 (UnicodeString &, int &p2, UErrorCode &) const
UnicodeString a[2]; UnicodeString a[2];
} }
/* { dg-final { scan-tree-dump-not "\\n OBJ_TYPE_REF" "fre2" } } */ /* { dg-final { scan-tree-dump-not "\\n OBJ_TYPE_REF" "fre3" } } */
// { dg-do compile } // { dg-do compile }
// { dg-options "-O2 -fdump-tree-fre2 -fdump-tree-optimized" } // { dg-options "-O2 -fdump-tree-fre3 -fdump-tree-optimized" }
#define assume(x) if(!(x))__builtin_unreachable() #define assume(x) if(!(x))__builtin_unreachable()
...@@ -42,13 +42,13 @@ bool f(I a, I b, I c, I d) { ...@@ -42,13 +42,13 @@ bool f(I a, I b, I c, I d) {
// a bunch of conditional free()s and unreachable()s. // a bunch of conditional free()s and unreachable()s.
// This works only if everything is inlined into 'f'. // This works only if everything is inlined into 'f'.
// { dg-final { scan-tree-dump-times ";; Function" 1 "fre2" } } // { dg-final { scan-tree-dump-times ";; Function" 1 "fre3" } }
// { dg-final { scan-tree-dump-times "unreachable" 11 "fre2" } } // { dg-final { scan-tree-dump-times "unreachable" 11 "fre3" } }
// Note that depending on PUSH_ARGS_REVERSED we are presented with // Note that depending on PUSH_ARGS_REVERSED we are presented with
// a different initial CFG and thus the final outcome is different // a different initial CFG and thus the final outcome is different
// { dg-final { scan-tree-dump-times "free" 10 "fre2" { target x86_64-*-* i?86-*-* } } } // { dg-final { scan-tree-dump-times "free" 10 "fre3" { target x86_64-*-* i?86-*-* } } }
// { dg-final { scan-tree-dump-times "free" 3 "optimized" { target x86_64-*-* i?86-*-* } } } // { dg-final { scan-tree-dump-times "free" 3 "optimized" { target x86_64-*-* i?86-*-* } } }
// { dg-final { scan-tree-dump-times "free" 14 "fre2" { target aarch64-*-* ia64-*-* arm-*-* hppa*-*-* sparc*-*-* powerpc*-*-* alpha*-*-* } } } // { dg-final { scan-tree-dump-times "free" 14 "fre3" { target aarch64-*-* ia64-*-* arm-*-* hppa*-*-* sparc*-*-* powerpc*-*-* alpha*-*-* } } }
// { dg-final { scan-tree-dump-times "free" 4 "optimized" { target aarch64-*-* ia64-*-* arm-*-* hppa*-*-* sparc*-*-* powerpc*-*-* alpha*-*-* } } } // { dg-final { scan-tree-dump-times "free" 4 "optimized" { target aarch64-*-* ia64-*-* arm-*-* hppa*-*-* sparc*-*-* powerpc*-*-* alpha*-*-* } } }
/* { dg-do run } */ /* { dg-do run } */
/* { dg-options "-O -fipa-pta -fdump-ipa-pta-details" } */ /* { dg-options "-O -fipa-pta -fdump-ipa-pta2-details" } */
static int __attribute__((noinline)) static int __attribute__((noinline))
foo (int *p, int *q) foo (int *p, int *q)
...@@ -45,8 +45,8 @@ int main() ...@@ -45,8 +45,8 @@ int main()
not seen by IPA PTA (if the address escapes the unit which we only compute not seen by IPA PTA (if the address escapes the unit which we only compute
during IPA PTA...). Thus the solution also includes NONLOCAL. */ during IPA PTA...). Thus the solution also includes NONLOCAL. */
/* { dg-final { scan-ipa-dump "fn_1 = { bar foo }" "pta" } } */ /* { dg-final { scan-ipa-dump "fn_1 = { bar foo }" "pta2" } } */
/* { dg-final { scan-ipa-dump "bar.arg0 = { NONLOCAL a }" "pta" } } */ /* { dg-final { scan-ipa-dump "bar.arg0 = { NONLOCAL a }" "pta2" } } */
/* { dg-final { scan-ipa-dump "bar.arg1 = { NONLOCAL a }" "pta" } } */ /* { dg-final { scan-ipa-dump "bar.arg1 = { NONLOCAL a }" "pta2" } } */
/* { dg-final { scan-ipa-dump "foo.arg0 = { NONLOCAL a }" "pta" } } */ /* { dg-final { scan-ipa-dump "foo.arg0 = { NONLOCAL a }" "pta2" } } */
/* { dg-final { scan-ipa-dump "foo.arg1 = { NONLOCAL a }" "pta" } } */ /* { dg-final { scan-ipa-dump "foo.arg1 = { NONLOCAL a }" "pta2" } } */
/* { dg-do run } */ /* { dg-do run } */
/* { dg-options "-O2 -fipa-pta -fdump-ipa-pta-details" } */ /* { dg-options "-O2 -fipa-pta -fdump-ipa-pta2-details" } */
#include <stdarg.h> #include <stdarg.h>
...@@ -26,4 +26,4 @@ int main() ...@@ -26,4 +26,4 @@ int main()
/* Verify we properly handle variadic arguments and do not let escape /* Verify we properly handle variadic arguments and do not let escape
stuff through it. */ stuff through it. */
/* { dg-final { scan-ipa-dump "ESCAPED = { (ESCAPED )?(NONLOCAL )?}" "pta" } } */ /* { dg-final { scan-ipa-dump "ESCAPED = { (ESCAPED )?(NONLOCAL )?}" "pta2" } } */
/* { dg-do link } */ /* { dg-do link } */
/* { dg-options "-O2 -fipa-pta -fdump-ipa-pta-details" } */ /* { dg-options "-O2 -fipa-pta -fdump-ipa-pta2-details" } */
static int i; static int i;
/* i should not escape here, p should point to i only. */ /* i should not escape here, p should point to i only. */
/* { dg-final { scan-ipa-dump "p = { i }" "pta" } } */ /* { dg-final { scan-ipa-dump "p = { i }" "pta2" } } */
static int *p = &i; static int *p = &i;
int j; int j;
/* q should point to j only. */ /* q should point to j only. */
/* { dg-final { scan-ipa-dump "q = { j }" "pta" } } */ /* { dg-final { scan-ipa-dump "q = { j }" "pta2" } } */
static int *q = &j; static int *q = &j;
static int k; static int k;
/* k should escape here, r should point to NONLOCAL, ESCAPED, k. */ /* k should escape here, r should point to NONLOCAL, ESCAPED, k. */
int *r = &k; int *r = &k;
/* { dg-final { scan-ipa-dump "r = { ESCAPED NONLOCAL k }" "pta" } } */ /* { dg-final { scan-ipa-dump "r = { ESCAPED NONLOCAL k }" "pta2" } } */
int l; int l;
/* s should point to NONLOCAL, ESCAPED, l. */ /* s should point to NONLOCAL, ESCAPED, l. */
int *s = &l; int *s = &l;
/* { dg-final { scan-ipa-dump "s = { ESCAPED NONLOCAL l }" "pta" } } */ /* { dg-final { scan-ipa-dump "s = { ESCAPED NONLOCAL l }" "pta2" } } */
/* Make p and q referenced so they do not get optimized out. */ /* Make p and q referenced so they do not get optimized out. */
int foo() { return &p < &q; } int foo() { return &p < &q; }
...@@ -32,4 +32,4 @@ int main() ...@@ -32,4 +32,4 @@ int main()
/* It isn't clear if the escape if l is strictly necessary, if it were /* It isn't clear if the escape if l is strictly necessary, if it were
we should have i, r and s in ESCAPED as well. */ we should have i, r and s in ESCAPED as well. */
/* { dg-final { scan-ipa-dump "ESCAPED = { ESCAPED NONLOCAL l k }" "pta" } } */ /* { dg-final { scan-ipa-dump "ESCAPED = { ESCAPED NONLOCAL l k }" "pta2" } } */
/* { dg-do link } */ /* { dg-do link } */
/* { dg-options "-O2 -fipa-pta -fdump-ipa-pta-details -fdump-tree-fre2 -fno-ipa-icf" } */ /* { dg-options "-O2 -fipa-pta -fdump-ipa-pta2-details -fdump-tree-fre3 -fno-ipa-icf" } */
static int x, y; static int x, y;
...@@ -19,7 +19,7 @@ void *anyfn_global; ...@@ -19,7 +19,7 @@ void *anyfn_global;
/* Even though not referenced in this TU we should have added constraints /* Even though not referenced in this TU we should have added constraints
for the initializer. */ for the initializer. */
/* { dg-final { scan-ipa-dump "ex = &local_address_taken" "pta" } } */ /* { dg-final { scan-ipa-dump "ex = &local_address_taken" "pta2" } } */
void (*ex)(int *) = local_address_taken; void (*ex)(int *) = local_address_taken;
extern void link_error (void); extern void link_error (void);
...@@ -38,11 +38,11 @@ int main() ...@@ -38,11 +38,11 @@ int main()
uses to be messed up even further. */ uses to be messed up even further. */
/* ??? As we don't expand the ESCAPED solution we either get x printed here /* ??? As we don't expand the ESCAPED solution we either get x printed here
or not based on the phase of the moon. */ or not based on the phase of the moon. */
/* { dg-final { scan-ipa-dump "local_address_taken.arg0 = { ESCAPED NONLOCAL y x }" "pta" { xfail *-*-* } } } */ /* { dg-final { scan-ipa-dump "local_address_taken.arg0 = { ESCAPED NONLOCAL y x }" "pta2" { xfail *-*-* } } } */
/* { dg-final { scan-ipa-dump "local_address_taken.clobber = { ESCAPED NONLOCAL y x }" "pta" { xfail *-*-* } } } */ /* { dg-final { scan-ipa-dump "local_address_taken.clobber = { ESCAPED NONLOCAL y x }" "pta2" { xfail *-*-* } } } */
/* { dg-final { scan-ipa-dump "local_address_taken.use = { }" "pta" { xfail *-*-* } } } */ /* { dg-final { scan-ipa-dump "local_address_taken.use = { }" "pta2" { xfail *-*-* } } } */
/* ??? But make sure x really escaped. */ /* ??? But make sure x really escaped. */
/* { dg-final { scan-ipa-dump "ESCAPED = {\[^\n\}\]* x \[^\n\}\]*}" "pta" } } */ /* { dg-final { scan-ipa-dump "ESCAPED = {\[^\n\}\]* x \[^\n\}\]*}" "pta2" } } */
(*anyfn) (&x); (*anyfn) (&x);
x = 0; x = 0;
local (&y); local (&y);
...@@ -54,7 +54,7 @@ int main() ...@@ -54,7 +54,7 @@ int main()
local_address_taken (&y); local_address_taken (&y);
/* As we are computing flow- and context-insensitive we may not /* As we are computing flow- and context-insensitive we may not
CSE the load of x here. */ CSE the load of x here. */
/* { dg-final { scan-tree-dump " = x;" "fre2" } } */ /* { dg-final { scan-tree-dump " = x;" "fre3" } } */
return x; return x;
} }
/* { dg-do run } */ /* { dg-do run } */
/* { dg-options "-O2 -fipa-pta -fno-tree-fre -fno-tree-sra -fdump-ipa-pta-details -fdelete-null-pointer-checks" } */ /* { dg-options "-O2 -fipa-pta -fno-tree-fre -fno-tree-sra -fdump-ipa-pta2-details -fdelete-null-pointer-checks" } */
struct X { struct X {
int i; int i;
...@@ -21,8 +21,8 @@ int main() ...@@ -21,8 +21,8 @@ int main()
void *p; void *p;
a.p = (void *)&c; a.p = (void *)&c;
p = foo(&a, &a); p = foo(&a, &a);
/* { dg-final { scan-ipa-dump "foo.result = { NULL a\[^ \]* c\[^ \]* }" "pta" { target { ! keeps_null_pointer_checks } } } } */ /* { dg-final { scan-ipa-dump "foo.result = { NULL a\[^ \]* c\[^ \]* }" "pta2" { target { ! keeps_null_pointer_checks } } } } */
/* { dg-final { scan-ipa-dump "foo.result = { NONLOCAL a\[^ \]* c\[^ \]* }" "pta" { target { keeps_null_pointer_checks } } } } */ /* { dg-final { scan-ipa-dump "foo.result = { NONLOCAL a\[^ \]* c\[^ \]* }" "pta2" { target { keeps_null_pointer_checks } } } } */
((struct X *)p)->p = (void *)0; ((struct X *)p)->p = (void *)0;
if (a.p != (void *)0) if (a.p != (void *)0)
abort (); abort ();
......
/* { dg-do run } */ /* { dg-do run } */
/* { dg-options "-O2 -fno-tree-sra -fipa-pta -fdump-ipa-pta" } */ /* { dg-options "-O2 -fno-tree-sra -fipa-pta -fdump-ipa-pta2" } */
struct X struct X
{ {
...@@ -29,4 +29,4 @@ int main() ...@@ -29,4 +29,4 @@ int main()
return 0; return 0;
} }
/* { dg-final { scan-ipa-dump "y.\[0-9\]*\\\+\[0-9\]* = { i }" "pta" } } */ /* { dg-final { scan-ipa-dump "y.\[0-9\]*\\\+\[0-9\]* = { i }" "pta2" } } */
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-options "-O -fipa-pta -fdump-ipa-pta-details" } */ /* { dg-options "-O -fipa-pta -fdump-ipa-pta2-details" } */
int (*fn)(int *); int (*fn)(int *);
...@@ -21,4 +21,4 @@ int main() ...@@ -21,4 +21,4 @@ int main()
/* Make sure that when a local function escapes its argument points-to sets /* Make sure that when a local function escapes its argument points-to sets
are properly adjusted. */ are properly adjusted. */
/* { dg-final { scan-ipa-dump "foo.arg0 = { ESCAPED NONLOCAL }" "pta" } } */ /* { dg-final { scan-ipa-dump "foo.arg0 = { ESCAPED NONLOCAL }" "pta2" } } */
/* { dg-do run } */ /* { dg-do run } */
/* { dg-options "-O2 -fipa-pta -fdump-ipa-pta-details -fdump-tree-fre2-details" } */ /* { dg-options "-O2 -fipa-pta -fdump-ipa-pta2-details -fdump-tree-fre3-details" } */
static int __attribute__((noinline,noclone)) static int __attribute__((noinline,noclone))
foo (int *p, int *q) foo (int *p, int *q)
...@@ -21,6 +21,6 @@ int main() ...@@ -21,6 +21,6 @@ int main()
/* Verify we can disambiguate *p and *q in foo. */ /* Verify we can disambiguate *p and *q in foo. */
/* { dg-final { scan-ipa-dump "foo.arg0 = &a" "pta" } } */ /* { dg-final { scan-ipa-dump "foo.arg0 = &a" "pta2" } } */
/* { dg-final { scan-ipa-dump "foo.arg1 = &b" "pta" } } */ /* { dg-final { scan-ipa-dump "foo.arg1 = &b" "pta2" } } */
/* { dg-final { scan-tree-dump "Replaced \\\*p_2\\\(D\\\) with 1" "fre2" } } */ /* { dg-final { scan-tree-dump "Replaced \\\*p_2\\\(D\\\) with 1" "fre3" } } */
/* { dg-do run } */ /* { dg-do run } */
/* { dg-options "-O2 -fipa-pta -fdump-ipa-pta-details -fdump-tree-fre2-details" } */ /* { dg-options "-O2 -fipa-pta -fdump-ipa-pta2-details -fdump-tree-fre3-details" } */
int a, b; int a, b;
...@@ -26,6 +26,6 @@ int main() ...@@ -26,6 +26,6 @@ int main()
/* Verify we can disambiguate *p and *q in foo. */ /* Verify we can disambiguate *p and *q in foo. */
/* { dg-final { scan-ipa-dump "foo.arg0 = &a" "pta" } } */ /* { dg-final { scan-ipa-dump "foo.arg0 = &a" "pta2" } } */
/* { dg-final { scan-ipa-dump "foo.arg1 = &b" "pta" } } */ /* { dg-final { scan-ipa-dump "foo.arg1 = &b" "pta2" } } */
/* { dg-final { scan-tree-dump "Replaced \\\*p_2\\\(D\\\) with 1" "fre2" } } */ /* { dg-final { scan-tree-dump "Replaced \\\*p_2\\\(D\\\) with 1" "fre3" } } */
/* { dg-do run } */ /* { dg-do run } */
/* { dg-options "-O2 -fipa-pta -fdump-ipa-pta-details" } */ /* { dg-options "-O2 -fipa-pta -fdump-ipa-pta2-details" } */
int **x; int **x;
......
/* { dg-do run } */ /* { dg-do run } */
/* { dg-options "-O -fipa-pta -fdump-ipa-pta-details" } */ /* { dg-options "-O -fipa-pta -fdump-ipa-pta2-details" } */
static void __attribute__((noinline,noclone)) static void __attribute__((noinline,noclone))
foo (int *p) foo (int *p)
...@@ -21,4 +21,4 @@ int main() ...@@ -21,4 +21,4 @@ int main()
/* Verify we correctly compute the units ESCAPED set as empty but /* Verify we correctly compute the units ESCAPED set as empty but
still properly account for the store via *p in foo. */ still properly account for the store via *p in foo. */
/* { dg-final { scan-ipa-dump "ESCAPED = { }" "pta" } } */ /* { dg-final { scan-ipa-dump "ESCAPED = { }" "pta2" } } */
/* { dg-do compile { target { nonpic } } } */ /* { dg-do compile { target { nonpic } } } */
/* { dg-options "-fipa-pta -fdump-ipa-pta -fno-ipa-icf" } */ /* { dg-options "-fipa-pta -fdump-ipa-pta2 -fno-ipa-icf" } */
/* { dg-skip-if "" { *-*-* } { "-O0" "-fno-fat-lto-objects" } { "" } } */ /* { dg-skip-if "" { *-*-* } { "-O0" "-fno-fat-lto-objects" } { "" } } */
struct X { char x; char y; }; struct X { char x; char y; };
...@@ -42,4 +42,4 @@ void test4 (int a4, char b, char c, char d, char e, char f, char g, char h) ...@@ -42,4 +42,4 @@ void test4 (int a4, char b, char c, char d, char e, char f, char g, char h)
bar (p); bar (p);
} }
/* { dg-final { scan-ipa-dump "bar.arg0 = { test4.arg0 test3.arg0 test2.arg0 test1.arg0 }" "pta" } } */ /* { dg-final { scan-ipa-dump "bar.arg0 = { test4.arg0 test3.arg0 test2.arg0 test1.arg0 }" "pta2" } } */
...@@ -469,7 +469,8 @@ extern gimple_opt_pass *make_pass_vtable_verify (gcc::context *ctxt); ...@@ -469,7 +469,8 @@ extern gimple_opt_pass *make_pass_vtable_verify (gcc::context *ctxt);
extern gimple_opt_pass *make_pass_ubsan (gcc::context *ctxt); extern gimple_opt_pass *make_pass_ubsan (gcc::context *ctxt);
extern gimple_opt_pass *make_pass_sanopt (gcc::context *ctxt); extern gimple_opt_pass *make_pass_sanopt (gcc::context *ctxt);
extern gimple_opt_pass *make_pass_oacc_kernels (gcc::context *ctxt); extern gimple_opt_pass *make_pass_oacc_kernels (gcc::context *ctxt);
extern gimple_opt_pass *make_pass_oacc_kernels2 (gcc::context *ctxt); extern simple_ipa_opt_pass *make_pass_ipa_oacc (gcc::context *ctxt);
extern simple_ipa_opt_pass *make_pass_ipa_oacc_kernels (gcc::context *ctxt);
/* IPA Passes */ /* IPA Passes */
extern simple_ipa_opt_pass *make_pass_ipa_lower_emutls (gcc::context *ctxt); extern simple_ipa_opt_pass *make_pass_ipa_lower_emutls (gcc::context *ctxt);
......
...@@ -36,6 +36,7 @@ along with GCC; see the file COPYING3. If not see ...@@ -36,6 +36,7 @@ along with GCC; see the file COPYING3. If not see
#include "tree-scalar-evolution.h" #include "tree-scalar-evolution.h"
#include "tree-vectorizer.h" #include "tree-vectorizer.h"
#include "omp-low.h" #include "omp-low.h"
#include "diagnostic-core.h"
/* A pass making sure loops are fixed up. */ /* A pass making sure loops are fixed up. */
...@@ -206,12 +207,14 @@ make_pass_oacc_kernels (gcc::context *ctxt) ...@@ -206,12 +207,14 @@ make_pass_oacc_kernels (gcc::context *ctxt)
return new pass_oacc_kernels (ctxt); return new pass_oacc_kernels (ctxt);
} }
/* The ipa oacc superpass. */
namespace { namespace {
const pass_data pass_data_oacc_kernels2 = const pass_data pass_data_ipa_oacc =
{ {
GIMPLE_PASS, /* type */ SIMPLE_IPA_PASS, /* type */
"oacc_kernels2", /* name */ "ipa_oacc", /* name */
OPTGROUP_LOOP, /* optinfo_flags */ OPTGROUP_LOOP, /* optinfo_flags */
TV_TREE_LOOP, /* tv_id */ TV_TREE_LOOP, /* tv_id */
PROP_cfg, /* properties_required */ PROP_cfg, /* properties_required */
...@@ -221,34 +224,65 @@ const pass_data pass_data_oacc_kernels2 = ...@@ -221,34 +224,65 @@ const pass_data pass_data_oacc_kernels2 =
0, /* todo_flags_finish */ 0, /* todo_flags_finish */
}; };
class pass_oacc_kernels2 : public gimple_opt_pass class pass_ipa_oacc : public simple_ipa_opt_pass
{ {
public: public:
pass_oacc_kernels2 (gcc::context *ctxt) pass_ipa_oacc (gcc::context *ctxt)
: gimple_opt_pass (pass_data_oacc_kernels2, ctxt) : simple_ipa_opt_pass (pass_data_ipa_oacc, ctxt)
{} {}
/* opt_pass methods: */ /* opt_pass methods: */
virtual bool gate (function *fn) { return gate_oacc_kernels (fn); } virtual bool gate (function *)
virtual unsigned int execute (function *fn) {
{ return (optimize
/* Rather than having a copy of the previous dump, get some use out of /* Don't bother doing anything if the program has errors. */
this dump, and try to minimize differences with the following pass && !seen_error ()
(pass_lim), which will initizalize the loop optimizer with && flag_openacc
LOOPS_NORMAL. */ && flag_tree_parallelize_loops > 1);
loop_optimizer_init (LOOPS_NORMAL); }
loop_optimizer_finalize (fn);
return 0;
}
}; // class pass_oacc_kernels2 }; // class pass_ipa_oacc
} // anon namespace } // anon namespace
gimple_opt_pass * simple_ipa_opt_pass *
make_pass_oacc_kernels2 (gcc::context *ctxt) make_pass_ipa_oacc (gcc::context *ctxt)
{
return new pass_ipa_oacc (ctxt);
}
/* The ipa oacc kernels pass. */
namespace {
const pass_data pass_data_ipa_oacc_kernels =
{
SIMPLE_IPA_PASS, /* type */
"ipa_oacc_kernels", /* name */
OPTGROUP_LOOP, /* optinfo_flags */
TV_TREE_LOOP, /* tv_id */
PROP_cfg, /* properties_required */
0, /* properties_provided */
0, /* properties_destroyed */
0, /* todo_flags_start */
0, /* todo_flags_finish */
};
class pass_ipa_oacc_kernels : public simple_ipa_opt_pass
{
public:
pass_ipa_oacc_kernels (gcc::context *ctxt)
: simple_ipa_opt_pass (pass_data_ipa_oacc_kernels, ctxt)
{}
}; // class pass_ipa_oacc_kernels
} // anon namespace
simple_ipa_opt_pass *
make_pass_ipa_oacc_kernels (gcc::context *ctxt)
{ {
return new pass_oacc_kernels2 (ctxt); return new pass_ipa_oacc_kernels (ctxt);
} }
/* The no-loop superpass. */ /* The no-loop superpass. */
......
...@@ -7821,6 +7821,8 @@ public: ...@@ -7821,6 +7821,8 @@ public:
&& !seen_error ()); && !seen_error ());
} }
opt_pass * clone () { return new pass_ipa_pta (m_ctxt); }
virtual unsigned int execute (function *) { return ipa_pta_execute (); } virtual unsigned int execute (function *) { return ipa_pta_execute (); }
}; // class pass_ipa_pta }; // class pass_ipa_pta
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment