[PATCH] D158634: [RISCV] Fix wrong operand being used for VL in shift combine

Luke Lau via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 23 09:31:43 PDT 2023


luke created this revision.
luke added reviewers: craig.topper, reames.
Herald added subscribers: jobnoorman, asb, sunshaoce, pmatos, VincentWu, vkmr, frasercrmck, luismarques, apazos, sameer.abuasal, s.egerton, Jim, benna, psnobl, jocewei, PkmX, the_o, brucehoult, MartinMosbeck, rogfer01, edward-jones, zzheng, jrtc27, shiva0217, kito-cheng, niosHD, sabuasal, simoncook, johnrusso, rbar, hiraditya, arichardson.
Herald added a project: All.
luke requested review of this revision.
Herald added subscribers: llvm-commits, wangpc, eopXD, MaskRay.
Herald added a project: LLVM.

At some point a merge operand was added to the binary vl ops, so this combine
was using the mask for the VL. This causes a crash when trying to 
select the vmv_v_x_vl, which showed up locally when messing about with 
selectVSplat, but thankfully in ToT the vmv_v_x_vl gets pattern matched 
away into the .vx and .vi operands every time, so there's no noticeable 
change.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D158634

Files:
  llvm/lib/Target/RISCV/RISCVISelLowering.cpp


Index: llvm/lib/Target/RISCV/RISCVISelLowering.cpp
===================================================================
--- llvm/lib/Target/RISCV/RISCVISelLowering.cpp
+++ llvm/lib/Target/RISCV/RISCVISelLowering.cpp
@@ -13456,7 +13456,7 @@
     if (ShAmt.getOpcode() == RISCVISD::SPLAT_VECTOR_SPLIT_I64_VL) {
       // We don't need the upper 32 bits of a 64-bit element for a shift amount.
       SDLoc DL(N);
-      SDValue VL = N->getOperand(3);
+      SDValue VL = N->getOperand(4);
       EVT VT = N->getValueType(0);
       ShAmt = DAG.getNode(RISCVISD::VMV_V_X_VL, DL, VT, DAG.getUNDEF(VT),
                           ShAmt.getOperand(1), VL);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D158634.552759.patch
Type: text/x-patch
Size: 650 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230823/b407cf19/attachment.bin>


More information about the llvm-commits mailing list