Skip to content

Commit ab314b9

Browse files
committed
Lower -profiling option to -debug-info-kind=line-tables-only
'-profiling' option aims source code view under VTune. Turning it on means that debug information will be generated and all optimizations will be made. Most of OpenCL transformation passes (vectorizer, barrier, etc.) work with debug information too offhandedly. To minimize risks to get debug information broken, let's generate it as less as possible. The patch also does other several things: 1. Update minimum cmake version to 3.13.4 to align with LLVM's cmake requirement. 2. Remove unused header and format code 3. Fix some build warnings
1 parent fe597f8 commit ab314b9

File tree

6 files changed

+13
-15
lines changed

6 files changed

+13
-15
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmake_minimum_required(VERSION 3.4.3)
1+
cmake_minimum_required(VERSION 3.13.4)
22

33
if(NOT DEFINED BASE_LLVM_VERSION)
44
set(BASE_LLVM_VERSION 16.0.0)

cl_headers/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ add_custom_target (
101101
function(pack_to_obj SRC DST TAG)
102102
add_custom_command (
103103
OUTPUT ${DST}
104-
DEPENDS ${SRC} linux_resource_linker
104+
DEPENDS ${SRC} ${LINUX_RESOURCE_LINKER_COMMAND}
105105
COMMAND ${LINUX_RESOURCE_LINKER_COMMAND} "${SRC}" "${DST}" "${TAG}"
106106
COMMENT "Packing ${SRC}"
107107
)

common_clang.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ Copyright (c) Intel Corporation (2009-2017).
4040
#include "llvm/Support/TargetSelect.h"
4141
#include "llvm/Support/ManagedStatic.h"
4242
#include "llvm/Support/Mutex.h"
43-
#include "llvm/Support/VirtualFileSystem.h"
4443
#include "clang/Basic/LangOptions.h"
4544
#include "clang/Basic/Diagnostic.h"
4645
#include "clang/Basic/DiagnosticIDs.h"
@@ -63,11 +62,8 @@ Copyright (c) Intel Corporation (2009-2017).
6362
#define CL_OUT_OF_HOST_MEMORY -6
6463

6564
#include "assert.h"
66-
#include <algorithm>
6765
#include <iosfwd>
6866
#include <iterator>
69-
#include <list>
70-
#include <streambuf>
7167
#ifdef _WIN32
7268
#include <ctype.h>
7369
#endif
@@ -265,8 +261,6 @@ Compile(const char *pszProgramSource, const char **pInputHeaders,
265261
ProcessWarningOptions(*Diags, compiler->getDiagnosticOpts());
266262

267263
// Map memory buffers to a virtual file system
268-
269-
// Source file
270264
MemFS->addFile(
271265
optionsParser.getSourceName(), (time_t)0,
272266
llvm::MemoryBuffer::getMemBuffer(

options.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,8 @@ class OpenCLArgList : public llvm::opt::ArgList {
7171

7272
const char *MakeArgStringRef(llvm::StringRef str) const override;
7373

74+
virtual ~OpenCLArgList() {}
75+
7476
private:
7577
/// List of argument strings used by the contained Args.
7678
///

options_compile.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ static const OptTable::Info ClangOptionsInfoTable[] = {
4747
{ \
4848
PREFIX, NAME, HELPTEXT, METAVAR, OPT_COMPILE_##ID, \
4949
llvm::opt::Option::KIND##Class, PARAM, FLAGS, OPT_COMPILE_##GROUP, \
50-
OPT_COMPILE_##ALIAS, ALIASARGS \
50+
OPT_COMPILE_##ALIAS, ALIASARGS, VALUES \
5151
} \
5252
,
5353
#include "opencl_clang_options.inc"
@@ -157,14 +157,14 @@ std::string EffectiveOptionsFilter::processOptions(const OpenCLArgList &args,
157157
// default:
158158
// assert(false && "some unknown argument");
159159
case OPT_COMPILE_profiling:
160-
case OPT_COMPILE_g_Flag:
161-
effectiveArgs.push_back("-debug-info-kind=limited");
162-
effectiveArgs.push_back("-dwarf-version=4");
163-
break;
164160
case OPT_COMPILE_gline_tables_only_Flag:
165161
effectiveArgs.push_back("-debug-info-kind=line-tables-only");
166162
effectiveArgs.push_back("-dwarf-version=4");
167163
break;
164+
case OPT_COMPILE_g_Flag:
165+
effectiveArgs.push_back("-debug-info-kind=limited");
166+
effectiveArgs.push_back("-dwarf-version=4");
167+
break;
168168
}
169169
}
170170

@@ -220,7 +220,7 @@ std::string EffectiveOptionsFilter::processOptions(const OpenCLArgList &args,
220220
// OpenCL v2.0 s6.9.u - Implicit function declaration is not supported.
221221
// Behavior of clang is changed and now there is only warning about
222222
// implicit function declarations. To be more user friendly and avoid
223-
// unexpected indirect function calls in IR, let's force this warning to
223+
// unexpected indirect function calls in BE, let's force this warning to
224224
// error.
225225
effectiveArgs.push_back("-Werror=implicit-function-declaration");
226226

pch_mgr.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ Copyright (c) Intel Corporation (2009-2017).
1818

1919
#include "pch_mgr.h"
2020

21-
#include "llvm/Object/ELF.h"
2221
#include "llvm/ADT/Twine.h"
22+
#include "llvm/Object/ELF.h"
2323

2424
#include <cstdlib>
2525
#include <stdio.h>
@@ -35,6 +35,8 @@ struct auto_dlclose {
3535
auto_dlclose(void *module) : m_pModule(module) {}
3636

3737
~auto_dlclose() {
38+
if (m_pModule)
39+
dlclose(m_pModule);
3840
}
3941

4042
void *get() { return m_pModule; }

0 commit comments

Comments
 (0)