yaxunl created this revision. yaxunl added a reviewer: tra. Herald added subscribers: t-tye, tpr, dstuttard, wdng, kzhuravl.
AMDGPU backend needs -amdgpu-internalize-symbols option for opt to work around a limitation of no PLT support, otherwise there is compilation error at -O0. https://reviews.llvm.org/D51434 Files: lib/Driver/ToolChains/HIP.cpp test/Driver/hip-toolchain.hip Index: test/Driver/hip-toolchain.hip =================================================================== --- test/Driver/hip-toolchain.hip +++ test/Driver/hip-toolchain.hip @@ -29,7 +29,7 @@ // CHECK-SAME: "-o" [[LINKED_BC_DEV1:".*-gfx803-linked-.*bc"]] // CHECK: [[OPT:".*opt"]] [[LINKED_BC_DEV1]] "-mtriple=amdgcn-amd-amdhsa" -// CHECK-SAME: "-mcpu=gfx803" +// CHECK-SAME: "-mcpu=gfx803" "-amdgpu-internalize-symbols" // CHECK-SAME: "-o" [[OPT_BC_DEV1:".*-gfx803-optimized.*bc"]] // CHECK: [[LLC: ".*llc"]] [[OPT_BC_DEV1]] "-mtriple=amdgcn-amd-amdhsa" @@ -55,7 +55,7 @@ // CHECK-SAME: "-o" [[LINKED_BC_DEV2:".*-gfx900-linked-.*bc"]] // CHECK: [[OPT]] [[LINKED_BC_DEV2]] "-mtriple=amdgcn-amd-amdhsa" -// CHECK-SAME: "-mcpu=gfx900" +// CHECK-SAME: "-mcpu=gfx900" "-amdgpu-internalize-symbols" // CHECK-SAME: "-o" [[OPT_BC_DEV2:".*-gfx900-optimized.*bc"]] // CHECK: [[LLC]] [[OPT_BC_DEV2]] "-mtriple=amdgcn-amd-amdhsa" Index: lib/Driver/ToolChains/HIP.cpp =================================================================== --- lib/Driver/ToolChains/HIP.cpp +++ lib/Driver/ToolChains/HIP.cpp @@ -135,6 +135,9 @@ } OptArgs.push_back("-mtriple=amdgcn-amd-amdhsa"); OptArgs.push_back(Args.MakeArgString("-mcpu=" + SubArchName)); + // AMDGPU backend needs this option for whole program compilation to + // work around the limitation of no PLT support. + OptArgs.push_back("-amdgpu-internalize-symbols"); OptArgs.push_back("-o"); std::string TmpFileName = C.getDriver().GetTemporaryPath( OutputFilePrefix.str() + "-optimized", "bc");
Index: test/Driver/hip-toolchain.hip =================================================================== --- test/Driver/hip-toolchain.hip +++ test/Driver/hip-toolchain.hip @@ -29,7 +29,7 @@ // CHECK-SAME: "-o" [[LINKED_BC_DEV1:".*-gfx803-linked-.*bc"]] // CHECK: [[OPT:".*opt"]] [[LINKED_BC_DEV1]] "-mtriple=amdgcn-amd-amdhsa" -// CHECK-SAME: "-mcpu=gfx803" +// CHECK-SAME: "-mcpu=gfx803" "-amdgpu-internalize-symbols" // CHECK-SAME: "-o" [[OPT_BC_DEV1:".*-gfx803-optimized.*bc"]] // CHECK: [[LLC: ".*llc"]] [[OPT_BC_DEV1]] "-mtriple=amdgcn-amd-amdhsa" @@ -55,7 +55,7 @@ // CHECK-SAME: "-o" [[LINKED_BC_DEV2:".*-gfx900-linked-.*bc"]] // CHECK: [[OPT]] [[LINKED_BC_DEV2]] "-mtriple=amdgcn-amd-amdhsa" -// CHECK-SAME: "-mcpu=gfx900" +// CHECK-SAME: "-mcpu=gfx900" "-amdgpu-internalize-symbols" // CHECK-SAME: "-o" [[OPT_BC_DEV2:".*-gfx900-optimized.*bc"]] // CHECK: [[LLC]] [[OPT_BC_DEV2]] "-mtriple=amdgcn-amd-amdhsa" Index: lib/Driver/ToolChains/HIP.cpp =================================================================== --- lib/Driver/ToolChains/HIP.cpp +++ lib/Driver/ToolChains/HIP.cpp @@ -135,6 +135,9 @@ } OptArgs.push_back("-mtriple=amdgcn-amd-amdhsa"); OptArgs.push_back(Args.MakeArgString("-mcpu=" + SubArchName)); + // AMDGPU backend needs this option for whole program compilation to + // work around the limitation of no PLT support. + OptArgs.push_back("-amdgpu-internalize-symbols"); OptArgs.push_back("-o"); std::string TmpFileName = C.getDriver().GetTemporaryPath( OutputFilePrefix.str() + "-optimized", "bc");
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits