Let HIP default include respect -nogpuinc and -nogpulib
authorYaxun (Sam) Liu <yaxun.liu@amd.com>
Mon, 22 Jun 2020 12:00:57 +0000 (08:00 -0400)
committerYaxun (Sam) Liu <yaxun.liu@amd.com>
Mon, 22 Jun 2020 12:39:12 +0000 (08:39 -0400)
clang/lib/Driver/ToolChains/AMDGPU.cpp
clang/test/Driver/hip-include-path.hip

index edc52b8..3c10117 100644 (file)
@@ -223,8 +223,6 @@ void RocmInstallationDetector::AddHIPIncludeArgs(const ArgList &DriverArgs,
     llvm::sys::path::append(P, "cuda_wrappers");
     CC1Args.push_back("-internal-isystem");
     CC1Args.push_back(DriverArgs.MakeArgString(P));
-    CC1Args.push_back("-include");
-    CC1Args.push_back("__clang_hip_runtime_wrapper.h");
   }
 
   if (DriverArgs.hasArg(options::OPT_nogpuinc))
@@ -237,6 +235,8 @@ void RocmInstallationDetector::AddHIPIncludeArgs(const ArgList &DriverArgs,
 
   CC1Args.push_back("-internal-isystem");
   CC1Args.push_back(DriverArgs.MakeArgString(getIncludePath()));
+  CC1Args.push_back("-include");
+  CC1Args.push_back("__clang_hip_runtime_wrapper.h");
 }
 
 void amdgpu::Linker::ConstructJob(Compilation &C, const JobAction &JA,
index 996c53b..ea508a9 100644 (file)
 // COMMON-LABEL: "{{[^"]*}}clang{{[^"]*}}" "-cc1"
 // CLANG-SAME: "-internal-isystem" "{{.*}}clang/{{.*}}/include/cuda_wrappers"
 // NOCLANG-NOT: "{{.*}}clang/{{.*}}/include/cuda_wrappers"
-// CLANG-SAME: "-include" "__clang_hip_runtime_wrapper.h"
 // HIP-SAME: "-internal-isystem" "{{.*}}Inputs/rocm/include"
 // NOHIP-NOT: "{{.*}}Inputs/rocm/include"
+// HIP-SAME: "-include" "__clang_hip_runtime_wrapper.h"
+// NOHIP-NOT: "-include" "__clang_hip_runtime_wrapper.h"
 // skip check of standard C++ include path
 // CLANG-SAME: "-internal-isystem" "{{.*}}clang/{{.*}}/include"
 // NOCLANG-NOT: "{{.*}}clang/{{.*}}/include"
 // COMMON-LABEL: "{{[^"]*}}clang{{[^"]*}}" "-cc1"
 // CLANG-SAME: "-internal-isystem" "{{.*}}clang/{{.*}}/include/cuda_wrappers"
 // NOCLANG-NOT: "{{.*}}clang/{{.*}}/include/cuda_wrappers"
-// CLANG-SAME: "-include" "__clang_hip_runtime_wrapper.h"
 // HIP-SAME: "-internal-isystem" "{{.*}}Inputs/rocm/include"
 // NOHIP-NOT: "{{.*}}Inputs/rocm/include"
+// HIP-SAME: "-include" "__clang_hip_runtime_wrapper.h"
+// NOHIP-NOT: "-include" "__clang_hip_runtime_wrapper.h"
 // skip check of standard C++ include path
 // CLANG-SAME: "-internal-isystem" "{{.*}}clang/{{.*}}/include"
 // NOCLANG-NOT: "{{.*}}clang/{{.*}}/include"