2009-04-30 Andreas Krebbel <krebbel1@de.ibm.com>
authorkrebbel <krebbel@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 30 Apr 2009 06:54:54 +0000 (06:54 +0000)
committerkrebbel <krebbel@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 30 Apr 2009 06:54:54 +0000 (06:54 +0000)
* gcse.c (gcse_constant_p): Make sure the constant is sharable.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@146997 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/gcse.c

index c2943a6..f5a4bd8 100644 (file)
@@ -1,3 +1,7 @@
+2009-04-30  Andreas Krebbel  <krebbel1@de.ibm.com>
+
+       * gcse.c (gcse_constant_p): Make sure the constant is sharable.
+
 2009-04-29  James E. Wilson  <wilson@codesourcery.com>
 
        * config/mips/mips.c (mips_add_offset): Use gen_int_mode for
index c7b4b8f..fefdb8f 100644 (file)
@@ -1301,7 +1301,9 @@ gcse_constant_p (const_rtx x)
       && ! FLOAT_MODE_P (GET_MODE (XEXP (x, 1))))
     return true;
 
-  return CONSTANT_P (x);
+  /* Since X might be inserted more than once we have to take care that it
+     is sharable.  */
+  return CONSTANT_P (x) && (GET_CODE (X) != CONST || shared_const_p (x));
 }
 
 /* Scan pattern PAT of INSN and add an entry to the hash TABLE (set or