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

            Bug ID: 127771
           Summary: [17 Regression] ICE in execute_todo, at passes.cc:2147
                    since r17-4816
           Product: gcc
           Version: 17.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: dhruvc at gcc dot gnu.org
          Reporter: dhruvc at gcc dot gnu.org
                CC: karmea01 at gcc dot gnu.org
  Target Milestone: ---
            Target: aarch64

r17-4816-gb24418a2212866 introduces a temporary LHS for an intrinsic call whose
result is discarded. It uses create_tmp_var (generating a VAR_DECL) which sets
ssa_renaming_needed. The consequent passes that fold do not request
TODO_update_ssa, so execute_todo asserts.

This needs the fold to run after SSA construction. In the testcase the second
operand is not yet a constant when intrinsics are first folded from gimple-low,
so the fold declines there and only succeeds once CCP has propagated the splat.
This happens in C only as the C++ front end deletes the discarded call while
parsing, so the folder never runs.

Min-repro:

===
#include <arm_sve.h>

void g (svbool_t p, svuint32_t a, int k)
{
  svmul_x (p, a, svdup_u32 (k ? 1 : 1));
}
===

Compile flags: -march=armv8.2-a+sve -O1

Error:

===
during GIMPLE pass: ccp
<source>: In function 'g':
<source>:6:1: internal compiler error: in execute_todo, at passes.cc:2147
    6 | }
      | ^
===

Compiler explorer: https://godbolt.org/z/dj597jz4h

Reply via email to