[Bug target/122270] riscv: during GIMPLE pass: internal compiler error: in gsi_replace, at gimple-iterator.cc:438
cvs-commit at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Mon Nov 3 20:25:12 GMT 2025
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122270
--- Comment #13 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-15 branch has been updated by Jeff Law <law@gcc.gnu.org>:
https://gcc.gnu.org/g:f70ea624d1435027da9bb54d42f53caff68d97e2
commit r15-10478-gf70ea624d1435027da9bb54d42f53caff68d97e2
Author: Andrew Pinski <andrew.pinski@oss.qualcomm.com>
Date: Wed Oct 15 09:59:25 2025 -0700
riscv: Fix gimple folding of the vset* intrinsics [PR122270]
The problem here is that when the backend folds the vset intrinsics,
it tries to keep the lhs of the new statement to be the same as the old
statement
due to the check in gsi_replace. The problem is with a MEM_REF vset::fold
was
unsharing the new lhs here and using the original lhs in the other new
statement.
This meant the check in gsi_replace would fail.
This fixes that oversight by switching around which statement gets the
unshared
version.
Note the comment in vset::fold was already correct just not matching the
code:
/* Replace the call with two statements: a copy of the full tuple
to the call result, followed by an update of the individual vector.
The fold routines expect the replacement statement to have the
same lhs as the original call, so return the copy statement
rather than the field update. */
Changes since v1:
* v2: Fix testcase.
PR target/122270
gcc/ChangeLog:
* config/riscv/riscv-vector-builtins-bases.cc (vset::fold): Use the
unshare_expr for the statement that will be added seperately rather
the one which will be used for the replacement.
gcc/testsuite/ChangeLog:
* gcc.target/riscv/rvv/base/pr122270-1.c: New test.
Signed-off-by: Andrew Pinski <andrew.pinski@oss.qualcomm.com>
(cherry picked from commit 42f5f1004ff16ab25b97d3315a365614c68c6201)
More information about the Gcc-bugs
mailing list