Skip to content

Commit 623d1a5

Browse files
Merge branch 'main' into advance-support-extract-insert
2 parents 4c3646f + 3019e49 commit 623d1a5

File tree

376 files changed

+10079
-4458
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

376 files changed

+10079
-4458
lines changed

bolt/lib/RuntimeLibs/RuntimeLibrary.cpp

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#include "llvm/Object/Archive.h"
1919
#include "llvm/Object/ObjectFile.h"
2020
#include "llvm/Support/Path.h"
21+
#include "llvm/Support/Program.h"
2122

2223
#define DEBUG_TYPE "bolt-rtlib"
2324

@@ -38,6 +39,23 @@ std::string RuntimeLibrary::getLibPathByToolPath(StringRef ToolPath,
3839
llvm::sys::path::append(LibPath, "lib" LLVM_LIBDIR_SUFFIX);
3940
}
4041
llvm::sys::path::append(LibPath, LibFileName);
42+
if (!llvm::sys::fs::exists(LibPath)) {
43+
// If it is a symlink, check the directory that the symlink points to.
44+
if (llvm::sys::fs::is_symlink_file(ToolPath)) {
45+
SmallString<256> RealPath;
46+
llvm::sys::fs::real_path(ToolPath, RealPath);
47+
if (llvm::ErrorOr<std::string> P =
48+
llvm::sys::findProgramByName(RealPath)) {
49+
outs() << "BOLT-INFO: library not found: " << LibPath << "\n"
50+
<< "BOLT-INFO: " << ToolPath << " is a symlink; will look up "
51+
<< LibFileName
52+
<< " at the target directory that the symlink points to\n";
53+
return getLibPath(*P, LibFileName);
54+
}
55+
}
56+
errs() << "BOLT-ERROR: library not found: " << LibPath << "\n";
57+
exit(1);
58+
}
4159
return std::string(LibPath);
4260
}
4361

