[llvm] c42eda5 - IROutliner: cast instead of dyn_cast and assert

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 17 18:28:44 PST 2023


Author: Matt Arsenault
Date: 2023-02-17T22:28:09-04:00
New Revision: c42eda5d3692fcd67fc3d043ab37f1950ea653b9

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

LOG: IROutliner: cast instead of dyn_cast and assert

Added: 
    

Modified: 
    llvm/lib/Transforms/IPO/IROutliner.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/IPO/IROutliner.cpp b/llvm/lib/Transforms/IPO/IROutliner.cpp
index de8f73668e513..82f890a50f059 100644
--- a/llvm/lib/Transforms/IPO/IROutliner.cpp
+++ b/llvm/lib/Transforms/IPO/IROutliner.cpp
@@ -179,10 +179,8 @@ static void getSortedConstantKeys(std::vector<Value *> &SortedKeys,
 
   stable_sort(SortedKeys, [](const Value *LHS, const Value *RHS) {
     assert(LHS && RHS && "Expected non void values.");
-    const ConstantInt *LHSC = dyn_cast<ConstantInt>(LHS);
-    const ConstantInt *RHSC = dyn_cast<ConstantInt>(RHS);
-    assert(RHSC && "Not a constant integer in return value?");
-    assert(LHSC && "Not a constant integer in return value?");
+    const ConstantInt *LHSC = cast<ConstantInt>(LHS);
+    const ConstantInt *RHSC = cast<ConstantInt>(RHS);
 
     return LHSC->getLimitedValue() < RHSC->getLimitedValue();
   });


        


More information about the llvm-commits mailing list