aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Law <law@redhat.com>2015-04-15 12:24:28 +0000
committerJeff Law <law@redhat.com>2015-04-15 12:24:28 +0000
commit789cbefcb43d009e91ae79bb9d613c8362a18ac9 (patch)
tree1d0879dbbab7c2c5b15c92110904392c69270b07
parent24e81ca680297ffa6e5e8d86b222bd2e19c1f2ee (diff)
PR rtl-optimization/42522
* cse.c (fold_rtx): Try to simplify a ZERO_EXTRACT or SIGN_EXTRACT as a whole object rather than simplifying its operand. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@222125 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog7
-rw-r--r--gcc/cse.c9
2 files changed, 16 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index f1a96f270b5..a0f2fe7e2b9 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,10 @@
+2015-04-15 Jeff Law <law@redhat.com>
+
+ PR rtl-optimization/42522
+ * cse.c (fold_rtx): Try to simplify a ZERO_EXTRACT or
+ SIGN_EXTRACT as a whole object rather than simplifying
+ its operand.
+
2015-04-15 Jakub Jelinek <jakub@redhat.com>
PR ipa/65765
diff --git a/gcc/cse.c b/gcc/cse.c
index 2a33827a61c..d7638f051f3 100644
--- a/gcc/cse.c
+++ b/gcc/cse.c
@@ -3150,6 +3150,15 @@ fold_rtx (rtx x, rtx_insn *insn)
{
case MEM:
case SUBREG:
+ /* The first operand of a SIGN/ZERO_EXTRACT has a different meaning
+ than it would in other contexts. Basically its mode does not
+ signify the size of the object read. That information is carried
+ by size operand. If we happen to have a MEM of the appropriate
+ mode in our tables with a constant value we could simplify the
+ extraction incorrectly if we allowed substitution of that value
+ for the MEM. */
+ case ZERO_EXTRACT:
+ case SIGN_EXTRACT:
if ((new_rtx = equiv_constant (x)) != NULL_RTX)
return new_rtx;
return x;