[PATCH] D146362: [SelectionDAG][RISCV] Fix SimplifyDemandedBits for scalable vectors

Yingwei Zheng via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Mar 18 10:35:22 PDT 2023


dtcxzyw created this revision.
dtcxzyw added reviewers: liaolucy, StephenFan.
Herald added subscribers: jobnoorman, VincentWu, vkmr, ecnelises, evandro, luismarques, sameer.abuasal, s.egerton, Jim, benna, psnobl, rogfer01, shiva0217, kito-cheng, simoncook, hiraditya, arichardson.
Herald added a project: All.
dtcxzyw requested review of this revision.
Herald added subscribers: llvm-commits, alextsao1999, pcwang-thead, eopXD.
Herald added a project: LLVM.

The function `SimplifyDemandedBits` attempts to get the bit-width of a scalable vector type while compiling the `LLVM-test-suite` with `-march=rv64gcv`. This patch skips some simplifications since we assume we know nothing about scalable vectors for now. I am uncertain about how to provide test cases and need some guidance.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D146362

Files:
  llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp


Index: llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
===================================================================
--- llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
+++ llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
@@ -1722,6 +1722,8 @@
         if (ShAmt < InnerBits && DemandedBits.getActiveBits() <= InnerBits &&
             isTypeDesirableForOp(ISD::SHL, InnerVT)) {
           EVT ShTy = getShiftAmountTy(InnerVT, DL);
+          if (ShTy.isScalableVector())
+            return false;
           if (!APInt(BitWidth, ShAmt).isIntN(ShTy.getSizeInBits()))
             ShTy = InnerVT;
           SDValue NarrowShl =


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D146362.506303.patch
Type: text/x-patch
Size: 636 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230318/7445179f/attachment-0001.bin>


More information about the llvm-commits mailing list