Open preames opened 2 years ago
@llvm/issue-subscribers-backend-risc-v
I'm working on this bug. It seems that we can slightly modify RISCVDAGToDAGISel::PreprocessISelDAG not to always use X0 for splats, but sometimes choose VL more accurately if we have common VL for the users of the node.
Created review https://reviews.llvm.org/D130895 . @preames, could you please share the origin of the example from the issue if it is possible? I'd like to test my changes on it as well.
I noticed that we unconditionally treating splat constants as effecting all lanes in a vector register.
Example:
Repro command:
Key output:
As you can see here, we setup VL to be VLMAX for the splat, despite the fact we only use four lanes of the resulting value. We could have used AVL=4 the whole way through on this example.
This example is written with scalable vectors, but this also shows up in idiomatic fixed length vector loops. As an example, see
@vector_init_vsetvli_fv
fromtest/CodeGen/RISCV/rvv/vsetvli-insert-crossbb.ll
.