Matt Arsenault [Fri, 3 May 2019 19:06:57 +0000 (19:06 +0000)]
Reapply r359906, "RegAllocFast: Add heuristic to detect values not live-out of a block"
This reverts commit r359912.
This should pass now, since the clang test was made less fragile in
r359918.
llvm-svn: 359919
Matt Arsenault [Fri, 3 May 2019 19:04:14 +0000 (19:04 +0000)]
Ensure there is stack usage in stack size warning test
r359906 broke this because the only stack usage was from a spill which
can be avoided since the only block is a return.
llvm-svn: 359918
Don Hinton [Fri, 3 May 2019 18:56:25 +0000 (18:56 +0000)]
[CommandLine] Enable Grouping for short options by default. Part 4 of 5
Summary:
This change enables `cl::Grouping` for short options --
options with names of a single character. This is consistent with GNU
getopt behavior.
Reviewers: rnk, MaskRay
Reviewed By: MaskRay
Subscribers: thopre, cfe-commits, MaskRay, rupprecht, hiraditya, llvm-commits
Tags: #llvm, #clang
Differential Revision: https://reviews.llvm.org/D61270
llvm-svn: 359917
Nico Weber [Fri, 3 May 2019 18:54:18 +0000 (18:54 +0000)]
Attempt to fix the clang-sphinx-docs bot after r358797
llvm-svn: 359916
Simon Pilgrim [Fri, 3 May 2019 18:20:28 +0000 (18:20 +0000)]
[DAGCombine] Remove repeated variables. NFCI.
llvm-svn: 359915
Evgeniy Stepanov [Fri, 3 May 2019 18:20:16 +0000 (18:20 +0000)]
[hwasan] Fix HWASAN_WITH_INTERCEPTORS=OFF build on not-android.
Summary:
I'm not aware of any platforms where this will work, but the code should at least compile.
HWASAN_WITH_INTERCEPTORS=OFF means there is magic in libc that would call __hwasan_thread_enter /
__hwasan_thread_exit as appropriate.
Reviewers: pcc, winksaville
Subscribers: srhines, kubamracek, #sanitizers, llvm-commits
Tags: #sanitizers, #llvm
Differential Revision: https://reviews.llvm.org/D61337
llvm-svn: 359914
David Blaikie [Fri, 3 May 2019 18:11:31 +0000 (18:11 +0000)]
Remove else-after-return
llvm-svn: 359913
Nico Weber [Fri, 3 May 2019 18:08:03 +0000 (18:08 +0000)]
Revert r359906, "RegAllocFast: Add heuristic to detect values not live-out of a block"
Makes clang/test/Misc/backend-stack-frame-diagnostics-fallback.cpp fail.
llvm-svn: 359912
Simon Pilgrim [Fri, 3 May 2019 18:02:33 +0000 (18:02 +0000)]
[TargetLowering] SimplifySetCC - remove repeated variable. NFCI.
Also reduce scope of Temp variable.
llvm-svn: 359911
Gheorghe-Teodor Bercea [Fri, 3 May 2019 17:59:18 +0000 (17:59 +0000)]
[CUDA][Clang][Bugfix] Add missing CUDA 9.2 case
Summary:
The bug was reported on the OpenMP-dev list:
.../obj-release/lib/clang/9.0.0/include/__clang_cuda_intrinsics.h:173:35: error: '__nvvm_shfl_sync_idx_i32' needs target feature ptx60|ptx61|ptx63|ptx64
__MAKE_SYNC_SHUFFLES(__shfl_sync, __nvvm_shfl_sync_idx_i32,
This problem occurs when trying to compile a .cu file that requires a newer ptx version (>ptx60 in this case) than ptx42.
Reviewers: tra, ABataev, caomhin
Reviewed By: tra
Subscribers: jdoerfert, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D61474
llvm-svn: 359910
Don Hinton [Fri, 3 May 2019 17:47:29 +0000 (17:47 +0000)]
[CommandLine] Change help output to prefix long options with `--` instead of `-`. NFC . Part 3 of 5
Summary:
By default, `parseCommandLineOptions()` will accept either a
`-` or `--` prefix for long options -- options with names longer than
a single character.
While this change does not affect behavior, it will be helpful with a
subsequent change that requires long options use the `--` prefix.
Reviewers: rnk, thopre
Reviewed By: thopre
Subscribers: thopre, cfe-commits, hiraditya, llvm-commits
Tags: #llvm, #clang
Differential Revision: https://reviews.llvm.org/D61269
llvm-svn: 359909
Evgeniy Stepanov [Fri, 3 May 2019 17:31:49 +0000 (17:31 +0000)]
Revert "[CodeGenPrepare] limit overflow intrinsic matching to a single basic block"
This reverts commit r359879, which introduced a compiler crash.
llvm-svn: 359908
Nico Weber [Fri, 3 May 2019 17:26:17 +0000 (17:26 +0000)]
Mark is_trivially_destructible as unsupported with apple-clang-9
See discussion on https://reviews.llvm.org/D48292
llvm-svn: 359907
Matt Arsenault [Fri, 3 May 2019 17:03:24 +0000 (17:03 +0000)]
RegAllocFast: Add heuristic to detect values not live-out of a block
Add an improved/new heuristic to catch more cases when values are not
live out of a basic block.
Patch by Matthias Braun
llvm-svn: 359906
Brian Cain [Fri, 3 May 2019 16:50:38 +0000 (16:50 +0000)]
[hexagon] change AsmParser assertion to error
For immediates that can't be evaluated in assembler-mapped instructions, we
should return 'invalid operand' instead of assert.
llvm-svn: 359905
Yonghong Song [Fri, 3 May 2019 16:40:16 +0000 (16:40 +0000)]
[Docs][CodeGenerator][eBPF] Correct the values for BPF_X and BPF_K
Fix the values of BPF_X and BPF_K according to BPFInstrFormats.td:
"
def BPF_K : BPFSrcType<0x0>;
def BPF_X : BPFSrcType<0x1>;
"
The right value for BPF_X is 0x1, and the right value for BPF_K is 0x0.
Signed-off-by: Wang YanQing <udknight@gmail.com>
Differential Revision: https://reviews.llvm.org/D61512
llvm-svn: 359904
Craig Topper [Fri, 3 May 2019 16:15:15 +0000 (16:15 +0000)]
[X86] Allow assembly parser to accept x/y/z suffixes on non-memory vfpclassps/pd and on memory forms in intel syntax
The x/y/z suffix is needed to disambiguate the memory form in at&t syntax since no xmm/ymm/zmm register is mentioned.
But we should also allow it for the register and broadcast forms where its not needed for consistency. This matches gas.
The printing code will still only use the suffix for the memory form where it is needed.
llvm-svn: 359903
Don Hinton [Fri, 3 May 2019 16:15:13 +0000 (16:15 +0000)]
[llvm] Revert r231274: "Devirtualize ~parser<T> by making it protected in base classes and making derived classes final"
Summary: This patch was previously applied in r231221, and reverted in
r231254 because it broke self-hosting. It was subsequently fixed and
reapplied in r231274. Unfortunately, making the `parser<T>` classes
final prevents inheritance which makes it impossible to implement
custom parsers.
Reverting r231221 restores the ability to customize parsers.
Reviewers: dblaikie
Reviewed By: dblaikie
Subscribers: craig.topper, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D60955
llvm-svn: 359902
Simon Pilgrim [Fri, 3 May 2019 15:56:06 +0000 (15:56 +0000)]
[X86] LowerToHorizontalOp - Tidyup calls to getHopForBuildVector. NFCI.
Merge the if() tests for the various HADD/SUB + Subtarget tests
llvm-svn: 359901
Simon Pilgrim [Fri, 3 May 2019 15:50:37 +0000 (15:50 +0000)]
[SelectionDAG] CreateTopologicalOrder - don't use iterator
We shouldn't use an iterator to loop across a std::vector when the same loop is adding elements to that std::vector
Found by cppcheck
llvm-svn: 359900
Matt Arsenault [Fri, 3 May 2019 15:37:07 +0000 (15:37 +0000)]
AMDGPU: Select VOP3 form of sub
The VOP3 form should always be the preferred selection form to be
shrunk later.
The r600 sub test needs to be split out because it asserts on the
arguments in the new test during the calling convention lowering.
llvm-svn: 359899
Matt Arsenault [Fri, 3 May 2019 15:21:53 +0000 (15:21 +0000)]
AMDGPU: Support shrinking add with FI in SIFoldOperands
Avoids test regression in a future patch
llvm-svn: 359898
Robert Lougher [Fri, 3 May 2019 15:14:19 +0000 (15:14 +0000)]
Revert r359549 - incorrect update of test checks. NFC
llvm-svn: 359897
Sanjay Patel [Fri, 3 May 2019 15:09:53 +0000 (15:09 +0000)]
[x86] add tests for fneg with undefs; NFC
This was originally part of D61419.
llvm-svn: 359896
Matt Arsenault [Fri, 3 May 2019 15:08:36 +0000 (15:08 +0000)]
AMDGPU: Remove redundant patterns for shifts
llvm-svn: 359895
Matt Arsenault [Fri, 3 May 2019 15:08:35 +0000 (15:08 +0000)]
AMDGPU: Remove redundant patterns for sub
There were 2 patterns for sub, one selecting to sub and one to
subrev. Only one of these will succeed, so remove the reversed one.
llvm-svn: 359894
Matt Arsenault [Fri, 3 May 2019 14:54:38 +0000 (14:54 +0000)]
AMDGPU: Add baseline test for future patch
llvm-svn: 359893
Alexey Bataev [Fri, 3 May 2019 14:47:20 +0000 (14:47 +0000)]
[OPENMP][NVPTX]Improved several standard OpenMP functions, NFC.
Summary:
Used parallelLevel[] counter to simplify and improve implementation of
the existing standard OpenMP functions. Functions are tested already in
several tests, the patch is NFC.
Reviewers: grokos, gtbercea, kkwli0
Subscribers: guansong, jdoerfert, caomhin, openmp-commits
Tags: #openmp
Differential Revision: https://reviews.llvm.org/D61459
llvm-svn: 359892
Matt Arsenault [Fri, 3 May 2019 14:40:10 +0000 (14:40 +0000)]
AMDGPU: Replace shrunk instruction with dummy implicit_def
This was broken if the original operand was killed. The kill flag
would appear on both instructions, and fail the verifier. Keep the
kill flag, but remove the operands from the old instruction. This has
an added benefit of really reducing the use count for future folds.
Ideally the pass would be structured more like what PeepholeOptimizer
does to avoid this hack to avoid breaking instruction iterators.
llvm-svn: 359891
Simon Pilgrim [Fri, 3 May 2019 14:38:24 +0000 (14:38 +0000)]
[TargetLowering] ShrinkDemandedConstant - reduce scope of TLO.DAG variable. NFCI.
Only ever used in one block
llvm-svn: 359890
Simon Pilgrim [Fri, 3 May 2019 14:37:00 +0000 (14:37 +0000)]
[X86] Remove repeated variables. NFCI.
llvm-svn: 359889
Nico Weber [Fri, 3 May 2019 14:27:12 +0000 (14:27 +0000)]
gn build: Merge r359878
llvm-svn: 359888
Sid Manning [Fri, 3 May 2019 14:14:01 +0000 (14:14 +0000)]
Let --discard-all imply --strip-debug.
This will match gnu strip's behavior.
Differential Revision: https://reviews.llvm.org/D61092
llvm-svn: 359887
Simon Pilgrim [Fri, 3 May 2019 14:07:38 +0000 (14:07 +0000)]
[X86] Add X64 common prefixes and regenerate mul i64 tests
Noticed while reviewing D61472
llvm-svn: 359886
Matt Arsenault [Fri, 3 May 2019 13:55:40 +0000 (13:55 +0000)]
AMDGPU: Forgot to commit test file for r358890
llvm-svn: 359885
Simon Pilgrim [Fri, 3 May 2019 13:50:38 +0000 (13:50 +0000)]
Avoid cppcheck operator precedence warnings. NFCI.
Prefer ((X & Y) ? A : B) to (X & Y ? A : B)
llvm-svn: 359884
Matt Arsenault [Fri, 3 May 2019 13:42:56 +0000 (13:42 +0000)]
AMDGPU: Fix incorrect commute with sub when folding immediates
When a fold of an immediate into a sub/subrev required shrinking the
instruction, the wrong VOP2 opcode was used. This was using the VOP2
equivalent of the original instruction, not the commuted instruction
with the inverted opcode.
llvm-svn: 359883
Matt Arsenault [Fri, 3 May 2019 13:42:55 +0000 (13:42 +0000)]
AMDGPU: Fix test verification
This should run the verifier, and needs to enable trackRegLiveness.
llvm-svn: 359882
Sanjay Patel [Fri, 3 May 2019 13:25:06 +0000 (13:25 +0000)]
[LICM] auto-generate complete test checks; NFC
llvm-svn: 359881
Sam McCall [Fri, 3 May 2019 13:17:29 +0000 (13:17 +0000)]
[clangd] Fix header-guard check for include insertion, and don't index header guards.
Summary:
Both of these attempt to check whether a header guard exists while parsing the
file. However the file is only marked as guarded once clang finishes processing
it. We defer the checks and work until SymbolCollector::finish().
This is ugly and ad-hoc, deferring *all* work might be cleaner.
Reviewers: kadircet
Subscribers: ilya-biryukov, MaskRay, jkorous, mgrang, arphaman, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D61442
llvm-svn: 359880
Sanjay Patel [Fri, 3 May 2019 13:09:18 +0000 (13:09 +0000)]
[CodeGenPrepare] limit overflow intrinsic matching to a single basic block
Using/updating a dominator tree to match math overflow patterns may be very
expensive in compile-time (because of the way CGP uses a DT), so just handle
the single-block case.
Also, we were restarting the iterator loops when doing the overflow intrinsic
transforms by marking the dominator tree for update. That was done to prevent
iterating over a removed instruction. But we can postpone the deletion using
the existing "RemovedInsts" structure, and that means we don't need to update
the DT.
See post-commit thread for rL354298 for more details:
http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-
20190422/646276.html
Differential Revision: https://reviews.llvm.org/D61075
llvm-svn: 359879
Sean Fertile [Fri, 3 May 2019 12:57:07 +0000 (12:57 +0000)]
[Object][XCOFF] Add an XCOFF dumper for llvm-readobj.
Patch adds support for dumping of file headers with llvm-readobj. XCOFF
object files are added to test dumping a well formed file, and dumping
both negative timestamps and negative symbol counts, both of which are
allowed in the XCOFF definition.
Differential Revision: https://reviews.llvm.org/D60878
llvm-svn: 359878
Simon Pilgrim [Fri, 3 May 2019 12:55:25 +0000 (12:55 +0000)]
[TargetLowering] expandUnalignedStore - cleanup EVT variables. NFCI.
Avoid duplicated EVTs and rename Store/Load VTs to avoid -Wshadow warnings.
llvm-svn: 359877
Dmitri Gribenko [Fri, 3 May 2019 12:50:00 +0000 (12:50 +0000)]
Added an AST matcher for declarations that are in the `std` namespace
Reviewers: alexfh
Subscribers: cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D61480
llvm-svn: 359876
Anton Afanasyev [Fri, 3 May 2019 12:36:22 +0000 (12:36 +0000)]
Revert "[MIR] Add simple PRE pass to MachineCSE"
This reverts commit
9c20156de39b377190d7a91783d61877b303fe35.
It breaks stage 2 of clang-ppc64be-linux-multistage.
llvm-svn: 359875
Kadir Cetinkaya [Fri, 3 May 2019 12:11:14 +0000 (12:11 +0000)]
[clangd] Also perform merging for symbol definitions
Summary:
clangd currently prefers declarations from codegen files. This patch
implements that behavior for definition locations. If we have definiton
locations both coming from AST and index, clangd will perform a merging to show
the codegen file if that's the case.
Reviewers: sammccall
Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D61126
llvm-svn: 359874
Simon Pilgrim [Fri, 3 May 2019 11:32:00 +0000 (11:32 +0000)]
[SelectionDAG] Use INT_MIN as (1 << 31) is UB for signed integers. NFCI.
llvm-svn: 359873
Simon Pilgrim [Fri, 3 May 2019 11:11:03 +0000 (11:11 +0000)]
[SelectionDAG] computeKnownBits - remove some duplicate/shadow variables. NFCI.
llvm-svn: 359872
Simon Pilgrim [Fri, 3 May 2019 10:32:07 +0000 (10:32 +0000)]
[X86] LowerMULH - remove unused Lo/Hi vector indices. NFCI.
Leftover from before we had the extract128BitVector helpers.
llvm-svn: 359871
Anton Afanasyev [Fri, 3 May 2019 10:30:59 +0000 (10:30 +0000)]
[MIR] Add simple PRE pass to MachineCSE
This is the second part of the commit fixing PR38917 (hoisting
partitially redundant machine instruction). Most of PRE (partitial
redundancy elimination) and CSE work is done on LLVM IR, but some of
redundancy arises during DAG legalization. Machine CSE is not enough
to deal with it. This simple PRE implementation works a little bit
intricately: it passes before CSE, looking for partitial redundancy
and transforming it to fully redundancy, anticipating that the next
CSE step will eliminate this created redundancy. If CSE doesn't
eliminate this, than created instruction will remain dead and eliminated
later by Remove Dead Machine Instructions pass.
The third part of the commit is supposed to refactor MachineCSE,
to make it more clear and to merge MachinePRE with MachineCSE,
so one need no rely on further Remove Dead pass to clear instrs
not eliminated by CSE.
First step: https://reviews.llvm.org/D54839
Fixes llvm.org/PR38917
Reviewers: RKSimon
Subscribers: hfinkel, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D56772
llvm-svn: 359870
Simon Pilgrim [Fri, 3 May 2019 10:13:41 +0000 (10:13 +0000)]
Reduce variable scope to just the if() block its actually used in. NFCI.
llvm-svn: 359869
Raphael Isemann [Fri, 3 May 2019 10:03:28 +0000 (10:03 +0000)]
C.128 override, virtual keyword handling
Summary:
According to [C128] "Virtual functions should specify exactly one
of `virtual`, `override`, or `final`", I've added override where a
virtual function is overriden but the explicit `override` keyword
was missing. Whenever both `virtual` and `override` were specified,
I removed `virtual`. As C.128 puts it:
> [...] writing more than one of these three is both redundant and
> a potential source of errors.
I anticipate a discussion about whether or not to add `override` to
destructors but I went for it because of an example in [ISOCPP1000].
Let me repeat the comment for you here:
Consider this code:
```
struct Base {
virtual ~Base(){}
};
struct SubClass : Base {
~SubClass() {
std::cout << "It works!\n";
}
};
int main() {
std::unique_ptr<Base> ptr = std::make_unique<SubClass>();
}
```
If for some odd reason somebody removes the `virtual` keyword from the
`Base` struct, the code will no longer print `It works!`. So adding
`override` to destructors actively protects us from accidentally
breaking our code at runtime.
[C128]: https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#c128-virtual-functions-should-specify-exactly-one-of-virtual-override-or-final
[ISOCPP1000]: https://github.com/isocpp/CppCoreGuidelines/issues/1000#issuecomment-
476951555
Reviewers: teemperor, JDevlieghere, davide, shafik
Reviewed By: teemperor
Subscribers: kwk, arphaman, kadircet, lldb-commits
Tags: #lldb
Differential Revision: https://reviews.llvm.org/D61440
llvm-svn: 359868
Pavel Labath [Fri, 3 May 2019 08:06:28 +0000 (08:06 +0000)]
Split TestVLA into two and XFAIL one part
The part which checks whether vla_expr shows up in the variable list
does not pass on non-darwin platforms. Add the appropriate decorator.
llvm-svn: 359867
Ilya Biryukov [Fri, 3 May 2019 08:03:21 +0000 (08:03 +0000)]
[clangd] Minor code style cleanups in Protocol.h. NFC
- Remove a parameter name that was misspelled (OS used for non-stream
parameter)
- Declare operator == (TextEdit, TextEdit) outside the struct, for
consistency with other user-declared ops in our code.
- Fix naming style of a parameter.
llvm-svn: 359866
Martin Storsjo [Fri, 3 May 2019 07:43:23 +0000 (07:43 +0000)]
Avoid duplicate function aliases on MinGW after SVN r359835
On MinGW, the same alias mechanism as for ELF, using
__attribute__((__alias__())), is used.
llvm-svn: 359865
Akira Hatanaka [Fri, 3 May 2019 07:19:46 +0000 (07:19 +0000)]
[Sema][ObjC] Disable -Wunused-parameter for ObjC methods
The warning isn't very useful when the function is an ObjC method.
rdar://problem/
41561853
Differential Revision: https://reviews.llvm.org/D61147
llvm-svn: 359864
Craig Topper [Fri, 3 May 2019 07:14:05 +0000 (07:14 +0000)]
[X86] Add more one checks to masked compare patterns that were missed in r358358.
This covers the patterns we use for widening 128/256 comparisons to 512-bit when
AVX512VL isn't supported.
llvm-svn: 359863
Pavel Labath [Fri, 3 May 2019 07:11:43 +0000 (07:11 +0000)]
Revert "Initialization: move InstructionEmulation to full initialization"
This change is bogus. lldb-server definitely uses instruction emulation
on some architectures.
llvm-svn: 359862
Igor Kudrin [Fri, 3 May 2019 05:11:48 +0000 (05:11 +0000)]
[docs] Add support for Markdown documentation when creating man pages
rL358749 added a documentation page in the Markdown format. Currently,
such pages are ignored in the configuration script for manual pages.
This patch fixes that.
Differential Revision: https://reviews.llvm.org/D60964
llvm-svn: 359860
Leonard Chan [Fri, 3 May 2019 03:28:06 +0000 (03:28 +0000)]
Revert "[Attribute/Diagnostics] Print macro if definition is an attribute declaration"
This reverts commit
fc40cbd9d8c63e65eed3590ba925321afe782e1d.
llvm-svn: 359859
Nico Weber [Fri, 3 May 2019 03:16:07 +0000 (03:16 +0000)]
Revert r359814 "[Sema] Emit warning for visibility attribute on internal-linkage declaration"
See cfe-commits thread for r359814.
llvm-svn: 359858
Quentin Colombet [Fri, 3 May 2019 01:23:56 +0000 (01:23 +0000)]
[IRTranslator] Use the alloc size instead of the store size when translating allocas
We use to incorrectly use the store size instead of the alloc size when
creating the stack slot for allocas.
On aarch64 this can be demonstrated by allocating weirdly sized types.
For instance, in the added test case, we use an alloca for i19. We used
to allocate a slot of size 24-bit (19 rounded up to the next byte),
whereas we really want to use a full 32-bit slot for this type.
llvm-svn: 359856
Eli Friedman [Fri, 3 May 2019 00:59:52 +0000 (00:59 +0000)]
[AArch64][MC] Reject "add x0, x1, w2, lsl #1" etc.
Looks like just a minor oversight in the parsing code.
Fixes https://bugs.llvm.org/show_bug.cgi?id=41504.
Differential Revision: https://reviews.llvm.org/D60840
llvm-svn: 359855
David Blaikie [Fri, 3 May 2019 00:44:50 +0000 (00:44 +0000)]
SemaOverload: Complete candidates before emitting the error, to ensure diagnostics emitted (or suppressed) during completion don't interfere with the overload notes
Because diagnostics and their notes are not connected at the API level,
if the error message for an overload is emitted, then the overload
candidates are completed - if a diagnostic is emitted during that work,
the notes related to overload candidates would be attached to the latter
diagnostic, not the original error. Sort of worse, if the latter
diagnostic was disabled, the notes are disabled.
Reviewers: rsmith
Differential Revision: https://reviews.llvm.org/D61357
llvm-svn: 359854
Fangrui Song [Fri, 3 May 2019 00:35:49 +0000 (00:35 +0000)]
[ELF] Place SHT_NOTE sections with the same alignment into one PT_NOTE
Summary:
While the generic ABI requires notes to be 8-byte aligned in ELF64, many
vendor-specific notes (from Linux, NetBSD, Solaris, etc) use 4-byte
alignment.
In a PT_NOTE segment, if 4-byte aligned notes are followed by an 8-byte
aligned note, the possible 4-byte padding may make consumers fail to
parse the 8-byte aligned note. See PR41000 for a recent report about
.note.gnu.property (NT_GNU_PROPERTY_TYPE_0).
(Note, for NT_GNU_PROPERTY_TYPE_0, the consumers should probably migrate
to PT_GNU_PROPERTY, but the alignment issue affects other notes as well.)
To fix the issue, don't mix notes with different alignments in one
PT_NOTE. If compilers emit 4-byte aligned notes before 8-byte aligned
notes, we'll create at most 2 segments.
sh_size%sh_addralign=0 is actually implied by the rule for linking
unrecognized sections (in generic ABI), so we don't have to check that.
Notes that match in name, type and attribute flags are concatenated into
a single output section. The compilers have to ensure
sh_size%sh_addralign=0 to make concatenated notes parsable.
An alternative approach is to create a PT_NOTE for each SHT_NOTE, but
we'll have to incur the sizeof(Elf64_Phdr)=56 overhead every time a new
note section is introduced.
Reviewers: ruiu, jakehehrlich, phosek, jhenderson, pcc, espindola
Subscribers: emaste, arichardson, krytarowski, fedor.sergeev, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D61296
llvm-svn: 359853
Eric Christopher [Fri, 3 May 2019 00:15:23 +0000 (00:15 +0000)]
Tidy up a comment, fix a typo, remove a comment that's obsolete.
llvm-svn: 359852
Fangrui Song [Fri, 3 May 2019 00:11:53 +0000 (00:11 +0000)]
[crtbegin] Fix an off-by-1 bug in __do_fini
Differential Revision: https://reviews.llvm.org/D61367
llvm-svn: 359850
Eli Friedman [Fri, 3 May 2019 00:10:45 +0000 (00:10 +0000)]
[AArch64][Windows] Compute function length correctly in unwind tables.
The primary fix here is to WinException.cpp: we need to exclude jump
tables when computing the length of a function, or else we fail to
correctly compute the length. (We can only compute the number of bytes
consumed by certain assembler directives after the entire file is
parsed. ".p2align" is one of those directives, and is used by jump table
generation.)
The secondary fix, to MCWin64EH, is to make sure we don't silently
miscompile if we hit a similar situation in the future.
It's possible we could extend ARM64EmitUnwindInfo so it allows function
bodies that contain assembler directives, but that's a lot more
complicated; see the FIXME in MCWin64EH.cpp.
Fixes https://bugs.llvm.org/show_bug.cgi?id=41581 .
Differential Revision: https://reviews.llvm.org/D61095
llvm-svn: 359849
Jonas Devlieghere [Fri, 3 May 2019 00:10:31 +0000 (00:10 +0000)]
[Reproducers] Improve reproducer help
Extend the documentation for the reproducer command.
llvm-svn: 359848
Jason Molenda [Thu, 2 May 2019 23:49:56 +0000 (23:49 +0000)]
RegisterContextLLDB::GetFullUnwindPlanForFrame has four verbose
logging messages that are written the same, making it difficult to
know for certain which code path was taken based on a logfile. Add
some words to make each unique.
Right now the ordering for finding a FullUnwindPlan (ignoring
fallback unwind plan logic) is
1. If this is a _sigtramp like function, try eh_frame which is
hand written on darwin systems to account for finding the
saved register context correctly.
2. Ask the DynamicLoader if eh_frame should be preferred for
this frame. Some binaries on the system may have hand-written
eh_frame and the DynamicLoader is the source for this. (primarily
this is for hand-written assembly in the objc runtime, and we tell
lldb to trust that for functions in libobjc.dylib.)
3. if 0th frame, use GetUnwindPlanAtNonCallSite plan.
4. GetUnwindPlanAtCallSite {for 0th or any other}
5. GetUnwindPlanAtNonCallSite {now for non-0th frames, only if not from a compiler? hm.}
6. GetUnwindPlanArchitectureDefaultAtFunctionEntry if we're on the first instruction
7. Architectural default unwind plan ABI::CreateDefaultUnwindPlan
I'm moving #6 -- DefaultAtFunctionEntry -- up to between #3 and #4,
where we're already doing things specific to the zeroth frame. If
we're on the zeroth frame and the GetUnwindPlanAtNonCallSite plan
has failed for some reason, and we're on the first instruction, we
should definitely use DefaultAtFunctionEntry instead of any other
unwind plan. If we're trying to step out of some rando function
on the system that we couldn't assembly instruction inspect, this
is sufficient for us to step out of it.
llvm-svn: 359847
Adrian Prantl [Thu, 2 May 2019 23:49:55 +0000 (23:49 +0000)]
Fix tests on non-Darwin platforms.
llvm-svn: 359846
Alina Sbirlea [Thu, 2 May 2019 23:41:58 +0000 (23:41 +0000)]
[MemorySSA] Check that block is reachable when adding phis.
Summary:
Originally the insertDef method was only used when building MemorySSA, and was limiting the number of Phi nodes that it created.
Now it's used for updates as well, and it can create additional Phis needed for correctness.
Make sure no Phis are created in unreachable blocks (condition met during MSSA build), otherwise the renamePass will find a null DTNode.
Resolves PR41640.
Reviewers: george.burgess.iv
Subscribers: jlebar, Prazek, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D61410
llvm-svn: 359845
Richard Smith [Thu, 2 May 2019 23:21:28 +0000 (23:21 +0000)]
Fix -Wunsequenced false-positives in code controlled by a branch on
__builtin_constant_p.
If the operand of __builtin_constant_p is not constant and has
side-effects, then code controlled by a branch on it is unreachable and
we should not emit runtime behavior warnings in such code.
llvm-svn: 359844
Jason Molenda [Thu, 2 May 2019 23:14:26 +0000 (23:14 +0000)]
Upstreaming an apple local patch by Frederic Riss.
lldb has an expression that runs in the inferior process to collect
the isa values and hash of the class names for classes in the
system's shared cache. In recent OSes, swift classes are in this
table and the function the jitted expression calls returns demangled
names. We need to compute the hashes based on the mangled names.
So for these names, return a hash value of 0 which indicates that
lldb should read the class name directly out of the runtime tables
and compute the hash itself.
When this patch is absent, the lldb+swift testsuite has many failures
on a recent macOS system; there isn't a direct non-swift way to
test for this being correct.
<rdar://problem/
47935062>
llvm-svn: 359843
Alina Sbirlea [Thu, 2 May 2019 23:12:49 +0000 (23:12 +0000)]
[MemorySSA] Refactor removing multiple trivial phis [NFC].
Summary: Create a method to clean up multiple potentially trivial phis, since we will need this often.
Reviewers: george.burgess.iv
Subscribers: jlebar, Prazek, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D61471
llvm-svn: 359842
Adrian Prantl [Thu, 2 May 2019 23:07:23 +0000 (23:07 +0000)]
Hide runtime support values such as clang's __vla_expr from frame variable
by respecting the "artificial" attribute on variables. Function
arguments that are artificial and useful to end-users are being
whitelisted by the language runtime.
<rdar://problem/
45322477>
Differential Revision: https://reviews.llvm.org/D61451
llvm-svn: 359841
Craig Topper [Thu, 2 May 2019 22:46:23 +0000 (22:46 +0000)]
[X86] Remove LEA16r references from X86FixupLEAs. NFCI
As far as I know, we never emit LEA16r
llvm-svn: 359840
Artem Belevich [Thu, 2 May 2019 22:37:19 +0000 (22:37 +0000)]
[CUDA] Do not pass deprecated option fo fatbinary
CUDA 10.1 tools deprecated some command line options.
fatbinary no longer needs --cuda.
Differential Revision: https://reviews.llvm.org/D61470
llvm-svn: 359838
Craig Topper [Thu, 2 May 2019 22:26:40 +0000 (22:26 +0000)]
[X86] Correct the register class for specific mask register constraints in getRegForInlineAsmConstraint when the VT is a scalar type
The default impementation in the base class for TargetLowering::getRegForInlineAsmConstraint doesn't work for mask registers when the VT is a scalar type integer types since the only legal mask types are vXi1. So we end up just getting whatever the first register class that contains the register. Currently this appears to be VK1, but its really dependent on the order tablegen outputs the register classes.
Some code in the caller ends up looking up the type for this register class and find v1i1 then generates a copyfromreg from the physical k-register with the v1i1 type. Then it generates an any_extend from v1i1 to the scalar VT which isn't legal. This bad any_extend sticks around until isel where it selects a MOVZX32rr8 with a v1i1 input or maybe a i8 input. Not sure but eventually we pick up a copy from VK1 to GR8 in MachineIR which isn't supported. This leads to a failure in physical register copying.
This patch uses the scalar type to find a VK class of the right size. In the attached test case this will be VK16. This causes a bitcast from vk16 to i16 to be generated instead of an any_extend. This will be properly iseled to a VK16 to GR32 copy and a GR32->GR16 extract_subreg.
Fixes PR41678
Differential Revision: https://reviews.llvm.org/D61453
llvm-svn: 359837
Craig Topper [Thu, 2 May 2019 22:26:26 +0000 (22:26 +0000)]
[SelectionDAG] Add asserts to verify the vectorness of input and output types of TRUNCATE/ZERO_EXTEND/ANY_EXTEND/SIGN_EXTEND agree
As a result of the underlying cause of PR41678 we created an ANY_EXTEND node with a scalar result type and v1i1 input type. Ideally we would have asserted for this instead of letting it go through to instruction selection and generate bad machine IR
Differential Revision: https://reviews.llvm.org/D61463
llvm-svn: 359836
Reid Kleckner [Thu, 2 May 2019 22:11:55 +0000 (22:11 +0000)]
Fix check-builtins on Windows after alias changes
llvm-svn: 359835
Evandro Menezes [Thu, 2 May 2019 22:01:39 +0000 (22:01 +0000)]
[AArch64] Update for Exynos
Fix the forwarding of multiplication results for Exynos M4.
llvm-svn: 359834
Craig Topper [Thu, 2 May 2019 21:57:18 +0000 (21:57 +0000)]
[X86] Remove string literal from an if. NFC
This if used to be an assert that got refactored into an if, but left the string literal behind.
Fixes PR41718
llvm-svn: 359833
Saleem Abdulrasool [Thu, 2 May 2019 21:49:29 +0000 (21:49 +0000)]
Initialization: move InstructionEmulation to full initialization
The debug server does not need to use the instruction emulation. This helps
reduce the size of the final lldb-server binary by another ~100K (~1% savings).
llvm-svn: 359832
Jordan Rupprecht [Thu, 2 May 2019 21:48:04 +0000 (21:48 +0000)]
Revert [ThinLTO] Fix X86/strong_non_prevailing.ll after llvm-nm 'r' change
This reverts r359314 (git commit
5015aa854dc043b2ae5d95e04e00d98518207ce5)
llvm-svn: 359831
Jordan Rupprecht [Thu, 2 May 2019 21:42:46 +0000 (21:42 +0000)]
Revert [llvm-nm] Fix handling of symbol types + [llvm-nm] Generalize symbol types
This reverts r359311 and r359312 (git commit
0bf06a8f59b0074a60871865e828d92db8930c59 and
5f184f17800ea2ac27be5e4ab540cb94a46e80c7)
llvm-svn: 359830
Nico Weber [Thu, 2 May 2019 21:21:55 +0000 (21:21 +0000)]
lld-link: Add /force:multipleres extension to make dupe resource diag non-fatal
As a side benefit, lld-link now reports more than one duplicate resource
entry before exiting with an error even if the new flag is not passed.
llvm-svn: 359829
Petr Hosek [Thu, 2 May 2019 21:20:08 +0000 (21:20 +0000)]
[gn] Include the missing BUILD.gn file for libcxxabi includes
This was omitted in r359805.
Differential Revision: https://reviews.llvm.org/D61462
llvm-svn: 359828
Casey Carter [Thu, 2 May 2019 21:19:41 +0000 (21:19 +0000)]
[libc++][test] Remove non-portable assumption that thread's constructor allocates with ::new
Drive-by:
* Fix potential race between check and update of `throw_one` in `operator new`
* Fix latent bug in `operator delete`, which shouldn't decrement `outstanding_new` when passed a null pointer
* Specifically catch the expected `bad_alloc` in `main` instead of `...`
Differential Revision: https://reviews.llvm.org/D50860
llvm-svn: 359827
Leonard Chan [Thu, 2 May 2019 20:38:14 +0000 (20:38 +0000)]
[Attribute/Diagnostics] Print macro if definition is an attribute declaration
If an address_space attribute is defined in a macro, print the macro instead
when diagnosing a warning or error for incompatible pointers with different
address_spaces.
We allow this for all attributes (not just address_space), and for multiple
attributes declared in the same macro.
Differential Revision: https://reviews.llvm.org/D51329
llvm-svn: 359826
Petr Hosek [Thu, 2 May 2019 20:34:54 +0000 (20:34 +0000)]
[gn] Update the clangd test lit site configuration
This reflects changes made in r359763.
llvm-svn: 359825
Jan Korous [Thu, 2 May 2019 20:32:56 +0000 (20:32 +0000)]
[clangd][xpc] Cannonicalize value of CLANGD_BUILD_XPC before caching
llvm-svn: 359824
Amy Huang [Thu, 2 May 2019 20:07:35 +0000 (20:07 +0000)]
Change the metadata for heapallocsite calls when the type is cast.
llvm-svn: 359823
Alexey Bataev [Thu, 2 May 2019 20:05:01 +0000 (20:05 +0000)]
[OPENMP][NVPTX]Improve code by using parallel level counter.
Summary:
Previously for the different purposes we need to get the active/common
parallel level and with full runtime we iterated over all the records to
calculate this level. Instead, we can used the warp-based parallel level
counters used in no-runtime mode.
Reviewers: grokos, gtbercea, kkwli0
Subscribers: guansong, jfb, jdoerfert, caomhin, openmp-commits
Tags: #openmp
Differential Revision: https://reviews.llvm.org/D61395
llvm-svn: 359822
Eric Christopher [Thu, 2 May 2019 19:49:35 +0000 (19:49 +0000)]
Typo Functino->Function.
llvm-svn: 359821
Nico Weber [Thu, 2 May 2019 19:47:05 +0000 (19:47 +0000)]
Another attempt to fix "could not find clang-check" lit warning in analyzer-less builds
r359717 added clang-check as a dep of check-clang unconditionally
because I had missed lit.local.cfg in test/Tooling.
Instead, only add clang-check to the tools if the analyzer is enabled,
since the build target only exists then, and since all tests using
clang-check are skipped when the analyzer is disabled.
Differential Revision: https://reviews.llvm.org/D61418
llvm-svn: 359820
Saleem Abdulrasool [Thu, 2 May 2019 19:37:26 +0000 (19:37 +0000)]
build: add option to disable unwind tables
The unwind tables (`.eh_frame`, `.arm.extab`) add a significant chunk of data to
the final binaries. These should not be needed normally, particularly when
exceptions are disabled. This enables shrinking `lldb-server` by ~18% (3 MiB)
when built with gold.
llvm-svn: 359819
George Rimar [Thu, 2 May 2019 19:28:04 +0000 (19:28 +0000)]
[yaml2obj] - Make interface of `NameToIdxMap` class be human friendly and fix users.
This patch inverses the values returned by `addName` and
`lookup` methods of the class mentioned so that they
now return true on success and false on failure.
Also, it does minor code cleanup.
Differential revision: https://reviews.llvm.org/D61190
llvm-svn: 359818
Saleem Abdulrasool [Thu, 2 May 2019 19:25:18 +0000 (19:25 +0000)]
Initialization: correct macro usage
`_MSC_VER` indiciates that you are building with MSVC, not that you are building
for Windows. Use `_WIN32` (which identifies Win32 and Win64).
llvm-svn: 359817
Saleem Abdulrasool [Thu, 2 May 2019 19:09:58 +0000 (19:09 +0000)]
gdb-remote: fix the build on Windows
Windows does not have a definition for `mode_t`. Include the appropriate
header.
llvm-svn: 359816