================
@@ -272,17 +222,49 @@ static bool hasPossibleIncompatibleOps(const Function *F,
       // Inlining operations on fixed-length vectors when the streaming
       // mode does not match is rejected because performance may be impacted.
       // This decision should eventually be moved to the cost-model.
+      // When IsVScaleDependent is true, then we allow fixed-length vectors as
+      // the operation may be something like llvm.vector.match, which takes 
both
+      // a scalable and a fixed-length vector.
       if (!IsAlwaysInline && (isa<FixedVectorType>(I.getType()) ||
                               any_of(I.operand_values(), [](const Value *V) {
                                 return isa<FixedVectorType>(V->getType());
                               })))
         return true;
 
-      StreamingIncompatibility C = 
getCompatibilityForChangeToStreamingMode(&I);
-      if (any(C & StreamingIncompatibility::HasIncompatibleInstruction) ||
-          (!AssumeVScaleIsEquivalent &&
-           any(C & StreamingIncompatibility::VScaleDependent)))
-        return true;
+      if (auto *II = dyn_cast<IntrinsicInst>(&I)) {
+        unsigned IID = II->getIntrinsicID();
+        switch (IID) {
+        default:
+          if (!Intrinsic::isTargetIntrinsic(IID))
+            break;
+          // Conservatively assume target intrinsics are vscale dependent
+          // or invalid in the current mode.
+          return true;
+        case Intrinsic::masked_gather:
+        case Intrinsic::masked_scatter:
+        case Intrinsic::masked_compressstore:
+        case Intrinsic::experimental_vector_histogram_add:
+          // Instructions that are not available in streaming mode.
+          // Fixed-length operations can still be code-generated by 
scalarizing.
+          // FIXME: Consider FEAT_FA64.
+          if (I.getOperand(0)->getType()->isScalableTy())
+            return true;
+          break;
+        case Intrinsic::vscale:
+          return !AssumeVScaleIsEquivalent;
+        }
+      }
+
+      // Determine if the operation is vscale dependent by looking at it's
+      // operand/result types.
+      bool IsVScaleDependent = false;
----------------
kazutakahirata wrote:

This seems to be unused.  Should we remove it?  Or add `[[maybe_unused]]` if 
you are planning to use it soon?

https://github.com/llvm/llvm-project/pull/231899
_______________________________________________
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits

Reply via email to