#
004ed2b0 |
| 31-Oct-2019 |
Amy Huang <akhuang@google.com> |
Revert "[CodeView] Add option to disable inline line tables." because it breaks compiler-rt tests.
This reverts commit 6d03890384517919a3ba7fe4c35535425f278f89.
|
#
6d038903 |
| 16-Sep-2019 |
Amy Huang <akhuang@google.com> |
[CodeView] Add option to disable inline line tables.
Summary: This adds a clang option to disable inline line tables. When it is used, the inliner uses the call site as the location of the inlined f
[CodeView] Add option to disable inline line tables.
Summary: This adds a clang option to disable inline line tables. When it is used, the inliner uses the call site as the location of the inlined function instead of marking it as an inline location with the function location.
See https://bugs.llvm.org/show_bug.cgi?id=42344
Reviewers: rnk
Subscribers: hiraditya, cfe-commits, llvm-commits
Tags: #clang, #llvm
Differential Revision: https://reviews.llvm.org/D67723
show more ...
|
#
d157a9bc |
| 28-Oct-2019 |
Andrew Paverd <andrew.paverd@microsoft.com> |
Add Windows Control Flow Guard checks (/guard:cf).
Summary: A new function pass (Transforms/CFGuard/CFGuard.cpp) inserts CFGuard checks on indirect function calls, using either the check mechanism (
Add Windows Control Flow Guard checks (/guard:cf).
Summary: A new function pass (Transforms/CFGuard/CFGuard.cpp) inserts CFGuard checks on indirect function calls, using either the check mechanism (X86, ARM, AArch64) or or the dispatch mechanism (X86-64). The check mechanism requires a new calling convention for the supported targets. The dispatch mechanism adds the target as an operand bundle, which is processed by SelectionDAG. Another pass (CodeGen/CFGuardLongjmp.cpp) identifies and emits valid longjmp targets, as required by /guard:cf. This feature is enabled using the `cfguard` CC1 option.
Reviewers: thakis, rnk, theraven, pcc
Subscribers: ychen, hans, metalcanine, dmajor, tomrittervg, alex, mehdi_amini, mgorny, javed.absar, kristof.beyls, hiraditya, steven_wu, dexonsmith, cfe-commits, llvm-commits
Tags: #clang, #llvm
Differential Revision: https://reviews.llvm.org/D65761
show more ...
|
#
1c98ff49 |
| 22-Oct-2019 |
Yaxun (Sam) Liu <yaxun.liu@amd.com> |
Fix name of warn_ignored_hip_only_option
Differential Revision: https://reviews.llvm.org/D69268
|
#
68f5ca4e |
| 22-Oct-2019 |
Yaxun (Sam) Liu <yaxun.liu@amd.com> |
[HIP] Add option -fgpu-allow-device-init
Add this option to allow device side class type global variables with non-trivial ctor/dtor. device side init/fini functions will be emitted, which will be e
[HIP] Add option -fgpu-allow-device-init
Add this option to allow device side class type global variables with non-trivial ctor/dtor. device side init/fini functions will be emitted, which will be executed by HIP runtime when the fat binary is loaded/unloaded.
This feature is to facilitate implementation of device side sanitizer which requires global vars with non-trival ctors.
By default this option is disabled.
Differential Revision: https://reviews.llvm.org/D69268
show more ...
|
#
8896d073 |
| 21-Oct-2019 |
Michael J. Spencer <bigcheesegs@gmail.com> |
[Implicit Modules] Add -cc1 option -fmodules-strict-context-hash which includes search paths and diagnostics.
This is a recommit of r375322 and r375327 with a fix for the Windows test breakage.
llv
[Implicit Modules] Add -cc1 option -fmodules-strict-context-hash which includes search paths and diagnostics.
This is a recommit of r375322 and r375327 with a fix for the Windows test breakage.
llvm-svn: 375466
show more ...
|
#
81a01e73 |
| 19-Oct-2019 |
Michael J. Spencer <bigcheesegs@gmail.com> |
Revert "[Implicit Modules] Add -cc1 option -fmodules-strict-context-hash which includes search paths and diagnostics." and "[Docs] Fix header level."
The test doesn't work on Windows. I'll fix it an
Revert "[Implicit Modules] Add -cc1 option -fmodules-strict-context-hash which includes search paths and diagnostics." and "[Docs] Fix header level."
The test doesn't work on Windows. I'll fix it and recommit later.
llvm-svn: 375338
show more ...
|
#
14a3f77b |
| 19-Oct-2019 |
Michael J. Spencer <bigcheesegs@gmail.com> |
[Implicit Modules] Add -cc1 option -fmodules-strict-context-hash which includes search paths and diagnostics.
Differential Revision: https://reviews.llvm.org/D68528
llvm-svn: 375322
|
#
3b598b9c |
| 17-Oct-2019 |
Oliver Stannard <oliver.stannard@linaro.org> |
Reland: Dead Virtual Function Elimination
Remove dead virtual functions from vtables with replaceNonMetadataUsesWith, so that CGProfile metadata gets cleaned up correctly.
Original commit message:
Reland: Dead Virtual Function Elimination
Remove dead virtual functions from vtables with replaceNonMetadataUsesWith, so that CGProfile metadata gets cleaned up correctly.
Original commit message:
Currently, it is hard for the compiler to remove unused C++ virtual functions, because they are all referenced from vtables, which are referenced by constructors. This means that if the constructor is called from any live code, then we keep every virtual function in the final link, even if there are no call sites which can use it.
This patch allows unused virtual functions to be removed during LTO (and regular compilation in limited circumstances) by using type metadata to match virtual function call sites to the vtable slots they might load from. This information can then be used in the global dead code elimination pass instead of the references from vtables to virtual functions, to more accurately determine which functions are reachable.
To make this transformation safe, I have changed clang's code-generation to always load virtual function pointers using the llvm.type.checked.load intrinsic, instead of regular load instructions. I originally tried writing this using clang's existing code-generation, which uses the llvm.type.test and llvm.assume intrinsics after doing a normal load. However, it is possible for optimisations to obscure the relationship between the GEP, load and llvm.type.test, causing GlobalDCE to fail to find virtual function call sites.
The existing linkage and visibility types don't accurately describe the scope in which a virtual call could be made which uses a given vtable. This is wider than the visibility of the type itself, because a virtual function call could be made using a more-visible base class. I've added a new !vcall_visibility metadata type to represent this, described in TypeMetadata.rst. The internalization pass and libLTO have been updated to change this metadata when linking is performed.
This doesn't currently work with ThinLTO, because it needs to see every call to llvm.type.checked.load in the linkage unit. It might be possible to extend this optimisation to be able to use the ThinLTO summary, as was done for devirtualization, but until then that combination is rejected in the clang driver.
To test this, I've written a fuzzer which generates random C++ programs with complex class inheritance graphs, and virtual functions called through object and function pointers of different types. The programs are spread across multiple translation units and DSOs to test the different visibility restrictions.
I've also tried doing bootstrap builds of LLVM to test this. This isn't ideal, because only classes in anonymous namespaces can be optimised with -fvisibility=default, and some parts of LLVM (plugins and bugpoint) do not work correctly with -fvisibility=hidden. However, there are only 12 test failures when building with -fvisibility=hidden (and an unmodified compiler), and this change does not cause any new failures for either value of -fvisibility.
On the 7 C++ sub-benchmarks of SPEC2006, this gives a geomean code-size reduction of ~6%, over a baseline compiled with "-O2 -flto -fvisibility=hidden -fwhole-program-vtables". The best cases are reductions of ~14% in 450.soplex and 483.xalancbmk, and there are no code size increases.
I've also run this on a set of 8 mbed-os examples compiled for Armv7M, which show a geomean size reduction of ~3%, again with no size increases.
I had hoped that this would have no effect on performance, which would allow it to awlays be enabled (when using -fwhole-program-vtables). However, the changes in clang to use the llvm.type.checked.load intrinsic are causing ~1% performance regression in the C++ parts of SPEC2006. It should be possible to recover some of this perf loss by teaching optimisations about the llvm.type.checked.load intrinsic, which would make it worth turning this on by default (though it's still dependent on -fwhole-program-vtables).
Differential revision: https://reviews.llvm.org/D63932
llvm-svn: 375094
show more ...
|
#
1731fc88 |
| 15-Oct-2019 |
Bruno Cardoso Lopes <bruno.cardoso@gmail.com> |
Reapply: [Modules][PCH] Hash input files content
Summary: When files often get touched during builds, the mtime based validation leads to different problems in implicit modules builds, even when the
Reapply: [Modules][PCH] Hash input files content
Summary: When files often get touched during builds, the mtime based validation leads to different problems in implicit modules builds, even when the content doesn't actually change:
- Modules only: module invalidation due to out of date files. Usually causing rebuild traffic. - Modules + PCH: build failures because clang cannot rebuild a module if it comes from building a PCH. - PCH: build failures because clang cannot rebuild a PCH in case one of the input headers has different mtime.
This patch proposes hashing the content of input files (headers and module maps), which is performed during serialization time. When looking at input files for validation, clang only computes the hash in case there's a mtime mismatch.
I've tested a couple of different hash algorithms availble in LLVM in face of building modules+pch for `#import <Cocoa/Cocoa.h>`: - `hash_code`: performace diff within the noise, total module cache increased by 0.07%. - `SHA1`: 5% slowdown. Haven't done real size measurements, but it'd be BLOCK_ID+20 bytes per input file, instead of BLOCK_ID+8 bytes from `hash_code`. - `MD5`: 3% slowdown. Like above, but BLOCK_ID+16 bytes per input file.
Given the numbers above, the patch uses `hash_code`. The patch also improves invalidation error msgs to point out which type of problem the user is facing: "mtime", "size" or "content".
rdar://problem/29320105
Reviewers: dexonsmith, arphaman, rsmith, aprantl
Subscribers: jkorous, cfe-commits, ributzka
Tags: #clang
Differential Revision: https://reviews.llvm.org/D67249
> llvm-svn: 374841
llvm-svn: 374895
show more ...
|
#
b052331b |
| 14-Oct-2019 |
Jorge Gorbe Moya <jgorbe@google.com> |
Revert "Dead Virtual Function Elimination"
This reverts commit 9f6a873268e1ad9855873d9d8007086c0d01cf4f.
llvm-svn: 374844
|
#
3be9169c |
| 14-Oct-2019 |
Eric Christopher <echristo@gmail.com> |
Temporarily Revert [Modules][PCH] Hash input files content as it's breaking a few bots.
This reverts r374841 (git commit 2a1386c81de504b5bda44fbecf3f7b4cdfd748fc)
llvm-svn: 374842
|
#
2a1386c8 |
| 14-Oct-2019 |
Bruno Cardoso Lopes <bruno.cardoso@gmail.com> |
[Modules][PCH] Hash input files content
Summary: When files often get touched during builds, the mtime based validation leads to different problems in implicit modules builds, even when the content
[Modules][PCH] Hash input files content
Summary: When files often get touched during builds, the mtime based validation leads to different problems in implicit modules builds, even when the content doesn't actually change:
- Modules only: module invalidation due to out of date files. Usually causing rebuild traffic. - Modules + PCH: build failures because clang cannot rebuild a module if it comes from building a PCH. - PCH: build failures because clang cannot rebuild a PCH in case one of the input headers has different mtime.
This patch proposes hashing the content of input files (headers and module maps), which is performed during serialization time. When looking at input files for validation, clang only computes the hash in case there's a mtime mismatch.
I've tested a couple of different hash algorithms availble in LLVM in face of building modules+pch for `#import <Cocoa/Cocoa.h>`: - `hash_code`: performace diff within the noise, total module cache increased by 0.07%. - `SHA1`: 5% slowdown. Haven't done real size measurements, but it'd be BLOCK_ID+20 bytes per input file, instead of BLOCK_ID+8 bytes from `hash_code`. - `MD5`: 3% slowdown. Like above, but BLOCK_ID+16 bytes per input file.
Given the numbers above, the patch uses `hash_code`. The patch also improves invalidation error msgs to point out which type of problem the user is facing: "mtime", "size" or "content".
rdar://problem/29320105
Reviewers: dexonsmith, arphaman, rsmith, aprantl
Subscribers: jkorous, cfe-commits, ributzka
Tags: #clang
Differential Revision: https://reviews.llvm.org/D67249
llvm-svn: 374841
show more ...
|
#
c5d14b5c |
| 14-Oct-2019 |
Jan Korous <jkorous@apple.com> |
[clang-scan-deps] Support for clang --analyze in clang-scan-deps
The goal is to have 100% fidelity in clang-scan-deps behavior when --analyze is present in compilation command.
At the same time I d
[clang-scan-deps] Support for clang --analyze in clang-scan-deps
The goal is to have 100% fidelity in clang-scan-deps behavior when --analyze is present in compilation command.
At the same time I don't want to break clang-tidy which expects __static_analyzer__ macro defined as built-in.
I introduce new cc1 options (-setup-static-analyzer) that controls the macro definition and is conditionally set in driver.
Differential Revision: https://reviews.llvm.org/D68093
llvm-svn: 374815
show more ...
|
#
17bde36a |
| 12-Oct-2019 |
Puyan Lotfi <puyan@puyan.org> |
[clang][IFS] Fixing spelling errors in interface-stubs OPT flag (NFC).
This is just a long standing spelling error that was found recently.
llvm-svn: 374638
|
#
9f6a8732 |
| 11-Oct-2019 |
Oliver Stannard <oliver.stannard@linaro.org> |
Dead Virtual Function Elimination
Currently, it is hard for the compiler to remove unused C++ virtual functions, because they are all referenced from vtables, which are referenced by constructors. T
Dead Virtual Function Elimination
Currently, it is hard for the compiler to remove unused C++ virtual functions, because they are all referenced from vtables, which are referenced by constructors. This means that if the constructor is called from any live code, then we keep every virtual function in the final link, even if there are no call sites which can use it.
This patch allows unused virtual functions to be removed during LTO (and regular compilation in limited circumstances) by using type metadata to match virtual function call sites to the vtable slots they might load from. This information can then be used in the global dead code elimination pass instead of the references from vtables to virtual functions, to more accurately determine which functions are reachable.
To make this transformation safe, I have changed clang's code-generation to always load virtual function pointers using the llvm.type.checked.load intrinsic, instead of regular load instructions. I originally tried writing this using clang's existing code-generation, which uses the llvm.type.test and llvm.assume intrinsics after doing a normal load. However, it is possible for optimisations to obscure the relationship between the GEP, load and llvm.type.test, causing GlobalDCE to fail to find virtual function call sites.
The existing linkage and visibility types don't accurately describe the scope in which a virtual call could be made which uses a given vtable. This is wider than the visibility of the type itself, because a virtual function call could be made using a more-visible base class. I've added a new !vcall_visibility metadata type to represent this, described in TypeMetadata.rst. The internalization pass and libLTO have been updated to change this metadata when linking is performed.
This doesn't currently work with ThinLTO, because it needs to see every call to llvm.type.checked.load in the linkage unit. It might be possible to extend this optimisation to be able to use the ThinLTO summary, as was done for devirtualization, but until then that combination is rejected in the clang driver.
To test this, I've written a fuzzer which generates random C++ programs with complex class inheritance graphs, and virtual functions called through object and function pointers of different types. The programs are spread across multiple translation units and DSOs to test the different visibility restrictions.
I've also tried doing bootstrap builds of LLVM to test this. This isn't ideal, because only classes in anonymous namespaces can be optimised with -fvisibility=default, and some parts of LLVM (plugins and bugpoint) do not work correctly with -fvisibility=hidden. However, there are only 12 test failures when building with -fvisibility=hidden (and an unmodified compiler), and this change does not cause any new failures for either value of -fvisibility.
On the 7 C++ sub-benchmarks of SPEC2006, this gives a geomean code-size reduction of ~6%, over a baseline compiled with "-O2 -flto -fvisibility=hidden -fwhole-program-vtables". The best cases are reductions of ~14% in 450.soplex and 483.xalancbmk, and there are no code size increases.
I've also run this on a set of 8 mbed-os examples compiled for Armv7M, which show a geomean size reduction of ~3%, again with no size increases.
I had hoped that this would have no effect on performance, which would allow it to awlays be enabled (when using -fwhole-program-vtables). However, the changes in clang to use the llvm.type.checked.load intrinsic are causing ~1% performance regression in the C++ parts of SPEC2006. It should be possible to recover some of this perf loss by teaching optimisations about the llvm.type.checked.load intrinsic, which would make it worth turning this on by default (though it's still dependent on -fwhole-program-vtables).
Differential revision: https://reviews.llvm.org/D63932
llvm-svn: 374539
show more ...
|
#
5e866e41 |
| 10-Oct-2019 |
Reid Kleckner <rnk@google.com> |
Add -fgnuc-version= to control __GNUC__ and other GCC macros
I noticed that compiling on Windows with -fno-ms-compatibility had the side effect of defining __GNUC__, along with __GNUG__, __GXX_RTTI_
Add -fgnuc-version= to control __GNUC__ and other GCC macros
I noticed that compiling on Windows with -fno-ms-compatibility had the side effect of defining __GNUC__, along with __GNUG__, __GXX_RTTI__, and a number of other macros for GCC compatibility. This is undesirable and causes Chromium to do things like mix __attribute__ and __declspec, which doesn't work. We should have a positive language option to enable GCC compatibility features so that we can experiment with -fno-ms-compatibility on Windows. This change adds -fgnuc-version= to be that option.
My issue aside, users have, for a long time, reported that __GNUC__ doesn't match their expectations in one way or another. We have encouraged users to migrate code away from this macro, but new code continues to be written assuming a GCC-only environment. There's really nothing we can do to stop that. By adding this flag, we can allow them to choose their own adventure with __GNUC__.
This overlaps a bit with the "GNUMode" language option from -std=gnu*. The gnu language mode tends to enable non-conforming behaviors that we'd rather not enable by default, but the we want to set things like __GXX_RTTI__ by default, so I've kept these separate.
Helps address PR42817
Reviewed By: hans, nickdesaulniers, MaskRay
Differential Revision: https://reviews.llvm.org/D68055
llvm-svn: 374449
show more ...
|
#
f71bac6f |
| 09-Oct-2019 |
Nikola Prica <nikola.prica@rt-rk.com> |
[DebugInfo] Enable call site debug info for ARM and AArch64
ARM and AArch64 SelectionDAG support for tacking parameter forwarding register is implemented so we can allow clang invocations for those
[DebugInfo] Enable call site debug info for ARM and AArch64
ARM and AArch64 SelectionDAG support for tacking parameter forwarding register is implemented so we can allow clang invocations for those two targets. Beside that restrict debug entry value support to be emitted for LimitedDebugInfo info and FullDebugInfo. Other types of debug info do not have functions nor variables debug info.
Reviewers: aprantl, probinson, dstenb, vsk
Reviewed By: vsk
Differential Revision: https://reviews.llvm.org/D67004
llvm-svn: 374153
show more ...
|
#
c382d03c |
| 08-Oct-2019 |
Puyan Lotfi <puyan@puyan.org> |
[clang][ifs] Clang Interface Stubs ToolChain plumbing.
Second Landing Attempt:
This patch enables end to end support for generating ELF interface stubs directly from clang. Now the following:
clan
[clang][ifs] Clang Interface Stubs ToolChain plumbing.
Second Landing Attempt:
This patch enables end to end support for generating ELF interface stubs directly from clang. Now the following:
clang -emit-interface-stubs -o libfoo.so a.cpp b.cpp c.cpp
will product an ELF binary with visible symbols populated. Visibility attributes and -fvisibility can be used to control what gets populated.
* Adding ToolChain support for clang Driver IFS Merge Phase * Implementing a default InterfaceStubs Merge clang Tool, used by ToolChain * Adds support for the clang Driver to involve llvm-ifs on ifs files. * Adds -emit-merged-ifs flag, to tell llvm-ifs to emit a merged ifs text file instead of the final object format (normally ELF)
Differential Revision: https://reviews.llvm.org/D63978
llvm-svn: 374061
show more ...
|
#
6713f823 |
| 03-Oct-2019 |
Nico Weber <nicolasweber@gmx.de> |
Revert 373538 and follow-ups 373549 and 373552.
They break tests on (at least) macOS.
llvm-svn: 373556
|
#
406de17b |
| 02-Oct-2019 |
Puyan Lotfi <puyan@puyan.org> |
[clang][ifs] Clang Interface Stubs ToolChain plumbing.
This patch enables end to end support for generating ELF interface stubs directly from clang. Now the following:
clang -emit-interface-stubs -
[clang][ifs] Clang Interface Stubs ToolChain plumbing.
This patch enables end to end support for generating ELF interface stubs directly from clang. Now the following:
clang -emit-interface-stubs -o libfoo.so a.cpp b.cpp c.cpp
will product an ELF binary with visible symbols populated. Visibility attributes and -fvisibility can be used to control what gets populated.
* Adding ToolChain support for clang Driver IFS Merge Phase * Implementing a default InterfaceStubs Merge clang Tool, used by ToolChain * Adds support for the clang Driver to involve llvm-ifs on ifs files. * Adds -emit-merged-ifs flag, to tell llvm-ifs to emit a merged ifs text file instead of the final object format (normally ELF)
Differential Revision: https://reviews.llvm.org/D63978
llvm-svn: 373538
show more ...
|
#
12828893 |
| 24-Sep-2019 |
Yaxun Liu <Yaxun.Liu@amd.com> |
[HIP] Support new kernel launching API
Differential Revision: https://reviews.llvm.org/D67947
llvm-svn: 372773
|
#
950b70dc |
| 13-Sep-2019 |
Nandor Licker <n@ndor.email> |
[Clang Interpreter] Initial patch for the constexpr interpreter
Summary: This patch introduces the skeleton of the constexpr interpreter, capable of evaluating a simple constexpr functions consistin
[Clang Interpreter] Initial patch for the constexpr interpreter
Summary: This patch introduces the skeleton of the constexpr interpreter, capable of evaluating a simple constexpr functions consisting of if statements. The interpreter is described in more detail in the RFC. Further patches will add more features.
Reviewers: Bigcheese, jfb, rsmith
Subscribers: bruno, uenoku, ldionne, Tyker, thegameg, tschuett, dexonsmith, mgorny, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D64146
llvm-svn: 371834
show more ...
|
#
c624510f |
| 13-Sep-2019 |
Richard Smith <richard-llvm@metafoo.co.uk> |
For PR17164: split -fno-lax-vector-conversion into three different levels:
-- none: no lax vector conversions [new GCC default] -- integer: only conversions between integer vectors [old GCC defaul
For PR17164: split -fno-lax-vector-conversion into three different levels:
-- none: no lax vector conversions [new GCC default] -- integer: only conversions between integer vectors [old GCC default] -- all: all conversions between same-size vectors [Clang default]
For now, Clang still defaults to "all" mode, but per my proposal on cfe-dev (2019-04-10) the default will be changed to "integer" as soon as that doesn't break lots of testcases. (Eventually I'd like to change the default to "none" to match GCC and general sanity.)
Following GCC's behavior, the driver flag -flax-vector-conversions is translated to -flax-vector-conversions=integer.
This reinstates r371805, reverted in r371813, with an additional fix for lldb.
llvm-svn: 371817
show more ...
|
#
4aaa77e4 |
| 13-Sep-2019 |
Jonas Devlieghere <jonas@devlieghere.com> |
Revert "For PR17164: split -fno-lax-vector-conversion into three different"
This breaks the LLDB build. I tried reaching out to Richard, but haven't gotten a reply yet.
llvm-svn: 371813
|