Skip to content

Commit 1830ec9

Browse files
committed
Revert "[HIP] [AlwaysInliner] Disable AlwaysInliner to eliminate undefined symbols"
This reverts commit 03375a3.
1 parent 4594f81 commit 1830ec9

File tree

5 files changed

+11
-37
lines changed

5 files changed

+11
-37
lines changed

clang/lib/Driver/ToolChains/Clang.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5089,9 +5089,9 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
50895089
}
50905090

50915091
// Enable -mconstructor-aliases except on darwin, where we have to work around
5092-
// a linker bug (see <rdar://problem/7651567>), and CUDA device code, where
5093-
// aliases aren't supported.
5094-
if (!RawTriple.isOSDarwin() && !RawTriple.isNVPTX())
5092+
// a linker bug (see <rdar://problem/7651567>), and CUDA/AMDGPU device code,
5093+
// where aliases aren't supported.
5094+
if (!RawTriple.isOSDarwin() && !RawTriple.isNVPTX() && !RawTriple.isAMDGPU())
50955095
CmdArgs.push_back("-mconstructor-aliases");
50965096

50975097
// Darwin's kernel doesn't support guard variables; just die if we

clang/test/CodeGenCUDA/amdgpu-alias-undef-symbols.cu

Lines changed: 0 additions & 17 deletions
This file was deleted.

llvm/lib/Target/AMDGPU/AMDGPUAlwaysInlinePass.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
#include "AMDGPU.h"
1616
#include "AMDGPUTargetMachine.h"
1717
#include "Utils/AMDGPUBaseInfo.h"
18-
#include "llvm/CodeGen/CommandFlags.h"
1918
#include "llvm/IR/Module.h"
2019
#include "llvm/Pass.h"
2120
#include "llvm/Support/CommandLine.h"
@@ -91,13 +90,9 @@ static bool alwaysInlineImpl(Module &M, bool GlobalOpt) {
9190

9291
SmallPtrSet<Function *, 8> FuncsToAlwaysInline;
9392
SmallPtrSet<Function *, 8> FuncsToNoInline;
94-
Triple TT(M.getTargetTriple());
9593

9694
for (GlobalAlias &A : M.aliases()) {
9795
if (Function* F = dyn_cast<Function>(A.getAliasee())) {
98-
if (TT.getArch() == Triple::amdgcn &&
99-
A.getLinkage() != GlobalValue::InternalLinkage)
100-
continue;
10196
A.replaceAllUsesWith(F);
10297
AliasesToRemove.push_back(&A);
10398
}

llvm/lib/Target/AMDGPU/AMDGPUResourceUsageAnalysis.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,6 @@
2929
#include "SIMachineFunctionInfo.h"
3030
#include "llvm/Analysis/CallGraph.h"
3131
#include "llvm/CodeGen/TargetPassConfig.h"
32-
#include "llvm/IR/GlobalAlias.h"
33-
#include "llvm/IR/GlobalValue.h"
3432
#include "llvm/Target/TargetMachine.h"
3533

3634
using namespace llvm;
@@ -63,8 +61,7 @@ static const Function *getCalleeFunction(const MachineOperand &Op) {
6361
assert(Op.getImm() == 0);
6462
return nullptr;
6563
}
66-
if (auto *GA = dyn_cast<GlobalAlias>(Op.getGlobal()))
67-
return cast<Function>(GA->getOperand(0));
64+
6865
return cast<Function>(Op.getGlobal());
6966
}
7067

llvm/test/CodeGen/AMDGPU/inline-calls.ll

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
; RUN: llc -mtriple amdgcn-unknown-linux-gnu -mcpu=tahiti -verify-machineinstrs < %s | FileCheck %s
2-
; RUN: llc -mtriple amdgcn-unknown-linux-gnu -mcpu=tonga -verify-machineinstrs < %s | FileCheck %s
3-
; RUN: llc -mtriple r600-unknown-linux-gnu -mcpu=redwood -verify-machineinstrs < %s | FileCheck %s --check-prefix=R600
1+
; RUN: llc -march=amdgcn -mcpu=tahiti -verify-machineinstrs < %s | FileCheck %s
2+
; RUN: llc -march=amdgcn -mcpu=tonga -verify-machineinstrs < %s | FileCheck %s
3+
; RUN: llc -march=r600 -mcpu=redwood -verify-machineinstrs < %s | FileCheck %s
44

55
; ALL-NOT: {{^}}func:
66
define internal i32 @func(i32 %a) {
@@ -9,7 +9,7 @@ entry:
99
ret i32 %tmp0
1010
}
1111

12-
; CHECK: {{^}}kernel:
12+
; ALL: {{^}}kernel:
1313
; GCN-NOT: s_swappc_b64
1414
define amdgpu_kernel void @kernel(i32 addrspace(1)* %out) {
1515
entry:
@@ -18,13 +18,12 @@ entry:
1818
ret void
1919
}
2020

21-
; CHECK: func_alias
22-
; R600-NOT: func_alias
21+
; CHECK-NOT: func_alias
22+
; ALL-NOT: func_alias
2323
@func_alias = alias i32 (i32), i32 (i32)* @func
2424

25-
; CHECK-NOT: {{^}}kernel3:
25+
; ALL: {{^}}kernel3:
2626
; GCN-NOT: s_swappc_b64
27-
; R600: {{^}}kernel3:
2827
define amdgpu_kernel void @kernel3(i32 addrspace(1)* %out) {
2928
entry:
3029
%tmp0 = call i32 @func_alias(i32 1)

0 commit comments

Comments
 (0)