[llvm] [VPlan] Strip dead code in cst live-in match (NFC) (PR #159589)
Ramkumar Ramachandra via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 18 08:11:58 PDT 2025
https://github.com/artagnon updated https://github.com/llvm/llvm-project/pull/159589
>From b2b9c56a83773452cb4c8d61531239560b024b56 Mon Sep 17 00:00:00 2001
From: Ramkumar Ramachandra <ramkumar.ramachandra at codasip.com>
Date: Thu, 18 Sep 2025 15:43:55 +0100
Subject: [PATCH 1/2] [VPlan] Strip dead code in cst live-in match (NFC)
A live-in constant can never be of vector type.
---
llvm/lib/Transforms/Vectorize/VPlanPatternMatch.h | 4 ----
1 file changed, 4 deletions(-)
diff --git a/llvm/lib/Transforms/Vectorize/VPlanPatternMatch.h b/llvm/lib/Transforms/Vectorize/VPlanPatternMatch.h
index 8f9ce7a74b58b..c7eeb79e79f6a 100644
--- a/llvm/lib/Transforms/Vectorize/VPlanPatternMatch.h
+++ b/llvm/lib/Transforms/Vectorize/VPlanPatternMatch.h
@@ -109,10 +109,6 @@ template <typename Pred, unsigned BitWidth = 0> struct int_pred_ty {
if (!V)
return false;
const auto *CI = dyn_cast<ConstantInt>(V);
- if (!CI && V->getType()->isVectorTy())
- if (const auto *C = dyn_cast<Constant>(V))
- CI = dyn_cast_or_null<ConstantInt>(
- C->getSplatValue(/*AllowPoison=*/false));
if (!CI)
return false;
>From 2a434c545a8556af4595586781130822add3e58e Mon Sep 17 00:00:00 2001
From: Ramkumar Ramachandra <ramkumar.ramachandra at codasip.com>
Date: Thu, 18 Sep 2025 16:11:18 +0100
Subject: [PATCH 2/2] [VPlan/PM] Add assert
---
llvm/lib/Transforms/Vectorize/VPlanPatternMatch.h | 1 +
1 file changed, 1 insertion(+)
diff --git a/llvm/lib/Transforms/Vectorize/VPlanPatternMatch.h b/llvm/lib/Transforms/Vectorize/VPlanPatternMatch.h
index c7eeb79e79f6a..49bce44239087 100644
--- a/llvm/lib/Transforms/Vectorize/VPlanPatternMatch.h
+++ b/llvm/lib/Transforms/Vectorize/VPlanPatternMatch.h
@@ -108,6 +108,7 @@ template <typename Pred, unsigned BitWidth = 0> struct int_pred_ty {
Value *V = VPV->getLiveInIRValue();
if (!V)
return false;
+ assert(!V->getType()->isVectorTy() && "Unexpected vector live-in");
const auto *CI = dyn_cast<ConstantInt>(V);
if (!CI)
return false;
More information about the llvm-commits
mailing list