You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by tq...@apache.org on 2020/09/23 02:44:35 UTC

[incubator-tvm] branch master updated: Add the SYSTEM keyword to all cmake include_directories commands for 3rd party or external headers. Warning flags should only be applied to code within the tvm repository. (#6531)

This is an automated email from the ASF dual-hosted git repository.

tqchen pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-tvm.git


The following commit(s) were added to refs/heads/master by this push:
     new b8474c8  Add the SYSTEM keyword to all cmake include_directories commands for 3rd party or external headers. Warning flags should only be applied to code within the tvm repository. (#6531)
b8474c8 is described below

commit b8474c80e3070af346cadbf2eafd4ab50936b2ef
Author: Robert Kimball <bo...@gmail.com>
AuthorDate: Tue Sep 22 19:44:26 2020 -0700

    Add the SYSTEM keyword to all cmake include_directories commands for 3rd party or external headers. Warning flags should only be applied to code within the tvm repository. (#6531)
---
 CMakeLists.txt                                    |  4 ++--
 apps/tf_tvmdsoop/CMakeLists.txt                   |  4 ++--
 cmake/modules/CUDA.cmake                          |  2 +-
 cmake/modules/Hexagon.cmake                       | 10 +++++-----
 cmake/modules/LLVM.cmake                          |  2 +-
 cmake/modules/OpenCL.cmake                        |  2 +-
 cmake/modules/ROCM.cmake                          |  2 +-
 cmake/modules/VTA.cmake                           | 10 +++++-----
 cmake/modules/Vulkan.cmake                        |  2 +-
 cmake/modules/contrib/BLAS.cmake                  |  6 +++---
 cmake/modules/contrib/EthosN.cmake                |  2 +-
 src/printer/tir_hybrid_printer.cc                 |  2 +-
 src/runtime/cuda/cuda_device_api.cc               |  2 +-
 src/runtime/cuda/cuda_module.cc                   |  6 +++---
 src/runtime/hexagon/sim/driver/CMakeLists.txt     |  2 ++
 src/runtime/hexagon/target/fastrpc/CMakeLists.txt | 18 +++++++++---------
 src/target/llvm/codegen_amdgpu.cc                 |  2 +-
 src/target/llvm/codegen_cpu.cc                    | 12 +++++++-----
 src/target/llvm/codegen_hexagon.cc                |  2 +-
 src/target/llvm/codegen_llvm.cc                   |  4 ++--
 src/target/llvm/codegen_nvptx.cc                  |  2 +-
 21 files changed, 51 insertions(+), 47 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 0e53a71..c6906e8 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -399,7 +399,7 @@ if(BUILD_FOR_HEXAGON)
   set_target_properties(tvm_runtime PROPERTIES LINK_FLAGS
                         "-Wl,--wrap=pthread_create")
 
-  target_include_directories(tvm_runtime
+  target_include_directories(tvm_runtime SYSTEM
     PUBLIC "${USE_HEXAGON_SDK}/libs/common/qurt/ADSPv62MP/include/posix"
     PUBLIC "${USE_HEXAGON_SDK}/libs/common/qurt/ADSPv62MP/include/qurt"
     PUBLIC "${USE_HEXAGON_SDK}/incs"
@@ -462,7 +462,7 @@ if(GTEST_INCLUDE_DIR AND GTEST_LIB)
     string(REPLACE ".cc" "" __execname ${__srcname})
     add_executable(${__execname} ${__srcpath})
     list(APPEND TEST_EXECS ${__execname})
-    target_include_directories(${__execname} PUBLIC ${GTEST_INCLUDE_DIR})
+    target_include_directories(${__execname} SYSTEM PUBLIC ${GTEST_INCLUDE_DIR})
     target_link_libraries(${__execname} ${TVM_TEST_LIBRARY_NAME} ${GTEST_LIB} pthread dl)
     set_target_properties(${__execname} PROPERTIES EXCLUDE_FROM_ALL 1)
     set_target_properties(${__execname} PROPERTIES EXCLUDE_FROM_DEFAULT_BUILD 1)
diff --git a/apps/tf_tvmdsoop/CMakeLists.txt b/apps/tf_tvmdsoop/CMakeLists.txt
index f4e83c5..9be5da9 100644
--- a/apps/tf_tvmdsoop/CMakeLists.txt
+++ b/apps/tf_tvmdsoop/CMakeLists.txt
@@ -22,8 +22,8 @@ set(BUILD_TVMDSOOP_ONLY ON)
 set(CMAKE_CURRENT_SOURCE_DIR ${TVM_ROOT})
 set(CMAKE_CURRENT_BINARY_DIR ${TVM_ROOT}/build)
 
-include_directories(${TVM_ROOT}/3rdparty/dlpack/include/)
-include_directories(${TVM_ROOT}/3rdparty/dmlc-core/include/)
+include_directories(SYSTEM ${TVM_ROOT}/3rdparty/dlpack/include/)
+include_directories(SYSTEM ${TVM_ROOT}/3rdparty/dmlc-core/include/)
 include_directories(${TVM_ROOT}/include)
 
 link_directories(${TVM_ROOT}/build)
diff --git a/cmake/modules/CUDA.cmake b/cmake/modules/CUDA.cmake
index 936bb68..2583e8f 100644
--- a/cmake/modules/CUDA.cmake
+++ b/cmake/modules/CUDA.cmake
@@ -21,7 +21,7 @@ find_cuda(${USE_CUDA})
 if(CUDA_FOUND)
   # always set the includedir when cuda is available
   # avoid global retrigger of cmake
-	include_directories(${CUDA_INCLUDE_DIRS})
+	include_directories(SYSTEM ${CUDA_INCLUDE_DIRS})
 endif(CUDA_FOUND)
 
 if(USE_CUDA)
diff --git a/cmake/modules/Hexagon.cmake b/cmake/modules/Hexagon.cmake
index 30b4ccb..9fc806c 100644
--- a/cmake/modules/Hexagon.cmake
+++ b/cmake/modules/Hexagon.cmake
@@ -76,7 +76,7 @@ if(USE_HEXAGON_DEVICE STREQUAL "${PICK_SIM}")
   find_hexagon_toolchain()
   message(STATUS "Hexagon toolchain: ${HEXAGON_TOOLCHAIN}")
   file(GLOB RUNTIME_HEXAGON_SIM_SRCS src/runtime/hexagon/sim/*.cc)
-  include_directories("${HEXAGON_TOOLCHAIN}/include/iss")
+  include_directories(SYSTEM "${HEXAGON_TOOLCHAIN}/include/iss")
   link_directories("${HEXAGON_TOOLCHAIN}/lib/iss")
   list(APPEND TVM_RUNTIME_LINKER_LIBS "-lwrapper")
   ExternalProject_Add(sim_dev
@@ -91,11 +91,11 @@ elseif(USE_HEXAGON_DEVICE STREQUAL "${PICK_HW}")
   find_hexagon_toolchain()
   message(STATUS "Hexagon SDK: ${HEXAGON_SDK_ROOT}")
   file(GLOB RUNTIME_HEXAGON_DEVICE_SRCS src/runtime/hexagon/target/*.cc)
-  include_directories("${HEXAGON_SDK_ROOT}/incs/stddef")
-  include_directories("${HEXAGON_SDK_ROOT}/libs/common/rpcmem/inc")
+  include_directories(SYSTEM "${HEXAGON_SDK_ROOT}/incs/stddef")
+  include_directories(SYSTEM "${HEXAGON_SDK_ROOT}/libs/common/rpcmem/inc")
   include_directories(
-      "${HEXAGON_SDK_ROOT}/libs/common/remote/ship/android_Release_aarch64")
-  include_directories("${HEXAGON_TOOLCHAIN}/include/iss")
+      SYSTEM "${HEXAGON_SDK_ROOT}/libs/common/remote/ship/android_Release_aarch64")
+  include_directories(SYSTEM "${HEXAGON_TOOLCHAIN}/include/iss")
   list(APPEND TVM_RUNTIME_LINKER_LIBS "dl")
   if(BUILD_FOR_ANDROID)
     # Hexagon runtime uses __android_log_print, which is in liblog.
diff --git a/cmake/modules/LLVM.cmake b/cmake/modules/LLVM.cmake
index be6d0fb..d002029 100644
--- a/cmake/modules/LLVM.cmake
+++ b/cmake/modules/LLVM.cmake
@@ -20,7 +20,7 @@ add_definitions(-DDMLC_USE_FOPEN64=0)
 
 if(NOT USE_LLVM STREQUAL "OFF")
   find_llvm(${USE_LLVM})
-  include_directories(${LLVM_INCLUDE_DIRS})
+  include_directories(SYSTEM ${LLVM_INCLUDE_DIRS})
   add_definitions(${LLVM_DEFINITIONS})
   message(STATUS "Build with LLVM " ${LLVM_PACKAGE_VERSION})
   message(STATUS "Set TVM_LLVM_VERSION=" ${TVM_LLVM_VERSION})
diff --git a/cmake/modules/OpenCL.cmake b/cmake/modules/OpenCL.cmake
index 64ce3c3..a82c080 100644
--- a/cmake/modules/OpenCL.cmake
+++ b/cmake/modules/OpenCL.cmake
@@ -21,7 +21,7 @@ find_opencl(${USE_OPENCL})
 if(OpenCL_FOUND)
   # always set the includedir when cuda is available
   # avoid global retrigger of cmake
-  include_directories(${OpenCL_INCLUDE_DIRS})
+  include_directories(SYSTEM ${OpenCL_INCLUDE_DIRS})
 endif(OpenCL_FOUND)
 
 if(USE_SDACCEL)
diff --git a/cmake/modules/ROCM.cmake b/cmake/modules/ROCM.cmake
index a28b37e..ec348f8 100644
--- a/cmake/modules/ROCM.cmake
+++ b/cmake/modules/ROCM.cmake
@@ -21,7 +21,7 @@ find_rocm(${USE_ROCM})
 if(ROCM_FOUND)
   # always set the includedir
   # avoid global retrigger of cmake
-  include_directories(${ROCM_INCLUDE_DIRS})
+  include_directories(SYSTEM ${ROCM_INCLUDE_DIRS})
   add_definitions(-D__HIP_PLATFORM_HCC__=1)
 endif(ROCM_FOUND)
 
diff --git a/cmake/modules/VTA.cmake b/cmake/modules/VTA.cmake
index fd3a121..a9fc665 100644
--- a/cmake/modules/VTA.cmake
+++ b/cmake/modules/VTA.cmake
@@ -59,7 +59,7 @@ elseif(PYTHON)
     list(APPEND FSIM_RUNTIME_SRCS ${VTA_HW_PATH}/src/vmem/virtual_memory.cc)
     # Target lib: vta_fsim
     add_library(vta_fsim SHARED ${FSIM_RUNTIME_SRCS})
-    target_include_directories(vta_fsim PUBLIC ${VTA_HW_PATH}/include)
+    target_include_directories(vta_fsim SYSTEM PUBLIC ${VTA_HW_PATH}/include)
     foreach(__def ${VTA_DEFINITIONS})
       string(SUBSTRING ${__def} 3 -1 __strip_def)
       target_compile_definitions(vta_fsim PUBLIC ${__strip_def})
@@ -80,7 +80,7 @@ elseif(PYTHON)
     list(APPEND TSIM_RUNTIME_SRCS ${VTA_HW_PATH}/src/vmem/virtual_memory.cc)
     # Target lib: vta_tsim
     add_library(vta_tsim SHARED ${TSIM_RUNTIME_SRCS})
-    target_include_directories(vta_tsim PUBLIC ${VTA_HW_PATH}/include)
+    target_include_directories(vta_tsim SYSTEM PUBLIC ${VTA_HW_PATH}/include)
     foreach(__def ${VTA_DEFINITIONS})
       string(SUBSTRING ${__def} 3 -1 __strip_def)
       target_compile_definitions(vta_tsim PUBLIC ${__strip_def})
@@ -116,9 +116,9 @@ elseif(PYTHON)
       target_link_libraries(vta ${__cma_lib})
     elseif(${VTA_TARGET} STREQUAL "de10nano")  # DE10-Nano rules
      #target_compile_definitions(vta PUBLIC VTA_MAX_XFER=2097152) # (1<<21)
-      target_include_directories(vta PUBLIC ${VTA_HW_PATH}/src/de10nano)
-      target_include_directories(vta PUBLIC 3rdparty)
-      target_include_directories(vta PUBLIC
+      target_include_directories(vta SYSTEM PUBLIC ${VTA_HW_PATH}/src/de10nano)
+      target_include_directories(vta SYSTEM PUBLIC 3rdparty)
+      target_include_directories(vta SYSTEM PUBLIC
         "/usr/local/intelFPGA_lite/18.1/embedded/ds-5/sw/gcc/arm-linux-gnueabihf/include")
     endif()
   endif()
diff --git a/cmake/modules/Vulkan.cmake b/cmake/modules/Vulkan.cmake
index 29fcfe9..4df8986 100644
--- a/cmake/modules/Vulkan.cmake
+++ b/cmake/modules/Vulkan.cmake
@@ -29,7 +29,7 @@ tvm_option(USE_VULKAN_VALIDATION "Enable Vulkan API validation layers" OFF
 if(Vulkan_FOUND)
   # always set the includedir
   # avoid global retrigger of cmake
-  include_directories(${Vulkan_INCLUDE_DIRS})
+  include_directories(SYSTEM ${Vulkan_INCLUDE_DIRS})
 endif(Vulkan_FOUND)
 
 if(USE_VULKAN)
diff --git a/cmake/modules/contrib/BLAS.cmake b/cmake/modules/contrib/BLAS.cmake
index e8c8e22..06c8755 100644
--- a/cmake/modules/contrib/BLAS.cmake
+++ b/cmake/modules/contrib/BLAS.cmake
@@ -27,7 +27,7 @@ elseif(USE_BLAS STREQUAL "atlas" OR USE_BLAS STREQUAL "blas")
   message(STATUS "Use BLAS library " ${BLAS_LIBRARY})
 elseif(USE_BLAS STREQUAL "apple")
   find_library(BLAS_LIBRARY Accelerate)
-  include_directories(${BLAS_LIBRARY}/Versions/Current/Frameworks/vecLib.framework/Versions/Current/Headers/)
+  include_directories(SYSTEM ${BLAS_LIBRARY}/Versions/Current/Frameworks/vecLib.framework/Versions/Current/Headers/)
   list(APPEND TVM_RUNTIME_LINKER_LIBS ${BLAS_LIBRARY})
   list(APPEND RUNTIME_SRCS src/runtime/contrib/cblas/cblas.cc)
   message(STATUS "Use BLAS library " ${BLAS_LIBRARY})
@@ -57,7 +57,7 @@ if(USE_MKL OR USE_MKL_PATH)
   elseif(MSVC)
     find_library(BLAS_LIBRARY_MKL NAMES mkl_rt HINTS ${USE_MKL}/lib/ ${USE_MKL}/lib/intel64_win)
   endif()
-  include_directories(${USE_MKL}/include)
+  include_directories(SYSTEM ${USE_MKL}/include)
   list(APPEND TVM_RUNTIME_LINKER_LIBS ${BLAS_LIBRARY_MKL})
   list(APPEND RUNTIME_SRCS src/runtime/contrib/cblas/mkl.cc)
   add_definitions(-DUSE_MKL_BLAS=1)
@@ -69,7 +69,7 @@ if(IS_DIRECTORY ${USE_MKLDNN})
   if (MKLDNN_LIBRARY STREQUAL "MKLDNN_LIBRARY-NOTFOUND")
     message(WARNING "Cannot find MKLDNN library at ${USE_MKLDNN}.")
   else()
-    include_directories(${USE_MKLDNN}/include)
+    include_directories(SYSTEM ${USE_MKLDNN}/include)
     list(APPEND TVM_RUNTIME_LINKER_LIBS ${MKLDNN_LIBRARY})
     list(APPEND RUNTIME_SRCS src/runtime/contrib/cblas/mkldnn.cc)
     add_definitions(-DUSE_DNNL=1)
diff --git a/cmake/modules/contrib/EthosN.cmake b/cmake/modules/contrib/EthosN.cmake
index ca1f7da..44d2a2a 100644
--- a/cmake/modules/contrib/EthosN.cmake
+++ b/cmake/modules/contrib/EthosN.cmake
@@ -24,7 +24,7 @@ if(NOT USE_ETHOSN STREQUAL "OFF")
     message(FATAL_ERROR "Cannot find Ethos-N, USE_ETHOSN=" ${USE_ETHOSN})
 
   else()
-    include_directories(${ETHOSN_INCLUDE_DIRS})
+    include_directories(SYSTEM ${ETHOSN_INCLUDE_DIRS})
     add_definitions(${ETHOSN_DEFINITIONS})
 
     message(STATUS "Build with Ethos-N ${ETHOSN_PACKAGE_VERSION}")
diff --git a/src/printer/tir_hybrid_printer.cc b/src/printer/tir_hybrid_printer.cc
index b58e5fc..0fadf17 100644
--- a/src/printer/tir_hybrid_printer.cc
+++ b/src/printer/tir_hybrid_printer.cc
@@ -68,7 +68,7 @@ class TIRHybridPrinter : public StmtFunctor<Doc(const Stmt&)>,
   std::unordered_set<const VarNode*> var_not_in_headers;
   /*! \brief buffer collector (buffer defined in BufferMap and BufferAllocation)*/
   std::unordered_set<const BufferNode*> buf_not_in_headers;
-  /*! \breif Map from Var to thread env name */
+  /*! \brief Map from Var to thread env name */
   std::unordered_map<Var, String, ObjectPtrHash, ObjectPtrEqual> var_env_map_;
   /*! \brief Map from Var to Doc */
   std::unordered_map<Var, Doc, ObjectPtrHash, ObjectPtrEqual> memo_var_;
diff --git a/src/runtime/cuda/cuda_device_api.cc b/src/runtime/cuda/cuda_device_api.cc
index b69ecf2..f7b88cc 100644
--- a/src/runtime/cuda/cuda_device_api.cc
+++ b/src/runtime/cuda/cuda_device_api.cc
@@ -217,7 +217,7 @@ class CUDADeviceAPI final : public DeviceAPI {
  private:
   static void GPUCopy(const void* from, void* to, size_t size, cudaMemcpyKind kind,
                       cudaStream_t stream) {
-    if (stream != 0) {
+    if (stream != nullptr) {
       CUDA_CALL(cudaMemcpyAsync(to, from, size, kind, stream));
     } else {
       CUDA_CALL(cudaMemcpy(to, from, size, kind));
diff --git a/src/runtime/cuda/cuda_module.cc b/src/runtime/cuda/cuda_module.cc
index 498a9b7..bf844c1 100644
--- a/src/runtime/cuda/cuda_module.cc
+++ b/src/runtime/cuda/cuda_module.cc
@@ -169,9 +169,9 @@ class CUDAWrappedFunc {
     }
     CUstream strm = static_cast<CUstream>(CUDAThreadEntry::ThreadLocal()->stream);
     ThreadWorkLoad wl = thread_axis_cfg_.Extract(args);
-    CUresult result =
-        cuLaunchKernel(fcache_[device_id], wl.grid_dim(0), wl.grid_dim(1), wl.grid_dim(2),
-                       wl.block_dim(0), wl.block_dim(1), wl.block_dim(2), 0, strm, void_args, 0);
+    CUresult result = cuLaunchKernel(fcache_[device_id], wl.grid_dim(0), wl.grid_dim(1),
+                                     wl.grid_dim(2), wl.block_dim(0), wl.block_dim(1),
+                                     wl.block_dim(2), 0, strm, void_args, nullptr);
     if (result != CUDA_SUCCESS && result != CUDA_ERROR_DEINITIALIZED) {
       const char* msg;
       cuGetErrorName(result, &msg);
diff --git a/src/runtime/hexagon/sim/driver/CMakeLists.txt b/src/runtime/hexagon/sim/driver/CMakeLists.txt
index 8632b49..a98cfe0 100644
--- a/src/runtime/hexagon/sim/driver/CMakeLists.txt
+++ b/src/runtime/hexagon/sim/driver/CMakeLists.txt
@@ -56,6 +56,8 @@ target_include_directories(sim_dev
   PUBLIC "."
   PUBLIC ".."
   PUBLIC "../../../../../include"
+)
+target_include_directories(sim_dev SYSTEM
   PUBLIC "../../../../../3rdparty/dlpack/include"
 )
 
diff --git a/src/runtime/hexagon/target/fastrpc/CMakeLists.txt b/src/runtime/hexagon/target/fastrpc/CMakeLists.txt
index 072b9ca..0d790d7 100644
--- a/src/runtime/hexagon/target/fastrpc/CMakeLists.txt
+++ b/src/runtime/hexagon/target/fastrpc/CMakeLists.txt
@@ -27,10 +27,10 @@ endif()
 set(FASTRPC_SRC "${CMAKE_CURRENT_SOURCE_DIR}")
 
 include_directories(include)
-include_directories(${HEXAGON_SDK_ROOT}/incs)
-include_directories(${HEXAGON_SDK_ROOT}/incs/stddef)
+include_directories(SYSTEM ${HEXAGON_SDK_ROOT}/incs)
+include_directories(SYSTEM ${HEXAGON_SDK_ROOT}/incs/stddef)
 include_directories(
-    ${HEXAGON_SDK_ROOT}/libs/common/remote/ship/android_Release_aarch64)
+    SYSTEM ${HEXAGON_SDK_ROOT}/libs/common/remote/ship/android_Release_aarch64)
 
 set(QAIC_EXE "${HEXAGON_SDK_ROOT}/tools/qaic/Ubuntu16/qaic")
 set(QAIC_FLAGS
@@ -96,9 +96,9 @@ if("${FASTRPC_LIBS}" STREQUAL "SKEL")
   endif()
 
   include_directories(
-      ${HEXAGON_SDK_ROOT}/libs/common/qurt/${HEXARCH_DIR}/include/qurt)
+      SYSTEM ${HEXAGON_SDK_ROOT}/libs/common/qurt/${HEXARCH_DIR}/include/qurt)
   include_directories(
-      ${HEXAGON_SDK_ROOT}/libs/common/qurt/${HEXARCH_DIR}/include/posix)
+      SYSTEM ${HEXAGON_SDK_ROOT}/libs/common/qurt/${HEXARCH_DIR}/include/posix)
 
   # Extra compile flags (both C and C++).
   set(EXTRA_COMP_FLAGS
@@ -158,11 +158,11 @@ if("${FASTRPC_LIBS}" STREQUAL "SKEL")
 else()
   # Stub libraries.
   #
-  include_directories(${HEXAGON_SDK_ROOT}/incs/a1std)
-  include_directories(${HEXAGON_SDK_ROOT}/incs/qlist)
-  include_directories(${HEXAGON_SDK_ROOT}/libs/common/rpcmem/inc)
+  include_directories(SYSTEM ${HEXAGON_SDK_ROOT}/incs/a1std)
+  include_directories(SYSTEM ${HEXAGON_SDK_ROOT}/incs/qlist)
+  include_directories(SYSTEM ${HEXAGON_SDK_ROOT}/libs/common/rpcmem/inc)
   link_directories(
-      ${HEXAGON_SDK_ROOT}/libs/common/remote/ship/android_Release_aarch64)
+      SYSTEM ${HEXAGON_SDK_ROOT}/libs/common/remote/ship/android_Release_aarch64)
 
   add_library(tvm_remote_nd_stub SHARED
       "${FASTRPC_SRC}/include/${TVM_REMOTE_ND_H}"
diff --git a/src/target/llvm/codegen_amdgpu.cc b/src/target/llvm/codegen_amdgpu.cc
index 205a8a4..1f6eedd 100644
--- a/src/target/llvm/codegen_amdgpu.cc
+++ b/src/target/llvm/codegen_amdgpu.cc
@@ -106,7 +106,7 @@ class CodeGenAMDGPU : public CodeGenLLVM {
       llvm::Type* type = llvm::ArrayType::get(DTypeToLLVMType(op->dtype), constant_size);
       // Allocate shared memory in global, address_space = 3
       llvm::GlobalVariable* global = new llvm::GlobalVariable(
-          *module_, type, false, llvm::GlobalValue::PrivateLinkage, 0, ".shared", nullptr,
+          *module_, type, false, llvm::GlobalValue::PrivateLinkage, nullptr, ".shared", nullptr,
           llvm::GlobalValue::NotThreadLocal, shared_address_space);
       if (global->getAlignment() < static_cast<uint32_t>(info.alignment)) {
 #if TVM_LLVM_VERSION >= 100
diff --git a/src/target/llvm/codegen_cpu.cc b/src/target/llvm/codegen_cpu.cc
index 127889d..5310454 100644
--- a/src/target/llvm/codegen_cpu.cc
+++ b/src/target/llvm/codegen_cpu.cc
@@ -225,8 +225,9 @@ void CodeGenCPU::AddMainFunction(const std::string& entry_func_name) {
   llvm::Function* f = module_->getFunction(entry_func_name);
   CHECK(f) << "Function " << entry_func_name << "does not in module";
   llvm::Type* type = llvm::ArrayType::get(t_char_, entry_func_name.length() + 1);
-  llvm::GlobalVariable* global = new llvm::GlobalVariable(
-      *module_, type, true, llvm::GlobalValue::WeakAnyLinkage, 0, runtime::symbol::tvm_module_main);
+  llvm::GlobalVariable* global =
+      new llvm::GlobalVariable(*module_, type, true, llvm::GlobalValue::WeakAnyLinkage, nullptr,
+                               runtime::symbol::tvm_module_main);
 #if TVM_LLVM_VERSION >= 100
   global->setAlignment(llvm::Align(1));
 #else
@@ -349,7 +350,7 @@ llvm::Value* CodeGenCPU::CreateCallExtern(Type ret_type, String global_symbol,
 
 llvm::GlobalVariable* CodeGenCPU::InitContextPtr(llvm::Type* p_type, std::string name) {
   llvm::GlobalVariable* gv = new llvm::GlobalVariable(
-      *module_, p_type, false, llvm::GlobalValue::LinkOnceAnyLinkage, 0, name);
+      *module_, p_type, false, llvm::GlobalValue::LinkOnceAnyLinkage, nullptr, name);
 #if TVM_LLVM_VERSION >= 100
   gv->setAlignment(llvm::Align(data_layout_->getTypeAllocSize(p_type)));
 #else
@@ -552,8 +553,9 @@ void CodeGenCPU::CreateParallelLaunch(const Stmt& body, int num_task) {
 }
 
 llvm::Value* CodeGenCPU::CreateStaticHandle() {
-  llvm::GlobalVariable* gv = new llvm::GlobalVariable(
-      *module_, t_void_p_, false, llvm::GlobalValue::PrivateLinkage, 0, "__tvm_static_handle");
+  llvm::GlobalVariable* gv =
+      new llvm::GlobalVariable(*module_, t_void_p_, false, llvm::GlobalValue::PrivateLinkage,
+                               nullptr, "__tvm_static_handle");
 #if TVM_LLVM_VERSION >= 100
   gv->setAlignment(llvm::Align(data_layout_->getTypeAllocSize(t_void_p_)));
 #else
diff --git a/src/target/llvm/codegen_hexagon.cc b/src/target/llvm/codegen_hexagon.cc
index c52f9b0..a7e96c9 100644
--- a/src/target/llvm/codegen_hexagon.cc
+++ b/src/target/llvm/codegen_hexagon.cc
@@ -237,7 +237,7 @@ llvm::Value* CodeGenHexagon::CreateCallExtern(Type ret_type, String global_symbo
 
 llvm::GlobalVariable* CodeGenHexagon::InitContextPtr(llvm::Type* p_type, std::string name) {
   llvm::GlobalVariable* gv = new llvm::GlobalVariable(
-      *module_, p_type, false, llvm::GlobalValue::LinkOnceAnyLinkage, 0, name);
+      *module_, p_type, false, llvm::GlobalValue::LinkOnceAnyLinkage, nullptr, name);
 #if TVM_LLVM_VERSION >= 100
   gv->setAlignment(llvm::Align(data_layout_->getTypeAllocSize(p_type)));
 #else
diff --git a/src/target/llvm/codegen_llvm.cc b/src/target/llvm/codegen_llvm.cc
index 4ffd6b2..cb04e6b 100644
--- a/src/target/llvm/codegen_llvm.cc
+++ b/src/target/llvm/codegen_llvm.cc
@@ -628,8 +628,8 @@ llvm::Constant* CodeGenLLVM::GetConstString(const std::string& str) {
   auto it = str_map_.find(str);
   if (it != str_map_.end()) return it->second;
   llvm::Type* type = llvm::ArrayType::get(t_char_, str.length() + 1);
-  llvm::GlobalVariable* global =
-      new llvm::GlobalVariable(*module_, type, true, llvm::GlobalValue::PrivateLinkage, 0, ".str");
+  llvm::GlobalVariable* global = new llvm::GlobalVariable(
+      *module_, type, true, llvm::GlobalValue::PrivateLinkage, nullptr, ".str");
 #if TVM_LLVM_VERSION >= 100
   global->setAlignment(llvm::Align(1));
 #else
diff --git a/src/target/llvm/codegen_nvptx.cc b/src/target/llvm/codegen_nvptx.cc
index e9999f1..601df86 100644
--- a/src/target/llvm/codegen_nvptx.cc
+++ b/src/target/llvm/codegen_nvptx.cc
@@ -82,7 +82,7 @@ class CodeGenNVPTX : public CodeGenLLVM {
       llvm::Type* type = llvm::ArrayType::get(DTypeToLLVMType(op->dtype), constant_size);
       // Allocate shared memory in global, address_space = 3
       llvm::GlobalVariable* global = new llvm::GlobalVariable(
-          *module_, type, false, llvm::GlobalValue::PrivateLinkage, 0, ".shared", nullptr,
+          *module_, type, false, llvm::GlobalValue::PrivateLinkage, nullptr, ".shared", nullptr,
           llvm::GlobalValue::NotThreadLocal, shared_address_space);
 #if TVM_LLVM_VERSION >= 100
       global->setAlignment(llvm::Align(info.alignment));