Stefanos Baziotis [Thu, 27 Feb 2020 02:36:11 +0000 (20:36 -0600)]
[docs][LoopTerminology] Add Loop Simplify Form description.
Information taken from https://youtu.be/3pRhvQi7Z10?t=481 and
comments in LoopSimplify.h.
Reviewed By: Meinersbur
Differential Revision: https://reviews.llvm.org/D74989
Craig Topper [Thu, 27 Feb 2020 02:06:59 +0000 (18:06 -0800)]
[X86] Add test cases showing incorrect setting of nofpexcept flag due to CSE occuring during SelectionDAG creation.
These tests generate two nodes that are identical except for the
metadata that indicates their exception behavior. The nodes get
CSEd by SelectionDAG, but the nofpexcept flag is being set based
only on the fpexcept.ignore node being created last.
We need to detect this case and intersect the flags similar to
what is already done with fast math flags.
Fangrui Song [Thu, 27 Feb 2020 00:24:58 +0000 (16:24 -0800)]
[ELF][test] Rename SHF_LINK_ORDER related "metadata" to "linkorder"
Test cleanups.
Kirill Naumov [Wed, 26 Feb 2020 23:44:42 +0000 (15:44 -0800)]
Cost Annotation Writer for InlineCost
Add extra diagnostics for the inline cost analysis under
-print-instruction-deltas cl option. When enabled along with
-debug-only=inline-cost it prints the IR of inline candidate
annotated with cost and threshold change per every instruction.
Reviewed By: apilipenko, davidxl, mtrofin
Differential Revision: https://reviews.llvm.org/D71501
Craig Topper [Thu, 27 Feb 2020 00:54:38 +0000 (16:54 -0800)]
[X86] Add proper MachinePointerInfo to stack store created in LowerWin64_i128OP.
Louis Dionne [Thu, 27 Feb 2020 00:29:49 +0000 (19:29 -0500)]
[libc++] Workaround unused variable warning in test
This only showed up in C++11/C++14 where the static_assert below was
ifdef'd out, and the variable was indeed unused.
Craig Topper [Thu, 27 Feb 2020 00:16:03 +0000 (16:16 -0800)]
[X86] Explicitly pass Destination VT and debug location to BuildFILD. NFC
We'd already passed most everything else. Might was well pass
these two things and stop passing Op.
Craig Topper [Thu, 27 Feb 2020 00:02:32 +0000 (16:02 -0800)]
[X86] Explicitly pass Pointer, MachinePointerInfo and Alignment to BuildFILD.
Previously this code was called into two ways, either a FrameIndexSDNode
was passed in StackSlot. Or a load node was passed in the argument
called StackSlot. This was determined by a dyn_cast to FrameIndexSDNode.
In the case of a load, we had to go find the real pointer from
operand 0 and cast the node to MemSDNode to find the pointer info.
For the stack slot case, the code assumed that the stack slot
was perfectly aligned despite not being the creator of the slot.
This commit modifies the interface to make the caller responsible
for passing all of the required information to avoid all the
guess work and reverse engineering.
I'm not aware of any issues with the original code after an
earlier commit to fix the alignment of one of the stack objects.
This is just clean up to make the code less surprising.
Louis Dionne [Thu, 27 Feb 2020 00:14:34 +0000 (19:14 -0500)]
Revert "[libc++] Do not set the `availability=XXX` feature when not testing against a system libc++"
This reverts commit
7dd6a862e, which broke more tests than it fixed.
Louis Dionne [Thu, 27 Feb 2020 00:09:07 +0000 (19:09 -0500)]
[libc++] Temporarily disable availability markup for the C++20 Synchronization library
The markup wasn't quite right, and that broke compilation with availability
markup enabled. I'm disabling it until I have time to fix it properly to
get the CI mostly green again.
Richard Smith [Wed, 26 Feb 2020 22:50:04 +0000 (14:50 -0800)]
PR44978: Accept as an extension some cases where destructor name lookup
is ambiguous, but only one of the possible lookup results could possibly
be right.
Clang recently started diagnosing ambiguity in more cases, and this
broke the build of Firefox. GCC, ICC, MSVC, and previous versions of
Clang all accept some forms of ambiguity here (albeit different ones in
each case); this patch mostly accepts anything any of those compilers
accept.
Erik Pilkington [Wed, 26 Feb 2020 22:47:02 +0000 (14:47 -0800)]
Disable memory leak checking in a test to work around a bot failure
This leak is expected, see the discussion on commit 85fb997
Adrian Prantl [Wed, 26 Feb 2020 22:12:30 +0000 (14:12 -0800)]
Visit previously unreachable nodes in the debug info metadata verifier.
This allows for diagnosing malformed LLVM IR debug info metadata such
as the one in the testcase.
<rdar://problem/
59756060>
Differential Revision: https://reviews.llvm.org/D75212
Craig Topper [Wed, 26 Feb 2020 22:11:19 +0000 (14:11 -0800)]
[X86] Query constant pool object alignment instead of hardcoding.
Craig Topper [Wed, 26 Feb 2020 22:10:50 +0000 (14:10 -0800)]
[X86] Use proper alignment for stack temporary and correct MachinePointerInfo for stack accesses in LowerUINT_TO_FP.
Craig Topper [Wed, 26 Feb 2020 21:41:00 +0000 (13:41 -0800)]
[X86] Use correct MachineMemOperand for stack load in LowerFLT_ROUNDS_
Craig Topper [Wed, 26 Feb 2020 19:46:40 +0000 (11:46 -0800)]
[X86] Add proper MachinePointerInfo to the loads/stores created for moving data between SSE and X87 in X86DAGToDAGISel::PreprocessISelDAG
Davide Italiano [Wed, 26 Feb 2020 22:31:06 +0000 (14:31 -0800)]
[ObjectFileMachO] Fix a build error on embedded.
Amara Emerson [Mon, 24 Feb 2020 22:27:32 +0000 (14:27 -0800)]
[AArch64][GlobalISel] Fixup <32b heterogeneous regbanks of G_PHIs just before selection.
Since all types <32b on gpr end up being assigned gpr32 regclasses, we can end
up with PHIs here which try to select between a gpr32 and an fpr16. Ideally RBS
shouldn't be selecting heterogenous regbanks for operands if possible, but we
still need to be able to deal with it here.
To fix this, if we have a gpr-bank operand < 32b in size and at least one other
operand is on the fpr bank, then we add cross-bank copies to homogenize the
operand banks. For simplicity the bank that we choose to settle on is whatever
bank the def operand has. For example:
%endbb:
%dst:gpr(s16) = G_PHI %in1:gpr(s16), %bb1, %in2:fpr(s16), %bb2
=>
%bb2:
...
%in2_copy:gpr(s16) = COPY %in2:fpr(s16)
...
%endbb:
%dst:gpr(s16) = G_PHI %in1:gpr(s16), %bb1, %in2_copy:gpr(s16), %bb2
Differential Revision: https://reviews.llvm.org/D75086
Nathan James [Wed, 26 Feb 2020 22:06:38 +0000 (22:06 +0000)]
[ASTMatchers] HasNameMatcher handles `extern "C"`
Summary: Fixes [[ https://bugs.llvm.org/show_bug.cgi?id=42193 | hasName AST matcher is confused by extern "C" in namespace. ]]
Reviewers: klimek, aaron.ballman, gribozavr2
Reviewed By: aaron.ballman
Subscribers: cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D75202
Alexey Lapshin [Tue, 25 Feb 2020 15:45:42 +0000 (18:45 +0300)]
[DebugInfo][NFC] Remove handler with ErrorPolicy from DWARFContext.
Summary:
Current LLVM code base does not use error handler with ErrorPolicy.
This patch removes ErrorPolicy from DWARFContext.
This patch is extracted from the D74308.
Reviewers: jhenderson, dblaikie, grimar, aprantl, JDevlieghere
Reviewed By: grimar
Subscribers: hiraditya, llvm-commits
Tags: #llvm, #debug-info
Differential Revision: https://reviews.llvm.org/D75118
John McCall [Wed, 26 Feb 2020 21:40:46 +0000 (16:40 -0500)]
Update the ARC docs for non-trivial ownership in structs.
Philip Reames [Wed, 26 Feb 2020 21:29:07 +0000 (13:29 -0800)]
[MC] Pull out a relaxFragment helper [NFC]
Having this as it's own function helps to reduce indentation and allows use of return instead of wiring a value over the switch. A lambda would have also worked, but with slightly deeper nesting.
Alexander Shaposhnikov [Wed, 26 Feb 2020 19:32:44 +0000 (11:32 -0800)]
[llvm-objcopy] Enable --discard-all for MachO
In this diff we enable the option --discard-all for MachO.
Test plan: make check-all
Differential revision: https://reviews.llvm.org/D75104
Lei Zhang [Wed, 26 Feb 2020 20:35:46 +0000 (15:35 -0500)]
[mlir][spirv] Refactoring to avoid calling the same function twice
Kostya Kortchinsky [Tue, 25 Feb 2020 22:23:34 +0000 (14:23 -0800)]
[scudo][standalone] Various improvements wrt RSS
Summary:
This patch includes several changes to reduce the overall footprint
of the allocator:
- for realloc'd chunks: only keep the same chunk when lowering the size
if the delta is within a page worth of bytes;
- when draining a cache: drain the beginning, not the end; we add pointers
at the end, so that meant we were draining the most recently added
pointers;
- change the release code to account for an freed up last page: when
scanning the pages, we were looking for pages fully covered by blocks;
in the event of the last page, if it's only partially covered, we
wouldn't mark it as releasable - even what follows the last chunk is
all 0s. So now mark the rest of the page as releasable, and adapt the
test;
- add a missing `setReleaseToOsIntervalMs` to the cacheless secondary;
- adjust the Android classes based on more captures thanks to pcc@'s
tool.
Reviewers: pcc, cferris, hctim, eugenis
Subscribers: #sanitizers, llvm-commits
Tags: #sanitizers, #llvm
Differential Revision: https://reviews.llvm.org/D75142
Paula Toth [Wed, 26 Feb 2020 20:15:26 +0000 (12:15 -0800)]
[libc] Fix typo of namespace in round implementation.
Summary: Fixed typos in namespace declarations and comments in the files under `src/math/round`.
Reviewers: sivachandra, abrachet
Reviewed By: sivachandra, abrachet
Subscribers: MaskRay, tschuett, libc-commits
Tags: #libc-project
Differential Revision: https://reviews.llvm.org/D75205
Leonard Chan [Wed, 26 Feb 2020 20:23:15 +0000 (12:23 -0800)]
Fix for the test failues introduced in https://reviews.llvm.org/D74704.
Adrian Prantl [Wed, 26 Feb 2020 17:35:00 +0000 (09:35 -0800)]
[dsymutil] Avoid copying swiftinterfaces from the SDK into the dsym bundle
This patch fixes a bug that would cause dsymutil to collect
.swiftinterface files for the Swift stdlib and other SDK
modules. There is no advantage in copying these since they should be
loaded from the ones bundled with LLDB's embedded Swift compiler
instead and copying them will cause LLDB to recompile them from source
instead of loading their prebuilt cached counterparts in the SDK.
rdar://problem/
57463247
Differential Revisions: https://reviews.llvm.org/D75196
Eric Astor [Wed, 26 Feb 2020 20:12:52 +0000 (15:12 -0500)]
[ms] Rename ParsingInlineAsm functions/variables to reflect MS-specificity.
Summary: ParsingInlineAsm was a misleading name. These values are only set for MS-style inline assembly.
Reviewed By: rnk
Tags: #clang, #llvm
Differential Revision: https://reviews.llvm.org/D75198
Sanjay Patel [Wed, 26 Feb 2020 20:14:35 +0000 (15:14 -0500)]
[VectorCombine] add a debug flag to skip all transforms
As suggested in D75145 -
I'm not sure why, but several passes have this kind of disable/enable flag
implemented at the pass manager level. But that means we have to duplicate
the flag for both pass managers and add code to check the flag every time
the pass appears in the pipeline.
We want a debug option to see if this pass is misbehaving regardless of the
pass managers, so just add a disablement check at the single point before
any transforms run.
Differential Revision: https://reviews.llvm.org/D75204
Lei Zhang [Wed, 26 Feb 2020 17:47:02 +0000 (12:47 -0500)]
[mlir][spirv] Add some folders for spv.LogicalAnd/spv.LogicalOr
This commit handles folding spv.LogicalAnd/spv.LogicalOr when
one of the operands is constant true/false.
Differential Revision: https://reviews.llvm.org/D75195
Tyker [Wed, 26 Feb 2020 17:59:09 +0000 (18:59 +0100)]
[clang] fix error detection in consteval calls
Summary:
code like:
```
consteval int f() {
int *A = new int(0);
return *A;
}
int i1 = f();
```
currently doesn't generate any error.
Reviewers: rsmith
Reviewed By: rsmith
Differential Revision: https://reviews.llvm.org/D74418
Nikita Popov [Wed, 26 Feb 2020 19:40:43 +0000 (20:40 +0100)]
[SimpleLoopUnswitch] Remove unnecessary include; NFC
Nikita Popov [Fri, 3 Jan 2020 17:40:18 +0000 (18:40 +0100)]
[CVP] Simplify cmp of local phi node
CVP currently does not simplify cmps with instructions in the same
block, because LVI getPredicateAt() currently does not provide
much useful information for that case (D69686 would change that,
but is stuck.) However, if the instruction is a Phi node, then
LVI can compute the result of the predicate by threading it into
the predecessor blocks, which allows it simplify some conditions
that nothing else can handle. Relevant code:
https://github.com/llvm/llvm-project/blob/
6d6a4590c5d4c7fc7445d72fe685f966b0a8cafb/llvm/lib/Analysis/LazyValueInfo.cpp#L1904-L1927
Differential Revision: https://reviews.llvm.org/D72169
Julian Lettner [Wed, 26 Feb 2020 18:33:18 +0000 (10:33 -0800)]
[TSan] Add CMake check for minimal SDK requirements on Darwin
Fails with the following message in the error case:
```
CMake Error at /path/to/llvm-project/compiler-rt/lib/tsan/CMakeLists.txt:119 (message):
Building the TSan runtime requires at least macOS SDK 10.12
```
Fixes #44682.
https://bugs.llvm.org/show_bug.cgi?id=44682
Reviewed By: dmajor, delcypher
Differential Revision: https://reviews.llvm.org/D74501
Nikita Popov [Wed, 26 Feb 2020 19:10:09 +0000 (20:10 +0100)]
[InstCombine] Simplify DCE code; NFC
As pointed out on D75008, MadeIRChange is already set by
eraseInstFromFunction(), which also already does a debug print.
Nikita Popov [Fri, 3 Jan 2020 17:39:20 +0000 (18:39 +0100)]
[CVP] Add test for cmp of local phi; NFC
Ayke van Laethem [Tue, 25 Feb 2020 16:15:34 +0000 (17:15 +0100)]
[AVR] Fix private label prefix
This is a small pet peeve from me. This change makes sure the AVR backend uses
the correct private label prefix (.L) so that private labels are hidden in
avr-objdump.
Example code:
define i8 @foo(i1 %cond) {
br i1 %cond, label %then, label %else
then:
ret i8 3
else:
ret i8 5
}
When compiling this:
llc -march=avr -filetype=obj -o test.o test.ll
and then dumping it:
avr-objdump -d test.o
You would previously get an ugly temporary label:
00000000 <foo>:
0: 81 70 andi r24, 0x01 ; 1
2: 80 30 cpi r24, 0x00 ; 0
4: f9 f3 breq .-2 ; 0x4 <foo+0x4>
6: 83 e0 ldi r24, 0x03 ; 3
8: 08 95 ret
0000000a <LBB0_2>:
a: 85 e0 ldi r24, 0x05 ; 5
c: 08 95 ret
This patch fixes that, the output is now:
00000000 <foo>:
0: 81 70 andi r24, 0x01 ; 1
2: 80 30 cpi r24, 0x00 ; 0
4: 01 f0 breq .+0 ; 0x6 <foo+0x6>
6: 83 e0 ldi r24, 0x03 ; 3
8: 08 95 ret
a: 85 e0 ldi r24, 0x05 ; 5
c: 08 95 ret
Note that as you can see the breq operand is different. However it is
still the same after linking:
4: 11 f0 breq .+4
Differential Revision: https://reviews.llvm.org/D75124
Ayke van Laethem [Fri, 7 Feb 2020 12:06:40 +0000 (13:06 +0100)]
[AVR] Don't adjust addresses by 2 for absolute values
Adjusting by 2 breaks DWARF output. With this fix, programs start to
compile and produce valid DWARF output.
Differential Revision: https://reviews.llvm.org/D74213
Nikita Popov [Sat, 22 Feb 2020 17:37:10 +0000 (18:37 +0100)]
[InstCombine] Remove trivially empty ranges from end
InstCombine removes pairs of start+end intrinsics that don't
have anything in between them. Currently this is done by starting
at the start intrinsic and scanning forwards. This patch changes
it to start at the end intrinsic and scan backwards.
The motivation here is as follows: When we process the start
intrinsic, we have not yet looked at the following instructions,
which may still get folded/removed. If they do, we will only be
able to remove the start/end pair on the next iteration. When we
process the end intrinsic, all the instructions before it have
already been visited, and we don't run into this problem.
Differential Revision: https://reviews.llvm.org/D75011
Reid Kleckner [Wed, 26 Feb 2020 18:41:59 +0000 (10:41 -0800)]
Fix LLP64 detection in SwapByteOrder.h
MSVC does not define __LONG_MAX__, so we were just getting lucky in this
conditional:
#if __LONG_MAX__ == __INT_MAX__
Undefined identifiers evaluate to zero in preprocessor conditionals, so
this became true, which happens to work for MSVC platforms.
Instead, use this pattern and let the compiler constant fold:
return sizeof(long) == sizeof(int) ? SwapByteOrder_32((uint32_t)C)
: SwapByteOrder_64((uint64_t)C);
Krzysztof Parzyszek [Wed, 26 Feb 2020 15:56:12 +0000 (09:56 -0600)]
[Hexagon] Improve casting of boolean HVX vectors to scalars
- Mark memory access for bool vectors as disallowed in target lowering.
This will prevent combining bitcasts of bool vectors with stores.
- Replace the actual bitcasting code with a faster version.
- Handle casting of v16i1 to i16.
Martijn Vels [Wed, 26 Feb 2020 18:25:43 +0000 (13:25 -0500)]
Inline basic_string::erase for fastpath where __n == npos
Summary:
This change checks for the case where people want to erase a string to the end, i.e., __n == npos, and inlines the call if so.
This also demonstrates keeping the ABI intact for V1, but inlining the erase() method for unstable.
Reviewers: EricWF, mclow.lists, ldionne
Reviewed By: EricWF, ldionne
Subscribers: smeenai, dexonsmith, christof, libcxx-commits
Tags: #libc
Differential Revision: https://reviews.llvm.org/D73743
Reid Kleckner [Wed, 26 Feb 2020 18:34:12 +0000 (10:34 -0800)]
Remove unneeded Compiler.h and DataTypes.h includes, NFC
Fangrui Song [Wed, 26 Feb 2020 00:39:31 +0000 (16:39 -0800)]
[ELF] --orphan-handling=: don't warn/error for input SHT_REL[A] retained by --emit-relocs
They are purposefully skipped by input section descriptions (rL295324).
Similarly, --orphan-handling= should not warn/error for them.
This behavior matches GNU ld.
Reviewed By: grimar
Differential Revision: https://reviews.llvm.org/D75151
Greg Clayton [Wed, 26 Feb 2020 18:30:04 +0000 (10:30 -0800)]
Fix buildbots after recent GSYM commit.
Added llvm-gsymutil to LLVM_TEST_DEPENDS.
Vedant Kumar [Wed, 26 Feb 2020 18:11:39 +0000 (10:11 -0800)]
[lldb/test] Skip running a test under ASan, it intentionally double-frees
Krzysztof Parzyszek [Wed, 26 Feb 2020 16:54:18 +0000 (10:54 -0600)]
[SDAG] Add SDNode::values() = make_range(values_begin(), values_end())
Also use it in a few places to simplify code a little bit. NFC
Juneyoung Lee [Wed, 26 Feb 2020 17:56:01 +0000 (02:56 +0900)]
[TTI] Let getOperationCost assume that Freeze is free
Mikhail Maltsev [Wed, 26 Feb 2020 17:54:43 +0000 (17:54 +0000)]
[libcxx] Fix _LIBCPP_HAS_THREAD_API_EXTERNAL build
Summary:
The definition of `__libcpp_timed_backoff_policy` and the declaration of
`__libcpp_thread_poll_with_backoff` must not be guarded by
#if !defined(_LIBCPP_HAS_THREAD_API_EXTERNAL)
because the definitions of `__libcpp_timed_backoff_policy::operator()`
and `__libcpp_thread_poll_with_backoff` aren't guarded by this macro
(and this is correct because these two functions are implemented in
terms of other libc++ functions and don't interact with the host
threading library).
Reviewers: ldionne, __simt__, EricWF, mclow.lists
Reviewed By: ldionne
Subscribers: dexonsmith, libcxx-commits
Tags: #libc
Differential Revision: https://reviews.llvm.org/D75191
Hiroshi Yamauchi [Sat, 1 Feb 2020 00:13:44 +0000 (16:13 -0800)]
Devirtualize a call on alloca without waiting for post inline cleanup and next
DevirtSCCRepeatedPass iteration. Needs ReviewPublic
This aims to fix a missed inlining case.
If there's a virtual call in the callee on an alloca (stack allocated object) in
the caller, and the callee is inlined into the caller, the post-inline cleanup
would devirtualize the virtual call, but if the next iteration of
DevirtSCCRepeatedPass doesn't happen (under the new pass manager), which is
based on a heuristic to determine whether to reiterate, we may miss inlining the
devirtualized call.
This enables inlining in clang/test/CodeGenCXX/member-function-pointer-calls.cpp.
Lei Zhang [Wed, 26 Feb 2020 14:12:56 +0000 (09:12 -0500)]
[mlir][spirv] NFC: move folders and canonicalizers in a separate file
This gives us better file organization and faster compilation time
by avoid having a gigantic SPIRVOps.cpp file.
Steven Wu [Wed, 26 Feb 2020 17:17:03 +0000 (09:17 -0800)]
[compiler-rt] Build all alias in builtin as private external on Darwin
Summary:
For builtin compiler-rt, it is built with visibility hidden by default
to avoid the client exporting symbols from libclang static library. The
compiler option -fvisibility=hidden doesn't work on the aliases in c files
because they are created with inline assembly. On Darwin platform,
thoses aliases are exported by default if they are reference by the client.
Fix the issue by adding ".private_extern" to all the aliases if the
library is built with visibility hidden.
rdar://problem/
58960296
Reviewers: dexonsmith, arphaman, delcypher, kledzik
Reviewed By: delcypher
Subscribers: dberris, jkorous, ributzka, #sanitizers, llvm-commits
Tags: #sanitizers, #llvm
Differential Revision: https://reviews.llvm.org/D73577
Sean Fertile [Wed, 26 Feb 2020 14:52:43 +0000 (09:52 -0500)]
[PowerPC][NFC] Convert grep usage to FileCheck in lit test.
John Brawn [Wed, 26 Feb 2020 16:31:24 +0000 (16:31 +0000)]
Use virtual functions in ParsedAttrInfo instead of function pointers
This doesn't do anything on its own, but it's the first step towards
allowing plugins to define attributes. It does simplify the
ParsedAttrInfo generation in ClangAttrEmitter a little though.
Differential Revision: https://reviews.llvm.org/D31337
Alex Brachet [Wed, 26 Feb 2020 17:19:09 +0000 (12:19 -0500)]
[libc] Fix build when -DBUILD_SHARED_LIBS=On
Reviewers: gchatelet, sivachandra
Reviewed By: gchatelet, sivachandra
Subscribers: libc-commits, mgorny, MaskRay, tschuett
Differential Revision: https://reviews.llvm.org/D75136
Reid Kleckner [Wed, 26 Feb 2020 16:49:53 +0000 (08:49 -0800)]
Avoid SmallString.h include in MD5.h, NFC
Saves 200 includes, which is mostly immaterial.
Fangrui Song [Wed, 19 Feb 2020 23:27:59 +0000 (15:27 -0800)]
[llvm-objcopy][test] Improve empty section tests
empty-sections.test: add two tests adapted from @jhenderson's https://reviews.llvm.org/D74755#1882221
strip-non-alloc.test: improve. D74755 will change the attribution of an empty section.
They mostly test the behavior of Object.cpp:sectionWithinSegment : how we attribute sections to segments.
`ParentSegment` can affect some subtle layout decisions.
Reviewed By: jhenderson
Differential Revision: https://reviews.llvm.org/D74879
Fangrui Song [Tue, 25 Feb 2020 23:02:04 +0000 (15:02 -0800)]
[ELF] --orphan-handling=: don't warn/error for unused synthesized sections
This makes --orphan-handling= less noisy.
This change also improves our compatibility with GNU ld.
GNU ld special cases .symtab, .strtab and .shstrtab . We need output section
descriptions for .symtab, .strtab and .shstrtab to suppress:
<internal>:(.symtab) is being placed in '.symtab'
<internal>:(.shstrtab) is being placed in '.shstrtab'
<internal>:(.strtab) is being placed in '.strtab'
With --strip-all, .symtab and .strtab can be omitted (note, --strip-all is not compatible with --emit-relocs).
Reviewed By: nickdesaulniers
Differential Revision: https://reviews.llvm.org/D75149
Kadir Cetinkaya [Wed, 26 Feb 2020 12:39:46 +0000 (13:39 +0100)]
[clangd] Clean-up XRefs.cpp from Lexer usages and unnecessary SourceLoc transformations
Summary:
Get rid of calls to lexer and unnecessary source location
transformations.
Reviewers: sammccall
Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, usaxena95, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D75166
Sanjay Patel [Wed, 26 Feb 2020 16:16:50 +0000 (11:16 -0500)]
[DAGCombiner] avoid narrowing fake fneg vector op
This may inhibit vector narrowing in general, but there's
already an inconsistency in the way that we deal with this
pattern as shown by the test diff.
We may want to add a dedicated function for narrowing fneg.
It's often folded into some other op, so moving it away from
other math ops may cause regressions that we would not see
for normal binops.
See D73978 for more details.
LLVM GN Syncbot [Wed, 26 Feb 2020 16:09:48 +0000 (16:09 +0000)]
[gn build] Port
3c36d8dad57
Pavel Labath [Thu, 13 Feb 2020 15:47:31 +0000 (16:47 +0100)]
Introduce DWARFDataExtractor::getInitialLength
Summary:
This patch introduces a function to house the code needed to do the
DWARF64 detection dance. The function decodes the initial length field
and returns it as a pair containing the actual length, and the DWARF
encoding.
This patch does _not_ attempt to handle the problem of detecting lengths
which extend past the size of the section, or cases when reads of a
single contribution accidentally escape beyond its specified length, but
I think it's useful in its own right.
Reviewers: dblaikie, jhenderson, ikudrin
Subscribers: hiraditya, probinson, aprantl, JDevlieghere, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D74560
Martijn Vels [Thu, 30 Jan 2020 19:12:44 +0000 (14:12 -0500)]
Add _LIBCPP_BUILTIN_CONSTANT_P support.
Summary:
This change adds the macros _LIBCPP_COMPILER_HAS_BUILTIN_CONSTANT and _LIBCPP_BUILTIN_CONSTANT_P to detect compile time constants, and optimze the code accordingly.
A planned usage example:
The implementation of basic_string::assign() can short-cut a compile time known short string assignent into a fast and compact inlined assignment:
```
basic_string::assign(const value_type* __s) {
if (_LIBCPP_BUILTIN_CONSTANT_P(__s[0]) && length(__s) < __min_cap) {
copy(pointer(), _s, length(__s) + 1);
set_size(length(__s));
} else {
// delegate / tail call out of line implementation
}
}
```
Subscribers: christof, libcxx-commits
Tags: #libc
Differential Revision: https://reviews.llvm.org/D73732
Sanjay Patel [Wed, 26 Feb 2020 15:55:15 +0000 (10:55 -0500)]
[AArch64] add tests for fake fneg; NFC
See comments in D73978 for background.
Unnar Freyr Erlendsson [Wed, 26 Feb 2020 15:43:43 +0000 (16:43 +0100)]
Add unit tests for RangeDataVector::FindEntryIndexesThatContain
Summary: This adds unit tests for FindEntryIndexesThatContain, this is done in preparation for changing the logic of the function.
Reviewers: labath, teemperor
Reviewed By: labath
Subscribers: arphaman, JDevlieghere, lldb-commits
Tags: #lldb
Differential Revision: https://reviews.llvm.org/D75180
Simon Pilgrim [Wed, 26 Feb 2020 15:39:52 +0000 (15:39 +0000)]
[DAG] visitRotate - modulo non-uniform constant rotation amounts
Pavel Labath [Mon, 24 Feb 2020 12:32:31 +0000 (13:32 +0100)]
Recommit "[DWARFDebugLine] Avoid dumping prologue members we did not parse"
The patch was reverted in
69da40033 because of test failures on windows.
The problem was the unpredictable order of some of the error messages,
which I've tried to strenghten in that patch.
It turns out this is not possible to do in verbose mode because there
the data is being writted as it is being parsed. No amount of flushing
(as I've done in the non-verbose mode) will help that. Indeed, even
without any buffering the warning messages can end in the middle of a
line in non-verbose mode.
In this patch, I have reverted the changes which tested the relative
position of the warning message, except for the messages about
unsupported initial length, which are the ones I really wanted to test,
and which do come out reasonably.
The original commit message was:
This patch if motivated by D74560, specifically the subthread about what
to print upon encountering reserved initial length values.
If the debug_line prologue has an unsupported version, we skip parsing
the rest of the data. If we encounter an reserved initial length field,
we don't even parse the version. However, we still print out all members
(with value 0) in the dump function.
This patch introduces early exits in the Prologue::dump function so that
we print only the fields that were parsed successfully. In case of an
unsupported version, we skip printing all subsequent prologue fields --
because we don't even know if this version has those fields. In case of a
reserved unit length, we don't print anything -- if the very first field
of the prologue is invalid, it's hard to say if we even have a prologue
to begin with.
Note that the user will still be able to see the invalid/reserved
initial length value in the error message. I've modified (reordered)
debug_line_invalid.test to show that the error message comes straight
after the debug_line offset. I've also added some flush() calls to the
dumping code to ensure this is the case in all situations (without that,
the warnings could get out of sync if the output was not a terminal -- I
guess this is why std::iostreams have the tie() function).
Reviewers: jhenderson, ikudrin, dblaikie
Subscribers: hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D75043
Jonathan Coe [Wed, 26 Feb 2020 15:13:09 +0000 (15:13 +0000)]
[clang-format] Special handling of spaces for C# code
Summary:
Ensure that there are spaces around braces '{', '}'.
Ensure that there is a space before and after '=>'.
Ensure that 'async' and 'when' are considered as keywords when inserting spaces.
Reviewers: krasimir, MyDeveloperDay
Reviewed By: krasimir
Tags: #clang-format
Differential Revision: https://reviews.llvm.org/D75129
Haojian Wu [Wed, 26 Feb 2020 14:22:56 +0000 (15:22 +0100)]
[clangd] use printQualifiedName to skip the inlinenamespace qualifiers.
Summary:
symbols in libcpp are inside the inline namespace, printQualifierAsString will
print the inline namespace, which is unexpected.
Reviewers: kadircet
Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, usaxena95, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D75174
Nicolai Hähnle [Wed, 26 Feb 2020 15:21:25 +0000 (16:21 +0100)]
Full fix for "AMDGPU/SIInsertSkips: Fix the determination of whether early-exit-after-kill is possible" (hopefully)
Properly preserve the MachineDominatorTree in all cases.
Change-Id: I54cf0c0a20934168a356920ba8ed5097a93c4131
Simon Tatham [Wed, 26 Feb 2020 14:10:43 +0000 (14:10 +0000)]
[ARM,MVE] Add predicated intrinsics for many unary functions.
Summary:
This commit adds the predicated MVE intrinsics for the same set of
unary operations that I added in their unpredicated forms in
* D74333 (vrint)
* D74334 (vrev)
* D74335 (vclz, vcls)
* D74336 (vmovl)
* D74337 (vmovn)
but since the predicated versions are a lot more similar to each
other, I've kept them all together in a single big patch. Everything
here is done in the standard way we've been doing other predicated
operations: an IR intrinsic called `@llvm.arm.mve.foo.predicated` and
some isel rules that match that alongside whatever they accept for the
unpredicated version of the same instruction.
In order to write the isel rules conveniently, I've refactored the
existing isel rules for the affected instructions into multiclasses
parametrised by a vector-type class, in the usual way. All those
refactorings are intended to leave the existing isel rules unchanged:
the only difference should be that new ones for the predicated
intrinsics are introduced.
The only tiny infrastructure change I needed in this commit was to
change the implementation of `IntrinsicMX` in `arm_mve_defs.td` so
that the records it defines are anonymous rather than named (and use
`NameOverride` to set the output intrinsic name), which allows me to
call it twice in two multiclasses with the same `NAME` without a
tablegen-time error.
Reviewers: dmgreen, MarkMurrayARM, miyuki, ostannard
Reviewed By: MarkMurrayARM
Subscribers: kristof.beyls, hiraditya, cfe-commits, llvm-commits
Tags: #clang, #llvm
Differential Revision: https://reviews.llvm.org/D75165
Xiangling Liao [Wed, 26 Feb 2020 14:42:04 +0000 (09:42 -0500)]
[AIX] Remove whitelist checking for ExternalSymbolSDNodes
Allow all ExternalSymbolSDNode on AIX, and rely on the linker error to find
symbols which we don't have definitions from any library/compiler-rt.
Differential Revision: https://reviews.llvm.org/D75075
Hans Wennborg [Tue, 25 Feb 2020 15:58:36 +0000 (16:58 +0100)]
Put microsoft template parameter shadow warning behind separate flag (PR44794)
Differential revision: https://reviews.llvm.org/D75121
Nicolai Hähnle [Wed, 26 Feb 2020 15:01:57 +0000 (16:01 +0100)]
Quick fix for bot failure on "AMDGPU/SIInsertSkips: Fix the determination of whether early-exit-after-kill is possible"
Apparently the dominator tree update is incorrect, will investigate.
Change-Id: Ie76f8d11b22a552af1f098c893773f3d85e02d4f
Yitzhak Mandelbaum [Wed, 26 Feb 2020 13:14:19 +0000 (08:14 -0500)]
[libTooling] Add function to determine associated text of a declaration.
Summary:
Second attempt -- the first was reverted in commit
0e480b39c66143ad142f9a30d8d40e49d7d7b0ce, because of test breakages. This revision fixes the cause of the test breakages.
Original description follows:
This patch adds `getAssociatedRange` which, for a given decl, computes preceding
and trailing text that would conceptually be associated with the decl by the
reader. This includes comments, whitespace, and separators like ';'.
Reviewers: gribozavr
Subscribers: cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D72153
Jay Foad [Wed, 26 Feb 2020 09:46:07 +0000 (09:46 +0000)]
AMDGPU: Fix some more incorrect check lines
Nicolai Hähnle [Fri, 21 Feb 2020 12:36:01 +0000 (13:36 +0100)]
AMDGPU/SIInsertSkips: Fix the determination of whether early-exit-after-kill is possible
Summary:
The old code made some incorrect assumptions about the order in which
basic blocks are laid out in a function. This could lead to incorrect
early-exits, especially when kills occurred inside of loops.
The new approach is to check whether the point where the conditional
kill occurs dominates all reachable code. If that is the case, there
cannot be any other threads in the wave that are waiting to rejoin
at a later point in the CFG, i.e. if exec=0 at that point, then all
threads really are dead and we can exit the wave.
Make some other minor cleanups to the pass while we're at it.
v2: preserve the dominator tree
Reviewers: arsenm, cdevadas, foad, critson
Subscribers: kzhuravl, jvesely, wdng, yaxunl, dstuttard, tpr, t-tye, hiraditya, kerbowa, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D74908
Change-Id: Ia0d2b113ac944ad642d1c622b6da1b20aa1aabcc
Nicolas Vasilache [Wed, 26 Feb 2020 14:21:47 +0000 (09:21 -0500)]
[mlir][Linalg] NFC - Refactor LinalgStructuredOps towards "named" Linalg ops
This revision performs some basic refactoring towards more easily defining Linalg "named" ops. Such named ops form the backbone of operations that are ubiquitous in the ML application domain.
Sven van Haastregt [Wed, 26 Feb 2020 14:08:23 +0000 (14:08 +0000)]
[OpenCL] Add atomic type builtins
Add atomic types and builtins operating on those atomic types to
`-fdeclare-opencl-builtins`. The _explicit variants are left out of
this commit, as these take enum arguments that are not yet supported
by the `-fdeclare-opencl-builtins` machinery.
Nico Weber [Wed, 26 Feb 2020 13:38:18 +0000 (08:38 -0500)]
[gn build] re-"gn format" all gn files
evgeny [Wed, 26 Feb 2020 13:34:11 +0000 (16:34 +0300)]
[Assembler] Allow assembling empty index with non-zero flags
Differential revision: https://reviews.llvm.org/D74778
Nico Weber [Wed, 26 Feb 2020 13:24:02 +0000 (08:24 -0500)]
[gn build] (manually) port
2f6cc21f44e
Kirill Bobyrev [Wed, 26 Feb 2020 13:07:13 +0000 (14:07 +0100)]
[OpenMP] Fix the test by generating output file in temporary directory
Related Revison: D74925
Commit:
396b7253944e927878dff2f6321efabb3aaa0f45
Kadir Cetinkaya [Fri, 21 Feb 2020 14:15:36 +0000 (15:15 +0100)]
[clang][Tooling] Add a way to tokenize a FileRange
Reviewers: sammccall
Subscribers: cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D74962
Haojian Wu [Wed, 26 Feb 2020 12:43:11 +0000 (13:43 +0100)]
[clangd] Bump index version number.
Summary:
Though we don't have new changes to the index format, we have changes to
symbol collector, e.g. collect marcos, spelled references. Bump the
version to force background-index to rebuild.
Reviewers: kadircet
Reviewed By: kadircet
Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, usaxena95, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D74127
Nico Weber [Wed, 26 Feb 2020 12:33:32 +0000 (07:33 -0500)]
[gn build] (manually) merge
e058667a2e01
Hans Wennborg [Wed, 26 Feb 2020 12:23:56 +0000 (13:23 +0100)]
Revert "[compiler-rt] Add a critical section when flushing gcov counters"
See discussion on PR44792.
This reverts commit
02ce9d8ef5a84bc884de4105eae5f8736ef67634.
It also reverts the follow-up commits
8f46269f0 "[profile] Don't dump counters when forking and don't reset when calling exec** functions"
62c7d8402 "[profile] gcov_mutex must be static"
Dmitry Vyukov [Wed, 19 Feb 2020 13:18:53 +0000 (14:18 +0100)]
tsan: fix pthread_detach with called_from_lib suppressions
Generally we ignore interceptors coming from called_from_lib-suppressed libraries.
However, we must not ignore critical interceptors like e.g. pthread_create,
otherwise runtime will lost track of threads.
pthread_detach is one of these interceptors we should not ignore as it affects
thread states and behavior of pthread_join which we don't ignore as well.
Currently we can produce very obscure false positives. For more context see:
https://groups.google.com/forum/#!topic/thread-sanitizer/ecH2P0QUqPs
The added test captures this pattern.
While we are here rename ThreadTid to ThreadConsumeTid to make it clear that
it's not just a "getter", it resets user_id to 0. This lead to confusion recently.
Reviewed in https://reviews.llvm.org/D74828
Kerry McLaughlin [Wed, 26 Feb 2020 09:49:50 +0000 (09:49 +0000)]
[AArch64][SVE] Add SVE2 intrinsics for bit permutation & table lookup
Summary:
Implements the following intrinsics:
- @llvm.aarch64.sve.bdep.x
- @llvm.aarch64.sve.bext.x
- @llvm.aarch64.sve.bgrp.x
- @llvm.aarch64.sve.tbl2
- @llvm.aarch64.sve.tbx
The SelectTableSVE2 function in this patch is used to select the TBL2
intrinsic & ensures that the vector registers allocated are consecutive.
Reviewers: sdesmalen, andwar, dancgr, cameron.mcinally, efriedma, rengolin
Reviewed By: efriedma
Subscribers: tschuett, kristof.beyls, hiraditya, rkruppe, psnobl, cfe-commits, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D74912
Sam Parker [Wed, 26 Feb 2020 11:14:54 +0000 (11:14 +0000)]
[ARM][RDA] add getUniqueReachingMIDef
Add getUniqueReachingMIDef to RDA which performs a global search for
a machine instruction that produces a unique definition of a given
register at a given point. Also add two helper functions
(getMIOperand) that wrap around this functionality to get the
incoming definition uses of a given instruction. These now replace
the uses of getReachingMIDef in ARMLowOverheadLoops. getReachingMIDef
has been renamed to getReachingLocalMIDef and has been made private
along with getInstFromId.
Differential Revision: https://reviews.llvm.org/D74605
Florian Hahn [Wed, 26 Feb 2020 11:05:59 +0000 (11:05 +0000)]
[AArch64] Flip default for register renaming in the ld/st optimizier.
Turn on register renaming again after disabling it for the 10.0 release,
to help flushing out any issues.
James Henderson [Wed, 26 Feb 2020 10:36:08 +0000 (10:36 +0000)]
[docs][llvm-objcopy][llvm-strip] Move --wildcard description earlier
This moves it above the response file description, which should be at
the end.
James Henderson [Wed, 26 Feb 2020 10:29:47 +0000 (10:29 +0000)]
[docs][llvm-symbolizer] Fix indentation of inline option examples
The examples for different options were inconsistently indented in
the HTML display. As they are tied to the options, this change
normalises to indent them the same as the option description body.
James Henderson [Wed, 26 Feb 2020 10:24:50 +0000 (10:24 +0000)]
[docs][llvm-symbolizer] Fix --functions description
"--functions none" and "--functions=none" are not the same. One is the
option "--functions" with its default value of "linkage", followed by an
input address of "none", and the other is "--functions" with the value
"none". This patch fixes the doc to match the actual behaviour by adding
an extra '=' sign in the allowed values description.
Jay Foad [Wed, 26 Feb 2020 09:41:41 +0000 (09:41 +0000)]
AMDGPU: Fix some incorrect FUNC-LABEL checks
serge-sans-paille [Wed, 26 Feb 2020 09:37:04 +0000 (10:37 +0100)]
Fix typo in clang lit config
Typo introduced in
e058667a2e017d3225a9bb067dbac7f2159576f7
serge-sans-paille [Mon, 17 Feb 2020 12:42:00 +0000 (13:42 +0100)]
Support -fuse-ld=lld for riscv
Add a configure feature test to filter out tests that explicitly depend on platform linker.
Differential Revision: https://reviews.llvm.org/D74704
Pavel Labath [Thu, 13 Feb 2020 13:30:04 +0000 (14:30 +0100)]
[lldb/gdb-remote] Add support for the qOffsets packet
Summary:
This packet is necessary to make lldb work with the remote-gdb stub in
user mode qemu when running position-independent binaries. It reports
the relative position (load bias) of the loaded executable wrt. the
addresses in the file itself.
Lldb needs to know this information in order to correctly set the load
address of the executable. Normally, lldb would be able to find this out
on its own by following the breadcrumbs in the process auxiliary vector,
but we can't do this here because qemu does not support the
qXfer:auxv:read packet.
This patch does not implement full scope of the qOffsets packet (it only
supports packets with identical code, data and bss offsets), because it
is not fully clear how should the different offsets be handled and I am
not aware of a producer which would make use of this feature (qemu will
always
<https://github.com/qemu/qemu/blob/master/linux-user/elfload.c#L2436>
return the same value for code and data offsets). In fact, even gdb
ignores the offset for the bss sections, and uses the "data" offset
instead. So, until the we need more of this packet, I think it's best
to stick to the simplest solution possible. This patch simply rejects
replies with non-uniform offsets.
Reviewers: clayborg, jasonmolenda
Subscribers: lldb-commits
Tags: #lldb
Differential Revision: https://reviews.llvm.org/D74598