From 8cc0f914fc9e6364a4cdb6fe03b334937a144c0c Mon Sep 17 00:00:00 2001 From: "Joel E. Denny" Date: Wed, 10 Jul 2024 17:12:52 -0400 Subject: [PATCH] [KernelInfo] Adjust for PR #96704 upstreaming changes so far The original version was introduced here in c4bfb84fbdd0. --- clang/test/Driver/linker-wrapper-passes.c | 72 ++++++++++++++++++ clang/test/Driver/linker-wrapper-passes.ll | 86 ---------------------- clang/test/Driver/lit.local.cfg | 1 - 3 files changed, 72 insertions(+), 87 deletions(-) create mode 100644 clang/test/Driver/linker-wrapper-passes.c delete mode 100644 clang/test/Driver/linker-wrapper-passes.ll diff --git a/clang/test/Driver/linker-wrapper-passes.c b/clang/test/Driver/linker-wrapper-passes.c new file mode 100644 index 00000000000000..aadcf472e9b636 --- /dev/null +++ b/clang/test/Driver/linker-wrapper-passes.c @@ -0,0 +1,72 @@ +// Check various clang-linker-wrapper pass options after -offload-opt. + +// REQUIRES: llvm-plugins, llvm-examples +// REQUIRES: x86-registered-target +// REQUIRES: amdgpu-registered-target + +// Setup. +// RUN: mkdir -p %t +// RUN: %clang -cc1 -emit-llvm-bc -o %t/host-x86_64-unknown-linux-gnu.bc \ +// RUN: -disable-O0-optnone -triple=x86_64-unknown-linux-gnu %s +// RUN: %clang -cc1 -emit-llvm-bc -o %t/openmp-amdgcn-amd-amdhsa.bc \ +// RUN: -disable-O0-optnone -triple=amdgcn-amd-amdhsa %s +// RUN: opt %t/openmp-amdgcn-amd-amdhsa.bc -o %t/openmp-amdgcn-amd-amdhsa.bc \ +// RUN: -passes=forceattrs -force-remove-attribute=f:noinline +// RUN: clang-offload-packager -o %t/openmp-x86_64-unknown-linux-gnu.out \ +// RUN: --image=file=%t/openmp-amdgcn-amd-amdhsa.bc,triple=amdgcn-amd-amdhsa +// RUN: %clang -cc1 -S -o %t/host-x86_64-unknown-linux-gnu.s \ +// RUN: -fopenmp -fopenmp-targets=amdgcn-amd-amdhsa \ +// RUN: -fembed-offload-object=%t/openmp-x86_64-unknown-linux-gnu.out \ +// RUN: %t/host-x86_64-unknown-linux-gnu.bc +// RUN: %clang -cc1as -o %t/host-x86_64-unknown-linux-gnu.o \ +// RUN: -triple x86_64-unknown-linux-gnu -filetype obj -target-cpu x86-64 \ +// RUN: %t/host-x86_64-unknown-linux-gnu.s + +// Check plugin, -passes, and no remarks. +// RUN: clang-linker-wrapper -o a.out --embed-bitcode \ +// RUN: --linker-path=/usr/bin/true %t/host-x86_64-unknown-linux-gnu.o \ +// RUN: %offload-opt-loadbye --offload-opt=-wave-goodbye \ +// RUN: --offload-opt=-passes="function(goodbye),module(inline)" 2>&1 | \ +// RUN: FileCheck -match-full-lines -check-prefixes=OUT %s + +// Check plugin, -p, and remarks. +// RUN: clang-linker-wrapper -o a.out --embed-bitcode \ +// RUN: --linker-path=/usr/bin/true %t/host-x86_64-unknown-linux-gnu.o \ +// RUN: %offload-opt-loadbye --offload-opt=-wave-goodbye \ +// RUN: --offload-opt=-p="function(goodbye),module(inline)" \ +// RUN: --offload-opt=-pass-remarks=inline \ +// RUN: --offload-opt=-pass-remarks-output=%t/remarks.yml \ +// RUN: --offload-opt=-pass-remarks-filter=inline \ +// RUN: --offload-opt=-pass-remarks-format=yaml 2>&1 | \ +// RUN: FileCheck -match-full-lines -check-prefixes=OUT,REM %s +// RUN: FileCheck -input-file=%t/remarks.yml -match-full-lines \ +// RUN: -check-prefixes=YML %s + +// Check handling of bad plugin. +// RUN: not clang-linker-wrapper \ +// RUN: --offload-opt=-load-pass-plugin=%t/nonexistent.so 2>&1 | \ +// RUN: FileCheck -match-full-lines -check-prefixes=BAD-PLUGIN %s + +// OUT-NOT: {{.}} +// OUT: Bye: f +// OUT-NEXT: Bye: test +// REM-NEXT: remark: {{.*}} 'f' inlined into 'test' {{.*}} +// OUT-NOT: {{.}} + +// YML-NOT: {{.}} +// YML: --- !Passed +// YML-NEXT: Pass: inline +// YML-NEXT: Name: Inlined +// YML-NEXT: Function: test +// YML-NEXT: Args: +// YML: - Callee: f +// YML: - Caller: test +// YML: ... +// YML-NOT: {{.}} + +// BAD-PLUGIN-NOT: {{.}} +// BAD-PLUGIN: {{.*}}Could not load library {{.*}}nonexistent.so{{.*}} +// BAD-PLUGIN-NOT: {{.}} + +void f() {} +void test() { f(); } diff --git a/clang/test/Driver/linker-wrapper-passes.ll b/clang/test/Driver/linker-wrapper-passes.ll deleted file mode 100644 index 28493b9a88eb19..00000000000000 --- a/clang/test/Driver/linker-wrapper-passes.ll +++ /dev/null @@ -1,86 +0,0 @@ -; Check various clang-linker-wrapper pass options after -offload-opt. - -; REQUIRES: llvm-plugins, llvm-examples -; REQUIRES: x86-registered-target -; REQUIRES: amdgpu-registered-target - -; Setup. -; RUN: split-file %s %t -; RUN: opt -o %t/host-x86_64-unknown-linux-gnu.bc \ -; RUN: %t/host-x86_64-unknown-linux-gnu.ll -; RUN: opt -o %t/openmp-amdgcn-amd-amdhsa.bc \ -; RUN: %t/openmp-amdgcn-amd-amdhsa.ll -; RUN: clang-offload-packager -o %t/openmp-x86_64-unknown-linux-gnu.out \ -; RUN: --image=file=%t/openmp-amdgcn-amd-amdhsa.bc,triple=amdgcn-amd-amdhsa -; RUN: %clang -cc1 -S -o %t/host-x86_64-unknown-linux-gnu.s \ -; RUN: -fopenmp -fopenmp-targets=amdgcn-amd-amdhsa \ -; RUN: -fembed-offload-object=%t/openmp-x86_64-unknown-linux-gnu.out \ -; RUN: %t/host-x86_64-unknown-linux-gnu.bc -; RUN: %clang -cc1as -o %t/host-x86_64-unknown-linux-gnu.o \ -; RUN: -triple x86_64-unknown-linux-gnu -filetype obj -target-cpu x86-64 \ -; RUN: %t/host-x86_64-unknown-linux-gnu.s - -; Check plugin, -passes, and no remarks. -; RUN: clang-linker-wrapper -o a.out --embed-bitcode \ -; RUN: --linker-path=/usr/bin/true %t/host-x86_64-unknown-linux-gnu.o \ -; RUN: %offload-opt-loadbye --offload-opt=-wave-goodbye \ -; RUN: --offload-opt=-passes="function(goodbye),module(inline)" 2>&1 | \ -; RUN: FileCheck -match-full-lines -check-prefixes=OUT %s - -; Check plugin, -p, and remarks. -; RUN: clang-linker-wrapper -o a.out --embed-bitcode \ -; RUN: --linker-path=/usr/bin/true %t/host-x86_64-unknown-linux-gnu.o \ -; RUN: %offload-opt-loadbye --offload-opt=-wave-goodbye \ -; RUN: --offload-opt=-p="function(goodbye),module(inline)" \ -; RUN: --offload-opt=-pass-remarks=inline \ -; RUN: --offload-opt=-pass-remarks-output=%t/remarks.yml \ -; RUN: --offload-opt=-pass-remarks-filter=inline \ -; RUN: --offload-opt=-pass-remarks-format=yaml 2>&1 | \ -; RUN: FileCheck -match-full-lines -check-prefixes=OUT,REM %s -; RUN: FileCheck -input-file=%t/remarks.yml -match-full-lines \ -; RUN: -check-prefixes=YML %s - -; Check handling of bad plugin. -; RUN: not clang-linker-wrapper \ -; RUN: --offload-opt=-load-pass-plugin=%t/nonexistent.so 2>&1 | \ -; RUN: FileCheck -match-full-lines -check-prefixes=BAD-PLUGIN %s - -; OUT-NOT: {{.}} -; OUT: Bye: f -; OUT-NEXT: Bye: test -; REM-NEXT: remark: {{.*}} 'f' inlined into 'test' {{.*}} -; OUT-NOT: {{.}} - -; YML-NOT: {{.}} -; YML: --- !Passed -; YML-NEXT: Pass: inline -; YML-NEXT: Name: Inlined -; YML-NEXT: Function: test -; YML-NEXT: Args: -; YML: - Callee: f -; YML: - Caller: test -; YML: ... -; YML-NOT: {{.}} - -; BAD-PLUGIN-NOT: {{.}} -; BAD-PLUGIN: {{.*}}Could not load library {{.*}}nonexistent.so{{.*}} -; BAD-PLUGIN-NOT: {{.}} - -;--- host-x86_64-unknown-linux-gnu.ll -target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128" -target triple = "x86_64-unknown-linux-gnu" - -;--- openmp-amdgcn-amd-amdhsa.ll -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-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" -target triple = "amdgcn-amd-amdhsa" - -define void @f() { -entry: - ret void -} - -define amdgpu_kernel void @test() { -entry: - call void @f() - ret void -} diff --git a/clang/test/Driver/lit.local.cfg b/clang/test/Driver/lit.local.cfg index 9bde2333a2e0df..6370e9f92d89b9 100644 --- a/clang/test/Driver/lit.local.cfg +++ b/clang/test/Driver/lit.local.cfg @@ -19,7 +19,6 @@ config.suffixes = [ ".hip", ".hipi", ".hlsl", - ".ll", ".yaml", ".test", ]