Skip to content

Commit f4f613b

Browse files
committed
[AMDGPU] Suppress DataLayout warnings after recent change
Summary: Recent changes caused all AMDGPU toolchain programs to emit unhelpful warnings since we linke a lot of external libraries. For now just accept the old triple without warnings. We can probably remove this in the future when these get updated.
1 parent 914fbe3 commit f4f613b

File tree

3 files changed

+15
-0
lines changed

3 files changed

+15
-0
lines changed

llvm/lib/Linker/IRMover.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1489,6 +1489,13 @@ Error IRLinker::run() {
14891489
SrcTriple.getOSName() == "unknown");
14901490
EnableTripleWarning = !SrcHasLibDeviceTriple;
14911491
EnableDLWarning = !(SrcHasLibDeviceTriple && SrcHasLibDeviceDL);
1492+
} else if (SrcTriple.isAMDGPU() && DstTriple.isAMDGPU()) {
1493+
StringRef SrcDL = SrcM->getDataLayoutStr();
1494+
StringRef DstDL = DstM.getDataLayoutStr();
1495+
1496+
// Suppress the data layout warning if the old layout without ELF mangling
1497+
// specified is used.
1498+
EnableDLWarning = DstDL.drop_front(4) != SrcDL;
14921499
}
14931500

14941501
if (EnableDLWarning && (SrcM->getDataLayout() != DstM.getDataLayout())) {
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
target datalayout = "e-p:64:64-p1:64:64-p2:32:32-p3:32:32-p4:64:64-p5:32:32-p6:32:32-p7:160:256:256:32-p8:128:128:128:48-p9:192:256:256:32-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-v2048:2048-n32:64-S32-A5-G1-ni:7:8:9"
2+
target triple = "amdgcn-amd-amdhsa"

llvm/test/Linker/amdgcn-triple.ll

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
; RUN: llvm-link %s %S/Inputs/legacy-amdgcn.ll -S -o - 2>&1 | FileCheck %s
2+
3+
; CHECK-NOT: Linking two modules of different data layouts
4+
; CHECK: target triple = "amdgcn-amd-amdhsa"
5+
target datalayout = "e-m:e-p:64:64-p1:64:64-p2:32:32-p3:32:32-p4:64:64-p5:32:32-p6:32:32-p7:160:256:256:32-p8:128:128:128:48-p9:192:256:256:32-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-v2048:2048-n32:64-S32-A5-G1-ni:7:8:9"
6+
target triple = "amdgcn-amd-amdhsa"

0 commit comments

Comments
 (0)