[PATCH] D51434: [HIP] Add -amdgpu-internalize-symbols option to opt

Yaxun Liu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 29 08:52:11 PDT 2018


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");


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D51434.163103.patch
Type: text/x-patch
Size: 1569 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180829/48d02f85/attachment.bin>


More information about the cfe-commits mailing list