diff --git a/gcc/ipa-array-dse.cc b/gcc/ipa-array-dse.cc index df973e849baa55579f43d86fca134762c1006e69..7d8bb9f9afaf0476ca988182ac02c5783c5ca12d 100644 --- a/gcc/ipa-array-dse.cc +++ b/gcc/ipa-array-dse.cc @@ -907,7 +907,7 @@ array_dse_callee::find_candidate_array () for (auto gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi)) { gimple *stmt = gsi_stmt (gsi); - if (gimple_clobber_p (stmt)) + if (gimple_clobber_p (stmt) || is_gimple_debug (stmt)) continue; /* There are 3 kind of stmts may have store ops: GIMPLE_ASSIGN, @@ -2138,7 +2138,8 @@ array_dse_edge::collect_array_accesses () for (auto gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi)) { gimple *stmt = gsi_stmt (gsi); - if (gimple_clobber_p (stmt) || call_stmt_p (stmt)) + if (gimple_clobber_p (stmt) || call_stmt_p (stmt) + || is_gimple_debug (stmt)) continue; for (unsigned i = 0; i < gimple_num_ops (stmt); i++) @@ -2495,7 +2496,8 @@ array_dse_edge::calc_read_bound () continue; auto range = calc_ref_range (var); - if (!integer_cst_p (range.max ())) + if (range.undefined_p() || range.varying_p() + || !integer_cst_p (range.max ())) return false; auto max = tree_to_shwi (range.max ()); @@ -3081,6 +3083,12 @@ ipa_array_dse::apply_array_dse (array_dse_edge *ad_edge) cfun_saver save (caller); + if (dump_file) + { + fprintf (dump_file, "Remove fully redundant call:\n"); + print_gimple_stmt (dump_file, call_stmt, 0); + } + auto gsi = gsi_for_stmt (call_stmt); basic_block call_bb = gimple_bb (call_stmt); tree fndecl = gimple_call_fndecl (call_stmt); @@ -3103,6 +3111,12 @@ ipa_array_dse::apply_array_dse (array_dse_edge *ad_edge) if (!transform_new_callee (callee, new_callee)) return false; + if (dump_file) + { + fprintf (dump_file, "Rewrite partial redundant call:\n"); + print_gimple_stmt (dump_file, ad_edge->call_edge->call_stmt, 0); + } + tree bound_addr = ad_edge->get_bound_addr (); rewrite_call_edge (ad_edge->call_edge, new_callee, bound_addr); diff --git a/gcc/testsuite/gcc.dg/alignment-propagation/alignment-propagation.exp b/gcc/testsuite/gcc.dg/alignment-propagation/alignment-propagation.exp new file mode 100644 index 0000000000000000000000000000000000000000..941849499807504bad02124829dd4b028494845f --- /dev/null +++ b/gcc/testsuite/gcc.dg/alignment-propagation/alignment-propagation.exp @@ -0,0 +1,35 @@ +# Copyright (C) 1997-2023 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GCC; see the file COPYING3. If not see +# . + +load_lib gcc-dg.exp +load_lib torture-options.exp + +# Initialize `dg'. +dg-init +torture-init + +set ALIGNMENT_PROPAGATION_TORTURE_OPTIONS [list \ + { -O3 } \ + { -Ofast } ] + +set-torture-options $ALIGNMENT_PROPAGATION_TORTURE_OPTIONS {{}} + +gcc-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.c]] \ + "" "-fipa-alignment-propagation -fdump-ipa-alignment-propagation-details" + +# All done. +torture-finish +dg-finish diff --git a/gcc/testsuite/gcc.dg/alignment-propagation/alignment_less_than_rhs.c b/gcc/testsuite/gcc.dg/alignment-propagation/alignment_less_than_rhs.c new file mode 100644 index 0000000000000000000000000000000000000000..4695968e2094812277c7ef53fd7713b8b0558edf --- /dev/null +++ b/gcc/testsuite/gcc.dg/alignment-propagation/alignment_less_than_rhs.c @@ -0,0 +1,18 @@ +/* { dg-do compile } */ + +#include + +void __attribute__((__noinline__)) and_alignment_128(void *p) { + if ((unsigned long)p & 127) + abort(); +} + +int main() { + int num[16]; + and_alignment_128(num); + + return 0; +} + +/*--------------------------------------------------------------------------*/ +/* { dg-final { scan-ipa-dump "Rewrite" "alignment-propagation" { xfail *-*-* } } } */ diff --git a/gcc/testsuite/gcc.dg/alignment-propagation/non_aligned_offset.c b/gcc/testsuite/gcc.dg/alignment-propagation/non_aligned_offset.c new file mode 100644 index 0000000000000000000000000000000000000000..f60f4dc18ace145538be3607a98d49ae7a276a44 --- /dev/null +++ b/gcc/testsuite/gcc.dg/alignment-propagation/non_aligned_offset.c @@ -0,0 +1,18 @@ +/* { dg-do compile } */ + +#include + +void __attribute__((__noinline__)) and_alignment_4(void *p) { + if (((unsigned long)p + 3) & 3) + abort(); +} + +int main() { + int num; + and_alignment_4(&num); + + return 0; +} + +/*--------------------------------------------------------------------------*/ +/* { dg-final { scan-ipa-dump "Rewrite" "alignment-propagation" { xfail *-*-* } } } */ diff --git a/gcc/testsuite/gcc.dg/alignment-propagation/not_address_of_local_var.c b/gcc/testsuite/gcc.dg/alignment-propagation/not_address_of_local_var.c new file mode 100644 index 0000000000000000000000000000000000000000..81d490c9291a04950489485506fe5632d2e14510 --- /dev/null +++ b/gcc/testsuite/gcc.dg/alignment-propagation/not_address_of_local_var.c @@ -0,0 +1,18 @@ +/* { dg-do compile } */ + +#include + +void __attribute__((__noinline__)) and_alignment_4(void *p) { + if ((unsigned long)p & 3) + abort(); +} + +int main() { + int *p = NULL; + and_alignment_4(p); + + return 0; +} + +/*--------------------------------------------------------------------------*/ +/* { dg-final { scan-ipa-dump "Rewrite" "alignment-propagation" { xfail *-*-* } } } */ diff --git a/gcc/testsuite/gcc.dg/alignment-propagation/rewrite_aligned_bit_and.c b/gcc/testsuite/gcc.dg/alignment-propagation/rewrite_aligned_bit_and.c new file mode 100644 index 0000000000000000000000000000000000000000..bf381596410afa63ec53601faf23af55ffb8fd39 --- /dev/null +++ b/gcc/testsuite/gcc.dg/alignment-propagation/rewrite_aligned_bit_and.c @@ -0,0 +1,26 @@ +/* { dg-do compile } */ + +#include + +void __attribute__((__noinline__)) and_alignment_4(void *p) { + if ((unsigned long)p & 3) + abort(); +} + +void __attribute__((__noinline__)) and_alignment_8(void *p) { + if ((unsigned long)p & 7) + abort(); +} + +int main() { + int num = 0; + int nums[16] = {0}; + and_alignment_4(&num); + and_alignment_4(nums); + and_alignment_8(nums); + + return 0; +} + +/*--------------------------------------------------------------------------*/ +/* { dg-final { scan-ipa-dump-times "Rewrite" 2 "alignment-propagation" } } */ diff --git a/gcc/testsuite/gcc.dg/array-dse/array-dse.exp b/gcc/testsuite/gcc.dg/array-dse/array-dse.exp new file mode 100644 index 0000000000000000000000000000000000000000..c04d54f000e55a25c8d4a3a2d834094f22e7fa09 --- /dev/null +++ b/gcc/testsuite/gcc.dg/array-dse/array-dse.exp @@ -0,0 +1,35 @@ +# Copyright (C) 1997-2023 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GCC; see the file COPYING3. If not see +# . + +load_lib gcc-dg.exp +load_lib torture-options.exp + +# Initialize `dg'. +dg-init +torture-init + +set ARRAY_DSE_TORTURE_OPTIONS [list \ + { -O3 } \ + { -Ofast } ] + +set-torture-options $ARRAY_DSE_TORTURE_OPTIONS {{}} + +gcc-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.c]] \ + "" "-fipa-array-dse -fdump-ipa-array-dse-details" + +# All done. +torture-finish +dg-finish diff --git a/gcc/testsuite/gcc.dg/array-dse/array-dse_callee_ptr_exceed_range.c b/gcc/testsuite/gcc.dg/array-dse/array-dse_callee_ptr_exceed_range.c new file mode 100644 index 0000000000000000000000000000000000000000..91db9ded743f9d69477caed17cb2912e1bb1aa8d --- /dev/null +++ b/gcc/testsuite/gcc.dg/array-dse/array-dse_callee_ptr_exceed_range.c @@ -0,0 +1,28 @@ +/* { dg-do compile } */ + +#include +#include + +void __attribute__((__noinline__)) test(int* a, unsigned long n) { + for (int* p = a + n; p >= a; p--) { + *p = p - a; + } +} + +int main() { + int num[16]; + int n = 0; + scanf("%d", &n); + if (n) + test(num, n); + + for (unsigned i = 0; i < 8; i++) { + if (num[i] != i) + abort (); + } + + return 0; +} + +/*--------------------------------------------------------------------------*/ +/* { dg-final { scan-ipa-dump "Fail finding array dse candidate callees" "array-dse" } } */ diff --git a/gcc/testsuite/gcc.dg/array-dse/array-dse_fully_redundant.c b/gcc/testsuite/gcc.dg/array-dse/array-dse_fully_redundant.c new file mode 100644 index 0000000000000000000000000000000000000000..c5d2dce58d24a6d2665993ae6a57ea2d5e0b425d --- /dev/null +++ b/gcc/testsuite/gcc.dg/array-dse/array-dse_fully_redundant.c @@ -0,0 +1,28 @@ +/* { dg-do compile } */ + +#include +#include + +void __attribute__((__noinline__)) test(int* a, unsigned long n) { + for (int* p = a + (n - 1); p >= a; p--) { + *p = p - a; + } +} + +int main() { + int num[16]; + int n = 0; + scanf("%d", &n); + if (n) + test(num + 9, n); + + for (unsigned i = 0; i < 8; i++) { + if (num[i] != i) + abort (); + } + + return 0; +} + +/*--------------------------------------------------------------------------*/ +/* { dg-final { scan-ipa-dump "Remove fully redundant call" "array-dse" } } */ diff --git a/gcc/testsuite/gcc.dg/array-dse/array-dse_no_unique_length_param.c b/gcc/testsuite/gcc.dg/array-dse/array-dse_no_unique_length_param.c new file mode 100644 index 0000000000000000000000000000000000000000..cd20d1b52aa305600f45191ed42fc936fc88e16c --- /dev/null +++ b/gcc/testsuite/gcc.dg/array-dse/array-dse_no_unique_length_param.c @@ -0,0 +1,33 @@ +/* { dg-do compile } */ + +#include +#include + +void __attribute__((__noinline__)) test(int* a, unsigned long n) { + for (int* p = a + (n - 1); p >= a; p--) { + *p = p - a; + } + + int n1; + for (int* p = a + (n1 - 1); p >= a; p--) { + *p = p - a; + } +} + +int main() { + int num[16]; + int n = 0; + scanf("%d", &n); + if (n) + test(num, n); + + for (unsigned i = 0; i < 8; i++) { + if (num[i] != i) + abort (); + } + + return 0; +} + +/*--------------------------------------------------------------------------*/ +/* { dg-final { scan-ipa-dump "Fail finding array dse candidate callees" "array-dse" } } */ diff --git a/gcc/testsuite/gcc.dg/array-dse/array-dse_non_local_array_in_caller.c b/gcc/testsuite/gcc.dg/array-dse/array-dse_non_local_array_in_caller.c new file mode 100644 index 0000000000000000000000000000000000000000..99af6299c7ec2942369063dc36bfa6d0df758871 --- /dev/null +++ b/gcc/testsuite/gcc.dg/array-dse/array-dse_non_local_array_in_caller.c @@ -0,0 +1,29 @@ +/* { dg-do compile } */ + +#include +#include + +void __attribute__((__noinline__)) test(int* a, unsigned long n) { + for (int* p = a + (n - 1); p >= a; p--) { + *p = p - a; + } +} + +int num[16]; + +int main() { + int n = 0; + scanf("%d", &n); + if (n) + test(num, n); + + for (unsigned i = 0; i < 8; i++) { + if (num[i] != i) + abort (); + } + + return 0; +} + +/*--------------------------------------------------------------------------*/ +/* { dg-final { scan-ipa-dump "Fail finding array dse candidate edges" "array-dse" } } */ diff --git a/gcc/testsuite/gcc.dg/array-dse/array-dse_non_unique_written_base.c b/gcc/testsuite/gcc.dg/array-dse/array-dse_non_unique_written_base.c new file mode 100644 index 0000000000000000000000000000000000000000..8011371d901476686fbba546d949954e0a99141b --- /dev/null +++ b/gcc/testsuite/gcc.dg/array-dse/array-dse_non_unique_written_base.c @@ -0,0 +1,31 @@ +/* { dg-do compile } */ + +#include +#include + +void __attribute__((__noinline__)) test(int* a, unsigned long n) { + int *a1; + *a1 = 0; + + for (int* p = a + (n - 1); p >= a; p--) { + *p = p - a; + } +} + +int main() { + int num[16]; + int n = 0; + scanf("%d", &n); + if (n) + test(num, n); + + for (unsigned i = 0; i < 8; i++) { + if (num[i] != i) + abort (); + } + + return 0; +} + +/*--------------------------------------------------------------------------*/ +/* { dg-final { scan-ipa-dump "Fail finding array dse candidate callees" "array-dse" } } */ diff --git a/gcc/testsuite/gcc.dg/array-dse/array-dse_partial_redundant.c b/gcc/testsuite/gcc.dg/array-dse/array-dse_partial_redundant.c new file mode 100644 index 0000000000000000000000000000000000000000..7eb4af33c40d7709a9ffbf0fcc7acd38ccfdd5a0 --- /dev/null +++ b/gcc/testsuite/gcc.dg/array-dse/array-dse_partial_redundant.c @@ -0,0 +1,28 @@ +/* { dg-do compile } */ + +#include +#include + +void __attribute__((__noinline__)) test(int* a, unsigned long n) { + for (int* p = a + (n - 1); p >= a; p--) { + *p = p - a; + } +} + +int main() { + int num[16]; + int n = 0; + scanf("%d", &n); + if (n) + test(num, n); + + for (unsigned i = 0; i < 8; i++) { + if (num[i] != i) + abort (); + } + + return 0; +} + +/*--------------------------------------------------------------------------*/ +/* { dg-final { scan-ipa-dump "Rewrite partial redundant call" "array-dse" } } */ diff --git a/gcc/testsuite/gcc.dg/array-dse/array-dse_read_bound_non_const.c b/gcc/testsuite/gcc.dg/array-dse/array-dse_read_bound_non_const.c new file mode 100644 index 0000000000000000000000000000000000000000..79cf118e962ba466bb7a7cdab2e04642ef404e11 --- /dev/null +++ b/gcc/testsuite/gcc.dg/array-dse/array-dse_read_bound_non_const.c @@ -0,0 +1,27 @@ +/* { dg-do compile } */ + +#include +#include + +void __attribute__((__noinline__)) test(int* a, unsigned long n) { + for (int* p = a + (n - 1); p >= a; p--) { + *p = p - a; + } +} + +int main() { + int num[16]; + int n = 0; + scanf("%d", &n); + if (n) + test(num, n); + + int n1; + if (num[n1]) + abort(); + + return 0; +} + +/*--------------------------------------------------------------------------*/ +/* { dg-final { scan-ipa-dump "Fail finding array dse candidate edges" "array-dse" } } */ diff --git a/gcc/testsuite/gcc.dg/localize-array/bad-dominance.c b/gcc/testsuite/gcc.dg/localize-array/bad-dominance.c new file mode 100644 index 0000000000000000000000000000000000000000..7f9ec730b4ca5fe8eacca59fa3fd76acac4f201d --- /dev/null +++ b/gcc/testsuite/gcc.dg/localize-array/bad-dominance.c @@ -0,0 +1,33 @@ +/* { dg-do compile } */ + +#include +#include + +static int* p; + +void __attribute__((noinline)) test() { + for (unsigned i = 0; i < 10; i++) { + p[i] = i; + } +} + +/* Set -O0 so that the ssa define by calloc and used by free + are not the same one. */ +#pragma GCC push_options +#pragma GCC optimize("O0") +int main() { + int n; + scanf("%d", &n); + + p = calloc(10, sizeof(int)); + for (unsigned i = 0; i < n; i++) { + test(); + } + free(p); + + return 0; +} +#pragma GCC pop_options + +/*--------------------------------------------------------------------------*/ +/* { dg-final { scan-ipa-dump "Localize global array: p" "localize-array" { xfail *-*-* } } } */ diff --git a/gcc/testsuite/gcc.dg/localize-array/escape-by-taking-address.c b/gcc/testsuite/gcc.dg/localize-array/escape-by-taking-address.c new file mode 100644 index 0000000000000000000000000000000000000000..17756c74d901dd320431754fde82bdf2fef25e1c --- /dev/null +++ b/gcc/testsuite/gcc.dg/localize-array/escape-by-taking-address.c @@ -0,0 +1,27 @@ +/* { dg-do compile } */ + +#include +#include + +static int* p; +int** a; + +void __attribute__((noinline)) test() { + a = &p; +} + +/* Set -O0 so that the ssa define by calloc and used by free + are not the same one. */ +#pragma GCC push_options +#pragma GCC optimize("O0") +int main() { + p = calloc(10, sizeof(int)); + test(); + int ret = **a; + free(p); + return ret; +} +#pragma GCC pop_options + +/*--------------------------------------------------------------------------*/ +/* { dg-final { scan-ipa-dump "Localize global array" "localize-array" { xfail *-*-* } } } */ diff --git a/gcc/testsuite/gcc.dg/localize-array/localize-array-with-multiple-elem.c b/gcc/testsuite/gcc.dg/localize-array/localize-array-with-multiple-elem.c new file mode 100644 index 0000000000000000000000000000000000000000..6917fd45123c9542b06353202ad9baf897334753 --- /dev/null +++ b/gcc/testsuite/gcc.dg/localize-array/localize-array-with-multiple-elem.c @@ -0,0 +1,28 @@ +/* { dg-do compile } */ + +#include +#include + +static int* p; + +void __attribute__((noinline)) test() { + for (unsigned i = 0; i < 10; i++) { + p[i] = i; + } +} + +/* Set -O0 so that the ssa define by calloc and used by free + are not the same one. */ +#pragma GCC push_options +#pragma GCC optimize("O0") +int main() { + p = calloc(10, sizeof(int)); + test(); + free(p); + return 0; +} +#pragma GCC pop_options + +/*--------------------------------------------------------------------------*/ +/* { dg-final { scan-ipa-dump "Localize global array: p" "localize-array" } } */ +/* { dg-final { scan-ipa-dump "Insert calloc statement" "localize-array" } } */ diff --git a/gcc/testsuite/gcc.dg/localize-array/localize-array-with-single-elem.c b/gcc/testsuite/gcc.dg/localize-array/localize-array-with-single-elem.c new file mode 100644 index 0000000000000000000000000000000000000000..b79c12d24378fdb4a733684a28cc900171c7746f --- /dev/null +++ b/gcc/testsuite/gcc.dg/localize-array/localize-array-with-single-elem.c @@ -0,0 +1,26 @@ +/* { dg-do compile } */ + +#include +#include + +static int* p; + +void __attribute__((noinline)) test() { + p[0] = 0; +} + +/* Set -O0 so that the ssa define by calloc and used by free + are not the same one. */ +#pragma GCC push_options +#pragma GCC optimize("O0") +int main() { + p = calloc(1, sizeof(int)); + test(); + free(p); + return 0; +} +#pragma GCC pop_options + +/*--------------------------------------------------------------------------*/ +/* { dg-final { scan-ipa-dump "Localize global array: p" "localize-array" } } */ +/* { dg-final { scan-ipa-dump "Insert calloc statement" "localize-array" { xfail *-*-* } } } */ diff --git a/gcc/testsuite/gcc.dg/localize-array/localize-array.exp b/gcc/testsuite/gcc.dg/localize-array/localize-array.exp new file mode 100644 index 0000000000000000000000000000000000000000..0bf6cc2cdbe0588be9451a4e6512a650a8eecc66 --- /dev/null +++ b/gcc/testsuite/gcc.dg/localize-array/localize-array.exp @@ -0,0 +1,35 @@ +# Copyright (C) 1997-2023 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GCC; see the file COPYING3. If not see +# . + +load_lib gcc-dg.exp +load_lib torture-options.exp + +# Initialize `dg'. +dg-init +torture-init + +set ALIGNMENT_PROPAGATION_TORTURE_OPTIONS [list \ + { -O3 } \ + { -Ofast } ] + +set-torture-options $ALIGNMENT_PROPAGATION_TORTURE_OPTIONS {{}} + +gcc-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.c]] \ + "" "-fipa-localize-array -fdump-ipa-localize-array-details -fwhole-program" + +# All done. +torture-finish +dg-finish diff --git a/gcc/testsuite/gcc.dg/localize-array/not-allocated-by-calloc.c b/gcc/testsuite/gcc.dg/localize-array/not-allocated-by-calloc.c new file mode 100644 index 0000000000000000000000000000000000000000..e519a62d826d8b3010b4fbc843760ad460bd210d --- /dev/null +++ b/gcc/testsuite/gcc.dg/localize-array/not-allocated-by-calloc.c @@ -0,0 +1,27 @@ +/* { dg-do compile } */ + +#include +#include + +static int* p; + +void __attribute__((noinline)) test() { + for (unsigned i = 0; i < 10; i++) { + p[i] = i; + } +} + +/* Set -O0 so that the ssa define by calloc and used by free + are not the same one. */ +#pragma GCC push_options +#pragma GCC optimize("O0") +int main() { + p = malloc(10 * sizeof(int)); + test(); + free(p); + return 0; +} +#pragma GCC pop_options + +/*--------------------------------------------------------------------------*/ +/* { dg-final { scan-ipa-dump "Localize global array" "localize-array" { xfail *-*-* } } } */ diff --git a/gcc/testsuite/gcc.dg/localize-array/used-by-multiple-functions.c b/gcc/testsuite/gcc.dg/localize-array/used-by-multiple-functions.c new file mode 100644 index 0000000000000000000000000000000000000000..1ac7969b64ca089d61c904d0d9f92089ab30e709 --- /dev/null +++ b/gcc/testsuite/gcc.dg/localize-array/used-by-multiple-functions.c @@ -0,0 +1,34 @@ +/* { dg-do compile } */ + +#include +#include + +static int* p; + +void __attribute__((noinline)) test() { + for (unsigned i = 0; i < 10; i++) { + p[i] = i; + } +} + +void __attribute__((noinline)) test2() { + for (unsigned i = 0; i < 10; i++) { + p[i] = i; + } +} + +/* Set -O0 so that the ssa define by calloc and used by free + are not the same one. */ +#pragma GCC push_options +#pragma GCC optimize("O0") +int main() { + p = calloc(10, sizeof(int)); + test(); + test2(); + free(p); + return 0; +} +#pragma GCC pop_options + +/*--------------------------------------------------------------------------*/ +/* { dg-final { scan-ipa-dump "Localize global array: p" "localize-array" { xfail *-*-* } } } */