aboutsummaryrefslogtreecommitdiff
path: root/gcc/expr.c
diff options
context:
space:
mode:
authorRoger Sayle <roger@eyesopen.com>2006-04-17 16:49:54 +0000
committerRoger Sayle <sayle@gcc.gnu.org>2006-04-17 16:49:54 +0000
commit6cc1d6942627e95cb4afc5de62b1551da1234669 (patch)
treeaaf9abd5466f99930e400bcf277a07d48c765d6a /gcc/expr.c
parent7304fcb4a7177bc0a988241401f11fa91afaa228 (diff)
downloadgcc-6cc1d6942627e95cb4afc5de62b1551da1234669.zip
gcc-6cc1d6942627e95cb4afc5de62b1551da1234669.tar.gz
gcc-6cc1d6942627e95cb4afc5de62b1551da1234669.tar.bz2
expr.c (expand_assignment): Optimize away no-op moves where the source and destination are equal and have...
* expr.c (expand_assignment): Optimize away no-op moves where the source and destination are equal and have no side-effects. From-SVN: r113009
Diffstat (limited to 'gcc/expr.c')
-rw-r--r--gcc/expr.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/gcc/expr.c b/gcc/expr.c
index b0e958c..f59cc42 100644
--- a/gcc/expr.c
+++ b/gcc/expr.c
@@ -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