[llvm] abcaebf - [InstSimplify] Use cast instead of dyn_cast+assert. NFC

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 29 22:15:07 PDT 2023


Author: Craig Topper
Date: 2023-09-29T22:08:53-07:00
New Revision: abcaebfe3aacb13d46be5e949fd6ed9b4321e2f6

URL: https://github.com/llvm/llvm-project/commit/abcaebfe3aacb13d46be5e949fd6ed9b4321e2f6
DIFF: https://github.com/llvm/llvm-project/commit/abcaebfe3aacb13d46be5e949fd6ed9b4321e2f6.diff

LOG: [InstSimplify] Use cast instead of dyn_cast+assert. NFC

Added: 
    

Modified: 
    llvm/lib/Analysis/InstructionSimplify.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Analysis/InstructionSimplify.cpp b/llvm/lib/Analysis/InstructionSimplify.cpp
index bcecab1525b9912..40a8f6a155b23d2 100644
--- a/llvm/lib/Analysis/InstructionSimplify.cpp
+++ b/llvm/lib/Analysis/InstructionSimplify.cpp
@@ -3949,8 +3949,7 @@ static Value *simplifyICmpInst(unsigned Predicate, Value *LHS, Value *RHS,
       // Turn icmp (sext X), Cst into a compare of X and Cst if Cst is extended
       // too.  If not, then try to deduce the result of the comparison.
       else if (match(RHS, m_ImmConstant())) {
-        Constant *C = dyn_cast<Constant>(RHS);
-        assert(C != nullptr);
+        Constant *C = cast<Constant>(RHS);
 
         // Compute the constant that would happen if we truncated to SrcTy then
         // reextended to DstTy.


        


More information about the llvm-commits mailing list