Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 20 Aug 2018 23:37:50 +0000 (UTC)
From:      Jan Beich <jbeich@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r477690 - head/lang/beignet/files
Message-ID:  <201808202337.w7KNboJY005304@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jbeich
Date: Mon Aug 20 23:37:50 2018
New Revision: 477690
URL: https://svnweb.freebsd.org/changeset/ports/477690

Log:
  lang/beignet: unbreak with llvm70
  
  backend/src/backend/program.cpp:797:34: error: reference to type 'const llvm::Module' could not bind to an lvalue of type 'llvm::Module *'
          llvm::WriteBitcodeToFile(*out_module, ostream);
                                   ^~~~~~~~~~~
  /usr/local/llvm70/include/llvm/Bitcode/BitcodeWriter.h:129:41: note: passing argument to parameter 'M' here
    void WriteBitcodeToFile(const Module &M, raw_ostream &Out,
                                          ^
  backend/src/llvm/llvm_bitcode_link.cpp:343:36: error: no matching function for call to 'CloneModule'
      llvm::Module * linked_module = llvm::CloneModule((llvm::Module*)mod).release();
                                     ^~~~~~~~~~~~~~~~~
  /usr/local/llvm70/include/llvm/Transforms/Utils/Cloning.h:52:25: note: candidate function not viable: no known conversion from 'llvm::Module *' to 'const llvm::Module' for 1st argument; dereference the argument with *
  std::unique_ptr<Module> CloneModule(const Module &M);
                          ^
  /usr/local/llvm70/include/llvm/Transforms/Utils/Cloning.h:53:25: note: candidate function not viable: requires 2 arguments, but 1 was provided
  std::unique_ptr<Module> CloneModule(const Module &M, ValueToValueMapTy &VMap);
                          ^
  /usr/local/llvm70/include/llvm/Transforms/Utils/Cloning.h:60:1: note: candidate function not viable: requires 3 arguments, but 1 was provided
  CloneModule(const Module &M, ValueToValueMapTy &VMap,
  ^
  backend/src/llvm/ExpandLargeIntegers.cpp:230:5: error: use of undeclared identifier 'DEBUG'
      DEBUG(dbgs() << "\tRecording as forward PHI\n");
      ^
  backend/src/llvm/ExpandLargeIntegers.cpp:237:5: error: use of undeclared identifier 'DEBUG'
      DEBUG(dbgs() << "\tTo:  " << *To.Lo << "\n");
      ^
  backend/src/llvm/ExpandLargeIntegers.cpp:238:5: error: use of undeclared identifier 'DEBUG'
      DEBUG(dbgs() << "\tAnd: " << *To.Hi << "\n");
      ^
  backend/src/llvm/ExpandLargeIntegers.cpp:247:5: error: use of undeclared identifier 'DEBUG'
      DEBUG(dbgs() << "\tTo:  " << *To << "\n");
      ^
  backend/src/llvm/ExpandLargeIntegers.cpp:256:11: error: expected expression
      DEBUG(if (!ForwardPHIs.empty()) dbgs() << "Patching forward PHIs:\n");
            ^
  backend/src/llvm/ExpandLargeIntegers.cpp:261:7: error: use of undeclared identifier 'DEBUG'
        DEBUG(dbgs() << "\t" << *F.Lo << "\n\t" << *F.Hi << "\n");
        ^
  backend/src/llvm/ExpandLargeIntegers.cpp:389:3: error: use of undeclared identifier 'DEBUG'
    DEBUG(dbgs() << "Expanding Large Integer: " << *Inst << "\n");
    ^
  backend/src/llvm/llvm_to_gen.cpp:142:13: error: use of undeclared identifier 'createInstructionCombiningPass'; did you mean 'createFunctionInliningPass'?
      MPM.add(createInstructionCombiningPass());// Clean up after IPCP & DAE
              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  backend/src/llvm/llvm_to_gen.cpp:164:13: error: use of undeclared identifier 'createInstructionCombiningPass'; did you mean 'createFunctionInliningPass'?
      MPM.add(createInstructionCombiningPass());  // Combine silly seq's
              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  backend/src/llvm/llvm_to_gen.cpp:172:13: error: use of undeclared identifier 'createInstructionCombiningPass'; did you mean 'createFunctionInliningPass'?
      MPM.add(createInstructionCombiningPass());
              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  backend/src/llvm/llvm_to_gen.cpp:209:13: error: use of undeclared identifier 'createInstructionCombiningPass'; did you mean 'createFunctionInliningPass'?
      MPM.add(createInstructionCombiningPass());
              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  backend/src/llvm/llvm_to_gen.cpp:215:13: error: use of undeclared identifier 'createInstructionCombiningPass'; did you mean 'createFunctionInliningPass'?
      MPM.add(createInstructionCombiningPass());  // Clean up after everything.
              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  backend/src/llvm/llvm_to_gen.cpp:366:16: error: use of undeclared identifier 'createPromoteMemoryToRegisterPass'
      passes.add(createPromoteMemoryToRegisterPass());
                 ^
  backend/src/llvm/llvm_to_gen.cpp:373:16: error: use of undeclared identifier 'createInstructionCombiningPass'; did you mean 'createFunctionInliningPass'?
      passes.add(createInstructionCombiningPass());  // legalize will generate some silly instructions
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  backend/src/llvm/llvm_to_gen.cpp:380:16: error: use of undeclared identifier 'createLowerSwitchPass'; did you mean 'createLoopUnswitchPass'?
      passes.add(createLowerSwitchPass());           // simplify cfg will generate switch-case instruction
                 ^~~~~~~~~~~~~~~~~~~~~
  backend/src/backend/gen_program.cpp:452:32: error: reference to type 'const llvm::Module' could not bind to an rvalue of type 'llvm::Module *'
        llvm::WriteBitcodeToFile((llvm::Module*)prog->module, OS);
                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~
  /usr/local/llvm70/include/llvm/Bitcode/BitcodeWriter.h:129:41: note: passing argument to parameter 'M' here
    void WriteBitcodeToFile(const Module &M, raw_ostream &Out,
                                          ^
  backend/src/backend/gen_program.cpp:543:29: error: no matching function for call to 'CloneModule'
        llvm::Module* clone = llvm::CloneModule(src).release();
                              ^~~~~~~~~~~~~~~~~
  /usr/local/llvm70/include/llvm/Transforms/Utils/Cloning.h:52:25: note: candidate function not viable: no known conversion from 'llvm::Module *' to 'const llvm::Module' for 1st argument; dereference the argument with *
  std::unique_ptr<Module> CloneModule(const Module &M);
                          ^
  /usr/local/llvm70/include/llvm/Transforms/Utils/Cloning.h:53:25: note: candidate function not viable: requires 2 arguments, but 1 was provided
  std::unique_ptr<Module> CloneModule(const Module &M, ValueToValueMapTy &VMap);
                          ^
  /usr/local/llvm70/include/llvm/Transforms/Utils/Cloning.h:60:1: note: candidate function not viable: requires 3 arguments, but 1 was provided
  CloneModule(const Module &M, ValueToValueMapTy &VMap,
  ^
  backend/src/backend/gen_program.cpp:452:32: error: reference to type 'const llvm::Module' could not bind to an rvalue of type 'llvm::Module *'
        llvm::WriteBitcodeToFile((llvm::Module*)prog->module, OS);
                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~
  /usr/local/llvm70/include/llvm/Bitcode/BitcodeWriter.h:129:41: note: passing argument to parameter 'M' here
    void WriteBitcodeToFile(const Module &M, raw_ostream &Out,
                                          ^
  
  Obtained from:	upstream (via Debian)
  Approved by:	portmgr blanket

Added:
  head/lang/beignet/files/patch-llvm7   (contents, props changed)
Modified:
  head/lang/beignet/files/patch-llvm6   (contents, props changed)

Modified: head/lang/beignet/files/patch-llvm6
==============================================================================
--- head/lang/beignet/files/patch-llvm6	Mon Aug 20 23:36:12 2018	(r477689)
+++ head/lang/beignet/files/patch-llvm6	Mon Aug 20 23:37:50 2018	(r477690)
@@ -1,20 +1,22 @@
-backend/src/llvm/llvm_unroll.cpp:209:22: error: no member named 'markAsRemoved' in 'llvm::LoopInfo'
-            loopInfo.markAsRemoved(parentL);
-            ~~~~~~~~ ^
-backend/src/llvm/llvm_to_gen.cpp:325:43: error: reference to type 'std::unique_ptr<DiagnosticHandler>' could not bind to an rvalue of type 'void (*)(const llvm::DiagnosticInfo &, void *)'
-    mod.getContext().setDiagnosticHandler(&gbeDiagnosticHandler,&dc);
-                                          ^~~~~~~~~~~~~~~~~~~~~
-/usr/local/llvm60/include/llvm/IR/LLVMContext.h:213:66: note: passing argument to parameter 'DH' here
-  void setDiagnosticHandler(std::unique_ptr<DiagnosticHandler> &&DH,
-                                                                 ^
+commit 6e60548adee0
+Author: Rebecca N. Palmer <rebecca_palmer@zoho.com>
+Date:   Sat Jul 21 20:04:00 2018 +0100
 
+    Add LLVM 6.0 support
+    
+    LLVMContext::setDiagnosticHandler and LoopInfo::markAsRemoved
+    have been renamed.
+    
+    Signed-off-by: Rebecca N. Palmer <rebecca_palmer@zoho.com>
+    Reviewed-by: Yang Rong <rong.r.yang@intel.com>
+
 --- backend/src/llvm/llvm_to_gen.cpp.orig	2017-10-24 06:04:48 UTC
 +++ backend/src/llvm/llvm_to_gen.cpp
 @@ -322,7 +322,11 @@ namespace gbe
      DataLayout DL(&mod);
      
      gbeDiagnosticContext dc;
-+#if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 60
++#if LLVM_VERSION_MAJOR >= 6
 +    mod.getContext().setDiagnosticHandlerCallBack(&gbeDiagnosticHandler,&dc);
 +#else
      mod.getContext().setDiagnosticHandler(&gbeDiagnosticHandler,&dc);
@@ -29,7 +31,7 @@ backend/src/llvm/llvm_to_gen.cpp:325:43: error: refere
              //Don't change the unrollID if doesn't force unroll.
              //setUnrollID(parentL, false);
 -#if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 38
-+#if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 60
++#if LLVM_VERSION_MAJOR >= 6
 +            loopInfo.erase(parentL);
 +#elif LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 38
              loopInfo.markAsRemoved(parentL);

Added: head/lang/beignet/files/patch-llvm7
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/lang/beignet/files/patch-llvm7	Mon Aug 20 23:37:50 2018	(r477690)
@@ -0,0 +1,112 @@
+commit e1b2419a0008
+Author: Rebecca N. Palmer <rebecca_palmer@zoho.com>
+Date:   Sat Jul 21 20:05:54 2018 +0100
+
+    Add preliminary LLVM 7 support
+    
+    This is preliminary because LLVM 7 has not been released yet:
+    it was tested with the snapshot from Debian experimental (svn336894).
+    
+    1.Change linking order, as clangCodeGen now links to clangFrontend
+    2.Pass references not pointers to WriteBitcodeToFile and CloneModule
+    3.Add the headers that LoopSimplifyID, LCSSAID and
+    some create*Pass have moved to
+    4.Define our DEBUG whether or not we just undefined LLVM's
+    (theirs is now LLVM_DEBUG, but we never actually use it)
+    
+    Signed-off-by: Rebecca N. Palmer <rebecca_palmer@zoho.com>
+    Reviewed-by: Yang Rong <rong.r.yang@intel.com>
+
+--- CMake/FindLLVM.cmake.orig	2017-09-22 08:05:22 UTC
++++ CMake/FindLLVM.cmake
+@@ -113,10 +113,10 @@ macro(add_one_lib name)
+ endmacro()
+ 
+ #Assume clang lib path same as llvm lib path
++add_one_lib("clangCodeGen")
+ add_one_lib("clangFrontend")
+ add_one_lib("clangSerialization")
+ add_one_lib("clangDriver")
+-add_one_lib("clangCodeGen")
+ add_one_lib("clangSema")
+ add_one_lib("clangStaticAnalyzerFrontend")
+ add_one_lib("clangStaticAnalyzerCheckers")
+--- backend/src/backend/gen_program.cpp.orig	2017-10-24 06:04:48 UTC
++++ backend/src/backend/gen_program.cpp
+@@ -449,7 +449,11 @@ namespace gbe {
+ #ifdef GBE_COMPILER_AVAILABLE
+       std::string str;
+       llvm::raw_string_ostream OS(str);
++#if LLVM_VERSION_MAJOR >= 7
++      llvm::WriteBitcodeToFile(*((llvm::Module*)prog->module), OS);
++#else
+       llvm::WriteBitcodeToFile((llvm::Module*)prog->module, OS);
++#endif
+       std::string& bin_str = OS.str();
+       int llsz = bin_str.size();
+       *binary = (char *)malloc(sizeof(char) * (llsz+1) );
+@@ -540,7 +544,11 @@ namespace gbe {
+                                     &modRef);
+         src = llvm::unwrap(modRef);
+       }
++#if LLVM_VERSION_MAJOR >= 7
++      llvm::Module* clone = llvm::CloneModule(*src).release();
++#else
+       llvm::Module* clone = llvm::CloneModule(src).release();
++#endif
+       if (LLVMLinkModules2(wrap(dst), wrap(clone))) {
+ #elif LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 37
+       if (LLVMLinkModules(wrap(dst), wrap(src), LLVMLinkerPreserveSource_Removed, &errMsg)) {
+--- backend/src/backend/program.cpp.orig	2017-10-24 06:04:48 UTC
++++ backend/src/backend/program.cpp
+@@ -794,7 +794,11 @@ namespace gbe {
+       llvm::raw_fd_ostream ostream (dumpSPIRBinaryName.c_str(),
+                                     err, llvm::sys::fs::F_None);
+       if (!err)
++#if LLVM_VERSION_MAJOR<7
+         llvm::WriteBitcodeToFile(*out_module, ostream);
++#else
++        llvm::WriteBitcodeToFile(**out_module, ostream);
++#endif
+     }
+ #endif
+     return true;
+--- backend/src/llvm/ExpandLargeIntegers.cpp.orig	2017-10-24 06:04:48 UTC
++++ backend/src/llvm/ExpandLargeIntegers.cpp
+@@ -99,8 +99,8 @@ using namespace llvm;
+ 
+ #ifdef DEBUG
+   #undef DEBUG
+-  #define DEBUG(...)
+ #endif
++#define DEBUG(...)
+ // Break instructions up into no larger than 64-bit chunks.
+ static const unsigned kChunkBits = 64;
+ static const unsigned kChunkBytes = kChunkBits / CHAR_BIT;
+--- backend/src/llvm/llvm_bitcode_link.cpp.orig	2017-10-24 06:04:48 UTC
++++ backend/src/llvm/llvm_bitcode_link.cpp
+@@ -340,7 +340,11 @@ namespace gbe
+     /* We use beignet's bitcode as dst because it will have a lot of
+        lazy functions which will not be loaded. */
+ #if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 39
++#if LLVM_VERSION_MAJOR >= 7
++    llvm::Module * linked_module = llvm::CloneModule(*(llvm::Module*)mod).release();
++#else
+     llvm::Module * linked_module = llvm::CloneModule((llvm::Module*)mod).release();
++#endif
+     if(LLVMLinkModules2(wrap(clonedLib), wrap(linked_module))) {
+ #else
+     char* errorMsg;
+--- backend/src/llvm/llvm_includes.hpp.orig	2017-10-24 06:04:48 UTC
++++ backend/src/llvm/llvm_includes.hpp
+@@ -89,6 +89,10 @@
+ #include "llvm/CodeGen/IntrinsicLowering.h"
+ 
+ #include "llvm/Transforms/Scalar.h"
++#if LLVM_VERSION_MAJOR >= 7
++#include "llvm/Transforms/Utils.h"
++#include "llvm/Transforms/InstCombine/InstCombine.h"
++#endif
+ #include "llvm/MC/MCAsmInfo.h"
+ #include "llvm/MC/MCContext.h"
+ #include "llvm/MC/MCInstrInfo.h"



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201808202337.w7KNboJY005304>