Skip to content

Commit

Permalink
Revert "PR rtl-optimization/111267: Improved forward propagation."
Browse files Browse the repository at this point in the history
This reverts commit 86de9b6.

In ARCv2, it has been noted that this patch reveals a potential
misbehavior in GCC regarding the handling of built-in
multiplication overflow. Reverting this patch serves as a temporary
solution to allow time for a proper fix of the exposed issue.

Issue: foss-for-synopsys-dwc-arc-processors/toolchain#630
  • Loading branch information
luismgsilva committed Jul 9, 2024
1 parent e2ba7f0 commit 23d5406
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 24 deletions.
15 changes: 5 additions & 10 deletions gcc/fwprop.cc
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ namespace

bool changed_mem_p () const { return result_flags & CHANGED_MEM; }
bool folded_to_constants_p () const;
bool likely_profitable_p () const;
bool profitable_p () const;

bool check_mem (int, rtx) final override;
void note_simplification (int, uint16_t, rtx, rtx) final override;
Expand Down Expand Up @@ -323,7 +323,7 @@ fwprop_propagation::folded_to_constants_p () const
false if it would increase the complexity of the pattern too much. */

bool
fwprop_propagation::likely_profitable_p () const
fwprop_propagation::profitable_p () const
{
if (changed_mem_p ())
return true;
Expand Down Expand Up @@ -398,7 +398,7 @@ try_fwprop_subst_note (insn_info *use_insn, set_info *def,
}
else
{
if (!prop.folded_to_constants_p () && !prop.likely_profitable_p ())
if (!prop.folded_to_constants_p () && !prop.profitable_p ())
{
if (dump_file && (dump_flags & TDF_DETAILS))
fprintf (dump_file, "cannot propagate from insn %d into"
Expand Down Expand Up @@ -449,11 +449,7 @@ try_fwprop_subst_pattern (obstack_watermark &attempt, insn_change &use_change,
if (prop.num_replacements == 0)
return false;

if (!prop.likely_profitable_p ()
&& (prop.changed_mem_p ()
|| contains_mem_rtx_p (src)
|| use_insn->is_asm ()
|| !single_set (use_rtl)))
if (!prop.profitable_p ())
{
if (dump_file && (dump_flags & TDF_DETAILS))
fprintf (dump_file, "cannot propagate from insn %d into"
Expand Down Expand Up @@ -485,8 +481,7 @@ try_fwprop_subst_pattern (obstack_watermark &attempt, insn_change &use_change,
redo_changes (0);
auto new_cost = set_src_cost (SET_SRC (use_set),
GET_MODE (SET_DEST (use_set)), speed);
if (new_cost > old_cost
|| (new_cost == old_cost && !prop.likely_profitable_p ()))
if (new_cost > old_cost)
{
if (dump_file)
fprintf (dump_file, "change not profitable"
Expand Down
14 changes: 0 additions & 14 deletions gcc/testsuite/gcc.target/i386/pr111267.c

This file was deleted.

0 comments on commit 23d5406

Please sign in to comment.