shenhan created this revision.
shenhan added reviewers: MaskRay, Hahnfeld, steelannelida.
Herald added subscribers: mattd, asavonic.
Herald added a project: All.
shenhan requested review of this revision.
Herald added projects: clang, LLVM.
Herald added subscribers: llvm-commits, cfe-commits.

This CL includes two changes:

1. move clang backend-warnings test cases from Driver/ to CodeGen/.
2. Replace multiple `cd "$(dirname "%t")"` with a single `rm -fr "%t"; mkdir -p 
"%t"; cd "%t"`.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D158231

Files:
  clang/test/CodeGen/fsplit-machine-functions.c
  clang/test/Driver/fsplit-machine-functions-with-cuda-nvptx.c
  clang/test/Driver/fsplit-machine-functions.c
  llvm/test/CodeGen/Generic/machine-function-splitter.ll

Index: llvm/test/CodeGen/Generic/machine-function-splitter.ll
===================================================================
--- llvm/test/CodeGen/Generic/machine-function-splitter.ll
+++ llvm/test/CodeGen/Generic/machine-function-splitter.ll
@@ -16,10 +16,10 @@
 
 ;; Check that MFS is on for X86 targets.
 ; MFS_ON: Machine Function Splitter Transformation
-; MFS_ON_NO: warning: -fsplit-machine-functions is not valid for
+; MFS_ON-NOT: warning: -fsplit-machine-functions is not valid for
 ;; Check that MFS is not on for non-X86 targets.
 ; MFS_OFF: warning: -fsplit-machine-functions is not valid for
