[llvm] r368636 - Move findBBwithCalls to the file it's used in to avoid unused function

Eric Christopher via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 12 17:05:01 PDT 2019


Author: echristo
Date: Mon Aug 12 17:05:01 2019
New Revision: 368636

URL: http://llvm.org/viewvc/llvm-project?rev=368636&view=rev
Log:
Move findBBwithCalls to the file it's used in to avoid unused function
warnings.

Modified:
    llvm/trunk/include/llvm/ExecutionEngine/Orc/SpeculateAnalyses.h
    llvm/trunk/lib/ExecutionEngine/Orc/SpeculateAnalyses.cpp

Modified: llvm/trunk/include/llvm/ExecutionEngine/Orc/SpeculateAnalyses.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ExecutionEngine/Orc/SpeculateAnalyses.h?rev=368636&r1=368635&r2=368636&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ExecutionEngine/Orc/SpeculateAnalyses.h (original)
+++ llvm/trunk/include/llvm/ExecutionEngine/Orc/SpeculateAnalyses.h Mon Aug 12 17:05:01 2019
@@ -18,30 +18,6 @@
 
 #include <vector>
 
-namespace {
-using namespace llvm;
-std::vector<const BasicBlock *> findBBwithCalls(const Function &F,
-                                                bool IndirectCall = false) {
-  std::vector<const BasicBlock *> BBs;
-
-  auto findCallInst = [&IndirectCall](const Instruction &I) {
-    if (auto Call = dyn_cast<CallBase>(&I)) {
-      if (Call->isIndirectCall())
-        return IndirectCall;
-      else
-        return true;
-    } else
-      return false;
-  };
-  for (auto &BB : F)
-    if (findCallInst(*BB.getTerminator()) ||
-        llvm::any_of(BB.instructionsWithoutDebug(), findCallInst))
-      BBs.emplace_back(&BB);
-
-  return BBs;
-}
-} // namespace
-
 namespace llvm {
 
 namespace orc {

Modified: llvm/trunk/lib/ExecutionEngine/Orc/SpeculateAnalyses.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/Orc/SpeculateAnalyses.cpp?rev=368636&r1=368635&r2=368636&view=diff
==============================================================================
--- llvm/trunk/lib/ExecutionEngine/Orc/SpeculateAnalyses.cpp (original)
+++ llvm/trunk/lib/ExecutionEngine/Orc/SpeculateAnalyses.cpp Mon Aug 12 17:05:01 2019
@@ -12,6 +12,30 @@
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/Analysis/BlockFrequencyInfo.h"
 
+namespace {
+using namespace llvm;
+std::vector<const BasicBlock *> findBBwithCalls(const Function &F,
+                                                bool IndirectCall = false) {
+  std::vector<const BasicBlock *> BBs;
+
+  auto findCallInst = [&IndirectCall](const Instruction &I) {
+    if (auto Call = dyn_cast<CallBase>(&I)) {
+      if (Call->isIndirectCall())
+        return IndirectCall;
+      else
+        return true;
+    } else
+      return false;
+  };
+  for (auto &BB : F)
+    if (findCallInst(*BB.getTerminator()) ||
+        llvm::any_of(BB.instructionsWithoutDebug(), findCallInst))
+      BBs.emplace_back(&BB);
+
+  return BBs;
+}
+} // namespace
+
 // Implementations of Queries shouldn't need to lock the resources
 // such as LLVMContext, each argument (function) has a non-shared LLVMContext
 namespace llvm {




More information about the llvm-commits mailing list