[llvm] [Analysis] Remove an unnecessary cast (NFC) (PR #150838)

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Sun Jul 27 09:27:25 PDT 2025


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

getOpcode() already returns Instruction::CastOps.


>From ffd63d84ad1f8a6d7d4335aade82f75040f63d1c Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Sun, 27 Jul 2025 08:02:58 -0700
Subject: [PATCH] [Analysis] Remove an unnecessary cast (NFC)

getOpcode() already returns Instruction::CastOps.
---
 llvm/lib/Analysis/InstructionSimplify.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/llvm/lib/Analysis/InstructionSimplify.cpp b/llvm/lib/Analysis/InstructionSimplify.cpp
index 82530e7d5b6c6..5907e21065331 100644
--- a/llvm/lib/Analysis/InstructionSimplify.cpp
+++ b/llvm/lib/Analysis/InstructionSimplify.cpp
@@ -5366,7 +5366,7 @@ static Value *simplifyCastInst(unsigned CastOpc, Value *Op, Type *Ty,
     Type *MidTy = CI->getType();
     Type *DstTy = Ty;
     if (Src->getType() == Ty) {
-      auto FirstOp = static_cast<Instruction::CastOps>(CI->getOpcode());
+      auto FirstOp = CI->getOpcode();
       auto SecondOp = static_cast<Instruction::CastOps>(CastOpc);
       Type *SrcIntPtrTy =
           SrcTy->isPtrOrPtrVectorTy() ? Q.DL.getIntPtrType(SrcTy) : nullptr;



More information about the llvm-commits mailing list