yaxunl updated this revision to Diff 528937. yaxunl added a comment. Herald added a subscriber: MaskRay. Herald added a project: All.
rebase and simplify code CHANGES SINCE LAST ACTION https://reviews.llvm.org/D99201/new/ https://reviews.llvm.org/D99201 Files: clang/lib/Driver/ToolChains/Clang.cpp clang/test/Driver/hip-options.hip Index: clang/test/Driver/hip-options.hip =================================================================== --- clang/test/Driver/hip-options.hip +++ clang/test/Driver/hip-options.hip @@ -138,3 +138,10 @@ // RUN: %clang -### -nogpuinc -nogpulib -mamdgpu-ieee -mno-amdgpu-ieee -ffast-math \ // RUN: --cuda-gpu-arch=gfx906 %s 2>&1 | FileCheck -check-prefixes=IEEE-OFF-NEG %s // IEEE-OFF-NEG-NOT: clang{{.*}} "-triple" "amdgcn-amd-amdhsa" {{.*}} "-mamdgpu-ieee" + +// Check -Werror=atomic-alignment is passed for amdpu by default. + +// RUN: %clang -### -target x86_64-unknown-linux-gnu -nogpuinc -nogpulib \ +// RUN: --cuda-gpu-arch=gfx906 %s 2>&1 | FileCheck -check-prefix=WARN-ATOMIC %s +// WARN-ATOMIC: clang{{.*}} "-triple" "amdgcn-amd-amdhsa" {{.*}} "-Werror=atomic-alignment" +// WARN-ATOMIC-NOT: clang{{.*}} "-triple" "x86_64-unknown-linux-gnu" {{.*}} "-Werror=atomic-alignment" Index: clang/lib/Driver/ToolChains/Clang.cpp =================================================================== --- clang/lib/Driver/ToolChains/Clang.cpp +++ clang/lib/Driver/ToolChains/Clang.cpp @@ -7209,6 +7209,10 @@ options::OPT_mno_unsafe_fp_atomics); Args.addOptOutFlag(CmdArgs, options::OPT_mamdgpu_ieee, options::OPT_mno_amdgpu_ieee); + + // AMDGPU does not support atomic lib call. Treat atomic alignment + // warnings as errors. + CmdArgs.push_back("-Werror=atomic-alignment"); } // For all the host OpenMP offloading compile jobs we need to pass the targets
Index: clang/test/Driver/hip-options.hip =================================================================== --- clang/test/Driver/hip-options.hip +++ clang/test/Driver/hip-options.hip @@ -138,3 +138,10 @@ // RUN: %clang -### -nogpuinc -nogpulib -mamdgpu-ieee -mno-amdgpu-ieee -ffast-math \ // RUN: --cuda-gpu-arch=gfx906 %s 2>&1 | FileCheck -check-prefixes=IEEE-OFF-NEG %s // IEEE-OFF-NEG-NOT: clang{{.*}} "-triple" "amdgcn-amd-amdhsa" {{.*}} "-mamdgpu-ieee" + +// Check -Werror=atomic-alignment is passed for amdpu by default. + +// RUN: %clang -### -target x86_64-unknown-linux-gnu -nogpuinc -nogpulib \ +// RUN: --cuda-gpu-arch=gfx906 %s 2>&1 | FileCheck -check-prefix=WARN-ATOMIC %s +// WARN-ATOMIC: clang{{.*}} "-triple" "amdgcn-amd-amdhsa" {{.*}} "-Werror=atomic-alignment" +// WARN-ATOMIC-NOT: clang{{.*}} "-triple" "x86_64-unknown-linux-gnu" {{.*}} "-Werror=atomic-alignment" Index: clang/lib/Driver/ToolChains/Clang.cpp =================================================================== --- clang/lib/Driver/ToolChains/Clang.cpp +++ clang/lib/Driver/ToolChains/Clang.cpp @@ -7209,6 +7209,10 @@ options::OPT_mno_unsafe_fp_atomics); Args.addOptOutFlag(CmdArgs, options::OPT_mamdgpu_ieee, options::OPT_mno_amdgpu_ieee); + + // AMDGPU does not support atomic lib call. Treat atomic alignment + // warnings as errors. + CmdArgs.push_back("-Werror=atomic-alignment"); } // For all the host OpenMP offloading compile jobs we need to pass the targets
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits