[llvm] 54bd375 - [OpenMP][NFC] Add convenient helper and early exit check
Johannes Doerfert via llvm-commits
llvm-commits at lists.llvm.org
Fri Jul 10 22:53:57 PDT 2020
Author: Johannes Doerfert
Date: 2020-07-11T00:51:51-05:00
New Revision: 54bd3751ceebe6eb67804a1ed8be72943817852f
URL: https://github.com/llvm/llvm-project/commit/54bd3751ceebe6eb67804a1ed8be72943817852f
DIFF: https://github.com/llvm/llvm-project/commit/54bd3751ceebe6eb67804a1ed8be72943817852f.diff
LOG: [OpenMP][NFC] Add convenient helper and early exit check
Added:
Modified:
llvm/lib/Transforms/IPO/OpenMPOpt.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/IPO/OpenMPOpt.cpp b/llvm/lib/Transforms/IPO/OpenMPOpt.cpp
index d7572bf7dc53..b2e30a4d2b79 100644
--- a/llvm/lib/Transforms/IPO/OpenMPOpt.cpp
+++ b/llvm/lib/Transforms/IPO/OpenMPOpt.cpp
@@ -161,6 +161,9 @@ struct OMPInformationCache : public InformationCache {
/// Clear UsesMap for runtime function.
void clearUsesMap() { UsesMap.clear(); }
+ /// Boolean conversion that is true if the runtime function was found.
+ operator bool() const { return Declaration; }
+
/// Return the vector of uses in function \p F.
UseVector &getOrCreateUseVector(Function *F) {
std::shared_ptr<UseVector> &UV = UsesMap[F];
@@ -411,6 +414,9 @@ struct OpenMPOpt {
/// Run all OpenMP optimizations on the underlying SCC/ModuleSlice.
bool run() {
+ if (SCC.empty())
+ return false;
+
bool Changed = false;
LLVM_DEBUG(dbgs() << TAG << "Run on SCC with " << SCC.size()
More information about the llvm-commits
mailing list