[llvm] d379253 - Orc: Remove an unnecessary explicit scope

David Blaikie via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 31 10:32:07 PST 2020


Author: David Blaikie
Date: 2020-01-31T10:30:25-08:00
New Revision: d379253ca19b274681b075421612c7430a98c637

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

LOG: Orc: Remove an unnecessary explicit scope

(was useful at some point in the past for scoping some error handling
that's since been tidied up a bit)

Added: 
    

Modified: 
    llvm/include/llvm/ExecutionEngine/Orc/CompileOnDemandLayer.h

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/ExecutionEngine/Orc/CompileOnDemandLayer.h b/llvm/include/llvm/ExecutionEngine/Orc/CompileOnDemandLayer.h
index be68133da1a4..65295f97e2c6 100644
--- a/llvm/include/llvm/ExecutionEngine/Orc/CompileOnDemandLayer.h
+++ b/llvm/include/llvm/ExecutionEngine/Orc/CompileOnDemandLayer.h
@@ -393,50 +393,49 @@ class LegacyCompileOnDemandLayer {
 
     // Create stub functions.
     const DataLayout &DL = SrcM.getDataLayout();
-    {
-      typename IndirectStubsMgrT::StubInitsMap StubInits;
-      for (auto &F : SrcM) {
-        // Skip declarations.
-        if (F.isDeclaration())
-          continue;
 
-        // Skip weak functions for which we already have definitions.
-        auto MangledName = mangle(F.getName(), DL);
-        if (F.hasWeakLinkage() || F.hasLinkOnceLinkage()) {
-          if (auto Sym = LD.findSymbol(BaseLayer, MangledName, false))
-            continue;
-          else if (auto Err = Sym.takeError())
-            return Err;
-        }
+    typename IndirectStubsMgrT::StubInitsMap StubInits;
+    for (auto &F : SrcM) {
+      // Skip declarations.
+      if (F.isDeclaration())
+        continue;
 
-        // Record all functions defined by this module.
-        if (CloneStubsIntoPartitions)
-          LD.getStubsToClone(LMId).insert(&F);
-
-        // Create a callback, associate it with the stub for the function,
-        // and set the compile action to compile the partition containing the
-        // function.
-        auto CompileAction = [this, &LD, LMId, &F]() -> JITTargetAddress {
-          if (auto FnImplAddrOrErr = this->extractAndCompile(LD, LMId, F))
-            return *FnImplAddrOrErr;
-          else {
-            // FIXME: Report error, return to 'abort' or something similar.
-            consumeError(FnImplAddrOrErr.takeError());
-            return 0;
-          }
-        };
-        if (auto CCAddr =
-                CompileCallbackMgr.getCompileCallback(std::move(CompileAction)))
-          StubInits[MangledName] =
-              std::make_pair(*CCAddr, JITSymbolFlags::fromGlobalValue(F));
-        else
-          return CCAddr.takeError();
+      // Skip weak functions for which we already have definitions.
+      auto MangledName = mangle(F.getName(), DL);
+      if (F.hasWeakLinkage() || F.hasLinkOnceLinkage()) {
+        if (auto Sym = LD.findSymbol(BaseLayer, MangledName, false))
+          continue;
+        else if (auto Err = Sym.takeError())
+          return Err;
       }
 
-      if (auto Err = LD.StubsMgr->createStubs(StubInits))
-        return Err;
+      // Record all functions defined by this module.
+      if (CloneStubsIntoPartitions)
+        LD.getStubsToClone(LMId).insert(&F);
+
+      // Create a callback, associate it with the stub for the function,
+      // and set the compile action to compile the partition containing the
+      // function.
+      auto CompileAction = [this, &LD, LMId, &F]() -> JITTargetAddress {
+        if (auto FnImplAddrOrErr = this->extractAndCompile(LD, LMId, F))
+          return *FnImplAddrOrErr;
+        else {
+          // FIXME: Report error, return to 'abort' or something similar.
+          consumeError(FnImplAddrOrErr.takeError());
+          return 0;
+        }
+      };
+      if (auto CCAddr =
+              CompileCallbackMgr.getCompileCallback(std::move(CompileAction)))
+        StubInits[MangledName] =
+            std::make_pair(*CCAddr, JITSymbolFlags::fromGlobalValue(F));
+      else
+        return CCAddr.takeError();
     }
 
+    if (auto Err = LD.StubsMgr->createStubs(StubInits))
+      return Err;
+
     // If this module doesn't contain any globals, aliases, or module flags then
     // we can bail out early and avoid the overhead of creating and managing an
     // empty globals module.


        


More information about the llvm-commits mailing list