From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 6142A3858D35; Tue, 14 Nov 2023 19:12:58 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6142A3858D35 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1699989178; bh=QOXRAr9ZhdKINArUnNtbdKwNHApmjsOq2Wsr2AeDqyo=; h=From:To:Subject:Date:From; b=J22eZ7H9fbeBJArI6rl/9s6zunO58c+3f5cNC3IHfHoBaqc4+l9CMrIfZeHmFKCEk wBExGpU/721sLDpf8lJxfjSwxSYnA2mRJpsH7/xCm7iwwZQHNDewbsRhgSnb+1WCyD Eia3zvNRaJ+E/RtZDU3KUySuLwFlGhYkKHRtSywc= From: "ewlu at rivosinc dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/112531] New: [14] RISC-V: gcc.dg/unroll-8.c rtl-dump scan errors with --param=riscv-autovec-preference=scalable Date: Tue, 14 Nov 2023 19:12:57 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: target X-Bugzilla-Version: 14.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: ewlu at rivosinc dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D112531 Bug ID: 112531 Summary: [14] RISC-V: gcc.dg/unroll-8.c rtl-dump scan errors with --param=3Driscv-autovec-preference=3Dscalable Product: gcc Version: 14.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: ewlu at rivosinc dot com Target Milestone: --- As reported in https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D111311#c8 The following errors are found on trunk =3D=3D=3D gcc: Unexpected fails for rv64gcv lp64d medlow = =3D=3D=3D FAIL: gcc.dg/unroll-8.c scan-rtl-dump loop2_unroll "Not unrolling loop, doe= sn't roll" FAIL: gcc.dg/unroll-8.c scan-rtl-dump loop2_unroll "likely upper bound: 6" FAIL: gcc.dg/unroll-8.c scan-rtl-dump loop2_unroll "realistic bound: -1" I have bisected it down to this commit r14-701-gb75c9e10379 introducing the errors. I have isolated the cause to specifically the change in the expand pass by running the testsuite with just the refactor (reverting the change to autovec.md) and saw no change in testsuite results. Compilation command:=20 ./build-gcc-linux-stage2/gcc/xgcc -B./build-gcc-linux-stage2/gcc/=20 /scratch/ewlu/ci/triage/baseline/gcc/gcc/testsuite/gcc.dg/unroll-8.c=20 -march=3Drv64gcv -mabi=3Dlp64d -mcmodel=3Dmedlow -fdiagnostics-plain-outp= ut -O2 -fdump-rtl-loop2_unroll-details-blocks -funroll-loops -ffat-lto-objects -S = -o unroll-8.s --param=3Driscv-autovec-preference=3Dscalable --fdump-rtl-all --fdump-tree-all Observations: Adding the new define expand pattern changes unroll-8.s to output vector instructions. Previously only scalar output was generated (previous commit: r14-700-gaf595613acb.) The first difference in dump file outputs occurs with the tree dump 172t.ve= ct where vector variables are added. This is confusing to me since I expected = the first change to be with the rtl expand pass. I believe this may be the caus= e of the problem since the optimized tree dump has=20 # loop_len_16 =3D PHI <_31(4), _27(3)> which affects the analysis of the operands in the loop2_unroll pass. Analyzing operand (reg:DI 137 [ loop_len_16 ]) of insn (jump_insn 56 54 81 = 10 (set (pc) (if_then_else (ne (reg:DI 137 [ loop_len_16 ]) (const_int 0 [0])) (label_ref:DI 81) (pc))) 242 {*branchdi} (int_list:REG_BR_PROB 894784862 (nil)) -> 81) Checking get reaching def has more than one reaching def not simple. loop number: 1 Failed to analyze op0: (reg:DI 137 [ loop_len_16 ])=20 Loop 1 is not simple. /scratch/ewlu/ci/triage/baseline/gcc/gcc/testsuite/gcc.dg/unroll-8.c:8:9: n= ote: considering unrolling loop 1 at BB 6 ;; Not unrolling loop, user didn't want it unrolled starting the processing of deferred insns loop_len_16 now has multiple reaching definitions since it is the output of= a phi function.=