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

Mateusz Marciniec <mateuszmar2 at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mateuszmar2 at gmail dot com

--- Comment #5 from Mateusz Marciniec <mateuszmar2 at gmail dot com> ---
Regarding bisect, our attempt directed us to this commit:
https://gcc.gnu.org/cgit/gcc/commit/?id=44510e44e717d9c05b0c5d197a73676a9427e32f

This code was originally introduced here:
https://gcc.gnu.org/cgit/gcc/commit/?id=dc477ffb4aba21e9cf47de22a4df6f2b23849505

There were further improvements done in this area:
https://gcc.gnu.org/cgit/gcc/commit/?id=38ead98b2fe49b1fef4ae7c9771af48be7adaa10

Presented example worked properly only on the first commit there
(dc477ffb4aba21e9cf47de22a4df6f2b23849505).

We tried both revert to "2" argument of "gimple_call_arg()" and case removal:
diff --git a/gcc/tree-ssa-dse.cc b/gcc/tree-ssa-dse.cc
index fce4fc76a56..822a9a39a84 100644
--- a/gcc/tree-ssa-dse.cc
+++ b/gcc/tree-ssa-dse.cc
@@ -185,7 +185,7 @@ initialize_ao_ref_for_dse (gimple *stmt, ao_ref *write,
bool may_def_ok = false)
                ao_ref_init_from_ptr_and_size (
                  write, gimple_call_arg (stmt, 0),
                  TYPE_SIZE_UNIT (
-                   TREE_TYPE (gimple_call_arg (stmt, stored_value_index))));
+                   TREE_TYPE (gimple_call_arg (stmt, 2))));
                return true;
              }
            break;

diff --git a/gcc/tree-ssa-dse.cc b/gcc/tree-ssa-dse.cc
index fce4fc76a56..647d0d89911 100644
--- a/gcc/tree-ssa-dse.cc
+++ b/gcc/tree-ssa-dse.cc
@@ -159,7 +159,6 @@ initialize_ao_ref_for_dse (gimple *stmt, ao_ref *write,
bool may_def_ok = false)
       switch (gimple_call_internal_fn (stmt))
        {
        case IFN_LEN_STORE:
-       case IFN_MASK_STORE:
        case IFN_MASK_LEN_STORE:
          {
            internal_fn ifn = gimple_call_internal_fn (stmt);

Each of these changes fixes the issue.

Reply via email to