Commit Graph

343790 Commits

Author SHA1 Message Date
Philip Reames eca4bfea3d [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.
2020-02-26 13:37:12 -08:00
Alexander Shaposhnikov f79b81fbe2 [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
2020-02-26 12:51:15 -08:00
Lei Zhang 63779fb462 [mlir][spirv] Refactoring to avoid calling the same function twice 2020-02-26 15:36:54 -05:00
Kostya Kortchinsky c753a306fd [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
2020-02-26 12:25:43 -08:00
Paula Toth 52073310e4 [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
2020-02-26 12:24:07 -08:00
Leonard Chan d2cbaf1755 Fix for the test failues introduced in https://reviews.llvm.org/D74704. 2020-02-26 12:23:15 -08:00
Adrian Prantl 22cb36c86b [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
2020-02-26 12:22:50 -08:00
Eric Astor 85b641c27a [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
2020-02-26 15:19:40 -05:00
Sanjay Patel 25c6544f32 [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
2020-02-26 15:15:42 -05:00
Lei Zhang 5bc6ff6455 [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
2020-02-26 15:13:37 -05:00
Tyker ca50f09db9 [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
2020-02-26 21:09:31 +01:00
Nikita Popov 00f54050f7 [SimpleLoopUnswitch] Remove unnecessary include; NFC 2020-02-26 20:40:43 +01:00
Nikita Popov 9d9633fb70 [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:
6d6a4590c5/llvm/lib/Analysis/LazyValueInfo.cpp (L1904-L1927)

Differential Revision: https://reviews.llvm.org/D72169
2020-02-26 20:36:41 +01:00
Julian Lettner 3bf3996cd4 [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
2020-02-26 11:33:24 -08:00
Nikita Popov 7da3b5e45c [InstCombine] Simplify DCE code; NFC
As pointed out on D75008, MadeIRChange is already set by
eraseInstFromFunction(), which also already does a debug print.
2020-02-26 20:33:00 +01:00
Nikita Popov 3e440545dc [CVP] Add test for cmp of local phi; NFC 2020-02-26 20:32:59 +01:00
Ayke van Laethem 6afc3de42f
[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
2020-02-26 20:32:25 +01:00
Ayke van Laethem 165f707f9d
[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
2020-02-26 20:32:24 +01:00
Nikita Popov 56f7de5baa [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
2020-02-26 20:04:11 +01:00
Reid Kleckner 30dae38349 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);
2020-02-26 10:59:45 -08:00
Krzysztof Parzyszek 7691790dfd [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.
2020-02-26 12:46:52 -06:00
Martijn Vels d260ea7199 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
2020-02-26 13:37:45 -05:00
Reid Kleckner 34312ed24e Remove unneeded Compiler.h and DataTypes.h includes, NFC 2020-02-26 10:36:17 -08:00
Fangrui Song 37c7f0d945 [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
2020-02-26 10:32:54 -08:00
Greg Clayton e4af56db27 Fix buildbots after recent GSYM commit.
Added llvm-gsymutil to LLVM_TEST_DEPENDS.
2020-02-26 10:30:04 -08:00
Vedant Kumar 7822c8c03e [lldb/test] Skip running a test under ASan, it intentionally double-frees 2020-02-26 10:11:39 -08:00
Krzysztof Parzyszek fd7c2e24c1 [SDAG] Add SDNode::values() = make_range(values_begin(), values_end())
Also use it in a few places to simplify code a little bit.  NFC
2020-02-26 12:07:38 -06:00
Juneyoung Lee 4f71252cf8 [TTI] Let getOperationCost assume that Freeze is free 2020-02-27 02:56:11 +09:00
Mikhail Maltsev 14aef5367d [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
2020-02-26 17:54:43 +00:00
Hiroshi Yamauchi 59fb9cde7a 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.
2020-02-26 09:51:24 -08:00
Lei Zhang 1e9321e97a [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.
2020-02-26 12:41:14 -05:00
Steven Wu 387c3f74fd [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
2020-02-26 09:29:11 -08:00
Sean Fertile 73c3b52676 [PowerPC][NFC] Convert grep usage to FileCheck in lit test. 2020-02-26 12:28:18 -05:00
John Brawn 590dc8d02c 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
2020-02-26 17:24:30 +00:00
Alex Brachet 805f5836d1 [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
2020-02-26 12:19:09 -05:00
Reid Kleckner 465dca79b3 Avoid SmallString.h include in MD5.h, NFC
Saves 200 includes, which is mostly immaterial.
2020-02-26 09:10:24 -08:00
Fangrui Song 6503aadcc6 [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
2020-02-26 08:57:23 -08:00
Fangrui Song 423194098b [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
2020-02-26 08:56:12 -08:00
Kadir Cetinkaya 2011d14296
[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
2020-02-26 17:51:27 +01:00
Sanjay Patel b3d0c79836 [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.
2020-02-26 11:25:56 -05:00
LLVM GN Syncbot 299c3e13fb [gn build] Port 3c36d8dad5 2020-02-26 16:09:48 +00:00
Pavel Labath 3c36d8dad5 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
2020-02-26 17:07:58 +01:00
Martijn Vels 07eb82fc06 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
2020-02-26 11:03:51 -05:00
Sanjay Patel 894ce940db [AArch64] add tests for fake fneg; NFC
See comments in D73978 for background.
2020-02-26 10:56:26 -05:00
Unnar Freyr Erlendsson 594130db0a 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
2020-02-26 16:47:42 +01:00
Simon Pilgrim bbb0933e3d [DAG] visitRotate - modulo non-uniform constant rotation amounts 2020-02-26 15:43:12 +00:00
Pavel Labath ced45978a2 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
2020-02-26 16:42:25 +01:00
Jonathan Coe e8c5fea243 [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
2020-02-26 15:27:03 +00:00
Haojian Wu 02323a3d5f [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
2020-02-26 16:22:45 +01:00
Nicolai Hähnle d6b05fccb7 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
2020-02-26 16:21:44 +01:00