summaryrefslogtreecommitdiff
path: root/gcc/tree-tailcall.c
diff options
context:
space:
mode:
authorrsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>2004-09-10 12:00:33 +0000
committerrsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>2004-09-10 12:00:33 +0000
commit9cff5cbd171c9bad42b391fe11f9e9ea6e8f3331 (patch)
tree24cd45cd4c7f9788733ecbef21298e2e39bb35a6 /gcc/tree-tailcall.c
parentc875bbba682becb61d5fd9a4ff6d639da1a594b9 (diff)
downloadgcc-9cff5cbd171c9bad42b391fe11f9e9ea6e8f3331.tar.gz
* tree-tailcall.c (process_assignment): Only do accumulator transforms
for floating-point types if flag_unsafe_math_optimizations. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@87297 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-tailcall.c')
-rw-r--r--gcc/tree-tailcall.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/gcc/tree-tailcall.c b/gcc/tree-tailcall.c
index e3f491e2be1..d6cfe4c49ed 100644
--- a/gcc/tree-tailcall.c
+++ b/gcc/tree-tailcall.c
@@ -282,6 +282,13 @@ process_assignment (tree ass, tree stmt, block_stmt_iterator call, tree *m,
if (TREE_CODE_CLASS (code) != '2')
return false;
+ /* Accumulator optimizations will reverse the order of operations.
+ We can only do that for floating-point types if we're assuming
+ that addition and multiplication are associative. */
+ if (!flag_unsafe_math_optimizations)
+ if (FLOAT_TYPE_P (TREE_TYPE (DECL_RESULT (current_function_decl))))
+ return false;
+
/* We only handle the code like
x = call ();