[llvm] [SCEVPatternMatch] Strip redundant const_cast (NFC) (PR #189382)

Ramkumar Ramachandra via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 30 06:43:11 PDT 2026


https://github.com/artagnon created https://github.com/llvm/llvm-project/pull/189382

None

>From b3242930ddb7cd1225cbe4e628807a0dc77b8d49 Mon Sep 17 00:00:00 2001
From: Ramkumar Ramachandra <artagnon at tenstorrent.com>
Date: Mon, 30 Mar 2026 14:40:52 +0100
Subject: [PATCH] [SCEVPatternMatch] Strip redundant const_cast (NFC)

---
 llvm/include/llvm/Analysis/ScalarEvolutionPatternMatch.h | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/llvm/include/llvm/Analysis/ScalarEvolutionPatternMatch.h b/llvm/include/llvm/Analysis/ScalarEvolutionPatternMatch.h
index 398dc7da67abc..d678e23afc18d 100644
--- a/llvm/include/llvm/Analysis/ScalarEvolutionPatternMatch.h
+++ b/llvm/include/llvm/Analysis/ScalarEvolutionPatternMatch.h
@@ -24,8 +24,7 @@ template <typename Pattern> bool match(const SCEV *S, const Pattern &P) {
 }
 
 template <typename Pattern> bool match(const SCEVUse U, const Pattern &P) {
-  const SCEV *S = U.getPointer();
-  return const_cast<Pattern &>(P).match(S);
+  return P.match(U.getPointer());
 }
 
 template <typename Predicate> struct cst_pred_ty : public Predicate {



More information about the llvm-commits mailing list