[llvm] [Scalar] Remove an unnecessary cast (NFC) (PR #150474)

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 24 10:15:49 PDT 2025


https://github.com/kazutakahirata created https://github.com/llvm/llvm-project/pull/150474

getOperand() already returns Value *.


>From 65f2c6a2cf80f7f81cd4c59bd0c1431077f8589d Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Thu, 24 Jul 2025 00:03:04 -0700
Subject: [PATCH] [Scalar] Remove an unnecessary cast (NFC)

getOperand() already returns Value *.
---
 llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp b/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
index 9e318b04c2c99..e3ef9d8680b53 100644
--- a/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
+++ b/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
@@ -3785,7 +3785,7 @@ LSRInstance::CollectLoopInvariantFixupsAndFormulae() {
         // Ignore icmp instructions which are already being analyzed.
         if (const ICmpInst *ICI = dyn_cast<ICmpInst>(UserInst)) {
           unsigned OtherIdx = !U.getOperandNo();
-          Value *OtherOp = const_cast<Value *>(ICI->getOperand(OtherIdx));
+          Value *OtherOp = ICI->getOperand(OtherIdx);
           if (SE.hasComputableLoopEvolution(SE.getSCEV(OtherOp), L))
             continue;
         }



More information about the llvm-commits mailing list