Reid Kleckner [Fri, 15 Feb 2019 19:59:45 +0000 (19:59 +0000)]
[MSVC] Recognize `static_assert` keyword in C and C++98
Summary:
The main effect is that clang now accepts the following conforming C11
code with MSVC headers:
#include <assert.h>
static_assert(1, "true");
This is a non-conforming extension (the keyword is outside the
implementer's namespace), so it is placed under -fms-compatibility
instead of -fms-extensions like most MSVC-specific keyword extensions.
Normally, in C11, the compiler is supposed to provide the _Static_assert
keyword, and assert.h should define static_assert to _Static_assert.
However, that is not what MSVC does, and MSVC doesn't even provide
_Static_assert.
This also has the less important side effect of enabling static_assert
in C++98 mode with -fms-compatibility. It's exceptionally difficult to
use modern MSVC headers without C++14 even, so this is relatively
unimportant.
Fixes PR26672
Patch by Andrey Bokhanko!
Reviewers: rsmith, thakis
Subscribers: cfe-commits, STL_MSFT
Differential Revision: https://reviews.llvm.org/D17444
llvm-svn: 354162
Craig Topper [Fri, 15 Feb 2019 19:21:39 +0000 (19:21 +0000)]
[X86] Move all the SSE legality checks out of FP_TO_INTHelper and up to LowerFP_TO_INT. NFCI
These checks aren't needed on the call to FP_TO_INTHelper from the type legalizer for splitting i64. We always want to use X87 FIST/FISTT to memory there.
Moving up the SSE checks will allow this routine to focus on what it cares about and makes its return semantics cleaner.
llvm-svn: 354161
Jonas Paulsson [Fri, 15 Feb 2019 19:13:55 +0000 (19:13 +0000)]
Recommit "[SystemZ] Do not emit VEXTEND or VROUND nodes without vector support."
It seems there were some problem with using a .mir test. For some reason
doing '-stop-before=codegenprepare' and then '-start-before=codegenprepare'
on the output .mir file results in the NoVRegs Property after instruction
selection.
Recommitting the same test as an .ll file instead.
llvm-svn: 354160
Vedant Kumar [Fri, 15 Feb 2019 18:46:58 +0000 (18:46 +0000)]
[CodeExtractor] Do not lift lifetime.end markers for region inputs
If a lifetime.end marker occurs along one path through the extraction
region, but not another, then it's still incorrect to lift the marker,
because there is some path through the extracted function which would
ordinarily not reach the marker. If the call to the extracted function
is in a loop, unrolling can cause inputs to the function to become
optimized out as undef after the first iteration.
To prevent incorrect stack slot merging in the calling function, it
should be sufficient to lift lifetime.start markers for region inputs.
I've tested this theory out by doing a stage2 check-all with randomized
splitting enabled.
This is a follow-up to r353973, and there's additional context for this
change in https://reviews.llvm.org/D57834.
rdar://
47896986
Differential Revision: https://reviews.llvm.org/D58253
llvm-svn: 354159
Vedant Kumar [Fri, 15 Feb 2019 18:46:44 +0000 (18:46 +0000)]
[HotColdSplit] Schedule splitting late to fix perf regression
With or without PGO data applied, splitting early in the pipeline
(either before the inliner or shortly after it) regresses performance
across SPEC variants. The cause appears to be that splitting hides
context for subsequent optimizations.
Schedule splitting late again, in effect reversing r352080, which
scheduled the splitting pass early for code size benefits (documented in
https://reviews.llvm.org/D57082).
Differential Revision: https://reviews.llvm.org/D58258
llvm-svn: 354158
Evgeniy Stepanov [Fri, 15 Feb 2019 18:38:23 +0000 (18:38 +0000)]
Fix unsymbolized stack history printing.
Summary:
When symbols are unavailable, the current code prints
sp: ... pc: ... (null) (null)
instead of module name + offset.
Change the output to include module name and offset, and also to match
the regular sanitizer stack trace format so that it is recognized by
symbolize.py out of the box.
Reviewers: kcc, pcc
Subscribers: kubamracek, jdoerfert, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D58267
llvm-svn: 354157
Evgeniy Stepanov [Fri, 15 Feb 2019 18:38:14 +0000 (18:38 +0000)]
Runtime flags for malloc bisection.
Reviewers: kcc, pcc
Subscribers: kubamracek, mgorny, jdoerfert, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D58162
llvm-svn: 354156
Evgeniy Stepanov [Fri, 15 Feb 2019 18:38:03 +0000 (18:38 +0000)]
Fix false positive when tag_in_malloc=0,tag_in_free=1.
Summary:
With tag_in_free=1, malloc() can not assume that the memory is untagged,
and needs to retag is to 0.
Reviewers: pcc, kcc
Subscribers: kubamracek, jfb, jdoerfert, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D58158
llvm-svn: 354155
Andrea Di Biagio [Fri, 15 Feb 2019 18:28:11 +0000 (18:28 +0000)]
[MCA] Improved code comment. NFC
llvm-svn: 354154
Jonas Hahnfeld [Fri, 15 Feb 2019 18:25:26 +0000 (18:25 +0000)]
Revert "[compiler-rt] Cleanup usage of C++ ABI library"
This reverts r354132 because it breaks sanitizer-x86_64-linux:
http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux/builds/19915
llvm-svn: 354153
Simon Pilgrim [Fri, 15 Feb 2019 18:15:58 +0000 (18:15 +0000)]
Fix 80-column limit in SimplifyDemandedBits/SimplifyDemandedVectorElts. NFCI.
llvm-svn: 354152
Bruno Ricci [Fri, 15 Feb 2019 18:12:58 +0000 (18:12 +0000)]
[Sema][NFC] SequenceChecker: Add tests for references/members, and prepare for the C++17 tests
Add some tests for unsequenced operations with members and references.
For now most of it is unhandled but it shows what work needs to be done.
Also merge the tests for the C++17 sequencing rules in warn-unsequenced.cpp
since we want to make sure that the appropriate warnings are still present
in C++17 without duplicating the whole content of warn-unsequenced.cpp.
llvm-svn: 354151
Andrea Di Biagio [Fri, 15 Feb 2019 18:05:59 +0000 (18:05 +0000)]
[MCA][LSUnit] Return the ID of the dependent memory operation from method
isReady(). NFCI
This is yet another change in preparation for a fix for PR37494.
llvm-svn: 354150
Jorge Gorbe Moya [Fri, 15 Feb 2019 17:54:00 +0000 (17:54 +0000)]
Disable stop-hook-threads.test on Linux
ExecControl/StopHook/stop-hook-threads.test is flaky on Linux (it's
consistently failing on my machine, but doesn't fail on a co-worker's).
I'm seeing the following assertion failure:
```
CommandObject.cpp:145: bool lldb_private::CommandObject::CheckRequirements(lldb_private::CommandReturnObject&): Assertion `m_exe_ctx.GetTargetPtr() == NULL' failed.
```
Interestingly, this doesn't happen when typing the same commands in
interactive mode. The cause seems to be that, in synchronous execution
mode continue waits until the process stops again, and that includes
running any stop-hooks for that later stop, so we end with a stack trace
like this (lots of frames omitted for clarity):
```
abort()
CommandObject::CheckRequirements() <-- this is again the same instance of CommandObjectProcessContinue, fails assertion because the previous continue command hasn't finished.
Target::RunStopHooks()
CommandObjectProcessContinue::DoExecute()
Target::RunStopHooks()
```
In general, it seems like using process control commands inside
stop-hooks does not have very well defined semantics. You don't even
need multiple threads to make that assertion fail, you can build
```
int main() {
printf("1\n"); // break1
printf("2\n"); // break2
}
```
and then on lldb
```
target stop-hook add -o continue
break set -f stop-hook-simple.cpp -p "break1"
break set -f stop-hook-simple.cpp -p "break2"
run
```
In this case it's even worse because the presence of multiple threads
makes it prone to race conditions. In some tests I ran with a simpler
version of this test case, I was hitting either the previous assertion
failure or the following issue:
1. Two threads reach a breakpoint
2. First stop-hook does a process continue
3. Threads end
4. Second stop-hook runs, complains about process not existing.
This change disables the test on Linux. It's already marked as XFAIL on
Windows, so maybe we should just delete it until it's clear what should
be the expected behavior in these cases. Or maybe try to come up with a
way to write a similar multithreaded test without calling continue from
a stop hook, I don't know.
Differential Revision: https://reviews.llvm.org/D58257
llvm-svn: 354149
Louis Dionne [Fri, 15 Feb 2019 17:30:35 +0000 (17:30 +0000)]
[pstl] Remove some warnings when compiling with a recent Clang
There were multiple warnings for lambda captures that are unused, so
I removed those captures. I also fixed a couple of -Wsign-compare
warnings. Note that some warnings still remain, this change is not
exhaustive.
llvm-svn: 354148
JF Bastien [Fri, 15 Feb 2019 17:26:29 +0000 (17:26 +0000)]
Variable auto-init of blocks capturing self after init bugfix
Summary:
Blocks that capture themselves (and escape) after initialization currently codegen wrong because this:
bool capturedByInit =
Init && emission.IsEscapingByRef && isCapturedBy(D, Init);
Address Loc =
capturedByInit ? emission.Addr : emission.getObjectAddress(*this);
Already adjusts Loc from thr alloca to a GEP. This code:
if (emission.IsEscapingByRef)
Loc = emitBlockByrefAddress(Loc, &D, /*follow=*/false);
Was trying to do the same adjustment, and a GEP on a GEP (returning an int) triggers an assertion.
<rdar://problem/
47943027>
Reviewers: ahatanak
Subscribers: jkorous, dexonsmith, cfe-commits, rjmccall
Tags: #clang
Differential Revision: https://reviews.llvm.org/D58218
llvm-svn: 354147
Philip Reames [Fri, 15 Feb 2019 17:11:30 +0000 (17:11 +0000)]
[Tests] Demonstrate more missing atomicrmw transforms
llvm-svn: 354146
Stefan Granitz [Fri, 15 Feb 2019 16:42:29 +0000 (16:42 +0000)]
Fix potential UB when target_file directory is null
Summary: As seen in a crash report, the C-string returned for the directory component of `target_file` can null. It should not be assigned to `std::string` directly as this is undefined behavior.
Reviewers: jingham
Reviewed By: jingham
Subscribers: jdoerfert, lldb-commits, #lldb
Differential Revision: https://reviews.llvm.org/D57964
llvm-svn: 354145
Sanjay Patel [Fri, 15 Feb 2019 16:31:55 +0000 (16:31 +0000)]
[InstCombine] fix crash while trying to narrow a binop of shuffles (PR40734)
https://bugs.llvm.org/show_bug.cgi?id=40734
llvm-svn: 354144
Jonas Hahnfeld [Fri, 15 Feb 2019 16:27:52 +0000 (16:27 +0000)]
[compiler-rt] Let CMake search for thread support
This is an educated guess to fix sanitizer-x86_64-linux after r354132.
llvm-svn: 354143
Serge Guelton [Fri, 15 Feb 2019 16:12:46 +0000 (16:12 +0000)]
Revert r354137 - OptionalStorage implementation for trivial type, take III
This still fails on some random platform, and I fail to reproduce the issue.
llvm-svn: 354142
Shoaib Meenai [Fri, 15 Feb 2019 15:59:04 +0000 (15:59 +0000)]
[clang] Add build and install targets for clang libraries
This is modeled after the existing llvm-libraries target. It's a
convenient way to include all clang libraries in a distribution.
This differs slightly from the llvm-libraries target in that it adds any
library added via add_clang_library, whereas llvm-libraries only
includes targets added via add_llvm_library that didn't use the MODULE
or BUILDTREE_ONLY arguments. add_clang_library doesn't appear to have
any equivalents of those arguments, so the conditions don't apply.
Differential Revision: https://reviews.llvm.org/D58269
llvm-svn: 354141
Shoaib Meenai [Fri, 15 Feb 2019 15:59:02 +0000 (15:59 +0000)]
[clang] Create install targets for non-shared libraries
I don't see a reason for these to not have install targets created,
which in turn allows them to be bundled in distributions. This doesn't
affect the "install" target, since that just runs all CMake install
rules (and we were already creating install rules for these).
Differential Revision: https://reviews.llvm.org/D58268
llvm-svn: 354140
Matt Arsenault [Fri, 15 Feb 2019 15:24:34 +0000 (15:24 +0000)]
GlobalISel: Fix inadequate verification of g_build_vector
Testing based on the total size of the elements failed to catch a few
invalid scenarios, so explicitly check the number of elements/operands
and types.
This failed to catch situations like
<4 x s16> = G_BUILD_VECTOR s32, s32 since the total size added
up. This also would fail to catch an implicit conversion between
pointers and scalars.
llvm-svn: 354139
Matt Arsenault [Fri, 15 Feb 2019 15:24:31 +0000 (15:24 +0000)]
Try to organize MachineVerifier tests
The Verifier is separate from the MachineVerifier, so move it to a
different directory. Some other verifier tests were scattered in
target codegen tests as well (although I'm sure I missed some). Work
towards using a more consistent naming scheme to make it clearer where
the gaps still are for generic instructions.
llvm-svn: 354138
Serge Guelton [Fri, 15 Feb 2019 15:17:29 +0000 (15:17 +0000)]
OptionalStorage implementation for trivial type, take III
This is another attempt at implementating optional storage
for trivially copyable type, using an union instead of a
raw buffer to hold the actual storage. This make it possible
to get rid of the reinterpret_cast, and hopefully to fix the UB
of the previous attempts.
This validates fine on my laptop for gcc 8.2 and gcc 4.8, I'll
revert if it breaks the validation.
llvm-svn: 354137
Yitzhak Mandelbaum [Fri, 15 Feb 2019 14:43:10 +0000 (14:43 +0000)]
Exteded test of .
llvm-svn: 354136
Yitzhak Mandelbaum [Fri, 15 Feb 2019 14:43:08 +0000 (14:43 +0000)]
Remove unnecessary expectation.
llvm-svn: 354135
Yitzhak Mandelbaum [Fri, 15 Feb 2019 14:43:06 +0000 (14:43 +0000)]
Added test for matcher On.
llvm-svn: 354134
Yitzhak Mandelbaum [Fri, 15 Feb 2019 14:43:03 +0000 (14:43 +0000)]
Add tests for assorted `CXXMemberCallExpr` matchers.
Summary: Add tests for matchers `on`, `onImplicitObjectArgument` and `hasObjectExpression`.
Reviewers: alexfh, steveire, aaron.ballman
Differential Revision: https://reviews.llvm.org/D56850
llvm-svn: 354133
Jonas Hahnfeld [Fri, 15 Feb 2019 14:30:18 +0000 (14:30 +0000)]
[compiler-rt] Cleanup usage of C++ ABI library
Add missed value "libcxxabi" and introduce SANITIZER_TEST_CXX for linking
unit tests. This needs to be a full C++ library and cannot be libcxxabi.
Differential Revision: https://reviews.llvm.org/D58012
llvm-svn: 354132
Clement Courbet [Fri, 15 Feb 2019 14:17:17 +0000 (14:17 +0000)]
[MergeICmps] Make base ordering really deterministic.
Summary:
The idea is that we now manipulate bases through a `unsigned BaseID` based on
order of appearance in the comparison chain rather than through the `Value*`.
Fixes 40714.
Reviewers: gchatelet
Subscribers: mgrang, jfb, jdoerfert, llvm-commits, hans
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D58274
llvm-svn: 354131
Clement Courbet [Fri, 15 Feb 2019 12:58:06 +0000 (12:58 +0000)]
[MergeICmps][NFC] Improve doc.
llvm-svn: 354128
Adam Balogh [Fri, 15 Feb 2019 12:33:42 +0000 (12:33 +0000)]
[Analyzer] Fix for test file of bug 40625
Test fixed and changed to true positive, FIXME about false positive removed.
llvm-svn: 354127
Hans Wennborg [Fri, 15 Feb 2019 12:20:33 +0000 (12:20 +0000)]
Speculatively revert r354051 "Recommit Optional specialization for trivially copyable types"
and
r354055 "Optional specialization for trivially copyable types, part2"
These are suspected to cause Clang to get miscompiled on Ubuntu 14.04
(Trusty) which uses GCC 4.8.4. Reverting for an hour to see if this
helps. See llvm-commits thread.
> Recommit Optional specialization for trivially copyable types
>
> Unfortunately the original code gets misscompiled by GCC (at least 8.1),
> this is a tentative workaround using std::memcpy instead of inplace new
> for trivially copyable types. I'll revert if it breaks.
>
> Original revision: https://reviews.llvm.org/D57097
llvm-svn: 354126
Pavel Labath [Fri, 15 Feb 2019 12:20:23 +0000 (12:20 +0000)]
Remove alignment from struct XSAVE altogether
I reduced the alignment of this struct in r342029 to avoid compiler
warnings about under-aligned allocations, but it turns out that this
still causes problems with some compilers (see r353778). As I hinted in
r342029, I don't believe any special aligment is necessary here (the
only reason for that would be if we used some aligned SSE instructions to
access this buffer, but I don't see any reason why we should do that),
so here I go all the way, and remove the alignment requirements (except
the ones naturally imposed by basic types) altogether.
llvm-svn: 354125
Max Kazantsev [Fri, 15 Feb 2019 12:18:10 +0000 (12:18 +0000)]
[NFCI] Factor out block removal from stack of nested loops
llvm-svn: 354124
Simon Pilgrim [Fri, 15 Feb 2019 12:13:16 +0000 (12:13 +0000)]
Fix "field 'DFS' will be initialized after field 'DTU'" warning. NFCI.
llvm-svn: 354123
Michal Gorny [Fri, 15 Feb 2019 12:13:02 +0000 (12:13 +0000)]
[lldb] [MainLoop] Add kevent() EINTR handling
Add missing EINTR handling for kevent() calls. If the call is
interrupted, return from Poll() as if zero events were returned and let
the polling resume on next iteration. This fixes test flakiness
on NetBSD.
Includes a test case suggested by Pavel Labath on D42206.
Differential Revision: https://reviews.llvm.org/D58230
llvm-svn: 354122
Anastasia Stulova [Fri, 15 Feb 2019 12:07:57 +0000 (12:07 +0000)]
[OpenCL][PR40707] Allow OpenCL C types in C++ mode.
Allow all OpenCL types to be parsed in C++ mode.
llvm-svn: 354121
Gabor Marton [Fri, 15 Feb 2019 12:04:05 +0000 (12:04 +0000)]
[ASTImporter] Import every Decl in lambda record
Summary:
Previously only the fields were imported. Now every Decl is imported.
This way the destructor decl is not missing after import.
Patch by balazske (Balázs Kéri)
Reviewers: a.sidorin, shafik
Reviewed By: shafik
Subscribers: balazske, cfe-commits, Szelethus, martong, dkrupp
Tags: #clang
Differential Revision: https://reviews.llvm.org/D57740
llvm-svn: 354120
Sam Parker [Fri, 15 Feb 2019 11:50:21 +0000 (11:50 +0000)]
[BPI] Look through bitcasts in calcZeroHeuristic
Constant hoisting may have hidden a constant behind a bitcast so that
it isn't folded into its users. However, this prevents BPI from
calculating some of its heuristics that are based upon constant
values. So, I've added a simple helper function to look through these
casts.
Differential Revision: https://reviews.llvm.org/D58166
llvm-svn: 354119
Max Kazantsev [Fri, 15 Feb 2019 11:39:35 +0000 (11:39 +0000)]
[NFC] Promote DFS to field for further use
llvm-svn: 354118
Simon Pilgrim [Fri, 15 Feb 2019 11:39:21 +0000 (11:39 +0000)]
[X86][AVX] lowerShuffleAsLanePermuteAndPermute - fully populate the lane shuffle mask (PR40730)
As detailed on PR40730, we are not correctly filling in the lane shuffle mask (D53148/rL344446) - we fill in for the correct src lane but don't add it to the correct mask element, so any reference to the correct element is likely to see an UNDEF mask index.
This allows constant folding to propagate UNDEFs prior to the lane mask being (correctly) lowered to vperm2f128.
This patch fixes the issue by fully populating the lane shuffle mask - this is more than is necessary (if we only filled in the required mask elements we might be able to match other shuffle instructions - broadcasts etc.), but its the most cautious approach as this needs to be cherrypicked into the 8.0.0 release branch.
Differential Revision: https://reviews.llvm.org/D58237
llvm-svn: 354117
Sam McCall [Fri, 15 Feb 2019 11:04:25 +0000 (11:04 +0000)]
[clangd] Unlink VFS working dir from OS working dir. Reland of r351051
llvm-svn: 354116
Diana Picus [Fri, 15 Feb 2019 10:50:02 +0000 (10:50 +0000)]
[ARM GlobalISel] Style fix. NFCI
Add the opcode for ADDrr / t2ADDrr to the Opcode cache, as we did for
all other opcodes where the handling is otherwise the same between arm
mode and thumb2.
llvm-svn: 354115
Pavel Labath [Fri, 15 Feb 2019 10:47:34 +0000 (10:47 +0000)]
Fix the gdb-client test suite for python3
This applies the same fix that was done in r354106 to the lldb-server
test: bitcasting the string to a bytes object before sending it over a
socket. Since the gdb-remote protocol occasionally contains binary data,
and it does not assign any particular encoding to them, this is the
right thing to do here.
llvm-svn: 354114
Diana Picus [Fri, 15 Feb 2019 10:24:03 +0000 (10:24 +0000)]
[ARM GlobalISel] Support branches for Thumb2
Just like arm mode, but with different opcodes.
llvm-svn: 354113
Pavel Labath [Fri, 15 Feb 2019 10:06:21 +0000 (10:06 +0000)]
Sort files in source/Host/CMakeLists.txt
llvm-svn: 354112
Alex Bradbury [Fri, 15 Feb 2019 09:53:32 +0000 (09:53 +0000)]
[RISCV] Add assembler support for LA pseudo-instruction
This patch also introduces the emitAuipcInstPair helper, which is then used
for both emitLoadAddress and emitLoadLocalAddress.
Differential Revision: https://reviews.llvm.org/D55325
Patch by James Clarke.
llvm-svn: 354111
Alex Bradbury [Fri, 15 Feb 2019 09:43:46 +0000 (09:43 +0000)]
[RISCV] Support assembling %got_pcrel_hi operator
Differential Revision: https://reviews.llvm.org/D55279
Patch by James Clarke.
llvm-svn: 354110
Sam McCall [Fri, 15 Feb 2019 09:18:49 +0000 (09:18 +0000)]
Revert "[Analysis] -Wunreachable-code shouldn't fire on the increment of a foreach loop"
This reverts commit r354102.
llvm-svn: 354109
Sam Parker [Fri, 15 Feb 2019 09:04:39 +0000 (09:04 +0000)]
[ARM CGP] Fix ConvertTruncs
ConvertTruncs is used to replace a trunc for an AND mask, however
this function wasn't working as expected. By performing the change
later, we can create a wide type integer mask instead of a narrow -1
value, which could then be simply removed (incorrectly). Because we
now perform this action later, it's necessary to cache the trunc type
before we perform the promotion.
Differential Revision: https://reviews.llvm.org/D57686
llvm-svn: 354108
Max Kazantsev [Fri, 15 Feb 2019 08:18:00 +0000 (08:18 +0000)]
[NFC] Tweak SplitBlockAndInsertIfThen to use existing ThenBlock
llvm-svn: 354107
Pavel Labath [Fri, 15 Feb 2019 07:47:06 +0000 (07:47 +0000)]
Fix lldb-server test suite for python3
Summary:
This patch finishes the python3-ification of the lldb-server test suite.
It reverts the partial attempt in r352709 to encode/decode the string
via utf8 before writing to the socket. This wasn't enough because the
gdb-remote protocol can sometimes (but not very often) carry binary
data, and the utf8 codec chokes on that. Instead I add utility functions
to the "seven" module for performing "identity" transformations on the
byte data. This basically drills back the hole in the python type system
that the string/bytes distinction was supposed to plug. That is not
ideal, but was the best solution of the alternatives I could come up
with. The options I considered were:
- make use of the type system to add type safety to the test suite: This
required making a lot of changes to the test suite, since most of the
strings would now become byte objects instead, and it was not even
fully clear to me where to draw the line. One extreme solution would
be to just use byte objects everywhere, as the protocol doesn't
support non-ascii characters anyway. However, this appeared to be:
a) weird, because most of the protocol actually deals with strings,
but we would have to prefix everything with 'b'
b) clunky, because the handling of the bytes objects is sufficiently
different in PY2 and PY3 (e.g. b'a'[0] is a string in PY2, but an
int in PY3).
- using the latin1 codec (which gives an identity transformation for the
first 256 code points of unicode) instead of the custom
bytes_to_string functions. This almost could work, but it was still
slightly different between python 2 and 3, because in PY2 in would
return a unicode object, which would then cause problems when
combined with regular strings if it contained 8-bit chars.
With this in mind, I think the best solution for the time being is to
just coerce everything into the string type as early as possible, and
have things proceed indentically on both python versions. Once we stop
supporting python3, we can revisit the idea of using bytes objects more
prevasively.
Reviewers: davide, zturner, serge-sans-paille
Subscribers: lldb-commits
Differential Revision: https://reviews.llvm.org/D58177
llvm-svn: 354106
Pavel Labath [Fri, 15 Feb 2019 07:41:17 +0000 (07:41 +0000)]
Use sys.executable in lldb-dotest
Without that, dotest.py would be executed with the default python
interpreter, which may not be the same one that lldb is built with.
This still requires the user do know which python interpreter to use
when running lldb-dotest, but now he is at least able to choose it, if
he knows which one to use.
llvm-svn: 354105
Pavel Labath [Fri, 15 Feb 2019 07:41:12 +0000 (07:41 +0000)]
Embed swig version into lldb.py in a different way
Summary:
Instead of doing string chopping on the resulting python file, get swig
to output the version for us. The two things which make slightly
non-trivial are:
- in order to get swig to expand SWIG_VERSION for us, we cannot use
%pythoncode directly, but we have to go through an intermediate macro.
- SWIG_VERSION is a hex number, but it's components are supposed to be
interpreted decimally, so there is a bit of integer magic needed to
get the right number to come out.
I've tested that this approach works both with the latest (3.0.12) and
oldest (1.3.40) supported swig.
Reviewers: zturner, jingham, serge-sans-paille
Subscribers: jdoerfert, lldb-commits
Differential Revision: https://reviews.llvm.org/D58172
llvm-svn: 354104
Pavel Labath [Fri, 15 Feb 2019 07:33:37 +0000 (07:33 +0000)]
Remove redundant semicolon after namespace-closing '}'
llvm-svn: 354103
Sam McCall [Fri, 15 Feb 2019 07:16:11 +0000 (07:16 +0000)]
[Analysis] -Wunreachable-code shouldn't fire on the increment of a foreach loop
Summary:
The idea is that the code here isn't written, so doesn't indicate a bug.
Similar to code expanded from macros.
This means the warning no longer fires on this code:
for (auto C : collection) {
process(C);
return;
}
handleEmptyCollection();
Unclear whether this is more often a bug or not in practice, I think it's a
reasonable idiom in some cases.
Either way, if we want to warn on "loop that doesn't loop", I think it should be
a separate warning, and catch `while(1) break;`
Reviewers: ilya-biryukov, ioeric
Subscribers: cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D58134
llvm-svn: 354102
Max Kazantsev [Fri, 15 Feb 2019 07:06:52 +0000 (07:06 +0000)]
[TEST] Update test comments, refactor checks with update_test_checks.py
This patch changes messages in guards-related tests to adequately reflect
reality.
llvm-svn: 354101
Aaron Smith [Fri, 15 Feb 2019 06:13:59 +0000 (06:13 +0000)]
Fix for build bot problem from last change
llvm-svn: 354100
Aaron Smith [Fri, 15 Feb 2019 04:32:50 +0000 (04:32 +0000)]
Implement GetLoadAddress for the Windows process plugin
Summary:
When a process is loaded, update its sections with the load address to resolve any created breakpoints. For the remote debugging case, the debugged process is launched remotely so GetLoadAddress is intended to pass the load address from remote to LLDB (client).
Reviewers: zturner, llvm-commits, clayborg, labath
Reviewed By: labath
Subscribers: mgorny, sas, Hui, clayborg, labath, lldb-commits
Differential Revision: https://reviews.llvm.org/D56237
llvm-svn: 354099
Matt Arsenault [Fri, 15 Feb 2019 04:01:39 +0000 (04:01 +0000)]
X86: Replace isSafeToClobberEFLAGS implementation
Also use modifiesRegister instead of looping over operands.
llvm-svn: 354098
Francis Visoiu Mistrih [Fri, 15 Feb 2019 03:06:15 +0000 (03:06 +0000)]
Revert "Fix implementation of [temp.local]p4."
This reverts commit
40bd10b770813bd1471d46f514545437516aa4ba.
This seems to now emit an error when building the sanitizer tests:
http://green.lab.llvm.org/green/job/clang-stage1-configure-RA/53965/consoleFull.
llvm-svn: 354097
Francis Visoiu Mistrih [Fri, 15 Feb 2019 03:01:09 +0000 (03:01 +0000)]
Revert "[SystemZ] Do not emit VEXTEND or VROUND nodes without vector support."
This reverts commit
aa0b77d3395dc6ab91647138139c1a15a3aa088d.
This fails to pass the machine verifier:
http://green.lab.llvm.org/green/job/clang-stage1-cmake-RA-expensive/13579/
llvm-svn: 354096
Julian Lettner [Fri, 15 Feb 2019 02:44:52 +0000 (02:44 +0000)]
[lit][NFC] Cleanup copy&paste naming mistake
llvm-svn: 354095
Matt Davis [Fri, 15 Feb 2019 02:43:14 +0000 (02:43 +0000)]
[llvm-cxxfilt] Fix a comment typo. NFC.
llvm-svn: 354094
Aditya Nandakumar [Fri, 15 Feb 2019 01:37:54 +0000 (01:37 +0000)]
[GISel][NFC]: Add methods to speed up insertion into GISelWorklist
https://reviews.llvm.org/D58073
Speed up insertion during the initial populating phase into the
GISelWorkList by deferring repeatedly resizing the DenseMap.
This results in ~10% improvement in the combiner passes, and
~3% speedup in the Legalizer.
reviewed by: aemerson.
llvm-svn: 354093
Kostya Serebryany [Fri, 15 Feb 2019 01:22:00 +0000 (01:22 +0000)]
[libFuzzer] print new functions as they are discovered in the fork mode
llvm-svn: 354092
Richard Smith [Fri, 15 Feb 2019 00:29:04 +0000 (00:29 +0000)]
Fix implementation of [temp.local]p4.
When a template-name is looked up, we need to give injected-class-name
declarations of class templates special treatment, as they denote a
template rather than a type.
Previously we achieved this by applying a filter to the lookup results
after completing name lookup, but that is incorrect in various ways, not
least of which is that it lost all information about access and how
members were named, and the filtering caused us to generally lose
all ambiguity errors between templates and non-templates.
We now preserve the lookup results exactly, and the few places that need
to map from a declaration found by name lookup into a declaration of a
template do so explicitly. Deduplication of repeated lookup results of
the same injected-class-name declaration is done by name lookup instead
of after the fact.
llvm-svn: 354091
Richard Smith [Fri, 15 Feb 2019 00:27:53 +0000 (00:27 +0000)]
PR40642: Fix determination of whether the final statement of a statement
expression is a discarded-value expression.
Summary:
We used to get this wrong in three ways:
1) During parsing, an expression-statement followed by the }) ending a
statement expression was always treated as producing the value of the
statement expression. That's wrong for ({ if (1) expr; })
2) During template instantiation, various kinds of statement (most
statements not appearing directly in a compound-statement) were not
treated as discarded-value expressions, resulting in missing volatile
loads (etc).
3) In all contexts, an expression-statement with attributes was not
treated as producing the value of the statement expression, eg
({ [[attr]] expr; }).
Also fix incorrect enforcement of OpenMP rule that directives can "only
be placed in the program at a position where ignoring or deleting the
directive would result in a program with correct syntax". In particular,
a label (be it goto, case, or default) should not affect whether
directives are permitted.
Reviewers: aaron.ballman, rjmccall
Subscribers: cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D57984
llvm-svn: 354090
Ana Pazos [Fri, 15 Feb 2019 00:19:45 +0000 (00:19 +0000)]
Fixed failure on Darwin due to r354064
Summary:
instrprof-darwin-exports.c test fails on Darwin due to r354064.
Updated clang list of exported symbols to fix the issue.
Reviewers: vsk
Reviewed By: vsk
Subscribers: davidxl, efriedma
Differential Revision: https://reviews.llvm.org/D58259
llvm-svn: 354089
Kostya Serebryany [Fri, 15 Feb 2019 00:15:13 +0000 (00:15 +0000)]
[libFuzzer] fix the unit tests
llvm-svn: 354088
Kostya Serebryany [Fri, 15 Feb 2019 00:08:16 +0000 (00:08 +0000)]
[libFuzzer] when doing the merge, keep track of the coveraged edges, not just features
llvm-svn: 354087
Konstantin Zhuravlyov [Thu, 14 Feb 2019 23:59:44 +0000 (23:59 +0000)]
LLD/AMDGPU: Preserve ABI version during linking ELF for AMDGPU
Differential Revision: https://reviews.llvm.org/D58026
llvm-svn: 354086
Konstantin Zhuravlyov [Thu, 14 Feb 2019 23:56:04 +0000 (23:56 +0000)]
AMDGPU: Set ABI version to 1 for code object v3
Differential Revision: https://reviews.llvm.org/D57811
llvm-svn: 354085
Volodymyr Sapsai [Thu, 14 Feb 2019 23:50:44 +0000 (23:50 +0000)]
[Driver][Darwin] Emit an error when using -pg on OS without support for it.
Instead of letting a program fail at runtime, emit an error during
compilation.
rdar://problem/
12206955
Reviewers: dexonsmith, bob.wilson, steven_wu
Reviewed By: steven_wu
Subscribers: jkorous, cfe-commits
Differential Revision: https://reviews.llvm.org/D57991
llvm-svn: 354084
Matt Davis [Thu, 14 Feb 2019 23:50:35 +0000 (23:50 +0000)]
[symbolizer] Avoid collecting symbols belonging to invalid sections.
Summary:
llvm-symbolizer would originally report symbols that belonged to an invalid object file section.
Specifically the case where: `*Symbol.getSection() == ObjFile.section_end()`
This patch prevents the Symbolizer from collecting symbols that belong to invalid sections.
The test (from PR40591) introduces a case where two symbols have address 0,
one symbol is defined, 'foo', and the other is not defined, 'bar'. This patch will cause
the Symbolizer to keep 'foo' and ignore 'bar'.
As a side note, the logic for adding symbols to the Symbolizer's store
(`SymbolizableObjectFile::addSymbol`) replaces symbols with the
same <address, size> pair. At some point that logic should be revisited as in the
aforementioned case, 'bar' was overwriting 'foo' in the Symbolizer's store,
and 'foo' was forgotten.
This fixes PR40591
Reviewers: jhenderson, rupprecht
Reviewed By: rupprecht
Subscribers: hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D58146
llvm-svn: 354083
Nick Desaulniers [Thu, 14 Feb 2019 23:42:21 +0000 (23:42 +0000)]
Revert "[INLINER] allow inlining of address taken blocks"
This reverts commit
19e95fe61182945b7b68ad15348f144fb996633f.
llvm-svn: 354082
Nick Desaulniers [Thu, 14 Feb 2019 23:41:23 +0000 (23:41 +0000)]
Revert "Revert "[lld] Fix elf::unlinkAsync detached thread""
This reverts commit
9934f2ff02dba9fdabe6e27a83f9f95388bf4132.
llvm-svn: 354081
Nick Desaulniers [Thu, 14 Feb 2019 23:39:32 +0000 (23:39 +0000)]
Revert "[lld] Fix elf::unlinkAsync detached thread"
This reverts commit
2694810153cf992823eb45253d26b8567424438f.
llvm-svn: 354080
Nick Desaulniers [Thu, 14 Feb 2019 23:35:53 +0000 (23:35 +0000)]
[INLINER] allow inlining of address taken blocks
as long as their uses does not contain calls to functions that capture
the argument (potentially allowing the blockaddress to "escape" the
lifetime of the caller).
TODO:
- add more tests
- fix crash in llvm::updateCGAndAnalysisManagerForFunctionPass when
invoking Transforms/Inline/blockaddress.ll
llvm-svn: 354079
Vitaly Buka [Thu, 14 Feb 2019 23:29:28 +0000 (23:29 +0000)]
[lld] Fix elf::unlinkAsync detached thread
Summary:
So this patch just make sure that the thread is at least stated
before we return from main.
If we just detach then the thread may be actually be stated just after
the process returned from main and it's calling atexit handers. Then the thread may try to create own function static variable and it will
add new at exit handlers confusing libc.
GLIBC before 2.27 had race in that case which corrupted atexit handlers
list. Support for this use-case for other implementation is also unclear,
so we can try just avoid that.
PR40162
Reviewers: ruiu, espindola
Subscribers: emaste, arichardson, jfb, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D58246
llvm-svn: 354078
Sanjay Patel [Thu, 14 Feb 2019 23:17:22 +0000 (23:17 +0000)]
[x86] add tests for extractelement of FP; NFC
llvm-svn: 354077
Kostya Serebryany [Thu, 14 Feb 2019 23:12:33 +0000 (23:12 +0000)]
[libFuzzer] when doing the merge, keep track of the coveraged edges, not just features
llvm-svn: 354076
Jan Korous [Thu, 14 Feb 2019 23:02:35 +0000 (23:02 +0000)]
[clang][FileManager] fillRealPathName even if we aren't opening the file
The pathname wasn't previously filled when the getFile() method was called with openFile = false.
We are caching FileEntry-s in ParsedAST::Includes in clangd and this caused the problem.
This fixes an internal test failure in clangd - ClangdTests.GoToInclude.All
rdar://
47536127
Differential Revision: https://reviews.llvm.org/D58213
llvm-svn: 354075
Erik Pilkington [Thu, 14 Feb 2019 22:48:01 +0000 (22:48 +0000)]
[Sema] Fix-up a -Wfloat-conversion diagnostic
We were warning on valid ObjC property reference exprs, and passing
in the wrong arguments to DiagnoseFloatingImpCast (leading to a badly
worded diagnostic).
rdar://
47644670
Differential revision: https://reviews.llvm.org/D58145
llvm-svn: 354074
Julian Lettner [Thu, 14 Feb 2019 22:46:56 +0000 (22:46 +0000)]
[lit] Remove --single-process option (use -j1 instead)
Remove `--single-process` command line option. Use `-j1` instead.
Also see commit:
96adb78b120b6aa9739eb714534dc8e819f7bc52
llvm-svn: 354073
Konstantin Zhuravlyov [Thu, 14 Feb 2019 22:42:09 +0000 (22:42 +0000)]
MC/ELF: Allow targets to set ABI version
Tests are in the follow up change
Differential Revision: https://reviews.llvm.org/D57810
llvm-svn: 354072
Matt Arsenault [Thu, 14 Feb 2019 22:41:09 +0000 (22:41 +0000)]
GlobalISel: Add alignment to LegalityQuery MMOs
This allows targets to specify the minimum alignment required for the
load/store.
llvm-svn: 354071
Matt Arsenault [Thu, 14 Feb 2019 22:41:01 +0000 (22:41 +0000)]
Replace gcroot verifier tests
These haven't been checking anything useful and have been testing the
wrong failure reason for many years. Replace them with something which
stresses what is actually implemented in the verifier now.
llvm-svn: 354070
Volodymyr Sapsai [Thu, 14 Feb 2019 22:37:30 +0000 (22:37 +0000)]
[clang-tidy] Mention language version in test explicitly.
"modernize-use-using" check is applicable only to C++11 and later. Spell it out
to avoid relying on default language version.
rdar://problem/
47932196
llvm-svn: 354069
Julian Lettner [Thu, 14 Feb 2019 22:30:07 +0000 (22:30 +0000)]
[lit] Set --single-process for single tests and --threads=1
Summary:
Automatically upgrade debugging experience (single process, no thread
pool) when:
1) we only run a single test
2) user specifies `-j1`
Details:
Fix `--max-failures` in single process mode. Option did not have an
effect in single process mode.
Add display feedback for single process mode. Adapted test.
Improve argument checking (require positive integers).
`--single-process` is now essentially an alias for `-j1`. Should we
remove it?
Reviewers: rnk
Differential Revision: https://reviews.llvm.org/D58249
llvm-svn: 354068
Matt Arsenault [Thu, 14 Feb 2019 22:24:28 +0000 (22:24 +0000)]
AMDGPU/GlobalISel: Fix RegBankSelect for GEP.
This is basically a pointer typed add, so shouldn't be any different.
This was assuming everything was an SGPR, which is not true.
Also cleanup legality for GEP. I don't seem to be seeing the problem
the hack marking s64 as a legal pointer type the comment mentions.
llvm-svn: 354067
Stanislav Mekhanoshin [Thu, 14 Feb 2019 22:11:25 +0000 (22:11 +0000)]
[AMDGPU] Ressociate 'add (add x, y), z' to use SALU
Reassociate adds to collect scalar operands in a single
instruction when possible. That will result in a scalar
add followed by vector instead of two vector adds, thus
better utilizing SALU.
Differential Revision: https://reviews.llvm.org/D58220
llvm-svn: 354066
Matt Arsenault [Thu, 14 Feb 2019 21:58:12 +0000 (21:58 +0000)]
AMDGPU/GlobalISel: Handle split for 64-bit VALU select
llvm-svn: 354065
Ana Pazos [Thu, 14 Feb 2019 21:38:40 +0000 (21:38 +0000)]
Set hidden attribute on lprofMergeValueProfData
Summary:
The changes in https://reviews.llvm.org/D44847 cause load time failure
due to lprofMergeValueProfData in Android libs enabled with profile generation:
"dlopen failed: cannot locate symbol "lprofMergeValueProfData" referenced by..."
Marking lprofMergeValueProfData as hidden so the correct in-module definition
is picked by the linker.
Reviewers: davidxl
Reviewed By: davidxl
Subscribers: efriedma, xur, davidxl, llvm-commits
Differential Revision: https://reviews.llvm.org/D55893
llvm-svn: 354064
Douglas Yung [Thu, 14 Feb 2019 21:37:19 +0000 (21:37 +0000)]
Further relax restriction in tests to include where "-E" and "-S" must appear.
Also updated a few instances of "-emit-llvm-bc" and "-emit-obj" that were missed in the previous change.
llvm-svn: 354063
Teresa Johnson [Thu, 14 Feb 2019 21:22:50 +0000 (21:22 +0000)]
[ThinLTO] Detect partially split modules during the thin link
Summary:
The changes to disable LTO unit splitting by default (r350949) and
detect inconsistently split LTO units (r350948) are causing some crashes
when the inconsistency is detected in multiple threads simultaneously.
Fix that by having the code always look for the inconsistently split
LTO units during the thin link, by checking for the presence of type
tests recorded in the summaries.
Modify test added in r350948 to remove single threading required to fix
a bot failure due to this issue (and some debugging options added in the
process of diagnosing it).
Reviewers: pcc
Subscribers: mehdi_amini, inglorion, eraman, steven_wu, dexonsmith, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D57561
llvm-svn: 354062
Kostya Serebryany [Thu, 14 Feb 2019 21:09:32 +0000 (21:09 +0000)]
[libFuzzer] better stats for the fork mode
llvm-svn: 354061