Malcolm Parsons [Tue, 27 Nov 2018 16:23:39 +0000 (16:23 +0000)]
[clang-tidy] Ignore bool -> single bit bitfield conversion in readability-implicit-bool-conversion
Summary: There is no ambiguity / information loss in this conversion
Reviewers: alexfh, aaron.ballman, hokein
Reviewed By: alexfh
Subscribers: xazax.hun, cfe-commits
Differential Revision: https://reviews.llvm.org/D54941
llvm-svn: 347671
Pavel Labath [Tue, 27 Nov 2018 16:11:24 +0000 (16:11 +0000)]
[Demangle] remove itaniumFindTypesInMangledName
Summary:
This (very specialized) function was added to enable an LLDB use case.
Now that a more generic interface (overriding of parser functions -
D52992) is available, and LLDB has been converted to use that (D54074),
the function is unused and can be removed.
Reviewers: erik.pilkington, sgraenitz, rsmith
Subscribers: mgorny, hiraditya, christof, libcxx-commits, llvm-commits
Differential Revision: https://reviews.llvm.org/D54893
llvm-svn: 347670
Kadir Cetinkaya [Tue, 27 Nov 2018 16:08:53 +0000 (16:08 +0000)]
[clangd] Put direct headers into srcs section.
Summary:
Currently, there's no way of knowing about header files
using compilation database, since it doesn't contain header files as entries.
Using this information, restoring from cache using compile commands becomes
possible instead of doing directory traversal. Also, we can issue indexing
actions for out-of-date headers even if source files depending on them haven't
changed.
Reviewers: sammccall
Subscribers: ilya-biryukov, ioeric, MaskRay, jkorous, arphaman, cfe-commits
Differential Revision: https://reviews.llvm.org/D54817
llvm-svn: 347669
Jan Vesely [Tue, 27 Nov 2018 16:07:21 +0000 (16:07 +0000)]
travis: Add cmake build
Reviewer: Aaron Watry
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
llvm-svn: 347668
Jan Vesely [Tue, 27 Nov 2018 16:07:19 +0000 (16:07 +0000)]
Add cmake build system
Add cmake support for CLC and ll asm language,
the latter includes clang preprocessing stage.
Add ctests to check for external function calls.
v2: fix typos, style
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
Acked-by: Aaron Watry <awatry@gmail.com>
Tested-by: Aaron Watry <awatry@gmail.com>
Acked-by: Vedran Miletić <vedran@miletic.net>
llvm-svn: 347667
Jan Vesely [Tue, 27 Nov 2018 16:01:16 +0000 (16:01 +0000)]
r600: Remove empty OVERRIDES file
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
Reviewer: Aaron Watry
llvm-svn: 347666
Jan Vesely [Tue, 27 Nov 2018 16:01:13 +0000 (16:01 +0000)]
amdgcn: Consolidate atomic minmax helpers
Removes most overrides
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
Reviewer: Aaron Watry
llvm-svn: 347665
Jan Vesely [Tue, 27 Nov 2018 16:01:10 +0000 (16:01 +0000)]
configure: Add target specific asm rule.
Run the file through target specific preprocessing stage.
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
Reviewer: Aaron Watry
llvm-svn: 347664
Jan Vesely [Tue, 27 Nov 2018 16:01:01 +0000 (16:01 +0000)]
configure: provide llvm_as helper variable
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
Reviewer: Aaron Watry
llvm-svn: 347663
Andrea Di Biagio [Tue, 27 Nov 2018 15:56:00 +0000 (15:56 +0000)]
[llvm-mca] pass -dispatch-stats flag to a couple of tests. NFC
This change is in preparation for a patch that fixes PR36666.
llvm-mca currently doesn't know if a buffered processor resource describes a
load or store queue. So, any dynamic dispatch stall caused by the lack of
load/store queue entries is normally reported as a generic SCHEDULER stall. See for
example the -dispatch-stats output from the two tests modified by this patch.
In future, processor models will be able to tag processor resources that are
used to describe load/store queues. That information would then be used by
llvm-mca to correctly classify dynamic dispatch stalls caused by the lack of
tokens in the LS.
llvm-svn: 347662
Sanjay Patel [Tue, 27 Nov 2018 15:52:17 +0000 (15:52 +0000)]
[x86] regenerate checks; NFC
llvm-svn: 347661
Jonas Devlieghere [Tue, 27 Nov 2018 15:25:58 +0000 (15:25 +0000)]
Move time cast to SymbolFileDWARFDebugMap
When trying to fix the bots we expected that the cast would be needed in
different places. Ultimately it turned out only the
SymbolFileDWARFDebugMap was affected so, as Pavel correctly notes, it
makes more sense to do the cast just there instead of in teh FS.
llvm-svn: 347660
Stanislav Mekhanoshin [Tue, 27 Nov 2018 15:13:37 +0000 (15:13 +0000)]
[AMDGPU] Disable DAG combine at -O0
Differential Revision: https://reviews.llvm.org/D54358
llvm-svn: 347659
Marco Antognini [Tue, 27 Nov 2018 14:54:58 +0000 (14:54 +0000)]
Derive builtin return type from its definition
Summary:
Prior to this patch, OpenCL code such as the following would attempt to create
a BranchInst with a non-bool argument:
if (enqueue_kernel(get_default_queue(), 0, nd, ^(void){})) /* ... */
This patch is a follow up on a similar issue with pipe builtin
operations. See commit r280800 and https://bugs.llvm.org/show_bug.cgi?id=30219.
This change, while being conservative on non-builtin functions,
should set the type of expressions invoking builtins to the
proper type, instead of defaulting to `bool` and requiring
manual overrides in Sema::CheckBuiltinFunctionCall.
In addition to tests for enqueue_kernel, the tests are extended to
check other OpenCL builtins.
Reviewers: Anastasia, spatel, rsmith
Reviewed By: Anastasia
Subscribers: kristina, cfe-commits, svenvh
Differential Revision: https://reviews.llvm.org/D52879
llvm-svn: 347658
Hans Wennborg [Tue, 27 Nov 2018 14:15:37 +0000 (14:15 +0000)]
Revert r347419 "Update call to EvaluateAsInt() to the new syntax."
It's pre-requisite was reverted in r347656.
llvm-svn: 347657
Hans Wennborg [Tue, 27 Nov 2018 14:01:40 +0000 (14:01 +0000)]
Revert r347417 "Re-Reinstate 347294 with a fix for the failures."
This caused a miscompile in Chrome (see crbug.com/908372) that's
illustrated by this small reduction:
static bool f(int *a, int *b) {
return !__builtin_constant_p(b - a) || (!(b - a));
}
int arr[] = {1,2,3};
bool g() {
return f(arr, arr + 3);
}
$ clang -O2 -S -emit-llvm a.cc -o -
g() should return true, but after r347417 it became false for some reason.
This also reverts the follow-up commits.
r347417:
> Re-Reinstate 347294 with a fix for the failures.
>
> Don't try to emit a scalar expression for a non-scalar argument to
> __builtin_constant_p().
>
> Third time's a charm!
r347446:
> The result of is.constant() is unsigned.
r347480:
> A __builtin_constant_p() returns 0 with a function type.
r347512:
> isEvaluatable() implies a constant context.
>
> Assume that we're in a constant context if we're asking if the expression can
> be compiled into a constant initializer. This fixes the issue where a
> __builtin_constant_p() in a compound literal was diagnosed as not being
> constant, even though it's always possible to convert the builtin into a
> constant.
r347531:
> A "constexpr" is evaluated in a constant context. Make sure this is reflected
> if a __builtin_constant_p() is a part of a constexpr.
llvm-svn: 347656
Sam McCall [Tue, 27 Nov 2018 12:09:13 +0000 (12:09 +0000)]
[clangd] Prevent thread starvation in tests on loaded systems.
Summary:
Background index deliberately runs low-priority, but for tests this may stop
them making progress.
Reviewers: kadircet
Subscribers: ilya-biryukov, ioeric, MaskRay, jkorous, arphaman, jfb, cfe-commits
Differential Revision: https://reviews.llvm.org/D54938
llvm-svn: 347655
Ivan Donchevskii [Tue, 27 Nov 2018 12:02:39 +0000 (12:02 +0000)]
[libclang] Fix clang_Cursor_getNumArguments and clang_Cursor_getArgument for CXXConstructExpr
Constructors have the same methods for arguments as call expressions.
Let's provide a way to get their arguments the same way.
Differential Revision: https://reviews.llvm.org/D54934
llvm-svn: 347654
Tim Northover [Tue, 27 Nov 2018 11:08:14 +0000 (11:08 +0000)]
InstCombine: add comment explaining malloc deletion. NFC.
I tried to change this, not quite realising the logic behind what we
were doing. Hopefully this comment will help the next person to come
along.
llvm-svn: 347653
Alexander Kornienko [Tue, 27 Nov 2018 10:53:44 +0000 (10:53 +0000)]
[clang-tidy] Avoid inconsistent notes in readability-container-size-empty
When a warning is issued in a template instantiation, the check would previously
use template arguments in a note, which would result in inconsistent or
duplicate warnings (depending on how deduplication was done). This patch removes
template arguments from the note.
llvm-svn: 347652
Alexander Kornienko [Tue, 27 Nov 2018 10:53:38 +0000 (10:53 +0000)]
[clang-tidy] Minor fixes in a test
Use CHECK-FIXES where it was intended instead of CHECK-MESSAGES. Fixed compiler
warnings to pacify YouCompleteMe.
llvm-svn: 347651
George Rimar [Tue, 27 Nov 2018 10:30:46 +0000 (10:30 +0000)]
[ELF] - Fix R_AARCH64_ADR_GOT_PAGE, R_AARCH64_LD64_GOT_LO12 handling against IFUNC symbols.
This is https://bugs.llvm.org/show_bug.cgi?id=38074.
The issue is that when calling a function, LLD generates a
.got entry that points to the IFUNC resolver function when
instead, it should use the PLT entries properly for
handling the IFUNC.
So we should create a got entry that points to PLT entry,
which itself loads the value from
.got.plt, relocated with R_*_IRELATIVE to make things work.
Patch do that.
Differential revision: https://reviews.llvm.org/D54314
llvm-svn: 347650
Peter Smith [Tue, 27 Nov 2018 10:17:35 +0000 (10:17 +0000)]
[AArch64] Cortex-a53-843419 erratum should not apply to relaxed TLS.
The changes to the instructions performed by TLS relaxation and the errata
patching are performed with relocations. As these are applied so late the
errata scanning won't see the changes in the section data made by the TLS
relaxation. This can lead to a TLS relaxed sequence being patched when it
doesn't need to be.
The fix checks to see if there is a R_RELAX_TLS_IE_TO_LE instruction at the
same address as the ADRP as this indicates the presence of a relaxation
of a sequence that might get recognised as a patch.
Differential Revision: https://reviews.llvm.org/D54854
llvm-svn: 347649
Gabor Marton [Tue, 27 Nov 2018 09:51:36 +0000 (09:51 +0000)]
[ASTImporter] Typedef import brings in the complete type
Summary:
When we already have an incomplete underlying type of a typedef in the
"To" context, and the "From" context has the same typedef, but the
underlying type is complete, then the imported type should be complete.
Fixes an assertion in CTU analysis of Xerces:
Assertion `DD && "queried property of class with no definition"' failed.
This assert is happening in the analyzer engine, because that attempts
to query an underlying type of a typedef, which happens to be
incomplete.
Reviewers: a_sidorin, a.sidorin
Subscribers: rnkovacs, dkrupp, Szelethus, cfe-commits
Differential Revision: https://reviews.llvm.org/D53693
llvm-svn: 347648
George Rimar [Tue, 27 Nov 2018 09:48:17 +0000 (09:48 +0000)]
[ELF] - Implement -z nodefaultlib
This is https://bugs.llvm.org//show_bug.cgi?id=38978
Spec says that:
"Objects may be built with the -z nodefaultlib option to
suppress any search of the default locations at runtime.
Use of this option implies that all the dependencies of an
object can be located using its runpaths.
Without this option, which is the most common case, no
matter how you augment the runtime linker's library
search path, its last element is always /usr/lib for 32-bit
objects and /usr/lib/64 for 64-bit objects."
The patch implements this option.
Differential revision: https://reviews.llvm.org/D54577
llvm-svn: 347647
Martin Storsjo [Tue, 27 Nov 2018 09:23:15 +0000 (09:23 +0000)]
[CMake] Add a missing case of TO_CMAKE_PATH
This fixes building sanitizers for mingw natively.
llvm-svn: 347646
Martin Storsjo [Tue, 27 Nov 2018 09:20:55 +0000 (09:20 +0000)]
[COFF] Generate a codeview build id signature for MinGW even when not creating a PDB
GNU ld, which doesn't generate PDBs, can optionally generate a
build id by passing the --build-id option. LLD's MinGW frontend knows
about this option but ignores it, as I had falsely assumed that LLD
already generated build IDs even in those cases.
If debug info is requested and no PDB path is set, generate a
build id signature as a hash of the binary itself. This allows
associating a binary to a minidump, even if debug info isn't
written in PDB form by the linker.
Differential Revision: https://reviews.llvm.org/D54828
llvm-svn: 347645
Max Kazantsev [Tue, 27 Nov 2018 07:51:18 +0000 (07:51 +0000)]
Add missing REQUIRES: asserts
llvm-svn: 347644
Craig Topper [Tue, 27 Nov 2018 07:20:19 +0000 (07:20 +0000)]
[X86] Add test cases for vector shifts of v2i32/v2i16/v4i16/v2i8/v4i8/v8i8 with promotion legalization and widening legalization. NFC
llvm-svn: 347643
Craig Topper [Tue, 27 Nov 2018 06:24:56 +0000 (06:24 +0000)]
[X86] Use getUnpackl/getUnpackh instead of directly creating UNPCKL/UNPCKH nodes.
llvm-svn: 347642
Max Kazantsev [Tue, 27 Nov 2018 06:19:42 +0000 (06:19 +0000)]
[LoopSimplifyCFG] Turn on term folding after underlying bug fixed
llvm-svn: 347641
Max Kazantsev [Tue, 27 Nov 2018 06:17:21 +0000 (06:17 +0000)]
[LoopSimplifyCFG] Fix corner case with duplicating successors
It fixes a bug that doesn't update Phi inputs of the only live successor that
is in the list of block's successors more than once.
Thanks @uabelho for finding this.
Differential Revision: https://reviews.llvm.org/D54849
Reviewed By: anna
llvm-svn: 347640
Nico Weber [Tue, 27 Nov 2018 06:04:49 +0000 (06:04 +0000)]
[gn build] Merge r347530 to gn.
llvm-svn: 347639
Nico Weber [Tue, 27 Nov 2018 05:49:08 +0000 (05:49 +0000)]
Move a file I forgot to move in r347636.
llvm-svn: 347638
Bruce Mitchener [Tue, 27 Nov 2018 05:37:27 +0000 (05:37 +0000)]
Add support for the Dylan language to ClangASTContext
Summary:
This change adds eLanguageTypeDylan to the set of languages supported
by ClangASTContext. Debug info generated by the Open Dylan compiler's
LLVM back-end was designed to be compatible with C debug info.
Patch by Peter Housel.
Reviewers: clayborg
Reviewed By: clayborg
Subscribers: brucem, lldb-commits, aprantl
Differential Revision: https://reviews.llvm.org/D54886
llvm-svn: 347637
Nico Weber [Tue, 27 Nov 2018 05:19:17 +0000 (05:19 +0000)]
[gn build] Create abi-breaking.h, config.h, llvm-config.h, and add a build file for llvm/lib/Support.
The comments at the top of
llvm/utils/gn/secondary/llvm/include/llvm/Config/BUILD.gn and
llvm/utils/gn/build/write_cmake_config.py should explain the main bits
happening in this patch. The main parts here are that these headers are
generated at build time, not gn time, and that currently they don't do any
actual feature checks but just hardcode most things based on the current OS,
which seems to work well enough. If this stops being enough, the feature checks
should each be their own action writing the result to somewhere, and the config
write step should depend on those checks (so that they can run in parallel and
as part of the build) -- utils/llvm/gn/README.rst already has some more words
on that in "Philosophy".
(write_cmake_config.py is also going to be used to write clang's
clang/include/clang/Config/config.h)
This also adds a few files for linking to system libraries in a consistent way
if needed in llvm/utils/gn/build/libs (and moves pthread to that model).0
I'm also adding llvm/utils/gn/secondary/llvm/lib/Target/targets.gni in this
patch because $native_arch is needed for writing llvm-config.h -- the rest of
it will be used later, when the build files for llvm/lib/Target get added. That
file describes how to select which archs to build.
As a demo, also add a build file for llvm-undname and make it the default build
target (it depends on everything that can currently be built).
Differential Revision: https://reviews.llvm.org/D54678
llvm-svn: 347636
Henry Wong [Tue, 27 Nov 2018 04:27:00 +0000 (04:27 +0000)]
[clangd] NFC: Prefer `isa<>` to `dyn_cast<>` to do the checking.
Summary: Prefer `isa<>` to `dyn_cast<>` when there only need a checking.
Reviewers: ilya-biryukov, MaskRay
Reviewed By: ilya-biryukov, MaskRay
Subscribers: ioeric, MaskRay, jkorous, arphaman, kadircet, cfe-commits, MTC
Differential Revision: https://reviews.llvm.org/D54878
llvm-svn: 347635
Reid Kleckner [Tue, 27 Nov 2018 03:55:15 +0000 (03:55 +0000)]
[docs] UBSan and ASan are supported on Windows
Also fix a bullet list.
Fixes PR39775
llvm-svn: 347633
Craig Topper [Tue, 27 Nov 2018 02:57:27 +0000 (02:57 +0000)]
[X86] Prevent DAG combine from folding a bitcast from vXi1 to iX with a store on pre-AVX512 targets.
If we fold the bitcast into the store we'll end up creating a truncating store to vXi1 that will get scalarized. Instead allow the bitcast to be turned into a movmsk.
We probably need to do something if the store itself is a vXi1 type, but I'll leave that til a testcase appears.
llvm-svn: 347632
Craig Topper [Tue, 27 Nov 2018 02:57:23 +0000 (02:57 +0000)]
[X86] Add a bunch of test cases for storing a scalar bitcasted from a vXi1 type.
Currently a store combine will absorb the bitcast before our combine that turns bitcasts into movmsk gets a chance to run. This results in a store being created with a vXi1 type. Type legalization then promotes the input type and makes this a truncating store. Then we badly scalarize this store.
Currently we avoid this on v8i1->i8 bitcasts due to an incompletely qualified(per the original intention) check in isLoadBitCastBeneficial. An easy fix is to disable this for all vXi1->iX bitcasts on pre-avx512 targets. We'll still generate terrible code if the IR explicitly contains a store of vXi1 without a bitcast. We could probably solve that by just turning all stores of vXi1 into (store (iX (bitcast))) as an early DAG combine.
llvm-svn: 347631
Reid Kleckner [Tue, 27 Nov 2018 02:54:17 +0000 (02:54 +0000)]
Revert r347627 "[MS] Push fewer DeclContexts for delayed template parsing"
It broke the Windows self-host:
http://lab.llvm.org:8011/builders/clang-x64-windows-msvc/builds/1799/steps/stage%202%20build/logs/stdio
I can build
lib/CodeGen/CMakeFiles/LLVMCodeGen.dir/MachinePostDominators.cpp.obj to
repro.
llvm-svn: 347630
Kristof Umann [Tue, 27 Nov 2018 02:28:23 +0000 (02:28 +0000)]
[analyzer][PlistMacroExpansion] Part 3.: Macro arguments are expanded
This part focuses on expanding macro arguments.
Differential Revision: https://reviews.llvm.org/D52795
llvm-svn: 347629
Zola Bridges [Tue, 27 Nov 2018 02:22:00 +0000 (02:22 +0000)]
Revert "[clang][slh] add attribute for speculative load hardening"
until I figure out why the build is failing or timing out
***************************
Summary:
The prior diff had to be reverted because there were two tests
that failed. I updated the two tests in this diff
clang/test/Misc/pragma-attribute-supported-attributes-list.test
clang/test/SemaCXX/attr-speculative-load-hardening.cpp
LLVM IR already has an attribute for speculative_load_hardening. Before
this commit, when a user passed the -mspeculative-load-hardening flag to
Clang, every function would have this attribute added to it. This Clang
attribute will allow users to opt into SLH on a function by function
basis.
This can be applied to functions and Objective C methods.
Reviewers: chandlerc, echristo, kristof.beyls, aaron.ballman
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D54915
This reverts commit
a5b3c232d1e3613f23efbc3960f8e23ea70f2a79.
(r347617)
llvm-svn: 347628
Reid Kleckner [Tue, 27 Nov 2018 02:21:51 +0000 (02:21 +0000)]
[MS] Push fewer DeclContexts for delayed template parsing
Only push the outermost record as a DeclContext when parsing a function
body. See the comments in Sema::getContainingDC about the way the parser
pushes contexts. This is intended to match the behavior the parser
normally displays where it parses all method bodies from all nested
classes at the end of the outermost class, when all nested classes are
complete.
Fixes PR38460.
llvm-svn: 347627
Vitaly Buka [Tue, 27 Nov 2018 01:56:44 +0000 (01:56 +0000)]
[stack-safety] Update comment
llvm-svn: 347626
Vitaly Buka [Tue, 27 Nov 2018 01:56:35 +0000 (01:56 +0000)]
[stack-safety] Fix and uncomment assert
llvm-svn: 347625
Vitaly Buka [Tue, 27 Nov 2018 01:56:26 +0000 (01:56 +0000)]
[stack-safety] Fix build on gcc 5.4
llvm-svn: 347624
Reid Kleckner [Tue, 27 Nov 2018 01:50:17 +0000 (01:50 +0000)]
[COFF] Add exported functions to gfids table for /guard:cf
Summary:
MSVC does this, and we should to.
The .gfids table is a table of RVAs, so it's impossible for a DLL to
indicate that an imported symbol is address taken. Therefore, exports
appear to be listed as address taken by the DLL that exports them.
This fixes an issue that Firefox ran into here:
https://bugzilla.mozilla.org/show_bug.cgi?id=1485016#c12
In Firefox, the export directive came from a .def file, but we need to
do this for any kind of export.
Reviewers: dmajor, hans, amccarth, alex
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D54723
llvm-svn: 347623
Kuba Mracek [Tue, 27 Nov 2018 01:37:08 +0000 (01:37 +0000)]
Fix filtering of sanitizer_common unittest architectures on Darwin.
llvm-svn: 347622
Sam Clegg [Tue, 27 Nov 2018 01:08:16 +0000 (01:08 +0000)]
[WebAssembly] Remove `using` statements from header files. NFC.
Differential Revision: https://reviews.llvm.org/D54758
llvm-svn: 347621
Fangrui Song [Tue, 27 Nov 2018 00:26:50 +0000 (00:26 +0000)]
[Common] Threads: use function_ref instead of std::function
The benefits are:
a) Performance (very minor): it removes a heap allocation of the std::function constructor (template<class F> function(F f))
b) Clarity: it suggests that the callable's lifetime should end after the callee returns. Such callback is widely used in llvm. lld also uses it a lot.
Reviewers: ruiu, rnk, pcc
Reviewed By: ruiu
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D54813
llvm-svn: 347620
Davide Italiano [Tue, 27 Nov 2018 00:25:49 +0000 (00:25 +0000)]
Revert "[CMake] Streamline code signing for debugserver and pass entitlements to extended llvm_codesign"
It breaks the lldb cmake bots.
llvm-svn: 347619
Sanjay Patel [Tue, 27 Nov 2018 00:08:21 +0000 (00:08 +0000)]
[InstCombine] add tests for rotate/bswap equality; NFC
llvm-svn: 347618
Zola Bridges [Tue, 27 Nov 2018 00:03:44 +0000 (00:03 +0000)]
[clang][slh] add attribute for speculative load hardening
Summary:
The prior diff had to be reverted because there were two tests
that failed. I updated the two tests in this diff
clang/test/Misc/pragma-attribute-supported-attributes-list.test
clang/test/SemaCXX/attr-speculative-load-hardening.cpp
----- Summary from Previous Diff (Still Accurate) -----
LLVM IR already has an attribute for speculative_load_hardening. Before
this commit, when a user passed the -mspeculative-load-hardening flag to
Clang, every function would have this attribute added to it. This Clang
attribute will allow users to opt into SLH on a function by function basis.
This can be applied to functions and Objective C methods.
Reviewers: chandlerc, echristo, kristof.beyls, aaron.ballman
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D54915
llvm-svn: 347617
JF Bastien [Mon, 26 Nov 2018 23:48:47 +0000 (23:48 +0000)]
Fix debug build break
Comment out an assertion from D54543 which failed with error: no member named 'Range' in '(anonymous namespace)::PassAsArgInfo'.
llvm-svn: 347616
Jonas Devlieghere [Mon, 26 Nov 2018 23:40:52 +0000 (23:40 +0000)]
[FileSystem] Ignore nanoseconds when comparing oso_mod_time
After a recent change in LLVM the TimePoint encoding become more
precise, exceeding the precision of the TimePoint obtained from the
DebugMap. This patch adds a flag to the GetModificationTime helper in
the FileSystem to return the modification time with less precision.
Thanks to Davide for bisecting this failure on the LLDB bots.
llvm-svn: 347615
Sterling Augustine [Mon, 26 Nov 2018 23:26:31 +0000 (23:26 +0000)]
Notify the linker when a TU compiled with split-stack has a function without a prologue.
More context here: https://go-review.googlesource.com/c/go/+/148819/
llvm-svn: 347614
Vitaly Buka [Mon, 26 Nov 2018 23:17:52 +0000 (23:17 +0000)]
Remove trailing empty line
llvm-svn: 347613
Vitaly Buka [Mon, 26 Nov 2018 23:16:07 +0000 (23:16 +0000)]
[stack-safety] Analysis documentation
Summary:
Basic documentation of the Stack Safety Analysis.
It will be improved during review and upstream of an implementation.
Reviewers: kcc, eugenis, vlad.tsyrklevich, glider
Reviewed By: vlad.tsyrklevich
Subscribers: arphaman, llvm-commits
Differential Revision: https://reviews.llvm.org/D53336
llvm-svn: 347612
Vitaly Buka [Mon, 26 Nov 2018 23:05:58 +0000 (23:05 +0000)]
[stack-safety] Inter-Procedural Analysis implementation
Summary:
IPA is implemented as module pass which produce map from Function or Alias to
StackSafetyInfo for a single function.
From prototype by Evgenii Stepanov and Vlad Tsyrklevich.
Reviewers: eugenis, vlad.tsyrklevich, pcc, glider
Subscribers: hiraditya, mgrang, llvm-commits
Differential Revision: https://reviews.llvm.org/D54543
llvm-svn: 347611
Vitaly Buka [Mon, 26 Nov 2018 23:05:48 +0000 (23:05 +0000)]
[stack-safety] Empty local passes for Stack Safety Global Analysis
Reviewers: eugenis, vlad.tsyrklevich
Subscribers: hiraditya, llvm-commits
Differential Revision: https://reviews.llvm.org/D54541
llvm-svn: 347610
David Blaikie [Mon, 26 Nov 2018 22:57:18 +0000 (22:57 +0000)]
AArch64ISelLowering: Remove a return-of-assignment to allow NRVO
Patch by Arthur O'Dwyer!
llvm-svn: 347609
Eric Fiselier [Mon, 26 Nov 2018 22:51:35 +0000 (22:51 +0000)]
Remove duplicate _LIBCPP_INLINE_VISIBILITY attributes.
This attribute should appear only on the first declaration. This
patch cleans up <string> by removing the attribute on redeclarations.
llvm-svn: 347608
Mircea Trofin [Mon, 26 Nov 2018 22:49:17 +0000 (22:49 +0000)]
Add new passes to X86 pipeline tests
Summary: Fixes test failures introduced by rL347596.
Reviewers: davidxl
Reviewed By: davidxl
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D54916
llvm-svn: 347607
Fangrui Song [Mon, 26 Nov 2018 22:16:19 +0000 (22:16 +0000)]
[X86] Add dependency from X86 to ProfileData after rL347596
llvm-svn: 347606
Xin Tong [Mon, 26 Nov 2018 22:03:52 +0000 (22:03 +0000)]
[ICP] Remove incompatible attributes at indirect-call promoted callsites.
Summary:
Removing ncompatible attributes at indirect-call promoted callsites, not removing it results in
at least a IR verification error.
Reviewers: davidxl, xur, mssimpso
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D54913
llvm-svn: 347605
Sanjay Patel [Mon, 26 Nov 2018 22:00:41 +0000 (22:00 +0000)]
[InstCombine] add helper function to reduce code duplication; NFC
llvm-svn: 347604
Vitaly Buka [Mon, 26 Nov 2018 21:57:59 +0000 (21:57 +0000)]
[stack-safety] Local analysis implementation
Summary:
Analysis produces StackSafetyInfo which contains information with how allocas
and parameters were used in functions.
From prototype by Evgenii Stepanov and Vlad Tsyrklevich.
Reviewers: eugenis, vlad.tsyrklevich, pcc, glider
Subscribers: hiraditya, llvm-commits
Differential Revision: https://reviews.llvm.org/D54504
llvm-svn: 347603
Vitaly Buka [Mon, 26 Nov 2018 21:57:47 +0000 (21:57 +0000)]
[stack-safety] Empty local passes for Stack Safety Local Analysis
Reviewers: eugenis, vlad.tsyrklevich
Subscribers: mgorny, hiraditya, llvm-commits
Differential Revision: https://reviews.llvm.org/D54502
llvm-svn: 347602
Vitaly Buka [Mon, 26 Nov 2018 21:48:55 +0000 (21:48 +0000)]
[cfi] Help sanstats to find binary if they are not at the original location
Summary:
By default sanstats search binaries at the same location where they were when
stats was collected. Sometime you can not print report immediately or you need
to move post-processing to another workstation. To support this use-case when
original binary is missing sanstats will fall-back to directory with sanstats
file.
Reviewers: pcc
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D53857
llvm-svn: 347601
Vitaly Buka [Mon, 26 Nov 2018 21:48:45 +0000 (21:48 +0000)]
[cfi] Make sanstats print address of the check
Summary: Help with off-line symbolization or other type debugging.
Reviewers: pcc
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D53606
llvm-svn: 347600
Evandro Menezes [Mon, 26 Nov 2018 21:47:46 +0000 (21:47 +0000)]
[AArch64] Refactor the scheduling predicates (3/3) (NFC)
Refactor the scheduling predicates based on `MCInstPredicate`. In this
case, `AArch64InstrInfo::hasExtendedReg()`.
Differential revision: https://reviews.llvm.org/D54822
llvm-svn: 347599
Evandro Menezes [Mon, 26 Nov 2018 21:47:41 +0000 (21:47 +0000)]
[AArch64] Refactor the scheduling predicates (2/3) (NFC)
Refactor the scheduling predicates based on `MCInstPredicate`. In this
case, `AArch64InstrInfo::hasShiftedReg()`.
Differential revision: https://reviews.llvm.org/D54820
llvm-svn: 347598
Evandro Menezes [Mon, 26 Nov 2018 21:47:28 +0000 (21:47 +0000)]
[AArch64] Refactor the scheduling predicates (1/3) (NFC)
Refactor the scheduling predicates based on `MCInstPredicate`. In this
case, `AArch64InstrInfo::isScaledAddr()`
Differential revision: https://reviews.llvm.org/D54777
llvm-svn: 347597
Mircea Trofin [Mon, 26 Nov 2018 21:36:18 +0000 (21:36 +0000)]
Support for inserting profile-directed cache prefetches
Summary:
Support for profile-driven cache prefetching (X86)
This change is part of a larger system, consisting of a cache prefetches recommender, create_llvm_prof (https://github.com/google/autofdo), and LLVM.
A proof of concept recommender is DynamoRIO's cache miss analyzer. It processes memory access traces obtained from a running binary and identifies patterns in cache misses. Based on them, it produces a csv file with recommendations. The expectation is that, by leveraging such recommendations, we can reduce the amount of clock cycles spent waiting for data from memory. A microbenchmark based on the DynamoRIO analyzer is available as a proof of concept: https://goo.gl/6TM2Xp.
The recommender makes prefetch recommendations in terms of:
* the binary offset of an instruction with a memory operand;
* a delta;
* and a type (nta, t0, t1, t2)
meaning: a prefetch of that type should be inserted right before the instrution at that binary offset, and the prefetch should be for an address delta away from the memory address the instruction will access.
For example:
0x400ab2,64,nta
and assuming the instruction at 0x400ab2 is:
movzbl (%rbx,%rdx,1),%edx
means that the recommender determined it would be beneficial for a prefetchnta instruction to be inserted right before this instruction, as such:
prefetchnta 0x40(%rbx,%rdx,1)
movzbl (%rbx, %rdx, 1), %edx
The workflow for prefetch cache instrumentation is as follows (the proof of concept script details these steps as well):
1. build binary, making sure -gmlt -fdebug-info-for-profiling is passed. The latter option will enable the X86DiscriminateMemOps pass, which ensures instructions with memory operands are uniquely identifiable (this causes ~2% size increase in total binary size due to the additional debug information).
2. collect memory traces, run analysis to obtain recommendations (see above-referenced DynamoRIO demo as a proof of concept).
3. use create_llvm_prof to convert recommendations to reference insertion locations in terms of debug info locations.
4. rebuild binary, using the exact same set of arguments used initially, to which -mllvm -prefetch-hints-file=<file> needs to be added, using the afdo file obtained at step 3.
Note that if sample profiling feedback-driven optimization is also desired, that happens before step 1 above. In this case, the sample profile afdo file that was used to produce the binary at step 1 must also be included in step 4.
The data needed by the compiler in order to identify prefetch insertion points is very similar to what is needed for sample profiles. For this reason, and given that the overall approach (memory tracing-based cache recommendation mechanisms) is under active development, we use the afdo format as a syntax for capturing this information. We avoid confusing semantics with sample profile afdo data by feeding the two types of information to the compiler through separate files and compiler flags. Should the approach prove successful, we can investigate improvements to this encoding mechanism.
Reviewers: davidxl, wmi, craig.topper
Reviewed By: davidxl, wmi, craig.topper
Subscribers: davide, danielcdh, mgorny, aprantl, eraman, JDevlieghere, llvm-commits
Differential Revision: https://reviews.llvm.org/D54052
llvm-svn: 347596
Matt Arsenault [Mon, 26 Nov 2018 21:28:40 +0000 (21:28 +0000)]
AMDGPU: Record SGPR spills when restoring too
It's possible in some cases to have a restore present
without a corresponding spill. Due to an apparent bug
in D54366 <https://reviews.llvm.org/D54366>, only the
restore for a register was emitted. It's probably
always a bug for this to happen, but due to how SGPR
spilling is implemented, this makes the issues appear
worse than it is.
llvm-svn: 347595
Peter Collingbourne [Mon, 26 Nov 2018 21:15:47 +0000 (21:15 +0000)]
ELF: ICF: Include contents of referenced sections in initial partitioning hash. NFCI.
On my machine this reduced median link time of lld-speed-test/chrome
from 2.68s to 2.41s. It also reduces link time of Chrome for Android
with a prototype compiler change that causes the compiler to create
large numbers of identical (modulo relocations) sections from >15
minutes to a few seconds.
Differential Revision: https://reviews.llvm.org/D54773
llvm-svn: 347594
Craig Topper [Mon, 26 Nov 2018 21:12:39 +0000 (21:12 +0000)]
[LegalizeVectorTypes][X86][ARM][AArch64][PowerPC] Don't use SplitVecOp_TruncateHelper for FP_TO_SINT/UINT.
SplitVecOp_TruncateHelper tries to promote the result type while splitting FP_TO_SINT/UINT. It then concatenates the result and introduces a truncate to the original result type. But it does this without inserting the AssertZExt/AssertSExt that the regular result type promotion would insert. Nor does it turn FP_TO_UINT into FP_TO_SINT the way normal result type promotion for these operations does. This is bad on X86 which doesn't support FP_TO_SINT until AVX512.
This patch disables the use of SplitVecOp_TruncateHelper for these operations and just lets normal promotion handle it. I've tweaked a couple things in X86ISelLowering to avoid a few obvious regressions there. I believe all the changes on X86 are improvements. The other targets look neutral.
Differential Revision: https://reviews.llvm.org/D54906
llvm-svn: 347593
Teresa Johnson [Mon, 26 Nov 2018 20:40:37 +0000 (20:40 +0000)]
[ThinLTO] Consolidate cache key computation between new/old LTO APIs
Summary:
The old legacy LTO API had a separate cache key computation, which was
a subset of the cache key computation in the new LTO API (from what I
can tell this is largely just because certain features such as CFI,
dsoLocal, etc are only utilized via the new LTO API). However, having
separate computations is unnecessary (much of the code is duplicated),
and can lead to bugs when adding new optimizations if both cache
computation algorithms aren't updated properly - it's much easier to
maintain if we have a single facility.
This patch refactors the old LTO API code to use the cache key
computation from the new LTO API. To do this, we set up an lto::Config
object and fill in the fields that the old LTO was hashing (the others
will just use the defaults).
There are two notable changes:
- I added a Freestanding flag to the LTO Config. Currently this is only
used by the legacy LTO API. In the patch that added it (D30791) I had
asked about adding it to the new LTO API, but it looks like that was not
addressed. This should probably be discussed as a follow up to this
change, as it is orthogonal.
- The legacy LTO API had some code that was hashing the GUID of all
preserved symbols defined in the module. I looked back at the history of
this (which was added with the original hashing in the legacy LTO API in
D18494), and there is a comment in the review thread that it was added
in preparation for future internalization. We now do the internalization
of course, and that is handled in the new LTO API cache key computation
by hashing the recorded linkage type of all defined globals. Therefore I
didn't try to move over and keep the preserved symbols handling.
Reviewers: steven_wu, pcc
Subscribers: mehdi_amini, inglorion, eraman, dexonsmith, dang, llvm-commits
Differential Revision: https://reviews.llvm.org/D54635
llvm-svn: 347592
Craig Topper [Mon, 26 Nov 2018 20:16:33 +0000 (20:16 +0000)]
[SelectionDAG] Teach BaseIndexOffset::match to unwrap the base after looking through an add/or
We might find a target specific node that needs to be unwrapped after we look through an add/or. Otherwise we get inconsistent results if one pointer is just X86WrapperRIP and the other is (add X86WrapperRIP, C)
Differential Revision: https://reviews.llvm.org/D54818
llvm-svn: 347591
Craig Topper [Mon, 26 Nov 2018 20:16:31 +0000 (20:16 +0000)]
[X86] Add test case for D54818
llvm-svn: 347590
Eric Fiselier [Mon, 26 Nov 2018 20:15:38 +0000 (20:15 +0000)]
Add basic_string::__resize_default_init (from P1072)
This patch adds an implementation of __resize_default_init as
described in P1072R2. Additionally, it uses it in filesystem to
demonstrate its intended utility.
Once P1072 lands, or if it changes it's interface, I will adjust
the internal libc++ implementation to match.
llvm-svn: 347589
Zola Bridges [Mon, 26 Nov 2018 20:11:18 +0000 (20:11 +0000)]
Revert "[clang][slh] add attribute for speculative load hardening"
This reverts commit
801eaf91221ba6dd6996b29ff82659ad6359e885.
llvm-svn: 347588
Fangrui Song [Mon, 26 Nov 2018 20:07:07 +0000 (20:07 +0000)]
[COFF] ICF: use parallelForEach{,N}
Summary: They have an additional `ThreadsEnabled` check, which does not matter much.
Reviewers: pcc, ruiu, rnk
Reviewed By: ruiu
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D54812
llvm-svn: 347587
Zola Bridges [Mon, 26 Nov 2018 19:41:14 +0000 (19:41 +0000)]
[clang][slh] add attribute for speculative load hardening
Summary:
LLVM IR already has an attribute for speculative_load_hardening. Before
this commit, when a user passed the -mspeculative-load-hardening flag to
Clang, every function would have this attribute added to it. This Clang
attribute will allow users to opt into SLH on a function by function basis.
This can be applied to functions and Objective C methods.
Reviewers: chandlerc, echristo
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D54555
llvm-svn: 347586
Louis Dionne [Mon, 26 Nov 2018 19:30:08 +0000 (19:30 +0000)]
[libcxx] Fix XFAILs for aligned allocation tests
In r339743, I marked several aligned allocation tests as downright
unsupported on macosx in an attempt to unbreak the build. It turns
out that marking them as unuspported whenever we're on OS X is way
too coarse grained. This commit marks the tests as XFAIL with more
granularity.
llvm-svn: 347585
Than McIntosh [Mon, 26 Nov 2018 18:43:48 +0000 (18:43 +0000)]
[CodeGen] Support custom format of stack maps
Summary:
Add a hook to the GCMetadataPrinter for emitting stack maps in
custom format. The hook will be called at stack map generation
time. The default stack map format is used if there is no hook.
For this to be useful a few data structures and accessors are
exposed from the StackMaps class, so the custom printer can
access the stack map data.
This patch authored by Cherry Zhang <cherryyz@google.com>.
Reviewers: thanm, apilipenko, reames
Reviewed By: reames
Subscribers: reames, apilipenko, nemanjai, javed.absar, kbarton, jsji, llvm-commits
Differential Revision: https://reviews.llvm.org/D53892
llvm-svn: 347584
Alexey Bataev [Mon, 26 Nov 2018 18:37:09 +0000 (18:37 +0000)]
[OPENMP][NVPTX]Emit default locations with the correct Exec|Runtime
modes.
If the region is inside target|teams|distribute region, we can emit the
locations with the correct info for execution mode and runtime mode.
Patch adds this ability to the NVPTX codegen to help the optimizer to
produce better code.
llvm-svn: 347583
Zola Bridges [Mon, 26 Nov 2018 18:13:31 +0000 (18:13 +0000)]
[clang][slh] Forward mSLH only to Clang CC1
Summary:
-mno-speculative-load-hardening isn't a cc1 option, therefore,
before this change:
clang -mno-speculative-load-hardening hello.cpp
would have the following error:
error: unknown argument: '-mno-speculative-load-hardening'
This change will only ever forward -mspeculative-load-hardening
which is a CC1 option based on which flag was passed to clang.
Also added a test that uses this option that fails if an error like the
above is ever thrown.
Thank you ericwf for help debugging and fixing this error.
Reviewers: chandlerc, EricWF
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D54763
llvm-svn: 347582
Erich Keane [Mon, 26 Nov 2018 17:51:27 +0000 (17:51 +0000)]
Delete dead code introduced in r347354.
ParentTy is never used other than an assignment, and since it is a
pointer, there is no side effect. Some versions of GCC notice and warn
on this.
Change-Id: I37dc1a18c7b58040419afb803621de13d8904a8f
llvm-svn: 347581
Louis Dionne [Mon, 26 Nov 2018 17:47:16 +0000 (17:47 +0000)]
[libcxx] Fix XFAIL for aligned deallocation test with trunk Clang
The test was marked as failing whenever the deployment target was 10.12
or older, but in reality the test passes when the deployment target is
10.12 on recent Clangs. This happens because only older clangs do not
honor the -faligned-allocation flag, which disables any availability
error related to aligned allocation support, regardless of the
deployment target.
llvm-svn: 347580
Davide Italiano [Mon, 26 Nov 2018 17:39:20 +0000 (17:39 +0000)]
[lit] Fully qualify lit_config to avoid runtime crashes.
llvm-svn: 347579
Davide Italiano [Mon, 26 Nov 2018 17:30:28 +0000 (17:30 +0000)]
[Cmake] Add missing dependency to `count`.
llvm-svn: 347578
Sam Parker [Mon, 26 Nov 2018 17:26:49 +0000 (17:26 +0000)]
[NFC] Replace magic numbers with CodeGenOpt enums
Use enum values from llvm/Support/CodeGen.h for the optimisation
levels in CompilerInvocation.
llvm-svn: 347577
Matt Arsenault [Mon, 26 Nov 2018 17:17:07 +0000 (17:17 +0000)]
AMDGPU: Cleanup / relax tests for future changes
llvm-svn: 347576
Gabor Marton [Mon, 26 Nov 2018 17:09:50 +0000 (17:09 +0000)]
[ASTImporter] Set MustBuildLookupTable on PrimaryContext
Summary: SetMustBuildLookupTable() must always be called on a primary context.
Reviewers: labath, shafik, a.sidorin
Subscribers: rnkovacs, dkrupp, Szelethus, gamesh411
Differential Revision: https://reviews.llvm.org/D54863
llvm-svn: 347575
Ilya Biryukov [Mon, 26 Nov 2018 17:05:13 +0000 (17:05 +0000)]
[clangd] Do not drop diagnostics from macros
if they still end up being in the main file.
llvm-svn: 347574
Matt Arsenault [Mon, 26 Nov 2018 17:02:02 +0000 (17:02 +0000)]
AMDGPU: Don't optimize exec masks at -O0
llvm-svn: 347573
Matt Arsenault [Mon, 26 Nov 2018 17:02:01 +0000 (17:02 +0000)]
AMDGPU: Only add implicit super-reg def for first subreg
llvm-svn: 347572
Sander de Smalen [Mon, 26 Nov 2018 16:38:37 +0000 (16:38 +0000)]
[AArch64] Add aarch64_vector_pcs function attribute to Clang
This is the Clang patch to complement the following LLVM patches:
https://reviews.llvm.org/D51477
https://reviews.llvm.org/D51479
More information describing the vector ABI and procedure call standard
can be found here:
https://developer.arm.com/products/software-development-tools/\
hpc/arm-compiler-for-hpc/vector-function-abi
Patch by Kerry McLaughlin.
Reviewed By: rjmccall
Differential Revision: https://reviews.llvm.org/D54425
llvm-svn: 347571