From fa37a08a8c411f7036109abc9fa8ed99aab6bcee Mon Sep 17 00:00:00 2001
From: foreman
Date: Sat, 26 Aug 2017 00:57:57 -0400
Subject: [PATCH] P4 to Git Change 1451977 by lmoriche@lmoriche_opencl_dev2 on
2017/08/26 00:40:17
SWDEV-116136 - Support -Og for Clang
- Add missed changes mentioned in the code review.
Affected files ...
... //depot/stg/opencl/drivers/opencl/compiler/legacy-lib/backends/common/codegen.cpp#4 edit
... //depot/stg/opencl/drivers/opencl/compiler/legacy-lib/backends/common/opt_level.cpp#3 edit
... //depot/stg/opencl/drivers/opencl/compiler/legacy-lib/backends/gpu/scwrapper/scState.cpp#8 edit
... //depot/stg/opencl/drivers/opencl/compiler/legacy-lib/utils/options.cpp#6 edit
... //depot/stg/opencl/drivers/opencl/compiler/legacy-lib/utils/options.hpp#6 edit
... //depot/stg/opencl/drivers/opencl/compiler/lib/backends/common/codegen.cpp#74 edit
... //depot/stg/opencl/drivers/opencl/compiler/lib/backends/common/opt_level.cpp#34 edit
... //depot/stg/opencl/drivers/opencl/compiler/lib/utils/options.cpp#43 edit
... //depot/stg/opencl/drivers/opencl/compiler/lib/utils/options.hpp#20 edit
[ROCm/clr commit: de1c5f6d0dbc9d069312dc3a67b961ddc15a011a]
---
.../compiler/lib/backends/common/codegen.cpp | 2 +-
.../lib/backends/common/opt_level.cpp | 4 ++--
.../clr/rocclr/compiler/lib/utils/options.cpp | 8 --------
.../clr/rocclr/compiler/lib/utils/options.hpp | 20 +++++++++----------
4 files changed, 13 insertions(+), 21 deletions(-)
diff --git a/projects/clr/rocclr/compiler/lib/backends/common/codegen.cpp b/projects/clr/rocclr/compiler/lib/backends/common/codegen.cpp
index 0309a95272..760e6aa602 100644
--- a/projects/clr/rocclr/compiler/lib/backends/common/codegen.cpp
+++ b/projects/clr/rocclr/compiler/lib/backends/common/codegen.cpp
@@ -485,10 +485,10 @@ llvmCodeGen(
assert(!"Error with optimization level");
case amd::option::OPT_O2: // -O2
case amd::option::OPT_O5: // -O5
+ case amd::option::OPT_OG: // -Og
case amd::option::OPT_OS: // -Os
OLvl = CodeGenOpt::Default;
break;
- case amd::option::OPT_OG: // -Og
case amd::option::OPT_O3: // -O3
case amd::option::OPT_O4: // -O4
OLvl = CodeGenOpt::Aggressive;
diff --git a/projects/clr/rocclr/compiler/lib/backends/common/opt_level.cpp b/projects/clr/rocclr/compiler/lib/backends/common/opt_level.cpp
index 397587d8db..a2d7c2b412 100644
--- a/projects/clr/rocclr/compiler/lib/backends/common/opt_level.cpp
+++ b/projects/clr/rocclr/compiler/lib/backends/common/opt_level.cpp
@@ -71,10 +71,10 @@ OptLevel::setup(aclBinary *elf, bool isGPU, uint32_t OptLevel)
break;
case amd::option::OPT_O2: // -O2
case amd::option::OPT_O5: // -O5
+ case amd::option::OPT_OG: // -Og
case amd::option::OPT_OS: // -Os
OLvl = CodeGenOpt::Default;
break;
- case amd::option::OPT_OG: // -Og
case amd::option::OPT_O3: // -O3
case amd::option::OPT_O4: // -O4
OLvl = CodeGenOpt::Aggressive;
@@ -278,7 +278,7 @@ int
OgOptLevel::optimize(aclBinary *elf, Module *input, bool isGPU)
{
module_ = input;
- setup(elf, isGPU, 3);
+ setup(elf, isGPU, 2);
run(elf);
return 0;
}
diff --git a/projects/clr/rocclr/compiler/lib/utils/options.cpp b/projects/clr/rocclr/compiler/lib/utils/options.cpp
index bb263e4d4a..217ab931e0 100644
--- a/projects/clr/rocclr/compiler/lib/utils/options.cpp
+++ b/projects/clr/rocclr/compiler/lib/utils/options.cpp
@@ -758,14 +758,6 @@ processOption(int OptDescTableIx, Options& Opts, const std::string& Value,
}
break;
- case OID_OptLevel:
- if (ival == 'g') {
-#if defined(WITH_LIGHTNING_COMPILER)
- Opts.clangOptions.push_back("-Og");
-#endif
- }
- break;
-
case OID_FiniteMathOnly:
Opts.setFlag(OID_FiniteMathOnly, 1);
tod = &OptDescTable[OID_FiniteMathOnly];
diff --git a/projects/clr/rocclr/compiler/lib/utils/options.hpp b/projects/clr/rocclr/compiler/lib/utils/options.hpp
index 9f2f7635f1..f721f58869 100644
--- a/projects/clr/rocclr/compiler/lib/utils/options.hpp
+++ b/projects/clr/rocclr/compiler/lib/utils/options.hpp
@@ -181,16 +181,16 @@ enum DumpFlags {
DUMP_ALL = 0x00007FFF // Everything
};
-enum OptLevelFlags {
- OPT_O0 = 48, // No optimization setting.
- OPT_O1 = 49,
- OPT_O2 = 50,
- OPT_O3 = 51,
- OPT_O4 = 52,
- OPT_O5 = 53,
- OPT_OG = 103, // g ASCII
- OPT_OS = 115, // s ASCII
- OPT_Error = 116, // Invalid optimization set
+enum OptLevelFlags : unsigned char {
+ OPT_O0 = '0', // No optimization setting.
+ OPT_O1 = '1',
+ OPT_O2 = '2',
+ OPT_O3 = '3',
+ OPT_O4 = '4',
+ OPT_O5 = '5',
+ OPT_OG = 'g', // g ASCII
+ OPT_OS = 's', // s ASCII
+ OPT_Error = 0, // Invalid optimization set
/** Canary Value that guards against enum changes
* @warning This value cannot be changed without updating the appropriate
* tests and should NEVER be decreased.