public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/100727] New: [12 Regression] Recent change to WITH_SIZE_EXPR handling breaks mn10300-elf
@ 2021-05-23  3:52 law at gcc dot gnu.org
  2021-05-23  3:53 ` [Bug tree-optimization/100727] " law at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: law at gcc dot gnu.org @ 2021-05-23  3:52 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100727

            Bug ID: 100727
           Summary: [12 Regression] Recent change to WITH_SIZE_EXPR
                    handling breaks mn10300-elf
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: law at gcc dot gnu.org
  Target Milestone: ---

This change:
2e6ad1ba532fe684633edac766c598be19ad3b59 is the first bad commit
commit 2e6ad1ba532fe684633edac766c598be19ad3b59
Author: Richard Biener <rguenther@suse.de>
Date:   Wed May 19 10:20:37 2021 +0200

    Enable more WITH_SIZE_EXPR processing

    This enables the alias machinery for WITH_SIZE_EXPR which can appear
    in call LHS and arguments.  In particular this drops the NULL
    return from get_base_address and it adjusts get_ref_base_and_extent
    and friends to use the size information in WITH_SIZE_EXPR and
    look through it for further processing.

    2021-05-19  Richard Biener  <rguenther@suse.de>

            * builtins.c (get_object_alignment_1): Strip outer
            WITH_SIZE_EXPR.
            * tree-dfa.c (get_ref_base_and_extent): Handle outer
            WITH_SIZE_EXPR for size processing and process the
            containing ref.
            * tree-ssa-alias.c (ao_ref_base_alias_set): Strip
            outer WITH_SIZE_EXPR.
            (ao_ref_base_alias_ptr_type): Likewise.
            (refs_may_alias_p_2): Allow WITH_SIZE_EXPR in ref->ref
            and handle that accordingly, stripping it for the
            core alias workers.
            * tree.c (get_base_address): Handle WITH_SIZE_EXPR by
            looking through it instead of returning NULL.

Causes a correctness regression on mn10300-elf for
c-torture/execute/20020412-1.c at -O2.  It appears to me that the assignments
to x and y before the call to foo get erroneously removed.

What's particularly interesting here is the .optimized dumps are the same, but
the .expand dumps differ significantly.  Obviously this points to a problem not
in how this change affects the gimple optimizers, but how it affects the
gimple/tree->RTL translation.

http://3.14.90.209:8080/job/mn10300-elf/

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug tree-optimization/100727] [12 Regression] Recent change to WITH_SIZE_EXPR handling breaks mn10300-elf
  2021-05-23  3:52 [Bug tree-optimization/100727] New: [12 Regression] Recent change to WITH_SIZE_EXPR handling breaks mn10300-elf law at gcc dot gnu.org
@ 2021-05-23  3:53 ` law at gcc dot gnu.org
  2021-05-23  3:56 ` law at gcc dot gnu.org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: law at gcc dot gnu.org @ 2021-05-23  3:53 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100727

Jeffrey A. Law <law at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2021-05-23
           Assignee|unassigned at gcc dot gnu.org      |rguenth at gcc dot gnu.org

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug tree-optimization/100727] [12 Regression] Recent change to WITH_SIZE_EXPR handling breaks mn10300-elf
  2021-05-23  3:52 [Bug tree-optimization/100727] New: [12 Regression] Recent change to WITH_SIZE_EXPR handling breaks mn10300-elf law at gcc dot gnu.org
  2021-05-23  3:53 ` [Bug tree-optimization/100727] " law at gcc dot gnu.org
@ 2021-05-23  3:56 ` law at gcc dot gnu.org
  2021-05-25  7:19 ` rguenth at gcc dot gnu.org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: law at gcc dot gnu.org @ 2021-05-23  3:56 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100727

--- Comment #1 from Jeffrey A. Law <law at gcc dot gnu.org> ---
The v850-elf port is also seeing these failures in some of its multilib
configurations.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug tree-optimization/100727] [12 Regression] Recent change to WITH_SIZE_EXPR handling breaks mn10300-elf
  2021-05-23  3:52 [Bug tree-optimization/100727] New: [12 Regression] Recent change to WITH_SIZE_EXPR handling breaks mn10300-elf law at gcc dot gnu.org
  2021-05-23  3:53 ` [Bug tree-optimization/100727] " law at gcc dot gnu.org
  2021-05-23  3:56 ` law at gcc dot gnu.org
@ 2021-05-25  7:19 ` rguenth at gcc dot gnu.org
  2021-05-25  8:20 ` rguenth at gcc dot gnu.org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-05-25  7:19 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100727

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Version|unknown                     |12.0
             Status|NEW                         |ASSIGNED
   Target Milestone|---                         |12.0

--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
I will have a look.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug tree-optimization/100727] [12 Regression] Recent change to WITH_SIZE_EXPR handling breaks mn10300-elf
  2021-05-23  3:52 [Bug tree-optimization/100727] New: [12 Regression] Recent change to WITH_SIZE_EXPR handling breaks mn10300-elf law at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2021-05-25  7:19 ` rguenth at gcc dot gnu.org
@ 2021-05-25  8:20 ` rguenth at gcc dot gnu.org
  2021-05-25  9:11 ` cvs-commit at gcc dot gnu.org
  2021-05-25  9:13 ` rguenth at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-05-25  8:20 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100727

