https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112531
Bug ID: 112531
Summary: [14] RISC-V: gcc.dg/unroll-8.c rtl-dump scan errors
with --param=riscv-autovec-preference=scalable
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=111311#c8
The following errors are found on trunk
=== gcc: Unexpected fails for rv64gcv lp64d medlow ===
FAIL: gcc.dg/unroll-8.c scan-rtl-dump loop2_unroll "Not unrolling loop, doesn'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:
./build-gcc-linux-stage2/gcc/xgcc -B./build-gcc-linux-stage2/gcc/
/scratch/ewlu/ci/triage/baseline/gcc/gcc/testsuite/gcc.dg/unroll-8.c
-march=rv64gcv -mabi=lp64d -mcmodel=medlow -fdiagnostics-plain-output -O2
-fdump-rtl-loop2_unroll-details-blocks -funroll-loops -ffat-lto-objects -S -o
unroll-8.s --param=riscv-autovec-preference=scalable --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.vect
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 cause of
the problem since the optimized tree dump has
# loop_len_16 = 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 ])
Loop 1 is not simple.
/scratch/ewlu/ci/triage/baseline/gcc/gcc/testsuite/gcc.dg/unroll-8.c:8:9: note:
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.