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

--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Andrew Pinski from comment #3)
> Actually this is more likely the fix:
> ```
> diff --git a/gcc/gimple-fold.cc b/gcc/gimple-fold.cc
> index 4766187e0b9..a68bb9e0be7 100644
> --- a/gcc/gimple-fold.cc
> +++ b/gcc/gimple-fold.cc
> @@ -5907,6 +5907,8 @@ gimple_fold_partial_load_store (gimple_stmt_iterator
> *gsi, gcall *call)
>             }
>           gassign *new_stmt = gimple_build_assign (lhs, else_value);
>           gimple_set_location (new_stmt, gimple_location (call));
> +         if (is_gimple_reg (lhs))
> +           unlink_stmt_vdef (call);
> +         else
> +           gimple_move_vops (new_stmt, call);
>           gsi_replace (gsi, new_stmt, false);
>           return true;
>         }
> ```
> 
> That is if the lhs is a gimple reg, unlike the vdef otherwise move the vops
> to the new stmt.

Actually when this is a load (In reply to Andrew Pinski from comment #3)
> Actually this is more likely the fix:
> ```
> diff --git a/gcc/gimple-fold.cc b/gcc/gimple-fold.cc
> index 4766187e0b9..a68bb9e0be7 100644
> --- a/gcc/gimple-fold.cc
> +++ b/gcc/gimple-fold.cc
> @@ -5907,6 +5907,8 @@ gimple_fold_partial_load_store (gimple_stmt_iterator
> *gsi, gcall *call)
>             }
>           gassign *new_stmt = gimple_build_assign (lhs, else_value);
>           gimple_set_location (new_stmt, gimple_location (call));
> +         if (is_gimple_reg (lhs))
> +           unlink_stmt_vdef (call);
> +         else
> +           gimple_move_vops (new_stmt, call);
>           gsi_replace (gsi, new_stmt, false);
>           return true;
>         }
> ```
> 
> That is if the lhs is a gimple reg, unlike the vdef otherwise move the vops
> to the new stmt.

Actually since MASK_LOAD_LANES is ECF_PURE, there is no vdef if the lhs is a
gimple reg so there is no need to do unlink_stmt_vdef . Which is why it was not
there in the first place. But for arrays (lanes) load and removing it there is
still a store that happens but to the lhs (the array). Which case then we need
to move the vdef.

Reply via email to