diff options
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/ifcvt.c | 2 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/torture/pr61772.c | 24 |
4 files changed, 37 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index e9f938f..f777188 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2014-07-15 Michael Matz <matz@suse.de> + + PR rtl-optimization/61772 + * ifcvt.c (dead_or_predicable): Check jump to be free of side + effects. + 2014-07-15 Richard Biener <rguenther@suse.de> * opts.c (default_options_table): Disable bit-ccp at -Og. diff --git a/gcc/ifcvt.c b/gcc/ifcvt.c index 8104ae4..faf9b30 100644 --- a/gcc/ifcvt.c +++ b/gcc/ifcvt.c @@ -4138,6 +4138,8 @@ dead_or_predicable (basic_block test_bb, basic_block merge_bb, if (JUMP_P (end)) { + if (!onlyjump_p (end)) + return FALSE; if (head == end) { head = end = NULL_RTX; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 8332a20..bed5539 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2014-07-15 Michael Matz <matz@suse.de> + + PR rtl-optimization/61772 + * gcc.dg/torture/pr61772.c: New test. + 2014-07-15 Marek Polacek <polacek@redhat.com> * gcc.dg/ubsan/bounds-1.c: New test. diff --git a/gcc/testsuite/gcc.dg/torture/pr61772.c b/gcc/testsuite/gcc.dg/torture/pr61772.c new file mode 100644 index 0000000..da4c93e --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr61772.c @@ -0,0 +1,24 @@ +/* { dg-do compile } */ +/* { dg-final { scan-assembler-times "XXX" 2 } } */ + +static inline __attribute__((always_inline)) int dec_and_test (int *i) +{ + asm volatile goto ("XXX %0, %l[cc_label]" + : : "m" (*i) : "memory" : cc_label); + return 0; +cc_label: + return 1; +} +extern int getit (int *); +int f (int *i, int cond) +{ + if (cond) { + getit (0); + if (dec_and_test (i)) + getit (i); + return 42; + } + if (dec_and_test (i)) + (void)1; + return getit (i); +} |