Alexey Bataev [Mon, 23 Jul 2018 13:52:12 +0000 (13:52 +0000)]
[OPNEMP, NVPTX] Fixed sychronization construct + code cleanup.
Summary:
1. Fixed internal problem in `__kmpc_barrier` function: SPMD mode
synchronization function should be called only in L1 parallel level.
2. Removed some extra code for synchronization inside of the code, used
`__kmpc_barrier` instead.
3. Some code cleanup.
Reviewers: gtbercea, grokos
Subscribers: openmp-commits
Differential Revision: https://reviews.llvm.org/D49564
llvm-svn: 337691
Ivan A. Kosarev [Mon, 23 Jul 2018 13:26:37 +0000 (13:26 +0000)]
[NEON] Fix support for vrndi_f32(), vrndiq_f32() and vrndns_f32() intrinsics
This patch adds support for vrndi_f32() and vrndiq_f32()
intrinsics in AArch32 mode and for vrndns_f32() intrinsic in
AArch64 mode.
Differential Revision: https://reviews.llvm.org/D48829
llvm-svn: 337690
Alexander Polyakov [Mon, 23 Jul 2018 13:02:41 +0000 (13:02 +0000)]
[lldb-mi] Re-implement data-info-line command.
Summary: Now data-info-line command uses SB API instead of HandleCommand.
Reviewers: aprantl, clayborg, jingham
Reviewed By: aprantl
Subscribers: ki.stfu, lldb-commits
Differential Revision: https://reviews.llvm.org/D49062
llvm-svn: 337689
Benjamin Kramer [Mon, 23 Jul 2018 12:45:24 +0000 (12:45 +0000)]
[AST] Use llvm::TrailingObjects in CXXTryStmt
1. Use llvm::TrailingObjects in CXXTryStmt instead of manually doing the reinterpret_casts + pointer arithmetic. This is more consistent with other classes using this idiom and this make it clearer that this class has trailing objects.
2. Make the class CXXTryStmt final since it has trailing objects.
3. Move the friend declarations together.
No functional changes.
Patch by Bruno Ricci!
Differential Revision: https://reviews.llvm.org/D48873
llvm-svn: 337688
Sam Parker [Mon, 23 Jul 2018 12:27:47 +0000 (12:27 +0000)]
[ARM] ARMCodeGenPrepare backend pass
Arm specific codegen prepare is implemented to perform type promotion
on icmp operands, which can enable the removal of uxtb and uxth
(unsigned extend) instructions. This is possible because performing
type promotion before ISel alleviates this duty from the DAG builder
which has to perform legalisation, but has a limited view on data
ranges.
The pass visits any instruction operand of an icmp and creates a
worklist to traverse the use-def tree to determine whether the values
can simply be promoted. Our concern is values in the registers
overflowing the narrow (i8, i16) data range, so instructions marked
with nuw can be promoted easily. For add and sub instructions, we are
able to use the parallel dsp instructions to operate on scalar data
types and avoid overflowing bits. Underflowing adds and subs are also
permitted when the result is only used by an unsigned icmp.
Differential Revision: https://reviews.llvm.org/D48832
llvm-svn: 337687
John Brawn [Mon, 23 Jul 2018 12:14:45 +0000 (12:14 +0000)]
[GVN] Don't use the eliminated load as an available value in phi construction
In ConstructSSAForLoadSet if an available value is actually the load that we're
doing SSA construction to eliminate, then we can omit it as SSAUpdate will add
in the value for the phi that will be replacing it anyway. This can result in
simpler IR which can allow further optimisation.
Differential Revision: https://reviews.llvm.org/D44160
llvm-svn: 337686
Eric Fiselier [Mon, 23 Jul 2018 11:55:13 +0000 (11:55 +0000)]
Cleanup unnecessary conversions in filesystem.
llvm-svn: 337685
Eric Fiselier [Mon, 23 Jul 2018 11:46:47 +0000 (11:46 +0000)]
Cleanup name qualification in the filesystem internals.
In most cases there is no reason why the filesystem internals
use the qualifier std:: or _VSTD::. This patch removes the unneeded
qualifiers, making the sources files more consistent
llvm-svn: 337684
Andrew Ng [Mon, 23 Jul 2018 11:29:46 +0000 (11:29 +0000)]
[ELF] Fix handling of FDE negative relative PC addr
Signed values for the FDE PC addr were not correctly handled in
readFdeAddr(). If the value is negative and the type of the value is
smaller than 64 bits, the FDE PC addr overflow error would be
incorrectly triggered.
Fixed readFdeAddr() to properly handle signed values by sign extending
where appropriate.
Differential Revision: https://reviews.llvm.org/D49557
llvm-svn: 337683
Sam McCall [Mon, 23 Jul 2018 11:25:25 +0000 (11:25 +0000)]
[Tooling] Use UniqueStringSaver. NFC
llvm-svn: 337682
Eric Liu [Mon, 23 Jul 2018 10:56:37 +0000 (10:56 +0000)]
[clangd] Penalize non-instance members when accessed via class instances.
Summary:
The following are metrics for explicit member access completions. There is no
noticeable impact on other completion types.
Before:
EXPLICIT_MEMBER_ACCESS
Total measurements: 24382
All measurements: MRR: 62.27 Top10: 80.21% Top-100: 94.48%
Full identifiers: MRR: 98.81 Top10: 99.89% Top-100: 99.95%
0-5 filter len:
MRR: 13.25 46.31 62.47 67.77 70.40 81.91
Top-10: 29% 74% 84% 91% 91% 97%
Top-100: 67% 99% 99% 99% 99% 100%
After:
EXPLICIT_MEMBER_ACCESS
Total measurements: 24382
All measurements: MRR: 63.18 Top10: 80.58% Top-100: 95.07%
Full identifiers: MRR: 98.79 Top10: 99.89% Top-100: 99.95%
0-5 filter len:
MRR: 13.84 48.39 63.55 68.83 71.28 82.64
Top-10: 30% 75% 84% 91% 91% 97%
Top-100: 70% 99% 99% 99% 99% 100%
* Top-N: wanted result is found in the first N completion results.
* MRR: Mean reciprocal rank.
Remark: the change seems to have minor positive impact. Although the improvement
is relatively small, down-ranking non-instance members in instance member access
should reduce noise in the completion results.
Reviewers: sammccall
Reviewed By: sammccall
Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, cfe-commits
Differential Revision: https://reviews.llvm.org/D49543
llvm-svn: 337681
Alexandros Lamprineas [Mon, 23 Jul 2018 10:56:30 +0000 (10:56 +0000)]
[MemorySSAUpdater] Update Phi operands after trivial Phi elimination
Bug fix for PR37445. The underlying problem and its fix are similar to PR37808.
The bug lies in MemorySSAUpdater::getPreviousDefRecursive(), where PhiOps is
computed before the call to tryRemoveTrivialPhi() and it ends up being out of
date, pointing to stale data. We have now turned each of the PhiOps into a
TrackingVH<MemoryAccess>.
Differential Revision: https://reviews.llvm.org/D49425
llvm-svn: 337680
Adam Balogh [Mon, 23 Jul 2018 10:53:02 +0000 (10:53 +0000)]
Fix for last commit: adding new test file forgotten.
llvm-svn: 337679
Adam Balogh [Mon, 23 Jul 2018 10:50:20 +0000 (10:50 +0000)]
[Analyzer] Quick Fix for exponential execution time when simpilifying complex additive expressions
Patch https://reviews.llvm.org/rC329780 not only rearranges comparisons but
also binary expressions. This latter behavior is not protected by the analyzer
option. Hower, since no complexity threshold is enforced to the symbols this
may result in exponential execution time if the expressions are too complex:
https://bugs.llvm.org/show_bug.cgi?id=38208. For a quick fix we extended the
analyzer option to also cover the additive cases.
This is only a temporary fix, the final solution should be enforcing the
complexity threshold to the symbols.
Differential Revision: https://reviews.llvm.org/D49536
llvm-svn: 337678
Sam McCall [Mon, 23 Jul 2018 10:44:40 +0000 (10:44 +0000)]
[Support] Add a UniqueStringSaver: like StringSaver, but deduplicating.
Summary: Clarify contract of StringSaver (it null-terminates, callers rely on it).
Reviewers: hokein
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D49596
llvm-svn: 337677
Roman Lebedev [Mon, 23 Jul 2018 10:10:13 +0000 (10:10 +0000)]
[NFC][MCA] ZnVer1: Update RegisterFile to identify false dependencies on partially written registers.
Summary:
Pretty mechanical follow-up for D49196.
As microarchitecture.pdf notes, "20 AMD Ryzen pipeline",
"20.8 Register renaming and out-of-order schedulers":
The integer register file has 168 physical registers of 64 bits each.
The floating point register file has 160 registers of 128 bits each.
"20.14 Partial register access":
The processor always keeps the different parts of an integer register together.
...
An instruction that writes to part of a register will therefore have a false dependence
on any previous write to the same register or any part of it.
Reviewers: andreadb, courbet, RKSimon, craig.topper, GGanesh
Reviewed By: GGanesh
Subscribers: gbedwell, llvm-commits
Differential Revision: https://reviews.llvm.org/D49393
llvm-svn: 337676
Roman Lebedev [Mon, 23 Jul 2018 10:10:04 +0000 (10:10 +0000)]
[NFC][MCA] ZnVer1: add partial-reg-update tests
Reviewers: andreadb, courbet, RKSimon, craig.topper, GGanesh
Reviewed By: GGanesh
Subscribers: gbedwell, llvm-commits
Differential Revision: https://reviews.llvm.org/D49392
llvm-svn: 337675
Alexandros Lamprineas [Mon, 23 Jul 2018 09:42:35 +0000 (09:42 +0000)]
[GVNHoist] safeToHoistLdSt allows illegal hoisting
Bug fix for PR36787. When reasoning if it's safe to hoist a load we
want to make sure that the defining memory access dominates the new
insertion point of the hoisted instruction. safeToHoistLdSt calls
firstInBB(InsertionPoint,DefiningAccess) which returns false if
InsertionPoint == DefiningAccess, and therefore it falsely thinks
it's safe to hoist.
Differential Revision: https://reviews.llvm.org/D49555
llvm-svn: 337674
Chandler Carruth [Mon, 23 Jul 2018 07:56:15 +0000 (07:56 +0000)]
[x86/SLH] Fix a bug where we would harden tail calls twice -- once as
a call, and then again as a return.
Also added a comment to try and explain better why we would be doing
what we're doing when hardening the (non-call) returns.
llvm-svn: 337673
Chandler Carruth [Mon, 23 Jul 2018 07:51:51 +0000 (07:51 +0000)]
[x86/SLH] Add a test covering indirect forms of control flow. NFC.
This specifically covers different ways of making indirect calls and
jumps. There are some bugs in SLH that I will be fixing in subsequent
patches where the diff in the generated instructions makes the bug fix
much more clear, so just checking in a baseline of this test to start.
I'm also going to be adding direct mitigation for variant 1.2 which this
file very specifically tests in the various forms it can arise on x86.
Again, the diff to the generated instructions should make the change for
that much more clear, so having the test as a baseline seems useful.
llvm-svn: 337672
Ilya Biryukov [Mon, 23 Jul 2018 06:32:36 +0000 (06:32 +0000)]
Revert "Fold dangling-field warning into general initialization lifetime checks."
This reverts commit r337627.
After the change, clang started producing invalid warning on the following code:
struct foo {
foo(char *x) : x_(&x[10]) {}
private:
char *x_;
};
1.cpp:2:21: warning: initializing pointer member 'x_' with the stack address of parameter 'x' [-Wdangling-field]
llvm-svn: 337671
Petr Hosek [Mon, 23 Jul 2018 05:07:44 +0000 (05:07 +0000)]
Revert "[CMake] Support statically linking dependencies only to shared or static library"
This reverts commit r337668: broke the cxxabi build when using Make.
llvm-svn: 337670
Eric Fiselier [Mon, 23 Jul 2018 04:55:57 +0000 (04:55 +0000)]
Use possibly cached directory entry values when performing recursive directory iteration.
llvm-svn: 337669
Petr Hosek [Mon, 23 Jul 2018 04:19:55 +0000 (04:19 +0000)]
[CMake] Support statically linking dependencies only to shared or static library
Currently it's possible to select whether to statically link unwinder
or the C++ ABI library, but this option applies to both the shared
and static library. However, in some scenarios it may be desirable to
only statically link unwinder and C++ ABI library into static C++
library since for shared C++ library we can rely on dynamic linking
and linker scripts. This change enables selectively enabling or
disabling statically linking only to shared or static library.
Differential Revision: https://reviews.llvm.org/D49502
llvm-svn: 337668
Chandler Carruth [Mon, 23 Jul 2018 04:01:34 +0000 (04:01 +0000)]
[x86/SLH] Rename and comment the main hardening function. NFC.
This provides an overview of the algorithm used to harden specific
loads. It also brings this our terminology further in line with
hardening rather than checking.
Differential Revision: https://reviews.llvm.org/D49583
llvm-svn: 337667
Eric Fiselier [Mon, 23 Jul 2018 03:41:46 +0000 (03:41 +0000)]
Fix use of C++14 syntax in C++11 filesystem tests.
llvm-svn: 337666
Eric Fiselier [Mon, 23 Jul 2018 03:06:57 +0000 (03:06 +0000)]
Work around various GCC 4.9 build errors
llvm-svn: 337665
Eric Fiselier [Mon, 23 Jul 2018 02:00:52 +0000 (02:00 +0000)]
Implement filesystem_error::what() and improve reporting.
This patch implements the `what()` for filesystem errors. The message
includes the 'what_arg', any paths that were specified, and the
error code message.
Additionally this patch refactors how errors are created, making it easier
to report them correctly.
llvm-svn: 337664
Brad Smith [Sun, 22 Jul 2018 22:04:28 +0000 (22:04 +0000)]
Fix the test
llvm-svn: 337663
Eric Fiselier [Sun, 22 Jul 2018 21:58:46 +0000 (21:58 +0000)]
Add GCC 9 to XFAILs list for test
llvm-svn: 337662
Eric Fiselier [Sun, 22 Jul 2018 21:56:40 +0000 (21:56 +0000)]
Workaround bug in GCC trunk.
For some reason GCC ToT is failing to deduce the auto type for
a static data member from its initializer in some cases.
Though I'm sure the bug will be short lived, there is a trivial workaround for it.
So we might as well get the bot passing again.
llvm-svn: 337661
Brad Smith [Sun, 22 Jul 2018 21:39:54 +0000 (21:39 +0000)]
OpenBSD/arm has switched to float ABI SoftFP.
llvm-svn: 337660
Eric Fiselier [Sun, 22 Jul 2018 21:15:15 +0000 (21:15 +0000)]
Harden copy_file even more.
This patch removes the O_CREAT open flag when we first
attempt to open the destination file but we expect it to
already exist.
This theoretically avoids the possibility that it was removed
between when we first stat'ed it, and when we attempt to open it.
llvm-svn: 337659
Eric Fiselier [Sun, 22 Jul 2018 20:50:16 +0000 (20:50 +0000)]
fix test failures with older clang versions
llvm-svn: 337658
Jiading Gai [Sun, 22 Jul 2018 20:04:42 +0000 (20:04 +0000)]
Test commit, fix a minor typo.
llvm-svn: 337657
Craig Topper [Sun, 22 Jul 2018 19:44:35 +0000 (19:44 +0000)]
[X86] Remove the max vector width restriction from combineLoopMAddPattern and rely splitOpsAndApply to handle splitting.
This seems to be a net improvement. There's still an issue under avx512f where we have a 512-bit vpaddd, but not vpmaddwd so we end up doing two 256-bit vpmaddwds and inserting the results before a 512-bit vpaddd. It might be better to do two 512-bits paddds with zeros in the upper half. Same number of instructions, but breaks a dependency.
llvm-svn: 337656
Benjamin Kramer [Sun, 22 Jul 2018 15:55:57 +0000 (15:55 +0000)]
[clangd] Unbreak fuzzer build.
llvm-svn: 337655
Xin Tong [Sun, 22 Jul 2018 05:27:41 +0000 (05:27 +0000)]
[ORE] Move loop invariant ORE checks outside the PM loop.
Summary:
This takes 22ms out of ~20s compiling sqlite3.c because we call it
for every unit of compilation and every pass.
Reviewers: paquette, anemet
Subscribers: mehdi_amini, llvm-commits
Differential Revision: https://reviews.llvm.org/D49586
llvm-svn: 337654
Richard Smith [Sun, 22 Jul 2018 05:21:47 +0000 (05:21 +0000)]
PR38257: don't perform ADL when instantiating a unary & operator that turns out
to be forming a pointer-to-member.
llvm-svn: 337653
Craig Topper [Sun, 22 Jul 2018 05:16:50 +0000 (05:16 +0000)]
[SelectionDAGBuilder] Use APInt::isZero instead of comparing APInt::getZExtValue to 0 in a place where we can't be sure contents of the APInt fit in a uint64_t.
This is used on an extract vector element index which is most cases is going to be an i32 or i64 and the element will be a valid element number. But it is possible to construct IR with a larger type and large out of range value.
llvm-svn: 337652
Craig Topper [Sun, 22 Jul 2018 05:16:49 +0000 (05:16 +0000)]
[SelectionDAGBuilder] Restrict vector reduction check to types with a power of 2 number of elements.
The check for the shuffles usages probably isn't correct for non power of 2 vectors.
llvm-svn: 337651
Craig Topper [Sun, 22 Jul 2018 05:16:47 +0000 (05:16 +0000)]
[X86] Add more MADD recurrence test cases with larger and narrower vector widths.
llvm-svn: 337650
Eric Fiselier [Sun, 22 Jul 2018 02:00:53 +0000 (02:00 +0000)]
Implement a better copy_file.
This patch improves both the performance, and the safety of the
copy_file implementation.
The performance improvements are achieved by using sendfile on
Linux and copyfile on OS X when available.
The TOCTOU hardening is achieved by opening the source and
destination files and then using fstat to check their attributes to
see if we can copy them.
Unfortunately for the destination file, there is no way to open
it without accidentally creating it, so we first have to use
stat to determine if it exists, and if we should copy to it.
Then, once we're sure we should try to copy, we open the dest
file and ensure it names the same entity we previously stat'ed.
llvm-svn: 337649
Matt Davis [Sat, 21 Jul 2018 18:32:47 +0000 (18:32 +0000)]
[llvm-mca][docs] Add documentation for the statistic outputs from mca. NFC
Summary: The original text was lifted from the MCA README. I re-ran the dot-product example and updated the output seen in the docs. I also added a few paragraphs discussing the instruction issued and retired histograms, as well as discussing the register file stats.
Reviewers: andreadb, RKSimon, courbet, gbedwell, filcab
Reviewed By: andreadb
Subscribers: tschuett
Differential Revision: https://reviews.llvm.org/D49614
llvm-svn: 337648
Simon Atanasyan [Sat, 21 Jul 2018 16:16:08 +0000 (16:16 +0000)]
[mips] Factor out register class selection for global base register. NFC
Factor out register class selection for global base register into a
separate function to escape long chain of ternary operators.
llvm-svn: 337647
Simon Atanasyan [Sat, 21 Jul 2018 16:16:03 +0000 (16:16 +0000)]
[mips] Move out the WrapperPat declaration from the NotInMicroMips predicate
This is a follow-up to the rL335185. Those commit adds some WrapperPat
patterns for microMIPS target. But declaration of the WrapperPat class
is under the NotInMicroMips predicate and microMIPS patterns cannot be
selected because predicate (Subtarget->inMicroMipsMode()) &&
(!Subtarget->inMicroMipsMode()) is always false.
This change move out the WrapperPat class declaration from the
NotInMicroMips predicate and enables microMIPS WrapperPat patterns.
Differential revision: https://reviews.llvm.org/D49533
llvm-svn: 337646
Zachary Turner [Sat, 21 Jul 2018 15:39:05 +0000 (15:39 +0000)]
[llvm-undname] Flush output before demangling.
If an error occurs and we write it to stderr, it could appear
before we wrote the mangled name which we're undecorating.
By flushing stdout first, we ensure that the messages are always
sequenced in the correct order.
llvm-svn: 337645
Zachary Turner [Sat, 21 Jul 2018 15:38:47 +0000 (15:38 +0000)]
Fix the MSVC Visualizers for SmallVector classes.
Recent changes to the internal structure of SmallVector<> broke
all of the MSVC visualizers. This fixes them.
llvm-svn: 337644
Aditya Kumar [Sat, 21 Jul 2018 14:13:44 +0000 (14:13 +0000)]
Early exit with cheaper checks
Reviewers: sebpop,davide,fhahn,trentxintong
Differential Revision: https://reviews.llvm.org/D49617
llvm-svn: 337643
Chen Zheng [Sat, 21 Jul 2018 12:27:54 +0000 (12:27 +0000)]
[InstrSimplify] fold sdiv if two operands are negated and non-overflow
Differential Revision: https://reviews.llvm.org/D49382
llvm-svn: 337642
Aaron Smith [Sat, 21 Jul 2018 05:42:13 +0000 (05:42 +0000)]
[DebugInfo] Add a new DI flag to record if a C++ record is a trivial type
Summary:
This flag is used when emitting debug info and is needed to initialize subprogram and member function attributes (function options) for Codeview. These function options are used to create an accurate compiler type for UDT symbols (class/struct/union) from PDBs.
It is not easy to determine if a C++ record is trivial or not based on the current DICompositeType flags and other accessible debug information from Codeview. For example, without this flag the metadata for a non-trivial C++ record with user-defined ctor and a trivial one with a defaulted ctor are the same.
struct S { S(); }
struct S { S() = default; }
This change introduces a new DI flag and corresponding clang::CXXRecordDecl::isTrivial method to set the flag in the frontend.
Reviewers: rnk, zturner, llvm-commits, dblaikie, aleksandr.urakov, deadalnix
Reviewed By: rnk
Subscribers: asmith, probinson, aprantl, JDevlieghere
Differential Revision: https://reviews.llvm.org/D45122
llvm-svn: 337641
Peter Collingbourne [Sat, 21 Jul 2018 02:14:59 +0000 (02:14 +0000)]
ELF: Read address significance tables with --icf=all.
Under --icf=all we now only apply KeepUnique to non-executable
address-significant sections. This has the effect of making --icf=all
mean unsafe ICF for executable sections and safe ICF for non-executable
sections.
With this change the meaning of the KeepUnique bit changes to
"does the current ICF mode (together with the --keep-unique and
--ignore-data-address-equality flags) require this section to be
kept unique".
Differential Revision: https://reviews.llvm.org/D49626
llvm-svn: 337640
Yaxun Liu [Sat, 21 Jul 2018 02:02:22 +0000 (02:02 +0000)]
[HIP] Support -fcuda-flush-denormals-to-zero for amdgcn
Differential Revision: https://reviews.llvm.org/D48287
llvm-svn: 337639
Peter Collingbourne [Sat, 21 Jul 2018 00:17:11 +0000 (00:17 +0000)]
ELF: Make sections with KeepUnique bit eligible for ICF.
The only restriction is that we cannot merge more than one KeepUnique
section together. This matches gold's behaviour and reduces code size
when using --icf=safe.
Differential Revision: https://reviews.llvm.org/D49622
llvm-svn: 337638
Lang Hames [Sat, 21 Jul 2018 00:12:05 +0000 (00:12 +0000)]
[ORC] Re-apply r336760 with fixes.
llvm-svn: 337637
JF Bastien [Fri, 20 Jul 2018 23:37:12 +0000 (23:37 +0000)]
[NFC] CodeGen: rename memset to bzero
The optimization looks for opportunities to emit bzero, not memset. Rename the functions accordingly (and clang-format the diff) because I want to add a fallback optimization which actually tries to generate memset. bzero is still better and it would confuse the code to merge both.
llvm-svn: 337636
George Karpenkov [Fri, 20 Jul 2018 23:34:39 +0000 (23:34 +0000)]
[Driver] Sanitizer support based on runtime library presence
The runtime libraries of sanitizers are built in compiler-rt, and Clang
can be built without compiler-rt, or compiler-rt can be configured to
only build certain sanitizers. The driver should provide reasonable
diagnostics and not a link-time error when a runtime library is missing.
This patch changes the driver for OS X to only support sanitizers of
which we can find the runtime libraries. The discussion for this patch
explains the rationale
Differential Revision: https://reviews.llvm.org/D15225
llvm-svn: 337635
Nico Weber [Fri, 20 Jul 2018 23:09:12 +0000 (23:09 +0000)]
Omit path to lld binary from lld's error, warning, and log output.
lld currently prepends the absolute path to itself to every diagnostic it
emits. This path can be longer than the diagnostic, and makes the actual error
message hard to read.
There isn't a good reason for printing this path: if you want to know which lld
you're running, pass -v to clang – chances are that if you're unsure of this,
you're not only unsure when it errors out. Some people want an indication that
the diagnostic is from the linker though, so instead print just the basename of
the linker's path.
Before:
```
$ out/bin/clang -target x86_64-unknown-linux -x c++ /dev/null -fuse-ld=lld
/Users/thakis/src/llvm-mono/out/bin/ld.lld: error: cannot open crt1.o: No such file or directory
/Users/thakis/src/llvm-mono/out/bin/ld.lld: error: cannot open crti.o: No such file or directory
/Users/thakis/src/llvm-mono/out/bin/ld.lld: error: cannot open crtbegin.o: No such file or directory
/Users/thakis/src/llvm-mono/out/bin/ld.lld: error: unable to find library -lgcc
/Users/thakis/src/llvm-mono/out/bin/ld.lld: error: unable to find library -lgcc_s
/Users/thakis/src/llvm-mono/out/bin/ld.lld: error: unable to find library -lc
/Users/thakis/src/llvm-mono/out/bin/ld.lld: error: unable to find library -lgcc
/Users/thakis/src/llvm-mono/out/bin/ld.lld: error: unable to find library -lgcc_s
/Users/thakis/src/llvm-mono/out/bin/ld.lld: error: cannot open crtend.o: No such file or directory
/Users/thakis/src/llvm-mono/out/bin/ld.lld: error: cannot open crtn.o: No such file or directory
clang: error: linker command failed with exit code 1 (use -v to see invocation)
```
After:
```
$ out/bin/clang -target x86_64-unknown-linux -x c++ /dev/null -fuse-ld=lld
ld.lld: error: cannot open crt1.o: No such file or directory
ld.lld: error: cannot open crti.o: No such file or directory
ld.lld: error: cannot open crtbegin.o: No such file or directory
ld.lld: error: unable to find library -lgcc
ld.lld: error: unable to find library -lgcc_s
ld.lld: error: unable to find library -lc
ld.lld: error: unable to find library -lgcc
ld.lld: error: unable to find library -lgcc_s
ld.lld: error: cannot open crtend.o: No such file or directory
ld.lld: error: cannot open crtn.o: No such file or directory
clang: error: linker command failed with exit code 1 (use -v to see invocation)
```
https://reviews.llvm.org/D49189
llvm-svn: 337634
Nico Weber [Fri, 20 Jul 2018 23:06:34 +0000 (23:06 +0000)]
Simplify; no behavior change.
Reviewed as part of https://reviews.llvm.org/D49189
llvm-svn: 337633
Julie Hockett [Fri, 20 Jul 2018 23:00:34 +0000 (23:00 +0000)]
[clang-doc] Create a script to generate tests
Upstreaming the script I use to generate clang-doc tests (and updating
the existing tests to use it)
Differential Revision: https://reviews.llvm.org/D49268
llvm-svn: 337632
Yaxun Liu [Fri, 20 Jul 2018 22:45:24 +0000 (22:45 +0000)]
[HIP] Register/unregister device fat binary only once
HIP generates one fat binary for all devices after linking. However, for each compilation
unit a ctor function is emitted which register the same fat binary. Measures need to be
taken to make sure the fat binary is only registered once.
Currently each ctor function calls __hipRegisterFatBinary and stores the returned value
to __hip_gpubin_handle. This patch changes the linkage of __hip_gpubin_handle to be linkonce
so that they are shared between LLVM modules. Then this patch adds check of value of
__hip_gpubin_handle to make sure __hipRegisterFatBinary is only called once. The code
is equivalent to
void *_gpubin_handle;
void ctor() {
if (__hip_gpubin_handle == 0) {
__hip_gpubin_handle = __hipRegisterFatBinary(...);
}
// register kernels and variables.
}
The patch also does similar change to dtors so that __hipUnregisterFatBinary
is called once.
Differential Revision: https://reviews.llvm.org/D49083
llvm-svn: 337631
Petr Hosek [Fri, 20 Jul 2018 22:45:24 +0000 (22:45 +0000)]
[CMake] Install C++ ABI headers into the right location
This is a follow-up to r335809 and r337118. While libc++ headers are now
installed into the right location in both standard as well as multiarch
runtimes layout, turned out C++ ABI headers are still installed into the
old location in the latter case. This change addresses that.
Differential Revision: https://reviews.llvm.org/D49584
llvm-svn: 337630
Reid Kleckner [Fri, 20 Jul 2018 22:36:33 +0000 (22:36 +0000)]
Disable clang crash-report-modules.m test on Windows again
It still appears to be failing:
http://lab.llvm.org:8011/builders/clang-x86-windows-msvc2015/builds/12825
$ "rm" "-rf" "C:\b\slave\clang-x86-windows-msvc2015\clang-x86-windows-msvc2015\stage1\tools\clang\test\Driver\Output/crmdir"
Error: 'rm' command failed, [Error 3] The system cannot find the path specified: 'C:\\b\\slave\\clang-x86-windows-msvc2015\\clang-x86-windows-msvc2015\\stage1\\tools\\clang\\test\\Driver\\Output/crmdir\\crash-report-modules-300567.cache\\vfs\\b\\slave\\clang-x86-windows-msvc2015\\clang-x86-windows-msvc2015\\llvm\\tools\\clang\\test\\Driver\\Inputs\\module\\module.modulemap'
error: command failed with exit status: 1
llvm-svn: 337629
Reid Kleckner [Fri, 20 Jul 2018 22:34:20 +0000 (22:34 +0000)]
[PDB] Write the command line after response file expansion
Summary: Fixes PR38085
Reviewers: ruiu, zturner
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D49566
llvm-svn: 337628
Richard Smith [Fri, 20 Jul 2018 22:25:55 +0000 (22:25 +0000)]
Fold dangling-field warning into general initialization lifetime checks.
llvm-svn: 337627
Lang Hames [Fri, 20 Jul 2018 22:22:19 +0000 (22:22 +0000)]
Re-apply r337595 with fix for LLVM_ENABLE_THREADS=Off.
llvm-svn: 337626
Benjamin Kramer [Fri, 20 Jul 2018 22:15:09 +0000 (22:15 +0000)]
[ADT] Only run death tests in !NDEBUG
These invoke undefined behavior.
llvm-svn: 337625
Krzysztof Parzyszek [Fri, 20 Jul 2018 21:55:55 +0000 (21:55 +0000)]
[Hexagon] Disable packets in test to avoid ordering issues in checks
llvm-svn: 337624
Peter Collingbourne [Fri, 20 Jul 2018 21:43:20 +0000 (21:43 +0000)]
Change the cap on the amount of padding for each vtable to 32-byte (previously it was 128-byte)
We tested different cap values with a recent commit of Chromium. Our results show that the 32-byte cap yields the smallest binary and all the caps yield similar performance.
Based on the results, we propose to change the cap value to 32-byte.
Patch by Zhaomo Yang!
Differential Revision: https://reviews.llvm.org/D49405
llvm-svn: 337622
Matt Arsenault [Fri, 20 Jul 2018 21:20:36 +0000 (21:20 +0000)]
AMDGPU: Use existing function to check for VGPRs
llvm-svn: 337621
Nico Weber [Fri, 20 Jul 2018 21:06:41 +0000 (21:06 +0000)]
fix typo
llvm-svn: 337620
Nico Weber [Fri, 20 Jul 2018 21:02:09 +0000 (21:02 +0000)]
[ms] Add __shiftleft128 / __shiftright128 intrinsics
Carefully match the pattern matched by ISel so that this produces shld / shrd
(unless Subtarget->isSHLDSlow() is true).
Thanks to Craig Topper for providing the LLVM IR pattern that gets successfully
matched.
Fixes PR37755.
llvm-svn: 337619
Benjamin Kramer [Fri, 20 Jul 2018 20:59:46 +0000 (20:59 +0000)]
Revert "[X86][AVX] Convert X86ISD::VBROADCAST demanded elts combine to use SimplifyDemandedVectorElts"
This reverts commit r337547. It triggers an infinite loop.
llvm-svn: 337617
Reid Kleckner [Fri, 20 Jul 2018 20:55:00 +0000 (20:55 +0000)]
[codeview] Don't emit variable templates as class members
MSVC doesn't, so neither should we.
Fixes PR38004, which is a crash that happens when we try to emit debug
info for a still-dependent partial variable template specialization.
As a follow-up, we should review what we're doing for function and class
member templates. It looks like we don't filter those out, but I can't
seem to get clang to emit any.
llvm-svn: 337616
Martin Storsjo [Fri, 20 Jul 2018 20:48:36 +0000 (20:48 +0000)]
[llvm-undname] Remove a superfluous semicolon. NFC.
llvm-svn: 337615
Martin Storsjo [Fri, 20 Jul 2018 20:48:33 +0000 (20:48 +0000)]
[COFF] Use symbolic constants instead of hardcoded numbers. NFCI.
Patch by Martell Malone.
llvm-svn: 337614
Martin Storsjo [Fri, 20 Jul 2018 20:48:29 +0000 (20:48 +0000)]
[COFF] Adjust how we flag weak externals
This fixes PR36096.
Originally based on a patch by Martell Malone.
Differential Revision: https://reviews.llvm.org/D44357
llvm-svn: 337613
Konstantin Zhuravlyov [Fri, 20 Jul 2018 20:46:25 +0000 (20:46 +0000)]
AMDGPU: Switch default dwarf version to 2
There were some problems unearthed with version 5,
which I am going to look at.
Differential Revision: https://reviews.llvm.org/D49613
llvm-svn: 337612
David Carlier [Fri, 20 Jul 2018 20:39:49 +0000 (20:39 +0000)]
[CStringSyntaxChecker] Fix build bot builds != x86 archs
Reviewers: NoQ,george.karpenkov
Reviewed By: NoQ
Differential Revision: https://reviews.llvm.org/D49588
llvm-svn: 337611
Fangrui Song [Fri, 20 Jul 2018 20:27:42 +0000 (20:27 +0000)]
[ELF] Check eh_frame_hdr overflow with PC offsets instead of PC absolute addresses
Reviewers: grimar, ruiu, espindola
Subscribers: emaste, arichardson, llvm-commits
Differential Revision: https://reviews.llvm.org/D49607
llvm-svn: 337610
George Karpenkov [Fri, 20 Jul 2018 20:21:57 +0000 (20:21 +0000)]
[FileCheck] Provide an option for FileCheck to dump original input to stderr on failure
The option can be either set using environment variable (e.g. env
FILECHECK_DUMP_INPUT_ON_FAILURE=1 ninja check-fuzzer) or with a
FileCheck flag.
This can be extremely useful for debugging, cf.
https://groups.google.com/forum/#!topic/llvm-dev/kLrzg8OM_h8 for
discussion.
Differential Revision: https://reviews.llvm.org/D49328
llvm-svn: 337609
Reid Kleckner [Fri, 20 Jul 2018 20:20:45 +0000 (20:20 +0000)]
Revert r337595 "[ORC] Add new symbol lookup methods to ExecutionSessionBase in preparation for"
Breaks the build with LLVM_ENABLE_THREADS=OFF.
llvm-svn: 337608
Benjamin Kramer [Fri, 20 Jul 2018 20:13:08 +0000 (20:13 +0000)]
[AST] Various micro-optimizations in CXXInheritance
1. Pack std::pair<bool, unsigned> in CXXBasePaths::ClassSubobjects.
2. Use a SmallPtrSet instead of a SmallDenseSet for CXXBasePaths::VisitedDependentRecords.
3. Reorder some members of CXXBasePaths to save 8 bytes.
4. Use a SmallSetVector instead of a SetVector in CXXBasePaths::ComputeDeclsFound to avoid some allocations.
This speeds up an -fsyntax-only on all of Boost by approx 0.15%,
mainly by speeding up CXXBasePaths::lookupInBases by
approx 10%. No functional changes.
Patch by Bruno Ricci!
Differential Revision: https://reviews.llvm.org/D49302
llvm-svn: 337607
Roman Tereshin [Fri, 20 Jul 2018 20:10:04 +0000 (20:10 +0000)]
Reapply "[LSV] Refactoring + supporting bitcasts to a type of different size"
This reapplies commit r337489 reverted by r337541
Additionally, this commit contains a speculative fix to the issue reported in r337541
(the report does not contain an actionable reproducer, just a stack trace)
llvm-svn: 337606
Joel E. Denny [Fri, 20 Jul 2018 20:09:56 +0000 (20:09 +0000)]
[FileCheck] Fix search ranges for DAG-NOT-DAG
A DAG-NOT-DAG is a CHECK-DAG group, X, followed by a CHECK-NOT group,
N, followed by a CHECK-DAG group, Y. Let y be the initial directive
of Y. This patch makes the following changes to the behavior:
1. Directives in N can no longer match within part of Y's match
range just because y happens not to be the earliest match from
Y. Specifically, this patch withdraws N's search range end
from y's match range start to Y's match range start.
2. y can no longer match within X's match range, where a y match
produced a reordering complaint, which is thus no longer
possible. Specifically, this patch withdraws y's search range
start from X's permitted range start to X's match range end,
which was already the search range start for other members of
Y.
Both of these changes can only increase the number of test passes: #1
constrains the ability of CHECK-NOTs to match, and #2 expands the
ability of CHECK-DAGs to match without complaints.
These changes are based on discussions at:
<http://lists.llvm.org/pipermail/llvm-dev/2018-May/123550.html>
<https://reviews.llvm.org/D47106>
which conclude that:
1. These changes simplify the FileCheck conceptual model. First,
it makes search ranges for DAG-NOT-DAG more consistent with
other cases. Second, it was confusing that y was treated
differently from the rest of Y.
2. These changes add theoretical use cases for DAG-NOT-DAG that
had no obvious means to be expressed otherwise. We can justify
the first half of this assertion with the observation that
these changes can only increase the number of test passes.
3. Reordering detection for DAG-NOT-DAG had no obvious real
benefit.
We don't have evidence from real uses cases to help us debate
conclusions #2 and #3, but #1 at least seems intuitive.
Reviewed By: probinson
Differential Revision: https://reviews.llvm.org/D48986
llvm-svn: 337605
Jordan Rupprecht [Fri, 20 Jul 2018 19:54:24 +0000 (19:54 +0000)]
[llvm-objcopy] Add basic support for --rename-section
Summary:
Add basic support for --rename-section=old=new to llvm-objcopy.
A full replacement for GNU objcopy requires also modifying flags (i.e. --rename-section=old=new,flag1,flag2); I'd like to keep that in a separate change to keep this simple.
Reviewers: jakehehrlich, alexshap
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D49576
llvm-svn: 337604
H.J. Lu [Fri, 20 Jul 2018 19:24:11 +0000 (19:24 +0000)]
Mark REAL(swapcontext) with indirect_return attribute on x86
When shadow stack from Intel CET is enabled, the first instruction of all
indirect branch targets must be a special instruction, ENDBR.
lib/asan/asan_interceptors.cc has
...
int res = REAL(swapcontext)(oucp, ucp);
...
REAL(swapcontext) is a function pointer to swapcontext in libc. Since
swapcontext may return via indirect branch on x86 when shadow stack is
enabled, as in this case,
int res = REAL(swapcontext)(oucp, ucp);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^ This function may be
returned via an indirect branch.
Here compiler must insert ENDBR after call, like
call *bar(%rip)
endbr64
I opened an LLVM bug:
https://bugs.llvm.org/show_bug.cgi?id=38207
to add the indirect_return attribute so that it can be used to inform
compiler to insert ENDBR after REAL(swapcontext) call. We mark
REAL(swapcontext) with the indirect_return attribute if it is available.
This fixed:
https://bugs.llvm.org/show_bug.cgi?id=38249
Reviewed By: eugenis
Differential Revision: https://reviews.llvm.org/D49608
llvm-svn: 337603
Julie Hockett [Fri, 20 Jul 2018 18:49:55 +0000 (18:49 +0000)]
[clang-doc] Adding PublicOnly flag
Submitted on behalf of Annie Cherkaev (@anniecherk)
Added a flag which, when enabled, documents only those methods and
fields which have a Public attribute.
Differential Revision: https://reviews.llvm.org/D48395
llvm-svn: 337602
Benjamin Kramer [Fri, 20 Jul 2018 18:45:25 +0000 (18:45 +0000)]
[clangd] Fix racy use-after-scope in unittest
This only shows up with asan when the stars align in a bad way.
llvm-svn: 337601
Reid Kleckner [Fri, 20 Jul 2018 18:45:01 +0000 (18:45 +0000)]
And add a lit substitution for llvm-undname, as the comment says to
llvm-svn: 337600
Martin Storsjo [Fri, 20 Jul 2018 18:43:42 +0000 (18:43 +0000)]
Remove a superfluous semicolon
llvm-svn: 337599
Martin Storsjo [Fri, 20 Jul 2018 18:43:35 +0000 (18:43 +0000)]
[COFF] Sort .reloc before all other discardable sections
If a binary is stripped, which can remove discardable sections (except
for the .reloc section, which also is marked as discardable as it isn't
loaded at runtime, only read by the loader), the .reloc section should
be first of them, in order not to create gaps in the image.
Previously, binaries with relocations were broken if they were stripped
by GNU binutils strip. Trying to execute such binaries produces an error
about "xx is not a valid win32 application".
This fixes GNU binutils bug 23348.
Prior to SVN r329370 (which didn't intend to have functional changes),
the code for moving discardable sections to the end didn't clearly
express how other discardable sections should be ordered compared to
.reloc, but the change retained the exact same end result as before.
After SVN r329370, the code (and comments) more clearly indicate that
it tries to make the .reloc section the absolutely last one; this patch
changes that.
This matches how GNU binutils ld sorts .reloc compared to dwarf debug
info sections.
Differential Revision: https://reviews.llvm.org/D49351
Signed-off-by: Martin Storsjö <martin@martin.st>
llvm-svn: 337598
Reid Kleckner [Fri, 20 Jul 2018 18:42:19 +0000 (18:42 +0000)]
Make check-llvm depend on llvm-undname
llvm-svn: 337597
Zachary Turner [Fri, 20 Jul 2018 18:35:06 +0000 (18:35 +0000)]
[Demangler] Correctly factor in assignment when allocating.
Incidentally all allocations that we currently perform were
properly aligned, but this was only an accident.
Thanks to Erik Pilkington for catching this.
llvm-svn: 337596
Lang Hames [Fri, 20 Jul 2018 18:31:53 +0000 (18:31 +0000)]
[ORC] Add new symbol lookup methods to ExecutionSessionBase in preparation for
deprecating SymbolResolver and AsynchronousSymbolQuery.
Both lookup overloads take a VSO search order to perform the lookup. The first
overload is non-blocking and takes OnResolved and OnReady callbacks. The second
is blocking, takes a boolean flag to indicate whether to wait until all symbols
are ready, and returns a SymbolMap. Both overloads take a RegisterDependencies
function to register symbol dependencies (if any) on the query.
llvm-svn: 337595
Lang Hames [Fri, 20 Jul 2018 18:31:52 +0000 (18:31 +0000)]
[ORC] Simplify VSO::lookupFlags to return the flags map.
This discards the unresolved symbols set and returns the flags map directly
(rather than mutating it via the first argument).
The unresolved symbols result made it easy to chain lookupFlags calls, but such
chaining should be rare to non-existant (especially now that symbol resolvers
are being deprecated) so the simpler method signature is preferable.
llvm-svn: 337594
Lang Hames [Fri, 20 Jul 2018 18:31:50 +0000 (18:31 +0000)]
[ORC] Replace SymbolResolvers in the new ORC layers with search orders on VSOs.
A search order is a list of VSOs to be searched linearly to find symbols. Each
VSO now has a search order that will be used when fixing up definitions in that
VSO. Each VSO's search order defaults to just that VSO itself.
This is a first step towards removing symbol resolvers from ORC altogether. In
practice symbol resolvers tended to be used to implement a search order anyway,
sometimes with additional programatic generation of symbols. Now that VSOs
support programmatic generation of definitions via fallback generators, search
orders provide a cleaner way to achieve the desired effect (while removing a lot
of boilerplate).
llvm-svn: 337593
Benjamin Kramer [Fri, 20 Jul 2018 18:22:12 +0000 (18:22 +0000)]
[Demangler] Add missing overrides
-Winconsistent-missing-override complains about this.
llvm-svn: 337592
Zachary Turner [Fri, 20 Jul 2018 18:07:33 +0000 (18:07 +0000)]
Fix a few warnings and style issues in MS demangler.
Also remove a broken test case.
llvm-svn: 337591
Craig Topper [Fri, 20 Jul 2018 17:57:53 +0000 (17:57 +0000)]
[X86] Remove isel patterns for MOVSS/MOVSD ISD opcodes with integer types.
Ideally our ISD node types going into the isel table would have types consistent with their instruction domain. This prevents us having to duplicate patterns with different types for the same instruction.
Unfortunately, it seems our shuffle combining is currently relying on this a little remove some bitcasts. This seems to enable some switching between shufps and shufd. Hopefully there's some way we can address this in the combining.
Differential Revision: https://reviews.llvm.org/D49280
llvm-svn: 337590