[PATCH] D51476: AMDGPU: Stop forcing internalize at -O0

Matt Arsenault via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 30 01:43:50 PDT 2018


arsenm created this revision.
arsenm added a reviewer: rampitec.
Herald added subscribers: t-tye, tpr, dstuttard, yaxunl, nhaehnle, wdng, jvesely, kzhuravl.

This doesn't really matter if clang is always emitting
the visibility as hidden by default.


https://reviews.llvm.org/D51476

Files:
  lib/Target/AMDGPU/AMDGPUTargetMachine.cpp
  test/CodeGen/AMDGPU/internalize.ll


Index: test/CodeGen/AMDGPU/internalize.ll
===================================================================
--- test/CodeGen/AMDGPU/internalize.ll
+++ test/CodeGen/AMDGPU/internalize.ll
@@ -8,22 +8,23 @@
 ; ALL: gvar_used
 @gvar_used = addrspace(1) global i32 undef, align 4
 
-; ALL: define internal fastcc void @func_used_noinline(
+; OPT: define internal fastcc void @func_used_noinline(
+; OPT-NONE: define fastcc void @func_used_noinline(
 define fastcc void @func_used_noinline(i32 addrspace(1)* %out, i32 %tid) #1 {
 entry:
   store volatile i32 %tid, i32 addrspace(1)* %out
   ret void
 }
 
-; OPTNONE: define internal fastcc void @func_used_alwaysinline(
+; OPTNONE: define fastcc void @func_used_alwaysinline(
 ; OPT-NOT: @func_used_alwaysinline
 define fastcc void @func_used_alwaysinline(i32 addrspace(1)* %out, i32 %tid) #2 {
 entry:
   store volatile i32 %tid, i32 addrspace(1)* %out
   ret void
 }
 
-; OPTNONE: define internal void @func_unused(
+; OPTNONE: define void @func_unused(
 ; OPT-NOT: @func_unused
 define void @func_unused(i32 addrspace(1)* %out, i32 %tid) #1 {
 entry:
Index: lib/Target/AMDGPU/AMDGPUTargetMachine.cpp
===================================================================
--- lib/Target/AMDGPU/AMDGPUTargetMachine.cpp
+++ lib/Target/AMDGPU/AMDGPUTargetMachine.cpp
@@ -360,17 +360,6 @@
     Builder.Inliner = createAMDGPUFunctionInliningPass();
   }
 
-  if (Internalize) {
-    // If we're generating code, we always have the whole program available. The
-    // relocations expected for externally visible functions aren't supported,
-    // so make sure every non-entry function is hidden.
-    Builder.addExtension(
-      PassManagerBuilder::EP_EnabledOnOptLevel0,
-      [](const PassManagerBuilder &, legacy::PassManagerBase &PM) {
-        PM.add(createInternalizePass(mustPreserveGV));
-      });
-  }
-
   Builder.addExtension(
     PassManagerBuilder::EP_ModuleOptimizerEarly,
     [Internalize, EarlyInline, AMDGPUAA](const PassManagerBuilder &,


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D51476.163278.patch
Type: text/x-patch
Size: 2002 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180830/25f37731/attachment.bin>


More information about the llvm-commits mailing list