diff options
author | Jakub Jelinek <jakub@redhat.com> | 2009-10-20 15:29:08 +0200 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2009-10-20 15:29:08 +0200 |
commit | dd8c071d66169f4696a86b1ebe4638a26696bce7 (patch) | |
tree | 41fd57790932a3036655aea364c231276401030b /gcc | |
parent | b0cc341fd953d45f6418b2cbc646706eb3ad3bc5 (diff) | |
download | gcc-dd8c071d66169f4696a86b1ebe4638a26696bce7.zip gcc-dd8c071d66169f4696a86b1ebe4638a26696bce7.tar.gz gcc-dd8c071d66169f4696a86b1ebe4638a26696bce7.tar.bz2 |
re PR debug/41340 (GCC produces different code with and without -g option)
PR debug/41340
* loop-invariant.c (calculate_loop_reg_pressure): Don't count regs
referenced just in DEBUG_INSNs.
* gcc.dg/pr41340.c: New test.
From-SVN: r153011
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/loop-invariant.c | 2 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/pr41340.c | 68 |
4 files changed, 80 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index a631aaa..3e000cd 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2009-10-20 Jakub Jelinek <jakub@redhat.com> + + PR debug/41340 + * loop-invariant.c (calculate_loop_reg_pressure): Don't count regs + referenced just in DEBUG_INSNs. + 2009-10-20 Richard Guenther <rguenther@suse.de> * gimple.c (gimple_types_compatible_p): Simplify. Move diff --git a/gcc/loop-invariant.c b/gcc/loop-invariant.c index 7fb6cf0..8cbfdb3 100644 --- a/gcc/loop-invariant.c +++ b/gcc/loop-invariant.c @@ -1785,7 +1785,7 @@ calculate_loop_reg_pressure (void) FOR_BB_INSNS (bb, insn) { - if (! INSN_P (insn)) + if (! NONDEBUG_INSN_P (insn)) continue; mark_ref_regs (PATTERN (insn)); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 1868e09..7a862af 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2009-10-20 Jakub Jelinek <jakub@redhat.com> + + PR debug/41340 + * gcc.dg/pr41340.c: New test. + 2009-10-20 Eric Botcazou <ebotcazou@adacore.com> * gnat.dg/discr21.ad[sb]: New test. diff --git a/gcc/testsuite/gcc.dg/pr41340.c b/gcc/testsuite/gcc.dg/pr41340.c new file mode 100644 index 0000000..bafa61f --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr41340.c @@ -0,0 +1,68 @@ +/* PR debug/41340 */ +/* { dg-do compile } */ +/* { dg-options "-O3 -g -fcompare-debug" } */ +/* { dg-options "-O3 -g -fcompare-debug -march=i686" { target { { i?86-*-* x86_64-*-* } && ilp32 } } } */ + +typedef struct { int t; } *T; +struct S1 { unsigned s1; }; +struct S2 { struct S1 s2; }; +struct S3 { unsigned s3; struct S2 **s4; }; +struct S5 { struct S2 *s5; }; + +extern void fn0 (void) __attribute__ ((__noreturn__)); +T fn6 (struct S3); +void fn7 (void); + +static inline __attribute__((always_inline)) int +fn1 (const struct S1 *x) +{ + return x->s1; +} + +static inline __attribute__((always_inline)) int +fn2 (const struct S1 *x, unsigned y) +{ + if (y >= x->s1) + fn0 (); + return 0; +} + +static inline __attribute__((always_inline)) int +fn3 (struct S3 x) +{ + return (x.s3 == fn1 (*x.s4 ? &(*x.s4)->s2 : 0)); +} + +static inline __attribute__((always_inline)) int +fn4 (struct S3 x) +{ + return fn2 (&(*x.s4)->s2, x.s3); +} + +int +fn5 (struct S3 x, T *y) +{ + if (!fn3 (x)) + { + *y = (T) (long) fn4 (x); + return 1; + } + return 0; +} + +void +test (struct S5 *x) +{ + struct S3 a; + T b; + unsigned char c = 0; + a.s4 = &x->s5; + while (fn5 (a, &b)) + if (!(b->t & 8)) + c = 1; + a.s4 = &x->s5; + while ((b = fn6 (a))) + ; + if (!c) + fn7 (); +} |