diff options
author | Easwaran Raman <eraman@google.com> | 2014-09-05 22:23:26 +0000 |
---|---|---|
committer | Easwaran Raman <eraman@gcc.gnu.org> | 2014-09-05 22:23:26 +0000 |
commit | 14e4c2af4386b531f94a0ccdeb64d6282bc60415 (patch) | |
tree | 402ca864e3336212cecef4013cf31f42d3c49309 | |
parent | 8a03df77b1b29bc1a1609a68d694890a28e089a4 (diff) | |
download | gcc-14e4c2af4386b531f94a0ccdeb64d6282bc60415.zip gcc-14e4c2af4386b531f94a0ccdeb64d6282bc60415.tar.gz gcc-14e4c2af4386b531f94a0ccdeb64d6282bc60415.tar.bz2 |
re PR rtl-optimization/62146 (CSE replaces constant with an expression incorrectly)
2014-09-05 Easwaran Raman <eraman@google.com>
PR rtl-optimization/62146
* ifcvt.c (dead_or_predicable): Make removal of REG_EQUAL note of
hoisted instruction unconditional.
testsuite:
* testsuite/g++.dg/opt/pr62146.C: New.
From-SVN: r214977
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/ifcvt.c | 7 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/opt/pr62146.C | 51 |
4 files changed, 64 insertions, 5 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 18951b3..07988cd 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2014-09-05 Easwaran Raman <eraman@google.com> + + PR rtl-optimization/62146 + * ifcvt.c (dead_or_predicable): Make removal of REG_EQUAL note of + hoisted instruction unconditional. + 2014-09-05 Segher Boessenkool <segher@kernel.crashing.org> PR target/63187 diff --git a/gcc/ifcvt.c b/gcc/ifcvt.c index eee04cc..bce9fb3 100644 --- a/gcc/ifcvt.c +++ b/gcc/ifcvt.c @@ -4403,17 +4403,14 @@ dead_or_predicable (basic_block test_bb, basic_block merge_bb, insn = head; do { - rtx note, set; + rtx note; if (! INSN_P (insn)) continue; note = find_reg_note (insn, REG_EQUAL, NULL_RTX); if (! note) continue; - set = single_set (insn); - if (!set || !function_invariant_p (SET_SRC (set)) - || !function_invariant_p (XEXP (note, 0))) - remove_note (insn, note); + remove_note (insn, note); } while (insn != end && (insn = NEXT_INSN (insn))); /* PR46315: when moving insns above a conditional branch, the REG_EQUAL diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index b6422c9..582f538 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2014-09-05 Easwaran Raman <eraman@google.com> + + PR rtl-optimization/62146 + * testsuite/g++.dg/opt/pr62146.C: New. + 2014-09-05 Marat Zakirov <m.zakirov@samsung.com> * gcc.dg/vect/vect-109.c: Skip predicate added. diff --git a/gcc/testsuite/g++.dg/opt/pr62146.C b/gcc/testsuite/g++.dg/opt/pr62146.C new file mode 100644 index 0000000..dbe4174 --- /dev/null +++ b/gcc/testsuite/g++.dg/opt/pr62146.C @@ -0,0 +1,51 @@ +/* PR rtl-optimization/62146 */ +/* { dg-do compile } */ +/* { dg-options "-O2 " } */ +class F +{ +public: + virtual ~ F (); +}; +template < class CL > class G:public F +{ + int *member_; +public: + G ( int *b): member_ (0) + { + } +}; + +class D +{ +public: + template < class CL > void RegisterNonTagCallback (int, + void (CL:: + *p3) ()) + { + InternalRegisterNonTag (p3 ? new G < CL > ( 0) : 0); + } void InternalRegisterNonTag (F *); +}; + +void fn1 (); +class C1 +{ + void foo(); + class TokenType + { + public: + void AddToken () + { + } + }; + C1::TokenType bar_t; +}; +D a; +void C1::foo() +{ + if (&bar_t) + fn1 (); + for (int i = 0; i < sizeof 0; ++i) + a.RegisterNonTagCallback (0, &TokenType::AddToken); +} + +/* { dg-final { scan-assembler-not "mov.*_ZN2C19TokenType8AddTokenEv, .\\\(" } } */ |