[llvm] [RISCV] Use SelectionDAG::getVScale in lowerVPReverseExperimental. NFCI (PR #81694)
Luke Lau via llvm-commits
llvm-commits at lists.llvm.org
Tue Feb 13 19:23:51 PST 2024
https://github.com/lukel97 created https://github.com/llvm/llvm-project/pull/81694
Use a slightly more idiomatic way of getting vscale. getVScale
performs additional constant folding, but I presume computeKnownBits
also catches these cases too.
>From 7dabc5703b428d69dc27abd8f0b3f231cfb5c5fd Mon Sep 17 00:00:00 2001
From: Luke Lau <luke at igalia.com>
Date: Wed, 14 Feb 2024 11:19:55 +0800
Subject: [PATCH] [RISCV] Use SelectionDAG::getVScale in
lowerVPReverseExperimental. NFCI
Use a slightly more idiomatic way of getting vscale. getVScale
performs additional constant folding, but I presume computeKnownBits
also catches these cases too.
---
llvm/lib/Target/RISCV/RISCVISelLowering.cpp | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/llvm/lib/Target/RISCV/RISCVISelLowering.cpp b/llvm/lib/Target/RISCV/RISCVISelLowering.cpp
index 73492c28815b1d..4caadef694d725 100644
--- a/llvm/lib/Target/RISCV/RISCVISelLowering.cpp
+++ b/llvm/lib/Target/RISCV/RISCVISelLowering.cpp
@@ -11106,8 +11106,8 @@ RISCVTargetLowering::lowerVPReverseExperimental(SDValue Op,
// Slide off any elements from past EVL that were reversed into the low
// elements.
unsigned MinElts = GatherVT.getVectorMinNumElements();
- SDValue VLMax = DAG.getNode(ISD::VSCALE, DL, XLenVT,
- DAG.getConstant(MinElts, DL, XLenVT));
+ SDValue VLMax =
+ DAG.getVScale(DL, XLenVT, APInt(XLenVT.getSizeInBits(), MinElts));
SDValue Diff = DAG.getNode(ISD::SUB, DL, XLenVT, VLMax, EVL);
Result = getVSlidedown(DAG, Subtarget, DL, GatherVT,
More information about the llvm-commits
mailing list