From: Richard Biener Date: Mon, 1 Oct 2018 07:48:51 +0000 (+0000) Subject: tree-inline.c (expand_call_inline): Store origin of fn in BLOCK_ABSTRACT_ORIGIN for... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=796a2bb27466db5a151c06707b348cb2a705c514;p=gcc.git tree-inline.c (expand_call_inline): Store origin of fn in BLOCK_ABSTRACT_ORIGIN for the inline BLOCK. 2018-10-01 Richard Biener * tree-inline.c (expand_call_inline): Store origin of fn in BLOCK_ABSTRACT_ORIGIN for the inline BLOCK. * tree.c (block_ultimate_origin): Simplify and do some checking. From-SVN: r264734 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 54f3e9bc997..7783d0994e2 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2018-10-01 Richard Biener + + * tree-inline.c (expand_call_inline): Store origin of fn + in BLOCK_ABSTRACT_ORIGIN for the inline BLOCK. + * tree.c (block_ultimate_origin): Simplify and do some + checking. + 2018-09-30 Uros Bizjak * config/i386/mmx.md (EMMS): New int iterator. diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c index 2eac7b7cc4a..6b5ef36f6d2 100644 --- a/gcc/tree-inline.c +++ b/gcc/tree-inline.c @@ -4535,7 +4535,7 @@ expand_call_inline (basic_block bb, gimple *stmt, copy_body_data *id) if (loc == UNKNOWN_LOCATION) loc = BUILTINS_LOCATION; id->block = make_node (BLOCK); - BLOCK_ABSTRACT_ORIGIN (id->block) = fn; + BLOCK_ABSTRACT_ORIGIN (id->block) = DECL_ORIGIN (fn); BLOCK_SOURCE_LOCATION (id->block) = loc; prepend_lexical_block (gimple_block (stmt), id->block); } diff --git a/gcc/tree.c b/gcc/tree.c index 2bd209b5648..d52f8777392 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -12124,38 +12124,26 @@ prepare_target_option_nodes_for_pch (void) TREE_TARGET_GLOBALS (*iter) = NULL; } -/* Determine the "ultimate origin" of a block. The block may be an inlined - instance of an inlined instance of a block which is local to an inline - function, so we have to trace all of the way back through the origin chain - to find out what sort of node actually served as the original seed for the - given block. */ +/* Determine the "ultimate origin" of a block. */ tree block_ultimate_origin (const_tree block) { - tree immediate_origin = BLOCK_ABSTRACT_ORIGIN (block); + tree origin = BLOCK_ABSTRACT_ORIGIN (block); /* BLOCK_ABSTRACT_ORIGIN can point to itself; ignore that if we're trying to output the abstract instance of this function. */ - if (BLOCK_ABSTRACT (block) && immediate_origin == block) + if (BLOCK_ABSTRACT (block) && origin == block) return NULL_TREE; - if (immediate_origin == NULL_TREE) + if (origin == NULL_TREE) return NULL_TREE; else { - 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. - If so, we want that DECL's abstract origin (which is what DECL_ORIGIN - will give us if it has one). Note that DECL's abstract origins are - supposed to be the most distant ancestor (or so decl_ultimate_origin - claims), so we don't need to loop following the DECL origins. */ - if (DECL_P (ret_val)) - return DECL_ORIGIN (ret_val); - - return ret_val; + gcc_checking_assert ((DECL_P (origin) + && DECL_ORIGIN (origin) == origin) + || BLOCK_ORIGIN (origin) == origin); + return origin; } }