================
@@ -0,0 +1,152 @@
+// RUN: %clang -### --target=x86_64-unknown-linux-gnu 
--offload-arch=amdgcnspirv \
+// RUN:   -fsanitize=address \
+// RUN:   -nogpuinc --rocm-path=%S/Inputs/rocm \
+// RUN:   %s 2>&1 | FileCheck -check-prefixes=NORDC %s
+
+// RUN: %clang -### --target=x86_64-unknown-linux-gnu 
--offload-arch=amdgcnspirv \
+// RUN:   -fsanitize=address -fno-gpu-sanitize \
+// RUN:   -nogpuinc --rocm-path=%S/Inputs/rocm \
+// RUN:   %s 2>&1 | FileCheck %s
+
+// RUN: %clang -### --target=x86_64-unknown-linux-gnu 
--offload-arch=amdgcnspirv \
+// RUN:   -fsanitize=address -fgpu-sanitize \
+// RUN:   -nogpuinc --rocm-path=%S/Inputs/rocm \
+// RUN:   %s 2>&1 | FileCheck -check-prefixes=NORDC %s
+
+// RUN: %clang -### --target=x86_64-unknown-linux-gnu 
--offload-arch=amdgcnspirv \
+// RUN:   -fsanitize=address -fgpu-sanitize -fgpu-rdc \
+// RUN:   -nogpuinc --rocm-path=%S/Inputs/rocm \
+// RUN:   %s 2>&1 | FileCheck -check-prefixes=RDC %s
+
+// RUN: not %clang -### --target=x86_64-unknown-linux-gnu 
--offload-arch=gfx900:xnack- \
+// RUN:   --offload-arch=amdgcnspirv --offload-arch=gfx906 -fsanitize=address 
-fgpu-sanitize \
+// RUN:   -fsanitize=leak -nogpuinc --rocm-path=%S/Inputs/rocm \
+// RUN:   %s 2>&1 | FileCheck -check-prefixes=XNACK %s
+
+// RUN: not %clang -### --target=x86_64-unknown-linux-gnu 
--offload-arch=gfx900:xnack- \
+// RUN:   --offload-arch=amdgcnspirv --offload-arch=gfx906 -fsanitize=address 
-fgpu-sanitize \
+// RUN:   -fsanitize=leak -nogpuinc --rocm-path=%S/Inputs/rocm \
+// RUN:   %s 2>&1 | FileCheck -check-prefixes=XNACKNEG %s
+
+// Check -fno-gpu-sanitize with supported and unsupported GPU.
+// Sanitizer should be disabled for all GPU's and there should be no warnings 
about unsupported
+// GPU.
+
+// RUN: not %clang -### --target=x86_64-unknown-linux-gnu 
--offload-arch=gfx900:xnack- \
+// RUN:   --offload-arch=amdgcnspirv --offload-arch=gfx906 -fsanitize=address 
-fno-gpu-sanitize \
+// RUN:   -fsanitize=leak -nogpuinc --rocm-path=%S/Inputs/rocm \
+// RUN:   %s 2>&1 | FileCheck -check-prefixes=NOGPU %s
+
+// RUN: not %clang -### --target=x86_64-unknown-linux-gnu 
--offload-arch=gfx900:xnack- \
+// RUN:   --offload-arch=amdgcnspirv --offload-arch=gfx906 -fsanitize=address 
-fno-gpu-sanitize \
+// RUN:   -fsanitize=leak -nogpuinc --rocm-path=%S/Inputs/rocm \
+// RUN:   %s 2>&1 | FileCheck -check-prefixes=NOGPUNEG %s
+
+// Catch invalid combination of sanitizers regardless of their order and ignore
+// them selectively.
+// (The address sanitizer enables the device sanitizer pipeline. The fuzzer
+// implicitly turns on LLVMs SanitizerCoverage, which the driver then forwards
+// to the device cc1. SanitizerCoverage is not supported on amdgcn.)
+
+// RUN: %clang -### --target=x86_64-unknown-linux-gnu 
--offload-arch=amdgcnspirv \
+// RUN:   -fsanitize=address,fuzzer --rocm-path=%S/Inputs/rocm %s 2>&1 \
+// RUN:   | FileCheck -check-prefixes=INVALIDCOMBINATION,INVALIDCOMBINATION1 %s
+// RUN: %clang -### --target=x86_64-unknown-linux-gnu 
--offload-arch=amdgcnspirv \
+// RUN:   -fsanitize=fuzzer,address --rocm-path=%S/Inputs/rocm %s 2>&1 \
+// RUN:   | FileCheck -check-prefixes=INVALIDCOMBINATION,INVALIDCOMBINATION2 %s
+
+// Do the same for multiple -fsanitize arguments and multi-arch scenarios.
+
+// RUN:   %clang -### --target=x86_64-unknown-linux-gnu 
--offload-arch=amdgcnspirv --offload-arch=gfx908:xnack- \
+// RUN:   -fsanitize=address,fuzzer -fsanitize=leak --rocm-path=%S/Inputs/rocm 
%s 2>&1 \
+// RUN:   | FileCheck -check-prefixes=MULT1,XNACK2 %s
+// RUN:   %clang -### --target=x86_64-unknown-linux-gnu 
--offload-arch=amdgcnspirv,gfx908:xnack- \
+// RUN:   -fsanitize=fuzzer,address -fsanitize=leak --rocm-path=%S/Inputs/rocm 
%s 2>&1 \
+// RUN:   | FileCheck -check-prefixes=MULT2,XNACK2 %s
+
+// Check for -fsanitize-coverage options
+// RUN:   %clang -### --target=x86_64-unknown-linux-gnu 
--offload-arch=amdgcnspirv \
+// RUN:   -fsanitize=address -fsanitize-coverage=inline-bool-flag 
--rocm-path=%S/Inputs/rocm %s 2>&1 \
+// RUN:   | FileCheck -check-prefixes=WARNSANCOV %s
+
+// Test -Xarch_device error scenario
+
+// RUN:   not %clang -### --target=x86_64-unknown-linux-gnu 
--offload-arch=amdgcnspirv \
+// RUN:   -Xarch_device -fsanitize=leak --rocm-path=%S/Inputs/rocm %s 2>&1 \
+// RUN:   | FileCheck -check-prefixes=UNSUPPORTEDERROR %s
+
+// RUN:   not %clang -### --target=x86_64-unknown-linux-gnu 
--offload-arch=amdgcnspirv \
+// RUN:   -Xarch_device -fsanitize=fuzzer,address --rocm-path=%S/Inputs/rocm 
%s 2>&1 \
+// RUN:   | FileCheck -check-prefixes=INVALIDCOMBINATIONERROR %s
+
+// RUN:   not %clang -### --target=x86_64-unknown-linux-gnu 
--offload-arch=amdgcnspirv \
+// RUN:   -fsanitize=address -Xarch_device 
-fsanitize-coverage-stack-depth-callback-min=42 --rocm-path=%S/Inputs/rocm %s 
2>&1 \
+// RUN:   | FileCheck -check-prefixes=ERRSANCOV %s
+
+// CHECK-NOT: {{"[^"]*clang[^"]*".* "-fcuda-is-device".* "-fsanitize=address"}}
+// CHECK-NOT: {{"[^"]*clang[^"]*".* "-fcuda-is-device".* "-mlink-bitcode-file" 
".*asanrtl.bc"}}
+// CHECK-NOT: {{"[^"]*lld(\.exe){0,1}".* ".*hip.bc"}}
+// CHECK: {{"[^"]*clang[^"]*".* "-triple" "x86_64-unknown-linux-gnu".* 
"-fsanitize=address"}}
+
+// NORDC: {{"[^"]*clang[^"]*".* "-emit-llvm-bc".* "-fcuda-is-device".* .* 
"-fsanitize=address".*}} "-o" "[[OUT:[^"]*]]"
+// NORDC: {{"[^"]*clang[^"]*".* "-triple" "x86_64-unknown-linux-gnu".* 
"-fsanitize=address"}}
+
+// RDC: {{"[^"]*clang[^"]*".* "-emit-llvm-bc".* "-fcuda-is-device".* 
"-fsanitize=address".*}} "-o" "[[OUT:[^"]*]]"
+// RDC: {{"[^"]*clang[^"]*".* "-triple" "x86_64-unknown-linux-gnu".* 
"-fsanitize=address"}}
+
+// XNACK: warning: ignoring 'leak' in '-fsanitize=leak' option as it is not 
currently supported for target 'amdgpu-amd-amdhsa'
+// XNACK: warning: ignoring '-fsanitize=address' option for offload arch 
'gfx900:xnack-' as it is not currently supported there. Use it with an offload 
arch containing 'xnack+' instead
+// XNACK: warning: ignoring '-fsanitize=address' option for offload arch 
'gfx906' as it is not currently supported there. Use it with an offload arch 
containing 'xnack+' instead
+// XNACK-DAG: {{"[^"]*clang[^"]*".* "-triple" "spirv64-amd-amdhsa".* 
"-fsanitize=address"}}
+// XNACK-DAG: {{"[^"]*clang[^"]*".* "-triple" "amdgpu9.00.* "-mno-xnack"}}
+// XNACK-DAG: {{"[^"]*clang[^"]*".* "-triple" "amdgpu9.06}}
+// XNACK-DAG: {{"[^"]*clang[^"]*".* "-triple" "x86_64-unknown-linux-gnu".* 
"-fsanitize=address,leak"}}
+// XNACKNEG-NOT: {{"[^"]*clang[^"]*".* "-triple" "amdgpu9.00.* "-mxnack".* 
"-fsanitize=address,leak"}}
+// XNACKNEG-NOT: {{"[^"]*clang[^"]*".* "-triple" "amdgpu9.00.* "-mno-xnack".* 
"-fsanitize=address,leak"}}
+// XNACKNEG-NOT: {{"[^"]*clang[^"]*".* "-triple" "amdgpu9.06.* 
"-fsanitize=address,leak"}}
+// XNACKNEG-NOT: {{"[^"]*clang[^"]*".* "-triple" "amdgpu9.00.* "-mno-xnack".* 
"-fsanitize=address"}}
+// XNACKNEG-NOT: {{"[^"]*clang[^"]*".* "-triple" "amdgpu9.06.* 
"-fsanitize=address"}}
+// XNACKNEG-NOT: {{"[^"]*clang[^"]*".* "-triple" "amdgpu9.00.* 
"-mlink-bitcode-file" ".*asanrtl.bc".* "-mno-xnack"}}
+// XNACKNEG-NOT: {{"[^"]*clang[^"]*".* "-triple" "amdgpu9.06.* 
"-mlink-bitcode-file" ".*asanrtl.bc"}}
+// XNACKNEG-NOT: {{"[^"]*lld(\.exe){0,1}".* ".*hip.bc"}}
+
+// NOGPU-DAG: {{"[^"]*clang[^"]*".* "-triple" "spirv64-amd-amdhsa"}}
+// NOGPU-DAG: {{"[^"]*clang[^"]*".* "-triple" "amdgpu9.00.* "-mno-xnack"}}
+// NOGPU-DAG: {{"[^"]*clang[^"]*".* "-triple" "amdgpu9.06}}
+// NOGPU-DAG: {{"[^"]*clang[^"]*".* "-triple" "x86_64-unknown-linux-gnu".* 
"-fsanitize=address,leak"}}
+// NOGPUNEG-NOT: warning: ignoring '-fsanitize=leak' option as it is not 
currently supported for target 'amdgpu9-amd-amdhsa'
+// NOGPUNEG-NOT: warning: ignoring '-fsanitize=address' option for offload 
arch 'gfx900:xnack-' as it is not currently supported there. Use it with an 
offload arch containing 'xnack+' instead
+// NOGPUNEG-NOT: warning: ignoring '-fsanitize=address' option for offload 
arch 'gfx906' as it is not currently supported there. Use it with an offload 
arch containing 'xnack+' instead
+// NOGPUNEG-NOT: {{"[^"]*clang[^"]*".* "-triple" "amdgpu9.00.* 
"-mlink-bitcode-file" ".*asanrtl.bc".* "-mxnack".* "-fsanitize=address"}}
+// NOGPUNEG-NOT: {{"[^"]*clang[^"]*".* "-triple" "amdgpu9.00.* "-mxnack".* 
"-fsanitize=address,leak"}}
+// NOGPUNEG-NOT: {{"[^"]*clang[^"]*".* "-triple" "amdgpu9.00.* "-mno-xnack".* 
"-fsanitize=address,leak"}}
+// NOGPUNEG-NOT: {{"[^"]*clang[^"]*".* "-triple" "amdgpu9.06.* 
"-fsanitize=address,leak"}}
+// NOGPUNEG-NOT: {{"[^"]*clang[^"]*".* "-triple" "amdgpu9.00.* "-mxnack".* 
"-fsanitize=address"}}
+// NOGPUNEG-NOT: {{"[^"]*clang[^"]*".* "-triple" "amdgpu9.00.* "-mno-xnack".* 
"-fsanitize=address"}}
+// NOGPUNEG-NOT: {{"[^"]*clang[^"]*".* "-triple" "amdgpu9.06.* 
"-fsanitize=address"}}
+// NOGPUNEG-NOT: {{"[^"]*clang[^"]*".* "-mlink-bitcode-file" ".*asanrtl.bc".* 
"-triple" "amdgpu9.00.* "-mxnack"}}
+// NOGPUNEG-NOT: {{"[^"]*clang[^"]*".* "-triple" "amdgpu9.00.* 
"-mlink-bitcode-file" ".*asanrtl.bc".* "-mno-xnack"}}
+// NOGPUNEG-NOT: {{"[^"]*clang[^"]*".* "-triple" "amdgpu9.06.* 
"-mlink-bitcode-file" ".*asanrtl.bc"}}
+// NOGPUNEG-NOT: {{"[^"]*lld(\.exe){0,1}".* ".*hip.bc"}}
+
+// INVALIDCOMBINATION1-DAG: warning: ignoring 'fuzzer' in 
'-fsanitize=address,fuzzer' option as it is not currently supported for target 
'spirv64-amd-amdhsa' [-Woption-ignored]
+// INVALIDCOMBINATION2-DAG: warning: ignoring 'fuzzer' in 
'-fsanitize=fuzzer,address' option as it is not currently supported for target 
'spirv64-amd-amdhsa' [-Woption-ignored]
+// INVALIDCOMBINATION-DAG: {{"[^"]*clang[^"]*".* "-triple" 
"spirv64-amd-amdhsa".* "-fsanitize=address"}}
+// INVALIDCOMBINATION-DAG: {{"[^"]*clang[^"]*".* "-triple" 
"x86_64-unknown-linux-gnu".* "-fsanitize=address,fuzzer,fuzzer-no-link"}}
+
+// MULT1: warning: ignoring 'leak' in '-fsanitize=leak' option as it is not 
currently supported for target 'spirv64-amd-amdhsa' [-Woption-ignored]
+// MULT1: warning: ignoring 'fuzzer' in '-fsanitize=address,fuzzer' option as 
it is not currently supported for target 'spirv64-amd-amdhsa' [-Woption-ignored]
+
+// MULT2: warning: ignoring 'leak' in '-fsanitize=leak' option as it is not 
currently supported for target 'spirv64-amd-amdhsa' [-Woption-ignored]
+// MULT2: warning: ignoring 'fuzzer' in '-fsanitize=fuzzer,address' option as 
it is not currently supported for target 'spirv64-amd-amdhsa' [-Woption-ignored]
+
+// XNACK2-DAG: {{"[^"]*clang[^"]*".* "-triple" "spirv64-amd-amdhsa".* 
"-fsanitize=address"}}
+// XNACK2-DAG: {{"[^"]*clang[^"]*".* "-triple" "amdgpu9.08}}
+// XNACK2-DAG: {{"[^"]*clang[^"]*".* "-triple" "x86_64-unknown-linux-gnu".* 
"-fsanitize=address,fuzzer,fuzzer-no-link,leak"}}
+
+// UNSUPPORTEDERROR: error: 'leak' in '-fsanitize=leak' option is not 
currently supported for target 'spirv64-amd-amdhsa'
+// XNACKERROR: error: '-fsanitize=address' option for offload arch 
'gfx900:xnack-' is not currently supported there. Use it with an offload arch 
containing 'xnack+' instead
----------------
AlexVlx wrote:

Meant to remove, my bad.

https://github.com/llvm/llvm-project/pull/241411
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to