[llvm] [SLP]Improved reduction cost/codegen (PR #118293)

via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 22 13:56:02 PST 2025


================
@@ -2681,6 +2681,22 @@ class BasicTTIImplBase : public TargetTransformInfoImplCRTPBase<T> {
     return *LT.first.getValue();
   }
 
+  bool isFullSingleRegisterType(Type *Tp) const {
+    std::pair<InstructionCost, MVT> LT = getTypeLegalizationCost(Tp);
+    if (!LT.first.isValid() || LT.first > 1)
+      return false;
+
+    if (auto *FTp = dyn_cast<FixedVectorType>(Tp);
+        Tp && LT.second.isFixedLengthVector()) {
+      // Check if the n x i1 fits fully into largest integer.
+      if (unsigned VF = LT.second.getVectorNumElements();
----------------
hiraditya wrote:

Not sure if we need an initializer here when VF isn't used in the conditional? Moving this call inside would improve readability and avoid a call?

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


More information about the llvm-commits mailing list