summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--debian/changelog1
-rw-r--r--debian/patches/pr60902.diff102
-rw-r--r--debian/rules.patch1
3 files changed, 104 insertions, 0 deletions
diff --git a/debian/changelog b/debian/changelog
index cc0cc12..a5c71d1 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,6 +1,7 @@
gcc-4.9 (4.9.0-3) UNRELEASED; urgency=medium
* Update build dependencies for ada enabled snapshot builds.
+ * Fix PR tree-optimization/60902, taken from the trunk. Closes: #746944.
-- Matthias Klose <doko@debian.org> Sun, 04 May 2014 16:02:44 +0200
diff --git a/debian/patches/pr60902.diff b/debian/patches/pr60902.diff
new file mode 100644
index 0000000..b47bbcf
--- /dev/null
+++ b/debian/patches/pr60902.diff
@@ -0,0 +1,102 @@
+# DP: Fix PR tree-optimization/60902, taken from the trunk.
+
+gcc/
+
+2014-04-28 Jeff Law <law@redhat.com>
+
+ PR tree-optimization/60902
+ * tree-ssa-threadedge.c
+ (record_temporary_equivalences_from_stmts_at_dest): Only iterate
+ over real defs when invalidating outputs from statements that do not
+ produce useful outputs for threading.
+
+2014-04-23 Jeff Law <law@redhat.com>
+
+ 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.
+
+gcc/testsuite/
+
+2014-04-23 Jeff Law <law@redhat.com>
+
+ PR tree-optimization/60902
+ * gcc.target/i386/pr60902.c: New test.
+
+
+--- a/src/gcc/testsuite/gcc.target/i386/pr60902.c
++++ b/src/gcc/testsuite/gcc.target/i386/pr60902.c
+@@ -0,0 +1,32 @@
++/* { dg-do run } */
++/* { dg-options "-O2" } */
++extern void abort ();
++extern void exit (int);
++
++int x;
++
++foo()
++{
++ static int count;
++ count++;
++ if (count > 1)
++ abort ();
++}
++
++static inline int
++frob ()
++{
++ int a;
++ __asm__ ("mov %1, %0\n\t" : "=r" (a) : "m" (x));
++ x++;
++ return a;
++}
++
++int
++main ()
++{
++ int i;
++ for (i = 0; i < 10 && frob () == 0; i++)
++ foo();
++ exit (0);
++}
+--- a/src/gcc/tree-ssa-threadedge.c
++++ b/src/gcc/tree-ssa-threadedge.c
+@@ -387,8 +387,35 @@
+ && (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_DEF)
++ {
++ /* 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
+ results. For example
diff --git a/debian/rules.patch b/debian/rules.patch
index 071e9ab..2e67b95 100644
--- a/debian/rules.patch
+++ b/debian/rules.patch
@@ -78,6 +78,7 @@ debian_patches += \
libffi-m68k \
libitm-no-fortify-source \
pr59758 \
+ pr60902 \
gdb_depends := $(shell dpkg -s gdb | grep '^Depends:.*libpython3')
ifneq (,$(findstring libpython3,$(gdb_depends)))