[llvm] [RISCV] Use static arrays+ArrayRef instead of SmallVector to select P extension vector VTs. NFC (PR #175390)
via llvm-commits
llvm-commits at lists.llvm.org
Sat Jan 10 13:05:25 PST 2026
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-backend-risc-v
Author: Craig Topper (topperc)
<details>
<summary>Changes</summary>
---
Full diff: https://github.com/llvm/llvm-project/pull/175390.diff
1 Files Affected:
- (modified) llvm/lib/Target/RISCV/RISCVISelLowering.cpp (+5-3)
``````````diff
diff --git a/llvm/lib/Target/RISCV/RISCVISelLowering.cpp b/llvm/lib/Target/RISCV/RISCVISelLowering.cpp
index 9a72e8a3ca4a2..b23bffba4a0e0 100644
--- a/llvm/lib/Target/RISCV/RISCVISelLowering.cpp
+++ b/llvm/lib/Target/RISCV/RISCVISelLowering.cpp
@@ -526,16 +526,18 @@ RISCVTargetLowering::RISCVTargetLowering(const TargetMachine &TM,
setTargetDAGCombine(ISD::TRUNCATE);
setTruncStoreAction(MVT::v2i32, MVT::v2i16, Expand);
setTruncStoreAction(MVT::v4i16, MVT::v4i8, Expand);
- SmallVector<MVT, 2> VTs;
+ static const MVT RV32VTs[] = {MVT::v2i16, MVT::v4i8};
+ static const MVT RV64VTs[] = {MVT::v2i32, MVT::v4i16, MVT::v8i8};
+ ArrayRef<MVT> VTs;
if (Subtarget.is64Bit()) {
- VTs.append({MVT::v2i32, MVT::v4i16, MVT::v8i8});
+ VTs = RV64VTs;
setTruncStoreAction(MVT::v2i64, MVT::v2i32, Expand);
setTruncStoreAction(MVT::v4i32, MVT::v4i16, Expand);
setTruncStoreAction(MVT::v8i16, MVT::v8i8, Expand);
setTruncStoreAction(MVT::v2i32, MVT::v2i16, Expand);
setTruncStoreAction(MVT::v4i16, MVT::v4i8, Expand);
} else {
- VTs.append({MVT::v2i16, MVT::v4i8});
+ VTs = RV32VTs;
setOperationAction(ISD::BUILD_VECTOR, MVT::v4i8, Custom);
}
setOperationAction(ISD::UADDSAT, VTs, Legal);
``````````
</details>
https://github.com/llvm/llvm-project/pull/175390
More information about the llvm-commits
mailing list