[llvm] [RISCV] Keep same SEW/LMUL ratio if possible in forward transfer (PR #69788)
Philip Reames via llvm-commits
llvm-commits at lists.llvm.org
Wed Oct 25 12:20:36 PDT 2023
================
@@ -1042,6 +1042,26 @@ void RISCVInsertVSETVLI::transferBefore(VSETVLIInfo &Info,
if (!RISCVII::hasVLOp(TSFlags))
return;
+ // If we don't use LMUL or the SEW/LMUL ratio, then adjust LMUL so that we
+ // maintain the SEW/LMUL ratio. This allows us to eliminate VL toggles in more
+ // places.
+ DemandedFields Demanded = getDemanded(MI, MRI);
+ if (!Demanded.LMUL && !Demanded.SEWLMULRatio && Info.isValid() &&
----------------
preames wrote:
I mentioned this offline, but basing this off the existing demanded feilds is much better than re-infering which is what I'd tried This makes cornercase bugs around instructions (e.g. vrgather, or vslide*) much less likely because the existing getDemandedFeidls logic would have to be wrong as well. I feel a bit silly in retrospect, but glad you got it structured properly. :)
https://github.com/llvm/llvm-project/pull/69788
More information about the llvm-commits
mailing list