diff --git a/rocclr/compiler/lib/backends/common/frontend.cpp b/rocclr/compiler/lib/backends/common/frontend.cpp index a89e7802a1..1ef0352303 100644 --- a/rocclr/compiler/lib/backends/common/frontend.cpp +++ b/rocclr/compiler/lib/backends/common/frontend.cpp @@ -269,19 +269,8 @@ amdcl::OCLFrontend::compileCommand(const std::string& singleSrc) if (!llvmbinary_) { ret |= 1; } - if (!ret && -#if WITH_VERSION_0_8 - checkFlag(aclutGetCaps(Elf()), capSaveLLVMIR) -#elif WITH_VERSION_0_9 - Options()->oVariables->BinLLVMIR -#else -#error "The current version was not handled correctly here." -#endif - ) { - CL()->clAPI.insSec(CL(), Elf(), Source().data(), - Source().size(), aclLLVMIR); - } else { - CL()->clAPI.remSec(CL(), Elf(), aclLLVMIR); + if (!ret) { + CL()->clAPI.insSec(CL(), Elf(), Source().data(), Source().size(), aclLLVMIR); } log_ += loadFileToStr(logFile); amd::Os::unlink(logFile.c_str()); diff --git a/rocclr/compiler/lib/backends/common/frontend_clang.cpp b/rocclr/compiler/lib/backends/common/frontend_clang.cpp index b34b71cbe9..650cd079c2 100644 --- a/rocclr/compiler/lib/backends/common/frontend_clang.cpp +++ b/rocclr/compiler/lib/backends/common/frontend_clang.cpp @@ -190,19 +190,8 @@ int amdcl::ClangOCLFrontend::compileCommand(const std::string& src) { ret |= 1; } - if (!ret && -#if WITH_VERSION_0_8 - checkFlag(aclutGetCaps(Elf()), capSaveLLVMIR) -#elif WITH_VERSION_0_9 - Options()->oVariables->BinLLVMIR -#else -#error "The current version was not handled correctly here." -#endif - ) { - CL()->clAPI.insSec(CL(), Elf(), Source().data(), - Source().size(), aclLLVMIR); - } else { - CL()->clAPI.remSec(CL(), Elf(), aclLLVMIR); + if (!ret) { + CL()->clAPI.insSec(CL(), Elf(), Source().data(), Source().size(), aclLLVMIR); } log_ += logFromClang; if (isCpuTarget(Elf()->target) diff --git a/rocclr/compiler/lib/backends/common/v0_8/if_acl.cpp b/rocclr/compiler/lib/backends/common/v0_8/if_acl.cpp index e3197c9231..179d9b4640 100644 --- a/rocclr/compiler/lib/backends/common/v0_8/if_acl.cpp +++ b/rocclr/compiler/lib/backends/common/v0_8/if_acl.cpp @@ -1214,7 +1214,10 @@ aclCompileInternal( } dataStr = *cg; } - + if (!checkFlag(aclutGetCaps(bin), capSaveLLVMIR) || + !(reinterpret_cast(ald))->Options()->oVariables->BinLLVMIR) { + cl->clAPI.remSec(cl, bin, aclLLVMIR); + } cl->cgAPI.fini(ald); if (error_code != ACL_SUCCESS) { goto internal_compile_failure;