[PATCH] D86894: [SVE] Disable INSERT_SUBVECTOR DAGCombine for scalable vectors

Cameron McInally via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 1 09:01:49 PDT 2020


cameron.mcinally updated this revision to Diff 289192.
cameron.mcinally added a comment.

Updated with @david-arm's comments for Thursday's Sync-up call.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D86894/new/

https://reviews.llvm.org/D86894

Files:
  llvm/include/llvm/Support/TypeSize.h
  llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp


Index: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
===================================================================
--- llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
+++ llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
@@ -20595,7 +20595,7 @@
       SDLoc DL(N);
       SDValue NewIdx;
       LLVMContext &Ctx = *DAG.getContext();
-      unsigned NumElts = VT.getVectorNumElements();
+      ElementCount NumElts = VT.getVectorElementCount();
       unsigned EltSizeInBits = VT.getScalarSizeInBits();
       if ((EltSizeInBits % N1SrcSVT.getSizeInBits()) == 0) {
         unsigned Scale = EltSizeInBits / N1SrcSVT.getSizeInBits();
@@ -20603,7 +20603,7 @@
         NewIdx = DAG.getVectorIdxConstant(InsIdx * Scale, DL);
       } else if ((N1SrcSVT.getSizeInBits() % EltSizeInBits) == 0) {
         unsigned Scale = N1SrcSVT.getSizeInBits() / EltSizeInBits;
-        if ((NumElts % Scale) == 0 && (InsIdx % Scale) == 0) {
+        if (NumElts.isKnownMultipleOf(Scale) && (InsIdx % Scale) == 0) {
           NewVT = EVT::getVectorVT(Ctx, N1SrcSVT, NumElts / Scale);
           NewIdx = DAG.getVectorIdxConstant(InsIdx / Scale, DL);
         }
Index: llvm/include/llvm/Support/TypeSize.h
===================================================================
--- llvm/include/llvm/Support/TypeSize.h
+++ llvm/include/llvm/Support/TypeSize.h
@@ -79,6 +79,10 @@
     return {(unsigned)llvm::NextPowerOf2(Min), Scalable};
   }
 
+  bool isKnownMultipleOf(unsigned RHS) const {
+    return Min % RHS == 0;
+  }
+
   static ElementCount getFixed(unsigned Min) { return {Min, false}; }
   static ElementCount getScalable(unsigned Min) { return {Min, true}; }
   static ElementCount get(unsigned Min, bool Scalable) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D86894.289192.patch
Type: text/x-patch
Size: 1705 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200901/f08202ed/attachment.bin>


More information about the llvm-commits mailing list