This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFC] ipa bitwise constant propagation


Hi Prathamesh,

> The attached version passes bootstrap+test on
> x86_64-unknown-linux-gnu, ppc64le-linux-gnu,
> and with c,c++,fortran on armv8l-linux-gnueabihf.
> Cross-tested on arm*-*-* and aarch64*-*-*.
> Verified the patch survives lto-bootstrap on x86_64-unknown-linux-gnu.
> Ok to commit ?
[...]
> testsuite/
> 	* gcc.dg/ipa/propbits-1.c: New test-case.
> 	* gcc.dg/ipa/propbits-2.c: Likewise.
> 	* gcc.dg/ipa/propbits-3.c: Likewise.
[...]
> diff --git a/gcc/testsuite/gcc.dg/ipa/propbits-2.c b/gcc/testsuite/gcc.dg/ipa/propbits-2.c
> new file mode 100644
> index 0000000..3a960f0
> --- /dev/null
> +++ b/gcc/testsuite/gcc.dg/ipa/propbits-2.c
> @@ -0,0 +1,41 @@
> +/* x's mask should be meet(0xc, 0x3) == 0xf  */
> +
> +/* { dg-do compile } */
> +/* { dg-options "-O2 -fno-early-inlining -fdump-ipa-cp" } */
> +
> +extern int pass_test ();
> +extern int fail_test ();
> +
> +__attribute__((noinline))
> +static int f1(int x)
> +{
> +  if ((x & ~0xf) == 0)
> +    return pass_test ();
> +  else
> +    return fail_test ();
> +}
> +
> +__attribute__((noinline))
> +static int f2(int y)
> +{
> +  return f1(y & 0x03);
> +}
> +
> +__attribute__((noinline))
> +static int f3(int z)
> +{
> +  return f1(z & 0xc);
> +}
> +
> +extern int a;
> +extern int b;
> +
> +int main(void)
> +{
> +  int k = f2(a); 
> +  int l = f3(b);
> +  return k + l;
> +}
> +
> +/* { dg-final { scan-ipa-dump "Adjusting mask for param 0 to 0xf" "cp" } } */
> +/* { dg-final { scan-dump-tree-not "fail_test" "optimized" } } */

This testcase thoroughly broke make check-gcc:

At first, runtest errors out with

ERROR: (DejaGnu) proc "scan-dump-tree-not fail_test optimized" does not exist.

The resulting incomplete gcc.sum files confuse dg-extract-results.py

testsuite/gcc6/gcc.sum.sep: no recognised summary line
testsuite/gcc6/gcc.log.sep: no recognised summary line

and cause it to emit en empty gcc.sum, effectively losing all gcc
testresults in mail-report.log.

This cannot have been tested in any reasonable way.

Once you fix the typo (scan-dump-tree-not -> scan-tree-dump-not), at
least we get a complete gcc.sum again, but the testcase still shows up as

UNRESOLVED: gcc.dg/ipa/propbits-2.c scan-tree-dump-not optimized "fail_test"

and gcc.log shows

gcc.dg/ipa/propbits-2.c: dump file does not exist

Adding -fdump-tree-optimized creates the necessary dump and finally lets
the test pass.

Here's the resulting patch.  Unless there are objections, I plan to
commit it soon.

	Rainer


2016-08-26  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

	* gcc.dg/ipa/propbits-2.c: Add -fdump-tree-optimized to dg-options.
	Fix typo.

diff --git a/gcc/testsuite/gcc.dg/ipa/propbits-2.c b/gcc/testsuite/gcc.dg/ipa/propbits-2.c
--- a/gcc/testsuite/gcc.dg/ipa/propbits-2.c
+++ b/gcc/testsuite/gcc.dg/ipa/propbits-2.c
@@ -1,7 +1,7 @@
 /* x's mask should be meet(0xc, 0x3) == 0xf  */
 
 /* { dg-do compile } */
-/* { dg-options "-O2 -fno-early-inlining -fdump-ipa-cp" } */
+/* { dg-options "-O2 -fno-early-inlining -fdump-ipa-cp -fdump-tree-optimized" } */
 
 extern int pass_test ();
 extern int fail_test ();
@@ -38,4 +38,4 @@ int main(void)
 }
 
 /* { dg-final { scan-ipa-dump "Adjusting mask for param 0 to 0xf" "cp" } } */
-/* { dg-final { scan-dump-tree-not "fail_test" "optimized" } } */
+/* { dg-final { scan-tree-dump-not "fail_test" "optimized" } } */
-- 
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]