Skip to content

Conversation

@kazutakahirata
Copy link
Contributor

getOpcode() already returns Instruction::CastOps.

getOpcode() already returns Instruction::CastOps.
@kazutakahirata kazutakahirata requested a review from arsenm July 27, 2025 16:27
@kazutakahirata kazutakahirata requested a review from nikic as a code owner July 27, 2025 16:27
@llvmbot llvmbot added llvm:instcombine Covers the InstCombine, InstSimplify and AggressiveInstCombine passes llvm:analysis Includes value tracking, cost tables and constant folding labels Jul 27, 2025
@llvmbot
Copy link
Member

llvmbot commented Jul 27, 2025

@llvm/pr-subscribers-llvm-analysis

Author: Kazu Hirata (kazutakahirata)

Changes

getOpcode() already returns Instruction::CastOps.


Full diff: https://github.com/llvm/llvm-project/pull/150838.diff

1 Files Affected:

  • (modified) llvm/lib/Analysis/InstructionSimplify.cpp (+1-1)
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;

@kazutakahirata kazutakahirata merged commit c7cd1d0 into llvm:main Jul 27, 2025
12 checks passed
@kazutakahirata kazutakahirata deleted the cleanup_20250727_cast_llvm_Analysis branch July 27, 2025 17:43
mahesh-attarde pushed a commit to mahesh-attarde/llvm-project that referenced this pull request Jul 28, 2025
getOpcode() already returns Instruction::CastOps.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

llvm:analysis Includes value tracking, cost tables and constant folding llvm:instcombine Covers the InstCombine, InstSimplify and AggressiveInstCombine passes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants