Alex Bradbury [Tue, 19 Feb 2019 14:42:00 +0000 (14:42 +0000)]
[RISCV][NFC] Move some std::string to StringRef
llvm-svn: 354333
George Rimar [Tue, 19 Feb 2019 14:38:25 +0000 (14:38 +0000)]
Revert r354328, r354329 "[obj2yaml][yaml2obj] - Add support of parsing/dumping of the .gnu.version_r section."
Something went wrong. Bots are unhappy:
http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast/builds/44113/steps/test/logs/stdio
llvm-svn: 354332
Eric Liu [Tue, 19 Feb 2019 14:32:22 +0000 (14:32 +0000)]
[clangd] Handle unresolved scope specifier when fixing includes.
Summary:
In the following examples, "clangd" is unresolved, and the fixer will try to fix
include for `clang::clangd`; however, clang::clangd::X is usually intended. So
when handling a qualifier that is unresolved, we change the unresolved name and
scopes so that the fixer will fix "clang::clangd::X" in the following example.
```
namespace clang {
clangd::X
~~~~~~
}
// or
clang::clangd::X
~~~~~~
```
Reviewers: sammccall
Reviewed By: sammccall
Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, jdoerfert, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D58185
llvm-svn: 354330
George Rimar [Tue, 19 Feb 2019 14:22:10 +0000 (14:22 +0000)]
Fix BB after r354328.
Bot:
http://lab.llvm.org:8011/builders/lld-x86_64-darwin13/builds/30188/steps/build_Lld/logs/stdio
Error:
/Users/buildslave/as-bldslv9_new/lld-x86_64-darwin13/llvm.src/lib/ObjectYAML/ELFYAML.cpp:1013:15: error: unused variable 'Object' [-Werror,-Wunused-variable]
const auto *Object = static_cast<ELFYAML::Object *>(IO.getContext());
^
/Users/buildslave/as-bldslv9_new/lld-x86_64-darwin13/llvm.src/lib/ObjectYAML/ELFYAML.cpp:1023:15: error: unused variable 'Object' [-Werror,-Wunused-variable]
const auto *Object = static_cast<ELFYAML::Object *>(IO.getContext());
Fix:
change
const auto *Object = static_cast<ELFYAML::Object *>(IO.getContext());
assert(Object && "The IO context is not initialized");
to
assert(!IO.getContext() && "The IO context is initialized already");
llvm-svn: 354329
George Rimar [Tue, 19 Feb 2019 14:03:14 +0000 (14:03 +0000)]
[obj2yaml][yaml2obj] - Add support of parsing/dumping of the .gnu.version_r section.
The section is described here:
https://refspecs.linuxfoundation.org/LSB_1.3.0/gLSB/gLSB/symverrqmts.html
Patch just teaches obj2yaml/yaml2obj to dump and parse such sections.
We did the finalization of string tables very late,
and I had to move the logic to make it a bit earlier.
That was needed in this patch since .gnu.version_r adds strings to .dynstr.
This might also be useful for implementing other special sections.
Everything else changed in this patch seems to be straightforward.
Differential revision: https://reviews.llvm.org/D58119
llvm-svn: 354328
Pavel Labath [Tue, 19 Feb 2019 13:52:31 +0000 (13:52 +0000)]
Revert "minidump: Add ability to attach (breakpad) symbol files to placeholder modules"
This reverts r354263, because it uncovered a problem in handling of the
minidumps with conflicting UUIDs. If a minidump contains two files with
the same UUID, we will not create to placeholder modules for them, but
instead reuse the first one for the second instance. This creates a
problem because these modules have their load address hardcoded in them
(and I've added an assert to verify that).
Technically this is not a problem with this patch, as the same issue
existed in the previous implementation, but it did not have the assert
which would diagnose that. Nonetheless, I am reverting this until I
figure out what's the best course of action in this situation.
llvm-svn: 354324
Alex Bradbury [Tue, 19 Feb 2019 13:47:19 +0000 (13:47 +0000)]
[RISCV] Re-organise calling convention tests
Re-organise calling convention tests to prepare for ilp32f and ilp32d hard
float ABI tests. It's also clear that we need to introduce similar tests for
lp64.
llvm-svn: 354323
George Rimar [Tue, 19 Feb 2019 13:27:06 +0000 (13:27 +0000)]
Fix BB after r354319 "[yaml2obj] - Do not skip zeroes blocks if there are relocations against them."
Fix: move the test to x86 folder.
Seems it is needed, because llvm-objdump invocation used in test has -D (disasm) flag.
BB: http://lab.llvm.org:8011/builders/clang-hexagon-elf/builds/23016
/local/buildbot/slaves/hexagon-build-02/clang-hexagon-elf/stage1/bin/llvm-objdump:
error: '/local/buildbot/slaves/hexagon-build-02/clang-hexagon-elf/stage1/test/tools/llvm-objdump/Output/disasm-zeroes-relocations.test.tmp':
can't find target: : error: unable to get target for 'x86_64--', see --version and --triple.
.
llvm-svn: 354322
George Rimar [Tue, 19 Feb 2019 12:38:36 +0000 (12:38 +0000)]
[yaml2obj] - Do not skip zeroes blocks if there are relocations against them.
This is for -D -reloc combination.
With this patch, we do not skip the zero bytes that have a relocation against
them when -reloc is used. If -reloc is not used, then the behavior will be the same.
Differential revision: https://reviews.llvm.org/D58174
llvm-svn: 354319
George Rimar [Tue, 19 Feb 2019 12:15:04 +0000 (12:15 +0000)]
[yaml2obj] - Do not ignore explicit addresses for .dynsym and .dynstr
This fixes https://bugs.llvm.org/show_bug.cgi?id=40339
Previously if the addresses were set in YAML they were ignored for
.dynsym and .dynstr sections. The patch fixes that.
Differential revision: https://reviews.llvm.org/D58168
llvm-svn: 354318
Diana Picus [Tue, 19 Feb 2019 11:34:36 +0000 (11:34 +0000)]
Fix obsolete comment. NFC
Both files mentioned in the comment now include TargetOpcodes.def. Just
mention that directly.
llvm-svn: 354316
Simon Atanasyan [Tue, 19 Feb 2019 11:15:28 +0000 (11:15 +0000)]
[mips] Remove trailing whitespaces from the test case. NFC
llvm-svn: 354315
Max Kazantsev [Tue, 19 Feb 2019 11:14:05 +0000 (11:14 +0000)]
[NFC] API for signaling that the current loop is being deleted
We are planning to be able to delete the current loop in LoopSimplifyCFG
in the future. Add API to notify the loop pass manager that it happened.
llvm-svn: 354314
Max Kazantsev [Tue, 19 Feb 2019 11:13:58 +0000 (11:13 +0000)]
[NFC] Store loop header in a local to keep it available after the loop is deleted
llvm-svn: 354313
Simon Atanasyan [Tue, 19 Feb 2019 11:11:12 +0000 (11:11 +0000)]
[mips] Create LA25 thunks for MIPS R6 code
MIPS R6 code uses the `R_MIPS_PC26_S2` relocation for calls which might
cross boundaries of non-PIC-to-PIC code. We need to create a LA25 thunks
for that case.
llvm-svn: 354312
Simon Atanasyan [Tue, 19 Feb 2019 10:36:58 +0000 (10:36 +0000)]
[MIPS] Handle cross-mode (regular <-> microMIPS) jumps
The patch solves two tasks:
1. MIPS ABI allows to mix regular and microMIPS code and perform
cross-mode jumps. Linker needs to detect such cases and replace
jump/branch instructions by their cross-mode equivalents.
2. Other tools like dunamic linkers need to recognize cases when dynamic
table entries, e_entry field of an ELF header etc point to microMIPS
symbol. Linker should provide such information.
The first task is implemented in the `MIPS<ELFT>::relocateOne()` method.
New routine `fixupCrossModeJump` detects ISA mode change, checks and
replaces an instruction.
The main problem is how to recognize that relocation target is microMIPS
symbol. For absolute and section symbols compiler or assembler set the
less-significant bit of the symbol's value or sum of the symbol's value
and addend. And this bit signals to linker about microMIPS code. For
global symbols compiler cannot do the same trick because other tools like,
for example, disassembler wants to know an actual position of the symbol.
So compiler sets STO_MIPS_MICROMIPS flag in the `st_other` field.
In `MIPS<ELFT>::relocateOne()` method we have a symbol's value only and
cannot access any symbol's attributes. To pass type of the symbol
(regular/microMIPS) to that routine as well as other places where we
write a symbol value as-is (.dynamic section, `Elf_Ehdr::e_entry` field
etc) we set when necessary a less-significant bit in the `getSymVA`
function.
Differential revision: https://reviews.llvm.org/D40147
llvm-svn: 354311
Diana Picus [Tue, 19 Feb 2019 10:26:47 +0000 (10:26 +0000)]
[ARM GlobalISel] Support G_PHI for Thumb2
Same as arm mode.
llvm-svn: 354310
Pavel Labath [Tue, 19 Feb 2019 08:25:25 +0000 (08:25 +0000)]
Fix vscode tests for python3
encode/decode the data before sending it over the socket. Since (AFAICT)
the vscode protocol (unlike the gdb-remote one) is fully textual, using
the utf8 codec here is appropriate.
llvm-svn: 354308
Pavel Labath [Tue, 19 Feb 2019 08:12:41 +0000 (08:12 +0000)]
[gui] Simplify SourceFileWindowDelegate::WindowDelegateDraw
instead of printf-ing into a buffer, and them using that buffer as a
format string, simply use the appropriate indirect format string.
This also fixes a -Wformat-truncation warning with gcc.
llvm-svn: 354307
Fangrui Song [Tue, 19 Feb 2019 05:16:52 +0000 (05:16 +0000)]
[Dominators] Fix and optimize edge insertion of depth-based search
Summary:
After (x,y) is inserted, depth-based search finds all affected v that satisfies:
depth(nca(x,y))+1 < depth(v) && there exists a path P from y to v where every w on P satisfies depth(v) <= depth(w)
This reduces to a widest path problem (maximizing the depth of the
minimum vertex in the path) which can be solved by a modified version of
Dijkstra with a bucket queue (named depth-based search in the paper).
The algorithm visits vertices in decreasing order of bucket number.
However, the current code misused priority_queue to extract them in
increasing order. I cannot think of a failing scenario but it surely may
process vertices more than once due to the local usage of Processed.
This patch fixes this bug and simplifies/optimizes the code a bit. Also
add more comments.
Reviewers: kuhar
Reviewed By: kuhar
Subscribers: kristina, jdoerfert, llvm-commits, NutshellySima, brzycki
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D58349
llvm-svn: 354306
Craig Topper [Tue, 19 Feb 2019 03:04:14 +0000 (03:04 +0000)]
[X86] Remove command line strings from the ProcIntel* features.
These should always follow the CPU string. There's no reason to control them independently.
llvm-svn: 354304
Jonas Devlieghere [Tue, 19 Feb 2019 01:20:49 +0000 (01:20 +0000)]
[lldb-instr] Test that we ignore existing macros.
Although the functionality was already present, it wasn't tested.
llvm-svn: 354303
Jonas Devlieghere [Tue, 19 Feb 2019 01:04:31 +0000 (01:04 +0000)]
[lldb-instr] Wrap returns of struct/classes in LLDB_RECORD_RESULT
The instrumentation framework requires return values of custom classes
and structs to be wrapped in the LLDB_RECORD_RESULT macro.
llvm-svn: 354301
Jonas Devlieghere [Tue, 19 Feb 2019 00:08:10 +0000 (00:08 +0000)]
Disable TestModuleCXX.test on Windows
Importing cxx modules doesn't seem to work on Windows:
error: a.out :: Class 'tagARRAYDESC' has a member 'tdescElem' of type
'tagTYPEDESC' which does not have a complete definition.
error: a.out :: Class 'tagPARAMDESCEX' has a member 'varDefaultValue' of type
'tagVARIANT' which does not have a complete definition.
llvm-svn: 354300
Jessica Paquette [Mon, 18 Feb 2019 23:33:24 +0000 (23:33 +0000)]
[GlobalISel][AArch64] Legalize + select some llvm.ctlz.* intrinsics
Legalize/select llvm.ctlz.*
Add select-ctlz to show that we actually select them. Update arm64-clrsb.ll and
arm64-vclz.ll to show that we perform valid transformations in optimized builds,
and document where GISel can improve.
Differential Revision: https://reviews.llvm.org/D58155
llvm-svn: 354299
Sanjay Patel [Mon, 18 Feb 2019 23:33:05 +0000 (23:33 +0000)]
[CGP] form usub with overflow from sub+icmp
The motivating x86 cases for forming the intrinsic are shown in PR31754 and PR40487:
https://bugs.llvm.org/show_bug.cgi?id=31754
https://bugs.llvm.org/show_bug.cgi?id=40487
..and those are shown in the IR test file and x86 codegen file.
Matching the usubo pattern is harder than uaddo because we have 2 independent values rather than a def-use.
This adds a TLI hook that should preserve the existing behavior for uaddo formation, but disables usubo
formation by default. Only x86 overrides that setting for now although other targets will likely benefit
by forming usbuo too.
Differential Revision: https://reviews.llvm.org/D57789
llvm-svn: 354298
Davide Italiano [Mon, 18 Feb 2019 23:18:14 +0000 (23:18 +0000)]
[lldbtest] Fix some code to be compatible between py2 and py3.
llvm-svn: 354297
Jan Korous [Mon, 18 Feb 2019 23:12:29 +0000 (23:12 +0000)]
[clang][test] Fix FileManagerTest.getFileDontOpenRealPath for Windows
llvm-svn: 354296
Changpeng Fang [Mon, 18 Feb 2019 23:00:26 +0000 (23:00 +0000)]
AMDGPU: Use MachineInstr::mayAlias to replace areMemAccessesTriviallyDisjoint in LoadStoreOptimizer pass.
Summary:
This is to fix a memory dependence bug in LoadStoreOptimizer.
Reviewers:
arsenm, rampitec
Differential Revision:
https://reviews.llvm.org/D58295
llvm-svn: 354295
Jonas Devlieghere [Mon, 18 Feb 2019 22:59:52 +0000 (22:59 +0000)]
[lldb-instr] Add constructor and move test into lit/tools
The test had an implicit constructor for the Foo struct. Also, as the
instrumentation doesn't have to be reproducer specific, I moved the
tests into the lit/tools directory.
llvm-svn: 354294
Matt Arsenault [Mon, 18 Feb 2019 22:39:27 +0000 (22:39 +0000)]
GlobalISel: Implement widenScalar for g_extract scalar results
llvm-svn: 354293
Matt Arsenault [Mon, 18 Feb 2019 22:39:22 +0000 (22:39 +0000)]
GlobalISel: Make buildExtract use DstOp/SrcOp
llvm-svn: 354292
Jan Korous [Mon, 18 Feb 2019 22:33:40 +0000 (22:33 +0000)]
Reland "[clang][FileManager] fillRealPathName even if we aren't opening the file"
This reverts commit
e2bb3121fd4ab5b01f9ec1d2e3e9877db9c6a54c.
+ fixed test for Windows
llvm-svn: 354291
Julian Lettner [Mon, 18 Feb 2019 22:29:17 +0000 (22:29 +0000)]
[LSan][Darwin][NFC] Add comment explaining test failure
llvm-svn: 354290
Jason Molenda [Mon, 18 Feb 2019 22:18:11 +0000 (22:18 +0000)]
One more fix while I'm looking at this - remove the
unused IsSBProcess method, and have IsFBSProcess
return false if we don't have API that we can use to
make that determination, so we'll try other API
if we can.
llvm-svn: 354289
Jason Molenda [Mon, 18 Feb 2019 22:13:34 +0000 (22:13 +0000)]
Ah, misunderstood Jonas' feedback - fix this so we'll
do the right thing when both API are available. We
want to try both of them if the first one fails.
llvm-svn: 354288
Jason Molenda [Mon, 18 Feb 2019 22:10:23 +0000 (22:10 +0000)]
Clean up an unused variable warning when building this for
mac native.
llvm-svn: 354287
Davide Italiano [Mon, 18 Feb 2019 21:53:02 +0000 (21:53 +0000)]
[Python3] Fix TestObjCMethods.py to work with py2 and 3.
llvm-svn: 354286
Petr Hosek [Mon, 18 Feb 2019 20:58:06 +0000 (20:58 +0000)]
[libcxxabi][CMake] Drop unused HandleOutOfTreeLLVM include
This include doesn't seem to be needed for the standalone build (it's
not being used by libc++ build either), but introduces unnecessary
dependency because HandleOutOfTreeLLVM performs checks that require
a working C++ library. We shouldn't require a working C++ library to
build libc++abi or libc++ (it's what we're building after all).
Differential Revision: https://reviews.llvm.org/D58333
llvm-svn: 354284
Jonas Devlieghere [Mon, 18 Feb 2019 20:31:18 +0000 (20:31 +0000)]
[Reproducers] Make clang use lldb's VFS.
In r353906 we hooked up clang and lldb's reproducer infrastructure to
capture files used by clang. This patch adds the necessary logic to have
clang reuse the files from lldb's reproducer during replay.
Differential revision: https://reviews.llvm.org/D58309
llvm-svn: 354283
Julian Lettner [Mon, 18 Feb 2019 18:47:49 +0000 (18:47 +0000)]
[Sanitizer] On Darwin `__sanitizer_print_stack_trace` only prints topmost frame
In compiler-rt we have the notion of a `fast` and a `slow` stack
unwinder. Darwin currently only supports the fast unwinder.
From reading the code, my understanding is that
`BufferedStackTrace::Unwind` can be called with `bp=0, stack_top=0,
stack_bottom=0, request_fast_unwind=false`. If
`request_fast_unwind=true`, then we alos need to supply bp, stack_top,
and stack_bottom.
However, `BufferedStackTrace::Unwind` uses
`StackTrace::WillUseFastUnwind` which will adapt `request_fast_unwind`
if the requested unwinder is not supported. On Darwin, the result is
that we don't pass actual values for bp, stack_top, and stack_bottom,
but end up using the fast unwinder. The tests then fail because we only
print the topmost stack frame.
This patch adds a check to `WillUseFastUnwind` at the point of usage to
avoid the mismatch between `request_fast_unwind` and what `Unwind`
actually does. I am also interested in cleaning up the
`request_fast_unwind` machinery so this patch just the simplest thing
possible so I can enable the tests.
Reviewers: vitalybuka, vsk
Differential Revision: https://reviews.llvm.org/D58156
llvm-svn: 354282
Matt Arsenault [Mon, 18 Feb 2019 17:01:09 +0000 (17:01 +0000)]
GlobalISel: Fix double count of offset for irregular vector breakdowns
Fixes cases with odd vectors that break into multiple requested size
pieces.
llvm-svn: 354280
Sanjay Patel [Mon, 18 Feb 2019 16:46:12 +0000 (16:46 +0000)]
[x86] split more v8f32/v8i32 shuffles in lowering
Similar to D57867 - this is a small patch with lots of test diffs.
With half-vector-width narrowing potential, using an extract + 128-bit vshufps
is a win because it replaces a 256-bit shuffle with a 128-bit shufle.
This seems like it should be a win even for targets with 'fast-variable-shuffle',
but we are intentionally deferring that to an independent change to make sure
that is true.
Differential Revision: https://reviews.llvm.org/D58181
llvm-svn: 354279
Pavel Labath [Mon, 18 Feb 2019 16:05:26 +0000 (16:05 +0000)]
Un-XFAIL TestLinuxCore for windows
It turns out all that was needed to get this test passing was to fix the
python3 incompatibility.
llvm-svn: 354278
Sanjay Patel [Mon, 18 Feb 2019 16:04:22 +0000 (16:04 +0000)]
Revert "[InstCombine] reduce even more unsigned saturated add with 'not' op"
This reverts commit
079b610c29b4a428b3ae7b64dbac0378facf6632.
Bots are failing after this change on a stage 2 compile of clang.
llvm-svn: 354277
Sanjay Patel [Mon, 18 Feb 2019 15:21:39 +0000 (15:21 +0000)]
[InstCombine] reduce even more unsigned saturated add with 'not' op
We want to use the sum in the icmp to allow matching with
m_UAddWithOverflow and eliminate the 'not'. This is discussed
in D51929 and is another step towards solving PR14613:
https://bugs.llvm.org/show_bug.cgi?id=14613
Name: uaddsat, -1 fval
%notx = xor i32 %x, -1
%a = add i32 %x, %y
%c = icmp ugt i32 %notx, %y
%r = select i1 %c, i32 %a, i32 -1
=>
%a = add i32 %x, %y
%c2 = icmp ugt i32 %y, %a
%r = select i1 %c2, i32 -1, i32 %a
Name: uaddsat, -1 fval + ult
%notx = xor i32 %x, -1
%a = add i32 %x, %y
%c = icmp ult i32 %y, %notx
%r = select i1 %c, i32 %a, i32 -1
=>
%a = add i32 %x, %y
%c2 = icmp ugt i32 %y, %a
%r = select i1 %c2, i32 -1, i32 %a
https://rise4fun.com/Alive/nTp
llvm-svn: 354276
Pavel Labath [Mon, 18 Feb 2019 15:04:33 +0000 (15:04 +0000)]
Fix TestLinuxCore for python3
- dictionaries don't have iteritems()
- division returns floats
llvm-svn: 354273
Kadir Cetinkaya [Mon, 18 Feb 2019 14:23:19 +0000 (14:23 +0000)]
[clangd] Add tests for template specializations
Subscribers: ilya-biryukov, ioeric, MaskRay, jkorous, arphaman, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D58190
llvm-svn: 354272
Andrea Di Biagio [Mon, 18 Feb 2019 14:15:25 +0000 (14:15 +0000)]
[MCA] Correctly update register definitions in the PRF after move elimination.
This patch fixes a bug where register writes performed by optimizable register
moves were sometimes wrongly treated like partial register updates. Before this
patch, llvm-mca wrongly predicted a 1.50 IPC for test reg-move-elimination-6.s
(added by this patch). With this patch, llvm-mca correctly updates the register
defintions in the PRF, and the IPC for that test is now correctly reported as 2.
llvm-svn: 354271
George Rimar [Mon, 18 Feb 2019 13:58:12 +0000 (13:58 +0000)]
[llvm-readobj] - Simplify .gnu.version_d dumping.
This is similar to D58048.
Instead of scanning the dynamic table to read the
DT_VERDEFNUM, we could take it from the sh_info field.
(https://docs.oracle.com/cd/E19683-01/816-1386/chapter6-94076/index.html)
The patch does this.
llvm-svn: 354270
Eric Liu [Mon, 18 Feb 2019 13:12:10 +0000 (13:12 +0000)]
[clangd] Cache include fixes for diagnostics caused by the same unresolved name or incomplete type.
Summary:
Multiple diagnostics can be caused by the same unresolved name or incomplete type,
especially if the code is copy-pasted without #includes. The cache can avoid making
repetitive index requests, and thus reduce latency and allow more diagnostics to be
fixed (we limit the number of index requests for each parse).
Reviewers: sammccall
Reviewed By: sammccall
Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, jdoerfert, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D58239
llvm-svn: 354268
Gabor Marton [Mon, 18 Feb 2019 13:09:27 +0000 (13:09 +0000)]
[ASTImporter] Find previous friend function template
Reviewers: a_sidorin, shafik, a.sidorin
Subscribers: rnkovacs, dkrupp, Szelethus, gamesh411, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D57910
llvm-svn: 354267
Alexander Kornienko [Mon, 18 Feb 2019 12:50:35 +0000 (12:50 +0000)]
[clang-tidy] Fix links in docs.
llvm-svn: 354266
Oliver Stannard [Mon, 18 Feb 2019 12:39:47 +0000 (12:39 +0000)]
[ARM] Add pre-defined macros for ROPI and RWPI
This adds ACLE-defined macros to test for code being compiled in the ROPI and
RWPI position-independence modes.
Differential revision: https://reviews.llvm.org/D23610
llvm-svn: 354265
Serge Guelton [Mon, 18 Feb 2019 12:07:12 +0000 (12:07 +0000)]
[NFC] Make Optional<T> trivially copyable when T is trivially copyable
This is a follow-up to r354246 and a reimplementation of https://reviews.llvm.org/D57097?id=186600
that should not trigger any UB thanks to the use of an union.
This may still be subject to the problem solved by std::launder, but I'm unsure how it interacts whith union.
/me plans to revert if this triggers any relevant bot failure. At least this validates in Release mode with
clang 6.0.1 and gcc 4.8.5.
llvm-svn: 354264
Pavel Labath [Mon, 18 Feb 2019 11:55:01 +0000 (11:55 +0000)]
minidump: Add ability to attach (breakpad) symbol files to placeholder modules
This re-commits r353677, which was reverted due to test failures on the
windows bot. The issue there was that ObjectFilePECOFF vended its base
address through the incorrect interface. SymbolFilePDB depended on that,
which lead to assertion failures when SymbolFilePDB was attempting to
use the placeholder object files as a base. This has been fixed in
r354258
It also fixes one small problem in the original patch. The issue was that the
Module class would attempt to overwrite the object file we created in
CreateModuleFromObjectFile if the file corresponding to the placeholder object
file happened to exist (but we have already disqualified it due to UUID
mismatch. The fix is simple -- we set the m_did_load_objfile flag to properly
record the fact that we have already created an object file for the module.
The original commit message was:
The reason this wasn't working was that ProcessMinidump was creating odd
object-file-less modules, and SymbolFileBreakpad required the module to
have an associated object file because it needed to get its base
address.
This fixes that by introducing a PlaceholderObjectFile to serve as a
dummy object file. The general idea for this is taken from D55142, but
I've reworked it a bit to avoid the need for the PlaceholderModule
class. Now that we have an object file, our modules are sufficiently
similar to regular modules that we can use the regular Module class
almost out of the box -- the only thing I needed to tweak was the
Module::CreateModuleFromObjectFile functon to set the module's FileSpec
in addition to it's architecture. This wasn't needed for ObjectFileJIT
(the other user of CreateModuleFromObjectFile), but it shouldn't hurt it
either, and the change seems like a straightforward extension of this
function.
Reviewers: clayborg, lemo, amccarth
Subscribers: lldb-commits
Differential Revision: https://reviews.llvm.org/D57751
llvm-svn: 354263
Kadir Cetinkaya [Mon, 18 Feb 2019 11:30:43 +0000 (11:30 +0000)]
[clang][Index] Fix usage of IndexImplicitInstantiation
Summary:
Indexing context was skipping explicit template instantiations as well.
This patch makes sure it only skips implicit ones.
Subscribers: arphaman, jdoerfert, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D58189
llvm-svn: 354262
Andrea Di Biagio [Mon, 18 Feb 2019 11:27:11 +0000 (11:27 +0000)]
[MCA] Slightly refactor method writeStartEvent in WriteState and ReadState. NFCI
This is another change in preparation for PR37494.
No functional change intended.
llvm-svn: 354261
Gabor Marton [Mon, 18 Feb 2019 11:09:56 +0000 (11:09 +0000)]
[ASTImporter] Unify redecl chain tests as type parameterized tests
Summary:
This patch unifies all those tests which check the correctness of the
redecl chains. Previously we had several structurally very similar test
cases for each language construct (class, function, variable, function
template, ...).
We still use value-parameterized tests for the different AST
compatibility switches (-fdelayed-template-parsing, -fms-compatibility).
Gtest makes it possible to have either value-parameterized or
type-parameterized fixtures. However, we cannot have both value- and
type-parameterized test fixtures. So we use a value-parameterized test
fixture in the gtest sense. We intend to mimic gtest's type-parameters
via the type template parameter. We manually instantiate the different
tests with the each types.
After this patch I am planning to put the "generic redecl chain" related
tests into their own separate test file (in another patch).
Reviewers: a_sidorin, shafik, a.sidorin
Subscribers: rnkovacs, dkrupp, Szelethus, gamesh411, cfe-commits
Differential Revision: https://reviews.llvm.org/D57236
llvm-svn: 354259
Pavel Labath [Mon, 18 Feb 2019 11:06:57 +0000 (11:06 +0000)]
PECOFF: Implement GetBaseAddress
COFF files are modelled in lldb as having one big container section
spanning the entire module image, with the actual sections being
subsections of that. In this model, the base address is simply the
address of the first byte of that section.
This also removes the hack where ObjectFilePECOFF was using the
m_file_offset field to communicate this information. Using file offset
for this purpose is completely wrong, as that is supposed to indicate
where is this ObjectFile located in the file on disk. This field is only
meaningful for fat binaries, and should normally be 0.
Both PDB plugins have been updated to use GetBaseAddress instead of
GetFileOffset.
llvm-svn: 354258
Pavel Labath [Mon, 18 Feb 2019 10:36:23 +0000 (10:36 +0000)]
Return better error message from GDBRemoteCommunication::ConnectLocally
llvm-svn: 354256
Pavel Labath [Mon, 18 Feb 2019 10:09:29 +0000 (10:09 +0000)]
Set cmake policy CMP0075 to NEW
Summary:
The policy is about cmake_include_files ignoring
CMAKE_REQUIRED_LIBRARIES in the OLD behavior. Llvm already sets this
policy to NEW, but that is overridden by our cmake_minimum_required
command.
This makes our cmake policy setup consistent with the llvm build files
and avoids a warning when using newer versions of cmake.
Reviewers: sgraenitz, xiaobai
Subscribers: mgorny, lldb-commits
Differential Revision: https://reviews.llvm.org/D58279
llvm-svn: 354251
Guillaume Chatelet [Mon, 18 Feb 2019 10:08:20 +0000 (10:08 +0000)]
[llvm-exegesis] [NFC] Fixing typo.
Reviewers: courbet, gchatelet
Reviewed By: courbet, gchatelet
Subscribers: tschuett, llvm-commits
Differential Revision: https://reviews.llvm.org/D54895
llvm-svn: 354250
Serge Guelton [Mon, 18 Feb 2019 08:46:32 +0000 (08:46 +0000)]
Recommit [NFC] Better encapsulation of llvm::Optional Storage
Second attempt, trying to navigate out of the UB zone using
union for storage instead of raw bytes.
I'm prepared to revert that commit as soon as validation breaks,
which is likely to happen.
llvm-svn: 354246
Clement Courbet [Mon, 18 Feb 2019 08:24:29 +0000 (08:24 +0000)]
Revert r354244 "[DAGCombiner] Eliminate dead stores to stack."
Breaks some bots.
llvm-svn: 354245
Clement Courbet [Mon, 18 Feb 2019 07:59:01 +0000 (07:59 +0000)]
[DAGCombiner] Eliminate dead stores to stack.
Summary:
A store to an object whose lifetime is about to end can be removed.
See PR40550 for motivation.
Reviewers: niravd
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D57541
llvm-svn: 354244
Craig Topper [Mon, 18 Feb 2019 06:46:17 +0000 (06:46 +0000)]
[MC] Make SubtargetFeatureKV only store one FeatureBitset and use an 'unsigned' to hold the value.
This class is used for two difference tablegen generated tables. For one of the tables the Value FeatureBitset only has one bit set. For the other usage the Implies field was unused.
This patch changes the Value field to just be an unsigned. For the usage that put a real vector in bitset, we now use the previously unused Implies field and leave the Value field unused instead.
This is good for a 16K reduction in the size of llc on my local build with all targets enabled.
llvm-svn: 354243
Nico Weber [Mon, 18 Feb 2019 01:36:52 +0000 (01:36 +0000)]
gn build: Merge r354156
llvm-svn: 354242
Nico Weber [Mon, 18 Feb 2019 01:32:16 +0000 (01:32 +0000)]
lld-link: Mention comdat selection work in the 9.0.0 wip release notes
Differential Revision: https://reviews.llvm.org/D58301
llvm-svn: 354241
Serge Guelton [Sun, 17 Feb 2019 23:01:41 +0000 (23:01 +0000)]
Revert [NFC] Better encapsulation of llvm::Optional Storage
llvm-svn: 354240
Serge Guelton [Sun, 17 Feb 2019 22:54:23 +0000 (22:54 +0000)]
[NFC] Better encapsulation of llvm::Optional Storage, part II
Fix for better Windows support.
llvm-svn: 354239
Serge Guelton [Sun, 17 Feb 2019 22:41:14 +0000 (22:41 +0000)]
[NFC] Better encapsulation of llvm::Optional Storage
Second attempt, trying to navigate out of the UB zone using
union for storage instead of raw bytes.
I'm prepared to revert that commit as soon as validation breaks,
which is likely to happen.
llvm-svn: 354238
Robert Widmann [Sun, 17 Feb 2019 21:25:47 +0000 (21:25 +0000)]
[LLVM-C] Add bindings to create enumerators
Summary: The C API don't have the bindings to create enumerators, needed to create an enumeration.
Reviewers: whitequark, CodaFi, harlanhaskins, deadalnix
Reviewed By: whitequark, CodaFi, harlanhaskins
Subscribers: hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D58323
llvm-svn: 354237
Sanjay Patel [Sun, 17 Feb 2019 20:01:59 +0000 (20:01 +0000)]
[InstCombine] add even more tests for unsigned saturated add; NFC
The pattern-matching from rL354221 / rL354224 doesn't cover
these, so we're up to 8 different commuted possibilities.
There may still be 1 more variant of this pattern.
llvm-svn: 354236
Kristof Umann [Sun, 17 Feb 2019 19:51:42 +0000 (19:51 +0000)]
[analyzer] Make valist.Uninitialized depend on ValistBase
Accidentally left this dependency out, resulting in an assert failure if
only valist.Uninitialized is enabled from the valist package.
llvm-svn: 354235
Craig Topper [Sun, 17 Feb 2019 19:23:49 +0000 (19:23 +0000)]
[X86] In FP_TO_INTHelper, when moving data from SSE register to X87 register file via the stack, use the same stack slot we use for the integer conversion.
No need for a separate stack slot. The lifetimes don't overlap.
Also fix the MachinePointerInfo for the final load after the integer conversion to indicate it came from the stack slot.
llvm-svn: 354234
Bruno Ricci [Sun, 17 Feb 2019 19:18:38 +0000 (19:18 +0000)]
[NFC] Add a llvm_unreachable to silence a warning in SubstObjCTypeArgsVisitor
All cases in the switch are covered. NFC.
llvm-svn: 354233
Bruno Ricci [Sun, 17 Feb 2019 18:50:51 +0000 (18:50 +0000)]
Recommit "[AST] Factor out the logic of the various Expr::Ignore*"
(Originally commited in r354215 and reverted in r354216 because of a
missed failing clang-tidy test (fix in r354228))
Now that the implementation of all of the Expr::Ignore* is in Expr.cpp
we can try to remove some duplication. Do this by separating the logic
of the Expr::Ignore* from the iterative loop.
This is NFC, except for one change: IgnoreParenImpCasts now skips,
among other things, everything that IgnoreImpCasts skips. This means
FullExpr are now skipped by IgnoreParenImpCasts. This was likely an
oversight when FullExpr was added to the nodes skipped by IgnoreImpCasts.
Differential Revision: https://reviews.llvm.org/D57267
Reviewed By: aaron.ballman (with comments from void and rnk)
llvm-svn: 354232
Jonas Hahnfeld [Sun, 17 Feb 2019 18:47:33 +0000 (18:47 +0000)]
[compiler-rt] Fix broken sanitizer bots (hopefully)
According to the logs and local debugging there were two issues:
1) tsan tests listed libc++.a before the source file. That's usually
ok for shared libraries, but the linker will not add symbols from
a static library unless needed at that time. As a result the tests
that rely upon symbols from the library (and not only include the
headers) had undefined references.
To solve this I'm adding a new substitution %link_libcxx_tsan which
expands to libc++.a if available.
2) The target Fuzzer-x86_64-Test linked in SANITIZER_TEST_CXX_LIBRARIES
which defaults to -lstdc++. This resulted in error messages like
hidden symbol '_ZdlPv' is not defined locally
hidden symbol '_Znwm' is not defined locally
when using GNU gold (ld.bfd and lld are fine). Removing the linkage
is fine because we build a custom libc++ for that purpose.
llvm-svn: 354231
Max Kazantsev [Sun, 17 Feb 2019 18:22:00 +0000 (18:22 +0000)]
[TEST] Remove 2>&1 from tests
Avoid confusing CHECKS with debug dumps of sets that can be printed differently.
llvm-svn: 354229
Bruno Ricci [Sun, 17 Feb 2019 18:21:54 +0000 (18:21 +0000)]
[clang-tidy][NFCI] DanglingHandleCheck: Remove a superflous IgnoreParenImpCasts
ExprWithCleanups is currently not skipped by IgnoreParenImpCasts, but is skipped
by IgnoreImpCasts. In view of fixing this inconsistency in D57267, remove the
IgnoreParenImpCasts between the ReturnStmt and the ExprWithCleanups which
is not needed since ExprWithCleanups is always created as a direct child of
ReturnStmt (by inspection of each ReturnStmt::Create in Sema/SemaStmt.cpp).
NFC intended.
llvm-svn: 354228
Max Kazantsev [Sun, 17 Feb 2019 18:21:51 +0000 (18:21 +0000)]
[NFC] Teach getInnermostLoopFor walk up the loop trees
This should be NFC in current use case of this method, but it will
help to use it for solving more compex tasks in follow-up patches.
llvm-svn: 354227
Nikita Popov [Sun, 17 Feb 2019 17:40:47 +0000 (17:40 +0000)]
[SelectionDAG] Extract [US]MULO expansion into TL method; NFC
In preparation for supporting vector expansion.
Add an isPostTypeLegalization flag to makeLibCall(), because this
expansion relies on the legalized form using MERGE_VALUES. Drop
the corresponding variant of ExpandLibCall, which is no longer used.
Differential Revision: https://reviews.llvm.org/D58006
llvm-svn: 354226
Jan Kratochvil [Sun, 17 Feb 2019 17:12:37 +0000 (17:12 +0000)]
Remove unused extern declaration as removed by D32167
llvm-svn: 354225
Sanjay Patel [Sun, 17 Feb 2019 16:48:50 +0000 (16:48 +0000)]
[InstCombine] reduce more unsigned saturated add with 'not' op
We want to use the sum in the icmp to allow matching with
m_UAddWithOverflow and eliminate the 'not'. This is discussed
in D51929 and is another step towards solving PR14613:
https://bugs.llvm.org/show_bug.cgi?id=14613
Name: not op
%notx = xor i32 %x, -1
%a = add i32 %x, %y
%c = icmp ult i32 %notx, %y
%r = select i1 %c, i32 -1, i32 %a
=>
%a = add i32 %x, %y
%c2 = icmp ult i32 %a, %y
%r = select i1 %c2, i32 -1, i32 %a
Name: not op ugt
%notx = xor i32 %x, -1
%a = add i32 %x, %y
%c = icmp ugt i32 %y, %notx
%r = select i1 %c, i32 -1, i32 %a
=>
%a = add i32 %x, %y
%c2 = icmp ult i32 %a, %y
%r = select i1 %c2, i32 -1, i32 %a
https://rise4fun.com/Alive/niom
(The matching here is still incomplete.)
llvm-svn: 354224
Sanjay Patel [Sun, 17 Feb 2019 16:44:11 +0000 (16:44 +0000)]
[InstCombine] add more tests for unsigned saturated add; NFC
Extend the pattern-matching from rL354219 / rL354221.
llvm-svn: 354223
Shiva Chen [Sun, 17 Feb 2019 16:05:51 +0000 (16:05 +0000)]
[RISCV] Default enable RISCV linker relaxation
Differential Revision: https://reviews.llvm.org/D47127
llvm-svn: 354222
Sanjay Patel [Sun, 17 Feb 2019 15:58:48 +0000 (15:58 +0000)]
[InstCombine] reduce unsigned saturated add with 'not' op
We want to use the sum in the icmp to allow matching with
m_UAddWithOverflow and eliminate the 'not'. This is discussed
in D51929 and is another step towards solving PR14613:
https://bugs.llvm.org/show_bug.cgi?id=14613
(The matching here is incomplete. Trying to take minimal steps
to make sure we don't induce infinite looping from existing
canonicalizations of the 'select'.)
llvm-svn: 354221
Max Kazantsev [Sun, 17 Feb 2019 15:22:48 +0000 (15:22 +0000)]
[NFC] Fix name and clarifying comment for factored-out function
llvm-svn: 354220
Sanjay Patel [Sun, 17 Feb 2019 15:09:41 +0000 (15:09 +0000)]
[InstCombine] add tests for unsigned saturated add; NFC
We're missing IR canonicalizations for this op as shown in D51929.
llvm-svn: 354219
Max Kazantsev [Sun, 17 Feb 2019 15:04:09 +0000 (15:04 +0000)]
[NFC] Factor out a function for future reuse
llvm-svn: 354218
Serge Guelton [Sun, 17 Feb 2019 14:59:21 +0000 (14:59 +0000)]
Revert [NFC] Better encapsulation of llvm::Optional Storage
I'm getting the feealing that current Optional implementation is full of UB :-/
llvm-svn: 354217
Bruno Ricci [Sun, 17 Feb 2019 13:47:29 +0000 (13:47 +0000)]
Revert "[AST] Factor out the logic of the various Expr::Ignore*"
This breaks some clang-tidy checks. For some reason they were
not included in check-clang ?
llvm-svn: 354216
Bruno Ricci [Sun, 17 Feb 2019 13:32:39 +0000 (13:32 +0000)]
[AST] Factor out the logic of the various Expr::Ignore*
Now that the implementation of all of the Expr::Ignore* is in Expr.cpp
we can try to remove some duplication. Do this by separating the logic of
the Expr::Ignore* from the iterative loop.
This is NFC, except for one change: IgnoreParenImpCasts now skips, among
other things, everything that IgnoreImpCasts skips. This means FullExpr
are now skipped by IgnoreParenImpCasts. This was likely an oversight when
FullExpr was added to the nodes skipped by IgnoreImpCasts.
Differential Revision: https://reviews.llvm.org/D57267
Reviewed By: aaron.ballman (with comments from void and rnk)
llvm-svn: 354215
Serge Guelton [Sun, 17 Feb 2019 13:12:42 +0000 (13:12 +0000)]
[NFC] Better encapsulation of llvm::Optional Storage
llvm-svn: 354214
Jonas Hahnfeld [Sun, 17 Feb 2019 12:16:20 +0000 (12:16 +0000)]
[compiler-rt] Build custom libcxx with libcxxabi
This changes add_custom_libcxx to also build libcxxabi and merges
the two into a static and hermetic library.
There are multiple advantages:
1) The resulting libFuzzer doesn't expose C++ internals and looks
like a plain C library.
2) We don't have to manually link in libstdc++ to provide cxxabi.
3) The sanitizer tests cannot interfere with an installed version
of libc++.so in LD_LIBRARY_PATH.
Differential Revision: https://reviews.llvm.org/D58013
llvm-svn: 354212
Nirav Dave [Sun, 17 Feb 2019 03:53:23 +0000 (03:53 +0000)]
[X86] Prevent clang clobber checking for asm flag constraints.
Update getConstraintRegister as X86 Asm flag output constraints are no
longer fully alphanumeric,
llvm-svn: 354211
Petr Hosek [Sun, 17 Feb 2019 02:42:48 +0000 (02:42 +0000)]
[Driver][Gnu] Support -nolibc flag
This can be used to disable libc linking. This flag is supported by
GCC since version 9 as well as some Clang target toolchains.
Differential Revision: https://reviews.llvm.org/D58326
llvm-svn: 354210
Kristina Brooks [Sun, 17 Feb 2019 01:52:18 +0000 (01:52 +0000)]
[LLVMSupport]: Remove a severely outdated README.
The LLVM Support library implementation has resided in
//llvm/lib/Support for a significant amount of time now,
with documentation having been updated with all references
to the "System library" being replaced with "Support library".
Since this file mirrors already existing documentation available
for Support library, includes dead links to documentation and
still refers to it as "System library", having it there is
confusing and updating it has very little point as it duplicates
information in documentation, except documentation is a lot more
up to date while this file has not been maintained.
Up to date documentation concerning this can be found here:
http://llvm.org/docs/SupportLibrary.html
llvm-svn: 354209
Petr Hosek [Sun, 17 Feb 2019 01:02:40 +0000 (01:02 +0000)]
[Driver][Fuchsia] Support -nolibc flag
This can be used to disable libc linking. This flag is supported by
GCC since version 9 as well as some Clang target toolchains. This
change also includes tests for all -no* flags which previously weren't
covered.
Differential Revision: https://reviews.llvm.org/D58325
llvm-svn: 354208