-; MFS_OFF_NO: Machine Function Splitter Transformation
+; MFS_OFF-NOT: Machine Function Splitter Transformation
 
 define void @foo1(i1 zeroext %0) nounwind !prof !14 !section_prefix !15 {
 ;; Check that cold block is moved to .text.split.
Index: clang/test/Driver/fsplit-machine-functions.c
===================================================================
--- clang/test/Driver/fsplit-machine-functions.c
+++ clang/test/Driver/fsplit-machine-functions.c
@@ -1,10 +1,9 @@
-// REQUIRES: arm-registered-target
+// REQUIRES: x86-registered-target
 
-// RUN: %clang -### -target x86_64 -fprofile-use=default.profdata -fsplit-machine-functions %s -c -o %t.o 2>&1 | FileCheck -check-prefix=CHECK-OPT %s
-// RUN: %clang -### -target x86_64 -fsplit-machine-functions %s -c -o %t.o 2>&1 | FileCheck -check-prefix=CHECK-OPT %s
-// RUN: %clang -### -target x86_64 -fprofile-use=default.profdata -fsplit-machine-functions -fno-split-machine-functions %s -c -o %t.o 2>&1 | FileCheck -check-prefix=CHECK-NOOPT %s
-// RUN: %clang -c -target arm-unknown-linux-gnueabi -fsplit-machine-functions %s -o %t.o 2>&1 | FileCheck -check-prefix=CHECK-TRIPLE %s
+// RUN: %clang -### -target x86_64 -fprofile-use=default.profdata -fsplit-machine-functions %s -c 2>&1 | FileCheck -check-prefix=CHECK-OPT1 %s
+// RUN: %clang -### -target x86_64 -fsplit-machine-functions %s -c 2>&1 | FileCheck -check-prefix=CHECK-OPT2 %s
+// RUN: %clang -### -target x86_64 -fprofile-use=default.profdata -fsplit-machine-functions -fno-split-machine-functions %s -c 2>&1 | FileCheck -check-prefix=CHECK-NOOPT %s
 
-// CHECK-OPT:       "-fsplit-machine-functions"
-// CHECK-NOOPT-NOT: "-fsplit-machine-functions"
-// CHECK-TRIPLE:    warning: -fsplit-machine-functions is not valid for arm
+// CHECK-OPT1:       "-fsplit-machine-functions"
+// CHECK-OPT2:       "-fsplit-machine-functions"
+// CHECK-NOOPT-NOT:  "-fsplit-machine-functions"
Index: clang/test/Driver/fsplit-machine-functions-with-cuda-nvptx.c
===================================================================
--- clang/test/Driver/fsplit-machine-functions-with-cuda-nvptx.c
+++ clang/test/Driver/fsplit-machine-functions-with-cuda-nvptx.c
@@ -1,68 +1,29 @@
 // REQUIRES: system-linux
 // REQUIRES: x86-registered-target
 // REQUIRES: nvptx-registered-target
-// REQUIRES: shell
 
 // Check that -fsplit-machine-functions is passed to both x86 and cuda
 // compilation and does not cause driver error.
-// RUN:   cd "$(dirname "%t")" ; \
-// RUN:   %clang -### --target=x86_64-unknown-linux-gnu -nogpulib -nogpuinc \
+// RUN: %clang -### --target=x86_64-unknown-linux-gnu -nogpulib -nogpuinc \
 // RUN:     --cuda-gpu-arch=sm_70 -x cuda -fsplit-machine-functions -S %s \
 // RUN:     2>&1 | FileCheck %s --check-prefix=MFS1
 // MFS1: "-target-cpu" "x86-64"{{.*}}"-fsplit-machine-functions"
 // MFS1: "-target-cpu" "sm_70"{{.*}}"-fsplit-machine-functions"
 
-// Check that -fsplit-machine-functions is passed to cuda and it
-// causes a warning.
-// RUN:   cd "$(dirname "%t")" ; \
-// RUN:   %clang --target=x86_64-unknown-linux-gnu -nogpulib -nogpuinc \
-// RUN:     --cuda-gpu-arch=sm_70 -x cuda -fsplit-machine-functions -S %s \
-// RUN:     2>&1 | FileCheck %s --check-prefix=MFS2
-// MFS2: warning: -fsplit-machine-functions is not valid for nvptx
-
 // Check that -Xarch_host -fsplit-machine-functions is passed only to
 // native compilation.
-// RUN:   cd "$(dirname "%t")" ; \
-// RUN:   %clang -### --target=x86_64-unknown-linux-gnu -nogpulib -nogpuinc \
+// RUN: %clang -### --target=x86_64-unknown-linux-gnu -nogpulib -nogpuinc \
 // RUN:     --cuda-gpu-arch=sm_70 -x cuda -Xarch_host \
 // RUN:     -fsplit-machine-functions -S %s \
-// RUN:     2>&1 | FileCheck %s --check-prefix=MFS3
-// MFS3:     "-target-cpu" "x86-64"{{.*}}"-fsplit-machine-functions"
-// MFS3-NOT: "-target-cpu" "sm_70"{{.*}}"-fsplit-machine-functions"
-
-// Check that -Xarch_host -fsplit-machine-functions does not cause any warning.
-// RUN:   cd "$(dirname "%t")" ; \
-// RUN:   %clang --target=x86_64-unknown-linux-gnu -nogpulib -nogpuinc \
-// RUN      --cuda-gpu-arch=sm_70 -x cuda -Xarch_host \
-// RUN      -fsplit-machine-functions -S %s || { echo \
-// RUN      "warning: -fsplit-machine-functions is not valid for" ; } \
-// RUN      2>&1 | FileCheck %s --check-prefix=MFS4
-// MFS4-NOT: warning: -fsplit-machine-functions is not valid for
-
-// Check that -Xarch_device -fsplit-machine-functions does cause the warning.
-// RUN:   cd "$(dirname "%t")" ; \
-// RUN:   %clang --target=x86_64-unknown-linux-gnu -nogpulib -nogpuinc \
-// RUN:     --cuda-gpu-arch=sm_70 -x cuda -Xarch_device \
-// RUN:     -fsplit-machine-functions -S %s 2>&1 | \
-// RUN:     FileCheck %s --check-prefix=MFS5
-// MFS5: warning: -fsplit-machine-functions is not valid for
+// RUN:     2>&1 | FileCheck %s --check-prefix=MFS2
+// MFS2:     "-target-cpu" "x86-64"{{.*}}"-fsplit-machine-functions"
+// MFS2-NOT: "-target-cpu" "sm_70"{{.*}}"-fsplit-machine-functions"
 
 // Check that -fsplit-machine-functions -Xarch_device
 // -fno-split-machine-functions only passes MFS to x86
-// RUN:   cd "$(dirname "%t")" ; \
-// RUN:   %clang -### --target=x86_64-unknown-linux-gnu -nogpulib -nogpuinc \
-// RUN:     --cuda-gpu-arch=sm_70 -x cuda -fsplit-machine-functions \
-// RUN:     -Xarch_device -fno-split-machine-functions -S %s \
-// RUN:     2>&1 | FileCheck %s --check-prefix=MFS6
-// MFS6:     "-target-cpu" "x86-64"{{.*}}"-fsplit-machine-functions"
-// MFS6-NOT: "-target-cpu" "sm_70"{{.*}}"-fsplit-machine-functions"
-
-// Check that -fsplit-machine-functions -Xarch_device
-// -fno-split-machine-functions has no warnings
-// RUN:   cd "$(dirname "%t")" ; \
-// RUN:   %clang --target=x86_64-unknown-linux-gnu -nogpulib -nogpuinc \
+// RUN: %clang -### --target=x86_64-unknown-linux-gnu -nogpulib -nogpuinc \
 // RUN:     --cuda-gpu-arch=sm_70 -x cuda -fsplit-machine-functions \
 // RUN:     -Xarch_device -fno-split-machine-functions -S %s \
-// RUN:     || { echo "warning: -fsplit-machine-functions is not valid for"; } \
-// RUN:     2>&1 | FileCheck %s --check-prefix=MFS7
-// MFS7-NOT: warning: -fsplit-machine-functions is not valid for
+// RUN:     2>&1 | FileCheck %s --check-prefix=MFS3
+// MFS3:     "-target-cpu" "x86-64"{{.*}}"-fsplit-machine-functions"
+// MFS3-NOT: "-target-cpu" "sm_70"{{.*}}"-fsplit-machine-functions"
Index: clang/test/CodeGen/fsplit-machine-functions.c
===================================================================
--- /dev/null
+++ clang/test/CodeGen/fsplit-machine-functions.c
@@ -0,0 +1,43 @@
+// REQUIRES: system-linux
+// REQUIRES: x86-registered-target
+// REQUIRES: arm-registered-target
+// REQUIRES: nvptx-registered-target
+
+// clang does not accept "-o <output>" when generating multiple output
+// files. Create temp directory and cd to it before invoking clang.
+// RUN: rm -fr "%t" ; mkdir -p "%t" ; cd "%t"
+
+// Check that -fsplit-machine-functions is passed to cuda and it
+// causes a warning.
+// RUN: %clang --target=x86_64-unknown-linux-gnu -nogpulib -nogpuinc \
+// RUN:     --cuda-gpu-arch=sm_70 -x cuda -fsplit-machine-functions -S %s \
+// RUN:     2>&1 | FileCheck %s --check-prefix=MFS1
+// MFS1: warning: -fsplit-machine-functions is not valid for nvptx
+
+// Check that -Xarch_host -fsplit-machine-functions does not cause any warning.
+// RUN: %clang --target=x86_64-unknown-linux-gnu -nogpulib -nogpuinc \
+// RUN      --cuda-gpu-arch=sm_70 -x cuda -Xarch_host \
+// RUN      -fsplit-machine-functions -S %s || { echo \
+// RUN      "warning: -fsplit-machine-functions is not valid for" ; } \
+// RUN      2>&1 | FileCheck %s --check-prefix=MFS2
+// MFS2-NOT: warning: -fsplit-machine-functions is not valid for
+
+// Check that -Xarch_device -fsplit-machine-functions does cause the warning.
+// RUN: %clang --target=x86_64-unknown-linux-gnu -nogpulib -nogpuinc \
+// RUN:     --cuda-gpu-arch=sm_70 -x cuda -Xarch_device \
+// RUN:     -fsplit-machine-functions -S %s 2>&1 | \
+// RUN:     FileCheck %s --check-prefix=MFS3
+// MFS3: warning: -fsplit-machine-functions is not valid for
+
+// Check that -fsplit-machine-functions -Xarch_device
+// -fno-split-machine-functions has no warnings
+// RUN: %clang --target=x86_64-unknown-linux-gnu -nogpulib -nogpuinc \
+// RUN:     --cuda-gpu-arch=sm_70 -x cuda -fsplit-machine-functions \
+// RUN:     -Xarch_device -fno-split-machine-functions -S %s \
+// RUN:     || { echo "warning: -fsplit-machine-functions is not valid for"; } \
+// RUN:     2>&1 | FileCheck %s --check-prefix=MFS4
+// MFS4-NOT: warning: -fsplit-machine-functions is not valid for
+
+// RUN: %clang -c -target arm-unknown-linux-gnueabi -fsplit-machine-functions %s \
+// RUN:     2>&1 | FileCheck -check-prefix=MFS5 %s
+// MFS5: warning: -fsplit-machine-functions is not valid for arm
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to