From c3fca75c4c93686302973b375b50f3329d6a79db Mon Sep 17 00:00:00 2001
From: foreman
Date: Fri, 18 Sep 2015 10:30:23 -0400
Subject: [PATCH] P4 to Git Change 1192073 by atimofee@atimofee-hsa on
2015/09/18 10:21:36
ECR #333753 - HSA HLC: TBAA metadata missed in Clang because -O0 is forced in wrapper
Affected files ...
... //depot/stg/opencl/drivers/opencl/compiler/clc2/driver/clc2.cpp#14 edit
... //depot/stg/opencl/drivers/opencl/compiler/clc2/wrapper/ClangWrapper.cpp#16 edit
... //depot/stg/opencl/drivers/opencl/compiler/lib/backends/common/frontend_clang.cpp#24 edit
[ROCm/clr commit: 0c9990d426e1b03c30d4b53f71fb366b7af43e1a]
---
.../rocclr/compiler/lib/backends/common/frontend_clang.cpp | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/projects/clr/rocclr/compiler/lib/backends/common/frontend_clang.cpp b/projects/clr/rocclr/compiler/lib/backends/common/frontend_clang.cpp
index 71b7b0b3c6..2e25b63874 100644
--- a/projects/clr/rocclr/compiler/lib/backends/common/frontend_clang.cpp
+++ b/projects/clr/rocclr/compiler/lib/backends/common/frontend_clang.cpp
@@ -41,6 +41,11 @@ int amdcl::ClangOCLFrontend::compileCommand(const std::string& src) {
// Following are the options passed to the ClangOCLFE library
// and then to Clang itself.
+ // handle -O0
+ if (amdOpts && amdOpts->origOptionStr.find("-O0") != std::string::npos) {
+ amdOpts->clangOptions.push_back("-O0");
+ }
+
// Passing the compiler FE options to clang.
if (amdOpts) {
for (std::vector::const_iterator it = amdOpts->clangOptions.begin();
@@ -48,6 +53,7 @@ int amdcl::ClangOCLFrontend::compileCommand(const std::string& src) {
argsToClang.push_back((*it).c_str());
}
}
+
if (Options()->oVariables->ImageSupport) {
argsToClang.push_back ("-D__IMAGE_SUPPORT__=1 ");
}