summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2008-02-11 08:27:00 +0000
committerrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2008-02-11 08:27:00 +0000
commit3de988b56cf43973a8fb6f97b7b983d690323b87 (patch)
treeedef1ecdf13bbb8fb78a6e4be799ab1a487a80db
parentac835c6e54351eccb262c2fc56a7592a1f5a11ee (diff)
downloadgcc-3de988b56cf43973a8fb6f97b7b983d690323b87.tar.gz
2008-02-11 Uros Bizjak <ubizjak@gmail.com>
Richard Guenther <rguenther@suse.de> PR tree-optimization/33992 * tree-ssa-loop-im.c (rewrite_bittest): Fixup the type of the zero we compare against. * gcc.c-torture/execute/pr33992.c: New testcase. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@132234 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog7
-rw-r--r--gcc/testsuite/ChangeLog6
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/pr33992.c38
-rw-r--r--gcc/tree-ssa-loop-im.c5
4 files changed, 56 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index c41e364cfe7..a5fa886892e 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,10 @@
+2008-02-11 Uros Bizjak <ubizjak@gmail.com>
+ Richard Guenther <rguenther@suse.de>
+
+ PR tree-optimization/33992
+ * tree-ssa-loop-im.c (rewrite_bittest): Fixup the type of
+ the zero we compare against.
+
2008-02-09 John David Anglin <dave.anglin@nrc-cnrc.gc.ca>
PR middle_end/34150
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 505fa85b154..6919390d8dd 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,9 @@
+2008-02-11 Uros Bizjak <ubizjak@gmail.com>
+ Richard Guenther <rguenther@suse.de>
+
+ PR tree-optimization/33992
+ * gcc.c-torture/execute/pr33992.c: New testcase.
+
2008-02-10 Thomas Koenig <tkoenig@gcc.gnu.org>
* gfortran.dg/streamio_14.f90: New test.
diff --git a/gcc/testsuite/gcc.c-torture/execute/pr33992.c b/gcc/testsuite/gcc.c-torture/execute/pr33992.c
new file mode 100644
index 00000000000..c574596bbd6
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/execute/pr33992.c
@@ -0,0 +1,38 @@
+extern void abort ();
+
+void __attribute__((noinline))
+bar (unsigned long long i)
+{
+ if (i)
+ abort ();
+}
+
+void __attribute__((always_inline))
+foo (unsigned long long *r)
+
+{
+ int i;
+
+ for (i = 0; ; i++)
+ if (*r & ((unsigned long long)1 << (63 - i)))
+ break;
+
+ bar (i);
+}
+
+void __attribute__((noinline))
+do_test (unsigned long long *r)
+{
+ int i;
+
+ for (i = 0; i < 2; ++i)
+ foo (r);
+}
+
+int main()
+{
+ unsigned long long r = 0x8000000000000001ull;
+
+ do_test (&r);
+ return 0;
+}
diff --git a/gcc/tree-ssa-loop-im.c b/gcc/tree-ssa-loop-im.c
index 262ad972da8..cad14452a16 100644
--- a/gcc/tree-ssa-loop-im.c
+++ b/gcc/tree-ssa-loop-im.c
@@ -685,7 +685,12 @@ rewrite_bittest (block_stmt_iterator *bsi)
stmt2 = build_gimple_modify_stmt (var, t);
name = make_ssa_name (var, stmt2);
GIMPLE_STMT_OPERAND (stmt2, 0) = name;
+
+ /* Replace the SSA_NAME we compare against zero. Adjust
+ the type of zero accordingly. */
SET_USE (use, name);
+ TREE_OPERAND (COND_EXPR_COND (use_stmt), 1)
+ = build_int_cst_type (TREE_TYPE (name), 0);
bsi_insert_before (bsi, stmt1, BSI_SAME_STMT);
bsi_replace (bsi, stmt2, true);