[llvm] b85387d - [SCCP] Check instruction type before querying PredicateInfo (NFC)
    Nikita Popov via llvm-commits 
    llvm-commits at lists.llvm.org
       
    Fri Jun 20 02:08:19 PDT 2025
    
    
  
Author: Nikita Popov
Date: 2025-06-20T11:08:11+02:00
New Revision: b85387dfe8e67ee8a142a1faf25325761c343577
URL: https://github.com/llvm/llvm-project/commit/b85387dfe8e67ee8a142a1faf25325761c343577
DIFF: https://github.com/llvm/llvm-project/commit/b85387dfe8e67ee8a142a1faf25325761c343577.diff
LOG: [SCCP] Check instruction type before querying PredicateInfo (NFC)
Do the cheap intrinsic check before the hash lookup for the
PredicateInfo.
Added: 
    
Modified: 
    llvm/lib/Transforms/Utils/SCCPSolver.cpp
Removed: 
    
################################################################################
diff  --git a/llvm/lib/Transforms/Utils/SCCPSolver.cpp b/llvm/lib/Transforms/Utils/SCCPSolver.cpp
index cc0bb4735c231..e1b1cf68cd9f0 100644
--- a/llvm/lib/Transforms/Utils/SCCPSolver.cpp
+++ b/llvm/lib/Transforms/Utils/SCCPSolver.cpp
@@ -771,9 +771,9 @@ class SCCPInstVisitor : public InstVisitor<SCCPInstVisitor> {
 
     for (BasicBlock &BB : F) {
       for (Instruction &Inst : llvm::make_early_inc_range(BB)) {
-        if (It->second->getPredicateInfoFor(&Inst)) {
-          if (auto *II = dyn_cast<IntrinsicInst>(&Inst)) {
-            if (II->getIntrinsicID() == Intrinsic::ssa_copy) {
+        if (auto *II = dyn_cast<IntrinsicInst>(&Inst)) {
+          if (II->getIntrinsicID() == Intrinsic::ssa_copy) {
+            if (It->second->getPredicateInfoFor(&Inst)) {
               Value *Op = II->getOperand(0);
               Inst.replaceAllUsesWith(Op);
               Inst.eraseFromParent();
        
    
    
More information about the llvm-commits
mailing list