aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Guenther <rguenther@suse.de>2007-07-04 11:44:58 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2007-07-04 11:44:58 +0000
commitb0569227f5167ff69e3d729452f9066c9c15f15a (patch)
treec56451a80746f69f5417de37ab545e4e904fa2a8
parent6162fe83e1bc772487edef25d5a8ecf853cd3457 (diff)
downloadgcc-b0569227f5167ff69e3d729452f9066c9c15f15a.zip
gcc-b0569227f5167ff69e3d729452f9066c9c15f15a.tar.gz
gcc-b0569227f5167ff69e3d729452f9066c9c15f15a.tar.bz2
re PR tree-optimization/32482 (ICE verify_ssa failed)
2007-07-04 Richard Guenther <rguenther@suse.de> PR tree-optimization/32482 * tree-ssa-ifcombine.c (recognize_single_bit_test): Use the original ssa name if we didn't find a shift expression. Fix shift constant for bit zero test. * gcc.c-torture/compile/pr32482.c: New testcase. From-SVN: r126314
-rw-r--r--gcc/ChangeLog7
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/pr32482.c23
-rw-r--r--gcc/tree-ssa-ifcombine.c13
4 files changed, 44 insertions, 4 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index a0768d7..a294920 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,10 @@
+2007-07-04 Richard Guenther <rguenther@suse.de>
+
+ PR tree-optimization/32482
+ * tree-ssa-ifcombine.c (recognize_single_bit_test): Use the
+ original ssa name if we didn't find a shift expression.
+ Fix shift constant for bit zero test.
+
2007-07-04 Richard Sandiford <richard@codesourcery.com>
* config/sh/lib1funcs.asm (ic_invalidate): Align constant pool.
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 0c96acb..a0c0745 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2007-07-04 Richard Guenther <rguenther@suse.de>
+
+ PR tree-optimization/32482
+ * gcc.c-torture/compile/pr32482.c: New testcase.
+
2007-07-04 Richard Sandiford <richard@codesourcery.com>
* gcc.c-torture/execute/ieee/compare-fp-4.x: Add an XFAIL for ARM
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr32482.c b/gcc/testsuite/gcc.c-torture/compile/pr32482.c
new file mode 100644
index 0000000..9f0e3bf
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/pr32482.c
@@ -0,0 +1,23 @@
+typedef struct { unsigned long bits[((((1 << 0))+32 -1)/32)]; } nodemask_t;
+static inline __attribute__((always_inline))
+int bitmap_empty(const unsigned long *src, int nbits)
+{
+ return ! (*src & ( ((nbits) % 32) ? (1UL<<((nbits) % 32))-1 : ~0UL ));
+}
+static inline __attribute__((always_inline))
+int __nodes_empty(const nodemask_t *srcp, int nbits)
+{
+ return bitmap_empty(srcp->bits, nbits);
+}
+extern nodemask_t node_online_map;
+void drain_array(void);
+void drain_cpu_caches(void)
+{
+ int node;
+ if (!__nodes_empty(&(node_online_map), (1 << 0)))
+ for (((node)) = 0; ((node)) < 1; ((node))++)
+ {
+ }
+ if (!__nodes_empty(&(node_online_map), (1 << 0)))
+ drain_array();
+}
diff --git a/gcc/tree-ssa-ifcombine.c b/gcc/tree-ssa-ifcombine.c
index 89fd61d..9403857 100644
--- a/gcc/tree-ssa-ifcombine.c
+++ b/gcc/tree-ssa-ifcombine.c
@@ -167,17 +167,22 @@ recognize_single_bit_test (tree cond_expr, tree *name, tree *bit)
&& integer_onep (TREE_OPERAND (t, 1))
&& TREE_CODE (TREE_OPERAND (t, 0)) == SSA_NAME)
{
- t = TREE_OPERAND (t, 0);
+ tree orig_name = TREE_OPERAND (t, 0);
+
+ /* Look through copies and conversions to eventually
+ find the stmt that computes the shift. */
+ t = orig_name;
do {
t = SSA_NAME_DEF_STMT (t);
if (TREE_CODE (t) != GIMPLE_MODIFY_STMT)
- return false;
+ break;
t = GIMPLE_STMT_OPERAND (t, 1);
if (TREE_CODE (t) == NOP_EXPR
|| TREE_CODE (t) == CONVERT_EXPR)
t = TREE_OPERAND (t, 0);
} while (TREE_CODE (t) == SSA_NAME);
+ /* If we found such, decompose it. */
if (TREE_CODE (t) == RSHIFT_EXPR)
{
/* op0 & (1 << op1) */
@@ -187,8 +192,8 @@ recognize_single_bit_test (tree cond_expr, tree *name, tree *bit)
else
{
/* t & 1 */
- *bit = integer_one_node;
- *name = t;
+ *bit = integer_zero_node;
+ *name = orig_name;
}
return true;