1; Prepare bitcode files. 2; RUN: rm -rf %t && mkdir -p %t 3; RUN: llvm-as %s -o %t/main.bc 4; RUN: llvm-as %p/Inputs/libdevice-cuda-9.ll -o %t/libdevice.compute_35.10.bc 5; RUN: llvm-as %p/Inputs/libdevice-cuda-10.ll -o %t/libdevice.10.bc 6; RUN: llvm-as %p/Inputs/libdevice-cuda-11.ll -o %t/libdevice.11.10.bc 7; RUN: llvm-as %p/Inputs/not-a-libdevice.ll -o %t/libdevice-with-wrong-info.bc 8; RUN: llvm-as %p/Inputs/libdevice-with-wrong-dl.ll -o %t/libdevice-with-wrong-dl.bc 9 10; No warnings expected when we link with libdevice variants 11; RUN: llvm-link %t/main.bc %t/libdevice.compute_35.10.bc -S 2>&1 \ 12; RUN: | FileCheck --check-prefixes COMMON,NOWARN %s 13; RUN: llvm-link %t/main.bc %t/libdevice.10.bc -S 2>&1 \ 14; RUN: | FileCheck --check-prefixes COMMON,NOWARN %s 15; RUN: llvm-link %t/main.bc %t/libdevice.11.10.bc -S 2>&1 \ 16; RUN: | FileCheck --check-prefixes COMMON,NOWARN %s 17 18; But make sure we still issue warnings if we see unexpected triple or 19; datalayout within a libdevice module. 20; RUN: llvm-link %t/main.bc %t/libdevice-with-wrong-info.bc -S 2>&1 \ 21; RUN: | FileCheck --check-prefixes COMMON,WARN-TRIPLE,WARN-DL %s 22; RUN: llvm-link %t/main.bc %t/libdevice-with-wrong-dl.bc -S 2>&1 \ 23; RUN: | FileCheck --check-prefixes COMMON,NOWARN,WARN-DL %s 24 25 26target triple = "nvptx64-nvidia-cuda" 27target datalayout = "e-i64:64-i128:128-v16:16-v32:32-n16:32:64" 28 29; WARN-TRIPLE-DAG: warning: Linking two modules of different target triples: 30; WARN-DL-DAG: warning: Linking two modules of different data layouts: 31 32; NOWARN-NOT: warning: 33; COMMON-DAG: target triple = "nvptx64-nvidia-cuda" 34; NOWARN-NOT: warning: 35