Skip to content

Commit 609732c

Browse files
[RISCV] Fix warnings
This patch fixes: llvm/lib/Target/RISCV/RISCVISelLowering.cpp:5723:24: error: captured structured bindings are a C++20 extension [-Werror,-Wc++20-extensions] llvm/lib/Target/RISCV/RISCVISelLowering.cpp:5728:76: error: captured structured bindings are a C++20 extension [-Werror,-Wc++20-extensions]
1 parent 81bc28d commit 609732c

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

llvm/lib/Target/RISCV/RISCVISelLowering.cpp

+6-1
Original file line numberDiff line numberDiff line change
@@ -5473,7 +5473,11 @@ static SDValue lowerVECTOR_SHUFFLE(SDValue Op, SelectionDAG &DAG,
54735473

54745474
MVT ContainerVT = getContainerForFixedLengthVector(DAG, VT, Subtarget);
54755475

5476-
auto [TrueMask, VL] = getDefaultVLOps(VT, ContainerVT, DL, DAG, Subtarget);
5476+
// Store the return value in a single variable instead of structured bindings
5477+
// so that we can pass it to GetSlide below, which cannot capture structured
5478+
// bindings until C++20.
5479+
auto TrueMaskVL = getDefaultVLOps(VT, ContainerVT, DL, DAG, Subtarget);
5480+
auto [TrueMask, VL] = TrueMaskVL;
54775481

54785482
if (SVN->isSplat()) {
54795483
const int Lane = SVN->getSplatIndex();
@@ -5716,6 +5720,7 @@ static SDValue lowerVECTOR_SHUFFLE(SDValue Op, SelectionDAG &DAG,
57165720
};
57175721
auto GetSlide = [&](const std::pair<int, int> &Src, SDValue Mask,
57185722
SDValue Passthru) {
5723+
auto [TrueMask, VL] = TrueMaskVL;
57195724
SDValue SrcV = GetSourceFor(Src);
57205725
int SlideAmt = Src.second;
57215726
if (SlideAmt == 0) {

0 commit comments

Comments
 (0)