]> git.ipfire.org Git - thirdparty/gcc.git/commit
slsr: Fix some undefined/overflow introducing bugs in SLSR [PR106883]
authorAndrew Pinski <andrew.pinski@oss.qualcomm.com>
Thu, 15 Jan 2026 00:44:17 +0000 (16:44 -0800)
committerAndrew Pinski <andrew.pinski@oss.qualcomm.com>
Fri, 23 Jan 2026 16:02:16 +0000 (08:02 -0800)
commite5bcb08d132bf753178a2b30962b4a9d3452c4f2
tree125e9d3ba25d3c46eb38d7fe4cad4c196833a3b7
parentc9058b76716aa0cc163c08e7379365c7fdacc57a
slsr: Fix some undefined/overflow introducing bugs in SLSR [PR106883]

This fixes the first part of SLSR incorrectly inserting undefined code (overflow)
into the IR. The easiest way is to rewrite the statement after creating it
using rewrite_to_defined_unconditional.
This fixes the testcases from PR 121347 (and a few others) which all cause an
infinite loops to appear.
I will be posting the fix for replace_rhs_if_not_dup later and at that point I
will add a few testcases.

Bootstrapped and tested on x86_64-linux-gnu with no regressions.

PR tree-optimization/121347
PR tree-optimization/106883
gcc/ChangeLog:

* gimple-ssa-strength-reduction.cc (insert_initializers): Rewrite
newly inserted statements for undefinedness (overflow).

Signed-off-by: Andrew Pinski <andrew.pinski@oss.qualcomm.com>
gcc/gimple-ssa-strength-reduction.cc