--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
So it's fixed with

diff --git a/gcc/calls.c b/gcc/calls.c
index f3da1839dc5..74a5070605e 100644
--- a/gcc/calls.c
+++ b/gcc/calls.c
@@ -2397,6 +2397,7 @@ initialize_argument_information (int num_actuals
ATTRIBUTE_UNUSED,
             already in memory, instead of making a copy.  Likewise if we want
             to make the copy in the callee instead of the caller.  */
          if ((call_from_thunk_p || callee_copies)
+             && TREE_CODE (args[i].tree_value) != WITH_SIZE_EXPR
              && (base = get_base_address (args[i].tree_value))
              && TREE_CODE (base) != SSA_NAME
              && (!DECL_P (base) || MEM_P (DECL_RTL (base))))

where the get_base_address change lets WITH_SIZE_EXPR through now but not
before.  The only obvious followon difference is that we then do

              mark_addressable (args[i].tree_value);
...
              args[i].tree_value = build_fold_addr_expr_loc (loc,
                                                         args[i].tree_value);
              type = TREE_TYPE (args[i].tree_value);

unchanged is that we pass the argument by reference and that the target
requests callee_copies.

Now, this is variadic args, so maybe the callee_copies thing doesn't apply
and/or the varargs setup code now is inconsistent - in the end it's an
ABI change.

So given get_base_address only ever returned NULL for WITH_SIZE_EXPR
and clearly the !base check switches between ABIs we have to make the
WITH_SIZE_EXPR check explicit.

I'm also testing the additional (but then not needed)

diff --git a/gcc/gimple-expr.c b/gcc/gimple-expr.c
index b8c732b632a..c3211795d33 100644
--- a/gcc/gimple-expr.c
+++ b/gcc/gimple-expr.c
@@ -900,6 +900,8 @@ flush_mark_addressable_queue ()
 void
 mark_addressable (tree x)
 {
+  if (TREE_CODE (x) == WITH_SIZE_EXPR)
+    x = TREE_OPERAND (x, 0);
   while (handled_component_p (x))
     x = TREE_OPERAND (x, 0);
   if (TREE_CODE (x) == MEM_REF

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug tree-optimization/100727] [12 Regression] Recent change to WITH_SIZE_EXPR handling breaks mn10300-elf
  2021-05-23  3:52 [Bug tree-optimization/100727] New: [12 Regression] Recent change to WITH_SIZE_EXPR handling breaks mn10300-elf law at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2021-05-25  8:20 ` rguenth at gcc dot gnu.org
@ 2021-05-25  9:11 ` cvs-commit at gcc dot gnu.org
  2021-05-25  9:13 ` rguenth at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-05-25  9:11 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100727

--- Comment #4 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Richard Biener <rguenth@gcc.gnu.org>:

https://gcc.gnu.org/g:316bdb2e8970a461f2ae1a7183262d18a72adab3

commit r12-1032-g316bdb2e8970a461f2ae1a7183262d18a72adab3
Author: Richard Biener <rguenther@suse.de>
Date:   Tue May 25 10:21:41 2021 +0200

    middle-end/100727 - fix call expansion with WITH_SIZE_EXPR arg

    call expansion used the result of get_base_address to switch between
    ABIs - with get_base_address now never returning NULL we have to
    re-instantiate the check in a more explicit way.  This also adjusts
    mark_addressable to skip WITH_SIZE_EXPRs, consistent with how
    build_fold_addr_expr handles it.

    2021-05-25  Richard Biener  <rguenther@suse.de>

            PR middle-end/100727
            * calls.c (initialize_argument_information): Explicitely test
            for WITH_SIZE_EXPR.
            * gimple-expr.c (mark_addressable): Skip outer WITH_SIZE_EXPR.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug tree-optimization/100727] [12 Regression] Recent change to WITH_SIZE_EXPR handling breaks mn10300-elf
  2021-05-23  3:52 [Bug tree-optimization/100727] New: [12 Regression] Recent change to WITH_SIZE_EXPR handling breaks mn10300-elf law at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2021-05-25  9:11 ` cvs-commit at gcc dot gnu.org
@ 2021-05-25  9:13 ` rguenth at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-05-25  9:13 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100727

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|ASSIGNED                    |RESOLVED

--- Comment #5 from Richard Biener <rguenth at gcc dot gnu.org> ---
Fixed.

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2021-05-25  9:13 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-23  3:52 [Bug tree-optimization/100727] New: [12 Regression] Recent change to WITH_SIZE_EXPR handling breaks mn10300-elf law at gcc dot gnu.org
2021-05-23  3:53 ` [Bug tree-optimization/100727] " law at gcc dot gnu.org
2021-05-23  3:56 ` law at gcc dot gnu.org
2021-05-25  7:19 ` rguenth at gcc dot gnu.org
2021-05-25  8:20 ` rguenth at gcc dot gnu.org
2021-05-25  9:11 ` cvs-commit at gcc dot gnu.org
2021-05-25  9:13 ` rguenth at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).