This one isn't a wrong-code issue, just a missed optimization. The
strlen optimizations need to be made to look through
ADDR_SPACE_CONVERT_EXPR to work on ptx.
Bootstrapped and tested together with the other patches on x86_64-linux.
Ok?
Bernd
commit 35d765aeba4ea7d0ba829b2b502c8c7af0c24728
Author: Bernd Schmidt <ber...@codesourcery.com>
Date: Wed Sep 10 16:34:04 2014 +0200
* tree-ssa-strlen.c (strlen_optimize_stmt): Look through
ADDR_SPACE_CONVERT_EXPR.
diff --git a/gcc/tree-ssa-strlen.c b/gcc/tree-ssa-strlen.c
index bb42cc7..f72ecf5 100644
--- a/gcc/tree-ssa-strlen.c
+++ b/gcc/tree-ssa-strlen.c
@@ -1930,6 +1930,7 @@ strlen_optimize_stmt (gimple_stmt_iterator *gsi)
if (TREE_CODE (lhs) == SSA_NAME && POINTER_TYPE_P (TREE_TYPE (lhs)))
{
if (gimple_assign_single_p (stmt)
+ || gimple_assign_rhs_code (stmt) == ADDR_SPACE_CONVERT_EXPR
|| (gimple_assign_cast_p (stmt)
&& POINTER_TYPE_P (TREE_TYPE (gimple_assign_rhs1 (stmt)))))
{