[llvm] [ExpandLargeDivRem] Scalarize vector types. (PR #86959)

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 1 23:51:56 PDT 2024


================
@@ -54,8 +54,34 @@ static bool isSigned(unsigned int Opcode) {
   return Opcode == Instruction::SDiv || Opcode == Instruction::SRem;
 }
 
+static void scalarize(BinaryOperator *BO,
+                      SmallVectorImpl<BinaryOperator *> &Replace) {
+  VectorType *VTy = cast<VectorType>(BO->getType());
+  assert(!VTy->isScalableTy() && "Tried to scalarize scalable vector!");
+
+  IRBuilder<> Builder(BO);
+
+  unsigned NumElements = VTy->getElementCount().getKnownMinValue();
----------------
topperc wrote:

Since this only handles fixed vectors, we should use `getFixedValue`

https://github.com/llvm/llvm-project/pull/86959


More information about the llvm-commits mailing list