[llvm] fcfaed4 - Remove redundant comparisons (NFC)

Adrian Prantl via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 2 09:52:58 PDT 2021


Author: Adrian Prantl
Date: 2021-06-02T09:52:45-07:00
New Revision: fcfaed4ae6d718ebfe18eef7f5ddbef2a23ef413

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

LOG: Remove redundant comparisons (NFC)

Added: 
    

Modified: 
    llvm/lib/IR/DebugInfo.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/IR/DebugInfo.cpp b/llvm/lib/IR/DebugInfo.cpp
index 331bf8a1ecc8f..06c511f8530a8 100644
--- a/llvm/lib/IR/DebugInfo.cpp
+++ b/llvm/lib/IR/DebugInfo.cpp
@@ -388,7 +388,7 @@ static bool isDILocationReachable(SmallPtrSetImpl<Metadata *> &Visited,
   MDNode *N = dyn_cast_or_null<MDNode>(MD);
   if (!N)
     return false;
-  if (Reachable.count(N) || isa<DILocation>(N))
+  if (isa<DILocation>(N) || Reachable.count(N))
     return true;
   if (!Visited.insert(N).second)
     return false;
@@ -415,8 +415,7 @@ static MDNode *stripDebugLocFromLoopID(MDNode *N) {
   // count_if avoids an early exit.
   if (!std::count_if(N->op_begin() + 1, N->op_end(),
                      [&Visited, &DILocationReachable](const MDOperand &Op) {
-                       return isa<DILocation>(Op.get()) ||
-                              isDILocationReachable(
+                       return isDILocationReachable(
                                   Visited, DILocationReachable, Op.get());
                      }))
     return N;
@@ -426,8 +425,7 @@ static MDNode *stripDebugLocFromLoopID(MDNode *N) {
   if (std::all_of(
           N->op_begin() + 1, N->op_end(),
           [&Visited, &DILocationReachable](const MDOperand &Op) {
-            return isa<DILocation>(Op.get()) ||
-                   isDILocationReachable(Visited, DILocationReachable,
+            return isDILocationReachable(Visited, DILocationReachable,
                                          Op.get());
           }))
     return nullptr;


        


More information about the llvm-commits mailing list