diff --git a/clang/tools/clang-offload-wrapper/ClangOffloadWrapper.cpp b/clang/tools/clang-offload-wrapper/ClangOffloadWrapper.cpp index 9c84587afeb79..b82fe9e76499c 100644 --- a/clang/tools/clang-offload-wrapper/ClangOffloadWrapper.cpp +++ b/clang/tools/clang-offload-wrapper/ClangOffloadWrapper.cpp @@ -1108,23 +1108,23 @@ class BinaryWrapper { Fbin = *FBinOrErr; } else { - // If '--offload-compress' option is specified and zstd is not - // available, throw an error. - if (OffloadCompressDevImgs && !llvm::compression::zstd::isAvailable()) { - return createStringError( - inconvertibleErrorCode(), - "'--offload-compress' option is specified but zstd " - "is not available. The device image will not be " - "compressed."); - } - // Don't compress if the user explicitly specifies the binary image // format or if the image is smaller than OffloadCompressThreshold - // bytes. + // bytes, or if zstd is not available. if (Kind != OffloadKind::SYCL || !OffloadCompressDevImgs || Img.Fmt != BinaryImageFormat::none || !llvm::compression::zstd::isAvailable() || static_cast(Bin->getBufferSize()) < OffloadCompressThreshold) { + // If '--offload-compress' option is specified and zstd is not + // available, throw an error. + if (OffloadCompressDevImgs && + !llvm::compression::zstd::isAvailable()) { + errs() << "'--offload-compress' option is specified but zstd " + "is not available. The device image will not be " + "compressed." + << "\n"; + } + Fbin = addDeviceImageToModule( ArrayRef(Bin->getBufferStart(), Bin->getBufferSize()), Twine(OffloadKindTag) + Twine(ImgId) + Twine(".data"), Kind, diff --git a/sycl/test-e2e/Compression/no_zstd_warning.cpp b/sycl/test-e2e/Compression/no_zstd_warning.cpp index c87f2fe480096..21ce1f14f0916 100644 --- a/sycl/test-e2e/Compression/no_zstd_warning.cpp +++ b/sycl/test-e2e/Compression/no_zstd_warning.cpp @@ -1,4 +1,4 @@ -// using --offload-compress without zstd should throw an error. +// using --offload-compress without zstd should throw a warning. // REQUIRES: !zstd -// RUN: not %{build} %O0 -g --offload-compress %S/Inputs/single_kernel.cpp -o %t_compress.out 2>&1 | FileCheck %s +// RUN: %{build} %O0 -g --offload-compress %S/Inputs/single_kernel.cpp -o %t_compress.out 2>&1 | FileCheck %s // CHECK: '--offload-compress' option is specified but zstd is not available. The device image will not be compressed.