summaryrefslogtreecommitdiff
path: root/gcc/gimple-fold.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/gimple-fold.c')
-rw-r--r--gcc/gimple-fold.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/gcc/gimple-fold.c b/gcc/gimple-fold.c
index 08e960363b6..19a259e774e 100644
--- a/gcc/gimple-fold.c
+++ b/gcc/gimple-fold.c
@@ -25,9 +25,8 @@ along with GCC; see the file COPYING3. If not see
#include "tree.h"
#include "flags.h"
#include "function.h"
-#include "tree-dump.h"
+#include "dumpfile.h"
#include "tree-flow.h"
-#include "tree-pass.h"
#include "tree-ssa-propagate.h"
#include "target.h"
#include "gimple-fold.h"
@@ -140,7 +139,7 @@ can_refer_decl_in_current_unit_p (tree decl, tree from_decl)
tree
canonicalize_constructor_val (tree cval, tree from_decl)
{
- STRIP_NOPS (cval);
+ STRIP_USELESS_TYPE_CONVERSION (cval);
if (TREE_CODE (cval) == POINTER_PLUS_EXPR
&& TREE_CODE (TREE_OPERAND (cval, 1)) == INTEGER_CST)
{
@@ -170,12 +169,7 @@ canonicalize_constructor_val (tree cval, tree from_decl)
&& !can_refer_decl_in_current_unit_p (base, from_decl))
return NULL_TREE;
if (TREE_CODE (base) == VAR_DECL)
- {
- TREE_ADDRESSABLE (base) = 1;
- if (cfun && gimple_referenced_vars (cfun)
- && !is_global_var (base))
- add_referenced_var (base);
- }
+ TREE_ADDRESSABLE (base) = 1;
else if (TREE_CODE (base) == FUNCTION_DECL)
{
/* Make sure we create a cgraph node for functions we'll reference.
@@ -654,9 +648,6 @@ gimplify_and_update_call_from_tree (gimple_stmt_iterator *si_p, tree expr)
for (i = gsi_start (stmts); !gsi_end_p (i); gsi_next (&i))
{
new_stmt = gsi_stmt (i);
- /* The replacement can expose previously unreferenced variables. */
- if (gimple_in_ssa_p (cfun))
- find_referenced_vars_in (new_stmt);
/* If the new statement possibly has a VUSE, update it with exact SSA
name we know will reach this one. */
if (gimple_has_mem_ops (new_stmt))
@@ -745,6 +736,11 @@ get_maxval_strlen (tree arg, tree *length, bitmap visited, int type)
return true;
}
+ /* If ARG is registered for SSA update we cannot look at its defining
+ statement. */
+ if (name_registered_for_update_p (arg))
+ return false;
+
/* If we were already here, break the infinite cycle. */
if (!bitmap_set_bit (visited, SSA_NAME_VERSION (arg)))
return true;
@@ -2713,6 +2709,10 @@ get_base_constructor (tree base, HOST_WIDE_INT *bit_offset,
if (!DECL_INITIAL (base)
&& (TREE_STATIC (base) || DECL_EXTERNAL (base)))
return error_mark_node;
+ /* Do not return an error_mark_node DECL_INITIAL. LTO uses this
+ as special marker (_not_ zero ...) for its own purposes. */
+ if (DECL_INITIAL (base) == error_mark_node)
+ return NULL_TREE;
return DECL_INITIAL (base);
case ARRAY_REF: