diff options
Diffstat (limited to 'meta/recipes-devtools/gcc/gcc-4.6.0/gcc-4_6-branch-backports/0168-PR-tree-optimization-48717.patch')
-rw-r--r-- | meta/recipes-devtools/gcc/gcc-4.6.0/gcc-4_6-branch-backports/0168-PR-tree-optimization-48717.patch | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/meta/recipes-devtools/gcc/gcc-4.6.0/gcc-4_6-branch-backports/0168-PR-tree-optimization-48717.patch b/meta/recipes-devtools/gcc/gcc-4.6.0/gcc-4_6-branch-backports/0168-PR-tree-optimization-48717.patch new file mode 100644 index 0000000000..59101ff0ce --- /dev/null +++ b/meta/recipes-devtools/gcc/gcc-4.6.0/gcc-4_6-branch-backports/0168-PR-tree-optimization-48717.patch @@ -0,0 +1,69 @@ +From 8825c738568548e5d67dc2f4e7ce9326dcc2cd7c Mon Sep 17 00:00:00 2001 +From: jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4> +Date: Fri, 22 Apr 2011 18:53:30 +0000 +Subject: [PATCH 168/200] PR tree-optimization/48717 + * tree-ssa-forwprop.c (associate_plusminus): For A + ~A and + ~A + A optimizations use build_int_cst_type instead of build_int_cst. + + * gcc.c-torture/execute/pr48717.c: New test. + + +git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-4_6-branch@172869 138bc75d-0d04-0410-961f-82ee72b054a4 + +index a08d2c4..196a1e1 100644 +new file mode 100644 +index 0000000..a746374 +--- /dev/null ++++ b/gcc/testsuite/gcc.c-torture/execute/pr48717.c +@@ -0,0 +1,26 @@ ++/* PR tree-optimization/48717 */ ++ ++extern void abort (void); ++ ++int v = 1, w; ++ ++unsigned short ++foo (unsigned short x, unsigned short y) ++{ ++ return x + y; ++} ++ ++void ++bar (void) ++{ ++ v = foo (~w, w); ++} ++ ++int ++main () ++{ ++ bar (); ++ if (v != (unsigned short) -1) ++ abort (); ++ return 0; ++} +diff --git a/gcc/tree-ssa-forwprop.c b/gcc/tree-ssa-forwprop.c +index f183159..7900aa4 100644 +--- a/gcc/tree-ssa-forwprop.c ++++ b/gcc/tree-ssa-forwprop.c +@@ -1815,7 +1815,7 @@ associate_plusminus (gimple stmt) + { + /* ~A + A -> -1. */ + code = INTEGER_CST; +- rhs1 = build_int_cst (TREE_TYPE (rhs2), -1); ++ rhs1 = build_int_cst_type (TREE_TYPE (rhs2), -1); + rhs2 = NULL_TREE; + gimple_assign_set_rhs_with_ops (&gsi, code, rhs1, NULL_TREE); + gcc_assert (gsi_stmt (gsi) == stmt); +@@ -1915,7 +1915,7 @@ associate_plusminus (gimple stmt) + { + /* A + ~A -> -1. */ + code = INTEGER_CST; +- rhs1 = build_int_cst (TREE_TYPE (rhs1), -1); ++ rhs1 = build_int_cst_type (TREE_TYPE (rhs1), -1); + rhs2 = NULL_TREE; + gimple_assign_set_rhs_with_ops (&gsi, code, rhs1, NULL_TREE); + gcc_assert (gsi_stmt (gsi) == stmt); +-- +1.7.0.4 + |