clang/docs/BoundsSafety.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -777,13 +777,13 @@ the transformed pseudo code of function ``alloc_buf()`` in the example below.
777777
size_t count;
778778
} sized_buf_t;
779779
780-
void alloc_buf(sized_buf_t *sbuf, sized_t nelems) {
780+
void alloc_buf(sized_buf_t *sbuf, size_t nelems) {
781781
sbuf->buf = (int *)malloc(sizeof(int) * nelems);
782782
sbuf->count = nelems;
783783
}
784784
785785
// Transformed pseudo code:
786-
void alloc_buf(sized_buf_t *sbuf, sized_t nelems) {
786+
void alloc_buf(sized_buf_t *sbuf, size_t nelems) {
787787
// Materialize RHS values:
788788
int *tmp_ptr = (int *)malloc(sizeof(int) * nelems);
789789
int tmp_count = nelems;

clang/docs/BoundsSafetyImplPlans.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ same basic block and without side effect in between.
134134
int *__counted_by(count) buf; size_t count;
135135
} sized_buf_t;
136136
137-
void alloc_buf(sized_buf_t *sbuf, sized_t nelems) {
137+
void alloc_buf(sized_buf_t *sbuf, size_t nelems) {
138138
sbuf->buf = (int *)malloc(sizeof(int) * nelems);
139139
sbuf->count = nelems;
140140
}

clang/docs/UsersManual.rst

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3125,6 +3125,24 @@ indexed format, regardeless whether it is produced by frontend or the IR pass.
31253125
overhead. ``prefer-atomic`` will be transformed to ``atomic`` when supported
31263126
by the target, or ``single`` otherwise.
31273127

3128+
.. option:: -fprofile-continuous
3129+
3130+
Enables the continuous instrumentation profiling where profile counter updates
3131+
are continuously synced to a file. This option sets any neccessary modifiers
3132+
(currently ``%c``) in the default profile filename and passes any necessary
3133+
flags to the middle-end to support this mode. Value profiling is not supported
3134+
in continuous mode.
3135+
3136+
.. code-block:: console
3137+
3138+
$ clang++ -O2 -fprofile-generate -fprofile-continuous code.cc -o code
3139+
3140+
Running ``./code`` will collect the profile and write it to the
3141+
``default_xxxx.profraw`` file. However, if ``./code`` abruptly terminates or
3142+
does not call ``exit()``, in continuous mode the profile collected up to the
3143+
point of termination will be available in ``default_xxxx.profraw`` while in
3144+
the non-continuous mode, no profile file is generated.
3145+
31283146
.. option:: -ftemporal-profile
31293147

31303148
Enables the temporal profiling extension for IRPGO to improve startup time by

clang/include/clang/Basic/CodeGenOptions.def

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,7 @@ AFFECTING_VALUE_CODEGENOPT(OptimizationLevel, 2, 0) ///< The -O[0-3] option spec
221221
AFFECTING_VALUE_CODEGENOPT(OptimizeSize, 2, 0) ///< If -Os (==1) or -Oz (==2) is specified.
222222

223223
CODEGENOPT(AtomicProfileUpdate , 1, 0) ///< Set -fprofile-update=atomic
224+
CODEGENOPT(ContinuousProfileSync, 1, 0) ///< Enable continuous instrumentation profiling
224225
/// Choose profile instrumenation kind or no instrumentation.
225226
ENUM_CODEGENOPT(ProfileInstr, ProfileInstrKind, 2, ProfileNone)
226227
/// Choose profile kind for PGO use compilation.

clang/include/clang/Driver/Options.td

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1795,6 +1795,11 @@ def fprofile_update_EQ : Joined<["-"], "fprofile-update=">,
17951795
Values<"atomic,prefer-atomic,single">,
17961796
MetaVarName<"<method>">, HelpText<"Set update method of profile counters">,
17971797
MarshallingInfoFlag<CodeGenOpts<"AtomicProfileUpdate">>;
1798+
def fprofile_continuous : Flag<["-"], "fprofile-continuous">,
1799+
Group<f_Group>, Visibility<[ClangOption, CC1Option]>,
1800+
HelpText<"Enable continuous instrumentation profiling mode">,
1801+
MarshallingInfoFlag<CodeGenOpts<"ContinuousProfileSync">>;
1802+
17981803
defm pseudo_probe_for_profiling : BoolFOption<"pseudo-probe-for-profiling",
17991804
CodeGenOpts<"PseudoProbeForProfiling">, DefaultFalse,
18001805
PosFlag<SetTrue, [], [ClangOption], "Emit">,
@@ -3416,8 +3421,6 @@ def fno_strict_aliasing : Flag<["-"], "fno-strict-aliasing">, Group<f_Group>,
34163421
def fstruct_path_tbaa : Flag<["-"], "fstruct-path-tbaa">, Group<f_Group>;
34173422
def fno_struct_path_tbaa : Flag<["-"], "fno-struct-path-tbaa">, Group<f_Group>;
34183423
def fno_strict_enums : Flag<["-"], "fno-strict-enums">, Group<f_Group>;
3419-
def fno_strict_overflow : Flag<["-"], "fno-strict-overflow">, Group<f_Group>,
3420-
Visibility<[ClangOption, FlangOption]>;
34213424
defm init_global_zero : BoolOptionWithoutMarshalling<"f", "init-global-zero",
34223425
PosFlag<SetTrue, [], [FlangOption, FC1Option],
34233426
"Zero initialize globals without default initialization (default)">,
@@ -3929,7 +3932,9 @@ defm strict_vtable_pointers : BoolFOption<"strict-vtable-pointers",
39293932
" overwriting polymorphic C++ objects">,
39303933
NegFlag<SetFalse>>;
39313934
def fstrict_overflow : Flag<["-"], "fstrict-overflow">, Group<f_Group>,
3932-
Visibility<[ClangOption, FlangOption]>;
3935+
Visibility<[ClangOption, CLOption, FlangOption]>;
3936+
def fno_strict_overflow : Flag<["-"], "fno-strict-overflow">, Group<f_Group>,
3937+
Visibility<[ClangOption, CLOption, FlangOption]>;
39333938
def fpointer_tbaa : Flag<["-"], "fpointer-tbaa">, Group<f_Group>;
39343939
def fdriver_only : Flag<["-"], "fdriver-only">, Flags<[NoXarchOption]>,
39353940
Visibility<[ClangOption, CLOption, DXCOption]>,

0 commit comments

Comments
 (0)