This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
On 21/10/16 18:16, Richard Biener wrote:
Indeed. maybe_nonzero_address does look at node->nonzero_address () but we still seems to miss TREE_CODE (base) == PARM_DECL and TREE_CODE (base) == RESULT_DECL.On Fri, 21 Oct 2016, kugan wrote:Hi, On 20/10/16 23:15, Jan Hubicka wrote:Hi Richard, On 20/10/16 18:41, Richard Biener wrote:On Thu, 20 Oct 2016, kugan wrote:On 20/10/16 01:26, Jan Hubicka wrote:Would excluding weak symbols (I believe I can check DECL_WEAK for this) good enough. Or looking for acceptable subset would work?I think we should add a symtab helper to tell if address_nonzero_p (if that doesn't aleady exist).We have node->nonzero_address()Thanks for the pointer. Here is an attempt. Does this look OK? + if (TREE_CODE (arg) == ADDR_EXPR) + { + /* See if the AADR_EXPR is nonnull. */ + varpool_node *node = NULL; + tree base = TREE_OPERAND (arg, 0); + base = get_base_address (base); + + if (decl_address_ip_invariant_p (base) + || !is_global_var (base)) + { + /* If the symbol address is local or + constant. */"constant" doesn't matter. You want if (TREE_CODE (base) == CONST_DECL || TREE_CODE (base) == PARM_DECL || TREE_CODE (base) == RESULT_DECL) addr_nonzero = true; else if (VAR_P (base))Better to check decl_in_symtab_p (decl)addr_nonzero = ! is_global_var (base) || (varpool_node::get (base)->nonzero_address ());and symtab_node::get. I wonder if we can't unify the logic with tree_expr_nonzero_warnv_p and corresponding vrp code?Are you saying that we should export tree_expr_nonzero_warnv_p and use here with the logic from above added to tree_expr_nonzero_warnv_p as shown in the attached patch?tree_single_nonzero_warnv_p already handles this correctly via maybe_nonzero_address. And tree_single_nonzero_warnv_p is already exported.
Does the attached patch looks OK if no regressions? Thanks, Kugan
Richard.Thanks, KuganOtherwise the patch looks fine to me. Honza
Attachment:
p3.txt
Description: Text document
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |