[llvm] 180d3f2 - [MemDep][NFCI] Remove redundant dyn_cast, replace with cast

Max Kazantsev via llvm-commits llvm-commits at lists.llvm.org
Mon May 30 03:18:14 PDT 2022


Author: Max Kazantsev
Date: 2022-05-30T17:17:55+07:00
New Revision: 180d3f251d1ad5473705d3f00e6d426b5f8162e6

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

LOG: [MemDep][NFCI] Remove redundant dyn_cast, replace with cast

When `IsLoad` is `true`, we don't need to check if the instruction
is actually a load with dyn_cast. Saves some petty amount of CT.

Added: 
    

Modified: 
    llvm/lib/Analysis/MemoryDependenceAnalysis.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Analysis/MemoryDependenceAnalysis.cpp b/llvm/lib/Analysis/MemoryDependenceAnalysis.cpp
index 81d2143233ddc..c1ca9a9c56924 100644
--- a/llvm/lib/Analysis/MemoryDependenceAnalysis.cpp
+++ b/llvm/lib/Analysis/MemoryDependenceAnalysis.cpp
@@ -402,8 +402,8 @@ MemDepResult MemoryDependenceResults::getSimplePointerDependencyFrom(
   // forwarding, but any mayalias write can be assumed to be noalias.
   // Arguably, this logic should be pushed inside AliasAnalysis itself.
   if (isLoad && QueryInst) {
-    LoadInst *LI = dyn_cast<LoadInst>(QueryInst);
-    if (LI && LI->hasMetadata(LLVMContext::MD_invariant_load))
+    LoadInst *LI = cast<LoadInst>(QueryInst);
+    if (LI->hasMetadata(LLVMContext::MD_invariant_load))
       isInvariantLoad = true;
   }
 


        


More information about the llvm-commits mailing list