[RISCV] Increase complexity of RVV element extraction patterns
authorPengcheng Wang <wpc337719@alibaba-inc.com>
Mon, 11 Jul 2022 02:51:34 +0000 (10:51 +0800)
committerwangpc <pc.wang@linux.alibaba.com>
Mon, 11 Jul 2022 02:53:15 +0000 (10:53 +0800)
Somehow some tests failed in our downstream because it matched
VFMV+FSD pattern first. Both FSD and VSE patterns have the same
complexity, while FSD is matched before VSE in the generated
matcher table.

This problem only occurs in our downstream (so sorry that I can't
provide a test here) and increasing the value of `AddedComplexity`
can fix it.

Reviewed By: StephenFan, craig.topper

Differential Revision: https://reviews.llvm.org/D129360

llvm/lib/Target/RISCV/RISCVInstrInfoVSDPatterns.td

index 6501bb2..b7b2564 100644 (file)
@@ -1039,7 +1039,7 @@ foreach vti = AllFloatVectors in {
   // Fold store of vmv.f.s to a vse with VL=1.
   defvar store_instr = !cast<Instruction>("PseudoVSE"#vti.SEW#"_V_"#vti.LMul.MX);
 
-  let AddedComplexity = 1 in {
+  let AddedComplexity = 2 in {
   // Add complexity to increase the priority of this pattern being matched.
   def : Pat<(store (vti.Scalar (int_riscv_vfmv_f_s (vti.Vector vti.RegClass:$rs2))), GPR:$rs1),
             (store_instr vti.RegClass:$rs2, GPR:$rs1, 1, vti.Log2SEW)>;