OSDN Git Service

* expr.c (expand_assignment): Optimize away no-op moves where the
authorsayle <sayle@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 17 Apr 2006 16:49:54 +0000 (16:49 +0000)
committersayle <sayle@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 17 Apr 2006 16:49:54 +0000 (16:49 +0000)
source and destination are equal and have no side-effects.

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

gcc/ChangeLog
gcc/expr.c

index af150ff..6595ef5 100644 (file)
@@ -1,3 +1,8 @@
+2006-04-17  Roger Sayle  <roger@eyesopen.com>
+
+       * expr.c (expand_assignment): Optimize away no-op moves where the
+       source and destination are equal and have no side-effects.
+
 2006-04-17  Richard Guenther  <rguenther@suse.de>
 
        PR target/26826
index b0e958c..f59cc42 100644 (file)
@@ -3988,13 +3988,16 @@ expand_assignment (tree to, tree from)
   rtx result;
 
   /* Don't crash if the lhs of the assignment was erroneous.  */
-
   if (TREE_CODE (to) == ERROR_MARK)
     {
       result = expand_normal (from);
       return;
     }
 
+  /* Optimize away no-op moves without side-effects.  */
+  if (operand_equal_p (to, from, 0))
+    return;
+
   /* Assignment of a structure component needs special treatment
      if the structure component's rtx is not simply a MEM.
      Assignment of an array element at a constant index, and assignment of