From: Sergey Ostanevich Date: Mon, 7 Nov 2011 08:41:55 +0000 (+0000) Subject: re PR rtl-optimization/47698 (CMOV accessing volatile memory with read side effect) X-Git-Tag: releases/gcc-4.7.0~2418 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=b3242a4c75342dc2a5260fd452b9ea5c9d604296;p=thirdparty%2Fgcc.git re PR rtl-optimization/47698 (CMOV accessing volatile memory with read side effect) gcc/ PR rtl-optimization/47698 * ifconv.c (noce_operand_ok): prevent CMOV generation for volatile mem. gcc/testsuite/ PR rtl-optimization/47698 * gcc.target/i386/47698.c: New test. From-SVN: r181075 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index f8f33d90a821..95809a3a0293 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2011-11-07 Sergey Ostanevich + + PR rtl-optimization/47698 + * ifconv.c (noce_operand_ok): prevent CMOV generation + for volatile mem. + 2011-11-07 Tristan Gingold * common/config/alpha/alpha-common.c (alpha_option_init_struct): diff --git a/gcc/ifcvt.c b/gcc/ifcvt.c index 784e2e8b106b..3b05c2a8ad87 100644 --- a/gcc/ifcvt.c +++ b/gcc/ifcvt.c @@ -2329,12 +2329,12 @@ noce_operand_ok (const_rtx op) { /* We special-case memories, so handle any of them with no address side effects. */ - if (MEM_P (op)) - return ! side_effects_p (XEXP (op, 0)); - if (side_effects_p (op)) return FALSE; + if (MEM_P (op)) + return ! side_effects_p (XEXP (op, 0)); + return ! may_trap_p (op); } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 1f9aa8103030..7e7209c1d63e 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ + +2011-11-07 Sergey Ostanevich + + PR rtl-optimization/47698 + * gcc.target/i386/47698.c: New test. + 2011-11-06 Jason Merrill PR c++/35688 diff --git a/gcc/testsuite/gcc.target/i386/47698.c b/gcc/testsuite/gcc.target/i386/47698.c new file mode 100644 index 000000000000..2c751093ae37 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/47698.c @@ -0,0 +1,10 @@ +/* { dg-options "-Os" } */ +/* { dg-final { scan-assembler-not "cmov" } } */ + +extern volatile unsigned long mmio; +unsigned long foo(int cond) +{ + if (cond) + return mmio; + return 0; +}