[PATCH] D81093: [CodeGen] Fix ComputeNumSignBits for scalable vectors

David Sherwood via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 3 07:38:39 PDT 2020


david-arm created this revision.
david-arm added a reviewer: sdesmalen.
Herald added subscribers: llvm-commits, hiraditya.
Herald added a project: LLVM.

When trying to calculate the number of sign bits for scalable vectors
we should just bail out for now and pretend we know nothing.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D81093

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


Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
===================================================================
--- llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
+++ llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
@@ -3514,9 +3514,12 @@
 
 unsigned SelectionDAG::ComputeNumSignBits(SDValue Op, unsigned Depth) const {
   EVT VT = Op.getValueType();
-  APInt DemandedElts = VT.isVector()
-                           ? APInt::getAllOnesValue(VT.getVectorNumElements())
-                           : APInt(1, 1);
+  APInt DemandedElts;
+  if (!VT.isScalableVector()) {
+    DemandedElts = VT.isVector()
+                       ? APInt::getAllOnesValue(VT.getVectorNumElements())
+                       : APInt(1, 1);
+  }
   return ComputeNumSignBits(Op, DemandedElts, Depth);
 }
 
@@ -3537,7 +3540,7 @@
   if (Depth >= MaxRecursionDepth)
     return 1;  // Limit search depth.
 
-  if (!DemandedElts)
+  if (!DemandedElts || VT.isScalableVector())
     return 1;  // No demanded elts, better to assume we don't know anything.
 
   unsigned Opcode = Op.getOpcode();


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D81093.268190.patch
Type: text/x-patch
Size: 1074 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200603/89eae198/attachment-0001.bin>


More information about the llvm-commits mailing list