+2018-09-28 Richard Biener <rguenther@suse.de>
+
+ * tree.h (BLOCK_ORIGIN): New.
+ * omp-expand.c (grid_expand_target_grid_body): Assign
+ BLOCK_ORIGIN to BLOCK_ABSTRACT_ORIGIN.
+ * tree-inline.c (remap_block): Likewise.
+ * auto-profile.c (get_function_decl_from_block): Simplify
+ by eliding the BLOCK_ABSTRACT_ORIGIN chasing.
+ * langhooks.c (lhd_print_error_function): Likewise.
+ * optinfo-emit-json.cc (optrecord_json_writer::inlining_chain_to):
+ Likewise.
+ * tree-ssa-live.c (remove_unused_scope_block_p): Likewise.
+ * tree.c (block_nonartificial_location): Likewise.
+ (block_ultimate_origin): Likewise.
+ * tree-pretty-print.c (percent_K_format): Likewise. Remove
+ no longer needed LTO case.
+
2018-09-28 Andrew Stubbs <ams@codesourcery.com>
Jan Hubicka <jh@suse.cz>
Martin Jambor <mjambor@suse.cz>
static tree
get_function_decl_from_block (tree block)
{
- tree decl;
-
- if (LOCATION_LOCUS (BLOCK_SOURCE_LOCATION (block)) == UNKNOWN_LOCATION)
+ if (!inlined_function_outer_scope_p (block))
return NULL_TREE;
- for (decl = BLOCK_ABSTRACT_ORIGIN (block);
- decl && (TREE_CODE (decl) == BLOCK);
- decl = BLOCK_ABSTRACT_ORIGIN (decl))
- if (TREE_CODE (decl) == FUNCTION_DECL)
- break;
- return decl;
+ return BLOCK_ABSTRACT_ORIGIN (block);
}
/* Store inline stack for STMT in STACK. */
+2018-09-28 Richard Biener <rguenther@suse.de>
+
+ * error.c (cp_print_error_function): Simplify by eliding
+ the BLOCK_ABSTRACT_ORIGIN chasing.
+
2018-09-27 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/84940
if (abstract_origin)
{
ao = BLOCK_ABSTRACT_ORIGIN (abstract_origin);
- while (TREE_CODE (ao) == BLOCK
- && BLOCK_ABSTRACT_ORIGIN (ao)
- && BLOCK_ABSTRACT_ORIGIN (ao) != ao)
- ao = BLOCK_ABSTRACT_ORIGIN (ao);
gcc_assert (TREE_CODE (ao) == FUNCTION_DECL);
fndecl = ao;
}
&& BLOCK_ABSTRACT_ORIGIN (block))
{
ao = BLOCK_ABSTRACT_ORIGIN (block);
-
- while (TREE_CODE (ao) == BLOCK
- && BLOCK_ABSTRACT_ORIGIN (ao)
- && BLOCK_ABSTRACT_ORIGIN (ao) != ao)
- ao = BLOCK_ABSTRACT_ORIGIN (ao);
-
if (TREE_CODE (ao) == FUNCTION_DECL)
{
fndecl = ao;
if (abstract_origin)
{
ao = BLOCK_ABSTRACT_ORIGIN (abstract_origin);
- while (TREE_CODE (ao) == BLOCK
- && BLOCK_ABSTRACT_ORIGIN (ao)
- && BLOCK_ABSTRACT_ORIGIN (ao) != ao)
- ao = BLOCK_ABSTRACT_ORIGIN (ao);
gcc_assert (TREE_CODE (ao) == FUNCTION_DECL);
fndecl = ao;
}
&& BLOCK_ABSTRACT_ORIGIN (block))
{
ao = BLOCK_ABSTRACT_ORIGIN (block);
-
- while (TREE_CODE (ao) == BLOCK
- && BLOCK_ABSTRACT_ORIGIN (ao)
- && BLOCK_ABSTRACT_ORIGIN (ao) != ao)
- ao = BLOCK_ABSTRACT_ORIGIN (ao);
-
if (TREE_CODE (ao) == FUNCTION_DECL)
{
fndecl = ao;
SET_DECL_ASSEMBLER_NAME (kern_fndecl, DECL_NAME (kern_fndecl));
tree tgtblock = gimple_block (tgt_stmt);
tree fniniblock = make_node (BLOCK);
- BLOCK_ABSTRACT_ORIGIN (fniniblock) = tgtblock;
+ BLOCK_ABSTRACT_ORIGIN (fniniblock) = BLOCK_ORIGIN (tgtblock);
BLOCK_SOURCE_LOCATION (fniniblock) = BLOCK_SOURCE_LOCATION (tgtblock);
BLOCK_SOURCE_END_LOCATION (fniniblock) = BLOCK_SOURCE_END_LOCATION (tgtblock);
BLOCK_SUPERCONTEXT (fniniblock) = kern_fndecl;
&& BLOCK_ABSTRACT_ORIGIN (block))
{
tree ao = BLOCK_ABSTRACT_ORIGIN (block);
-
- while (TREE_CODE (ao) == BLOCK
- && BLOCK_ABSTRACT_ORIGIN (ao)
- && BLOCK_ABSTRACT_ORIGIN (ao) != ao)
- ao = BLOCK_ABSTRACT_ORIGIN (ao);
-
if (TREE_CODE (ao) == FUNCTION_DECL)
{
fndecl = ao;
old_block = *block;
new_block = make_node (BLOCK);
TREE_USED (new_block) = TREE_USED (old_block);
- BLOCK_ABSTRACT_ORIGIN (new_block) = old_block;
+ BLOCK_ABSTRACT_ORIGIN (new_block) = BLOCK_ORIGIN (old_block);
BLOCK_SOURCE_LOCATION (new_block) = BLOCK_SOURCE_LOCATION (old_block);
BLOCK_NONLOCALIZED_VARS (new_block)
= vec_safe_copy (BLOCK_NONLOCALIZED_VARS (old_block));
gcc_assert (pp_ti_abstract_origin (text) != NULL);
*pp_ti_abstract_origin (text) = NULL;
- if (in_lto_p)
- {
- /* ??? LTO drops all BLOCK_ABSTRACT_ORIGINs apart from those
- representing the outermost block of an inlined function.
- So walk the BLOCK tree until we hit such a scope. */
- while (block
- && TREE_CODE (block) == BLOCK)
- {
- if (inlined_function_outer_scope_p (block))
- {
- *pp_ti_abstract_origin (text) = block;
- break;
- }
- block = BLOCK_SUPERCONTEXT (block);
- }
- return;
- }
-
while (block
&& TREE_CODE (block) == BLOCK
&& BLOCK_ABSTRACT_ORIGIN (block))
{
tree ao = BLOCK_ABSTRACT_ORIGIN (block);
-
- while (TREE_CODE (ao) == BLOCK
- && BLOCK_ABSTRACT_ORIGIN (ao)
- && BLOCK_ABSTRACT_ORIGIN (ao) != ao)
- ao = BLOCK_ABSTRACT_ORIGIN (ao);
-
if (TREE_CODE (ao) == FUNCTION_DECL)
{
*pp_ti_abstract_origin (text) = block;
will not be emitted properly. */
if (inlined_function_outer_scope_p (scope))
{
- tree ao = scope;
-
- while (ao
- && TREE_CODE (ao) == BLOCK
- && BLOCK_ABSTRACT_ORIGIN (ao) != ao)
- ao = BLOCK_ABSTRACT_ORIGIN (ao);
+ tree ao = BLOCK_ORIGIN (scope);
if (ao
&& TREE_CODE (ao) == FUNCTION_DECL
&& DECL_DECLARED_INLINE_P (ao)
&& BLOCK_ABSTRACT_ORIGIN (block))
{
tree ao = BLOCK_ABSTRACT_ORIGIN (block);
-
- while (TREE_CODE (ao) == BLOCK
- && BLOCK_ABSTRACT_ORIGIN (ao)
- && BLOCK_ABSTRACT_ORIGIN (ao) != ao)
- ao = BLOCK_ABSTRACT_ORIGIN (ao);
-
if (TREE_CODE (ao) == FUNCTION_DECL)
{
/* If AO is an artificial inline, point RET to the
return NULL_TREE;
else
{
- tree ret_val;
- tree lookahead = immediate_origin;
-
- do
- {
- ret_val = lookahead;
- lookahead = (TREE_CODE (ret_val) == BLOCK
- ? BLOCK_ABSTRACT_ORIGIN (ret_val) : NULL);
- }
- while (lookahead != NULL && lookahead != ret_val);
+ tree ret_val = immediate_origin;
/* The block's abstract origin chain may not be the *ultimate* origin of
the block. It could lead to a DECL that has an abstract origin set.
#define BLOCK_SUPERCONTEXT(NODE) (BLOCK_CHECK (NODE)->block.supercontext)
#define BLOCK_CHAIN(NODE) (BLOCK_CHECK (NODE)->block.chain)
#define BLOCK_ABSTRACT_ORIGIN(NODE) (BLOCK_CHECK (NODE)->block.abstract_origin)
+#define BLOCK_ORIGIN(NODE) \
+ (BLOCK_ABSTRACT_ORIGIN(NODE) ? BLOCK_ABSTRACT_ORIGIN(NODE) : (NODE))
#define BLOCK_ABSTRACT(NODE) (BLOCK_CHECK (NODE)->block.abstract_flag)
#define BLOCK_DIE(NODE) (BLOCK_CHECK (NODE)->block.die)