aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-threadedge.c
diff options
context:
space:
mode:
authorJeff Law <law@redhat.com>2014-04-23 12:04:46 -0600
committerJeff Law <law@gcc.gnu.org>2014-04-23 12:04:46 -0600
commit9219922e543dec72f15bc095f8a99d25d2a60d24 (patch)
treef8adaeb72edcd87f9048cb8d2adcbfeeeeeba83f /gcc/tree-ssa-threadedge.c
parent0e4d63c5eef5c0565ac1d42ae1ac43a12c9fd071 (diff)
downloadgcc-9219922e543dec72f15bc095f8a99d25d2a60d24.zip
gcc-9219922e543dec72f15bc095f8a99d25d2a60d24.tar.gz
gcc-9219922e543dec72f15bc095f8a99d25d2a60d24.tar.bz2
re PR tree-optimization/60902 (ffmpeg built with gcc 4.9 RC produces incorrect flac playback code)
PR tree-optimization/60902 * tree-ssa-threadedge.c (record_temporary_equivalences_from_stmts_at_dest): Make sure to invalidate outputs from statements that do not produce useful outputs for threading. PR tree-optimization/60902 * gcc.target/i386/pr60902.c: New test. From-SVN: r209716
Diffstat (limited to 'gcc/tree-ssa-threadedge.c')
-rw-r--r--gcc/tree-ssa-threadedge.c29
1 files changed, 28 insertions, 1 deletions
diff --git a/gcc/tree-ssa-threadedge.c b/gcc/tree-ssa-threadedge.c
index c447b72..8a0103b 100644
--- a/gcc/tree-ssa-threadedge.c
+++ b/gcc/tree-ssa-threadedge.c
@@ -387,7 +387,34 @@ record_temporary_equivalences_from_stmts_at_dest (edge e,
&& (gimple_code (stmt) != GIMPLE_CALL
|| gimple_call_lhs (stmt) == NULL_TREE
|| TREE_CODE (gimple_call_lhs (stmt)) != SSA_NAME))
- continue;
+ {
+ /* STMT might still have DEFS and we need to invalidate any known
+ equivalences for them.
+
+ Consider if STMT is a GIMPLE_ASM with one or more outputs that
+ feeds a conditional inside a loop. We might derive an equivalence
+ due to the conditional. */
+ tree op;
+ ssa_op_iter iter;
+
+ if (backedge_seen)
+ FOR_EACH_SSA_TREE_OPERAND (op, stmt, iter, SSA_OP_ALL_DEFS)
+ {
+ /* This call only invalidates equivalences created by
+ PHI nodes. This is by design to keep the cost of
+ of invalidation reasonable. */
+ invalidate_equivalences (op, stack, src_map, dst_map);
+
+ /* However, conditionals can imply values for real
+ operands as well. And those won't be recorded in the
+ maps. In fact, those equivalences may be recorded totally
+ outside the threading code. We can just create a new
+ temporary NULL equivalence here. */
+ record_temporary_equivalence (op, NULL_TREE, stack);
+ }
+
+ continue;
+ }
/* The result of __builtin_object_size depends on all the arguments
of a phi node. Temporarily using only one edge produces invalid