platform/upstream/llvm.git
4 years ago[Coverage] Assert that filenames in a TU are unique, NFC
Vedant Kumar [Mon, 16 Sep 2019 19:08:41 +0000 (19:08 +0000)]
[Coverage] Assert that filenames in a TU are unique, NFC

llvm-svn: 372024

4 years ago[lld] Update lld driver to use new LTO APIs to handle libcall symbols
Steven Wu [Mon, 16 Sep 2019 18:49:57 +0000 (18:49 +0000)]
[lld] Update lld driver to use new LTO APIs to handle libcall symbols

NFC. Remove duplicated code in ELF/COFF driver and libLTO legacy
interfaces.

llvm-svn: 372022

4 years ago[LTO][Legacy] Add new C inferface to query libcall functions
Steven Wu [Mon, 16 Sep 2019 18:49:54 +0000 (18:49 +0000)]
[LTO][Legacy] Add new C inferface to query libcall functions

Summary:
This is needed to implemented the same approach as lld (implemented in r338434)
for how to handling symbols that can be generated by LTO code generator
but not present in the symbol table for linker that uses legacy C APIs.

libLTO is in charge of providing the list of symbols. Linker is in
charge of implementing the eager loading from static libraries using
the list of symbols.

rdar://problem/52853974

Reviewers: tejohnson, bd1976llvm, deadalnix, espindola

Reviewed By: tejohnson

Subscribers: emaste, arichardson, hiraditya, MaskRay, dang, kledzik, mehdi_amini, inglorion, jkorous, dexonsmith, ributzka, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D67568

llvm-svn: 372021

4 years ago[PGO] Use linkonce_odr linkage for __profd_ variables in comdat groups
Reid Kleckner [Mon, 16 Sep 2019 18:49:09 +0000 (18:49 +0000)]
[PGO] Use linkonce_odr linkage for __profd_ variables in comdat groups

This fixes relocations against __profd_ symbols in discarded sections,
which is PR41380.

In general, instrumentation happens very early, and optimization and
inlining happens afterwards. The counters for a function are calculated
early, and after inlining, counters for an inlined function may be
widely referenced by other functions.

For C++ inline functions of all kinds (linkonce_odr &
available_externally mainly), instr profiling wants to deduplicate these
__profc_ and __profd_ globals. Otherwise the binary would be quite
large.

I made __profd_ and __profc_ comdat in r355044, but I chose to make
__profd_ internal. At the time, I was only dealing with coverage, and in
that case, none of the instrumentation needs to reference __profd_.
However, if you use PGO, then instrumentation passes add calls to
__llvm_profile_instrument_range which reference __profd_ globals. The
solution is to make these globals externally visible by using
linkonce_odr linkage for data as was done for counters.

This is safe because PGO adds a CFG hash to the names of the data and
counter globals, so if different TUs have different globals, they will
get different data and counter arrays.

Reviewers: xur, hans

Differential Revision: https://reviews.llvm.org/D67579

llvm-svn: 372020

4 years ago[ARM][Codegen] Autogenerate arm-cgp-casts.ll test.
Roman Lebedev [Mon, 16 Sep 2019 18:28:22 +0000 (18:28 +0000)]
[ARM][Codegen] Autogenerate arm-cgp-casts.ll test.

Apparently it got broken by r372009 while i thought it was r372012.

llvm-svn: 372019

4 years ago[lldb] Remove SetCount/ClearCount from Flags
Raphael Isemann [Mon, 16 Sep 2019 18:02:49 +0000 (18:02 +0000)]
[lldb] Remove SetCount/ClearCount from Flags

Summary:
These functions are only used in tests where we should test the actual flag values instead of counting all bits for an approximate check.
Also these popcount implementation aren't very efficient and doesn't seem to be optimised to anything fast.

Reviewers: davide, JDevlieghere

Reviewed By: davide, JDevlieghere

Subscribers: abidh, JDevlieghere, lldb-commits

Tags: #lldb

Differential Revision: https://reviews.llvm.org/D67540

llvm-svn: 372018

4 years ago[lldb][NFC] Make ApplyObjcCastHack less scary
Raphael Isemann [Mon, 16 Sep 2019 18:02:21 +0000 (18:02 +0000)]
[lldb][NFC] Make ApplyObjcCastHack less scary

llvm-svn: 372017

4 years agoImplement std::condition_variable via pthread_cond_clockwait() where available
Dan Albert [Mon, 16 Sep 2019 17:57:48 +0000 (17:57 +0000)]
Implement std::condition_variable via pthread_cond_clockwait() where available

std::condition_variable is currently implemented via
pthread_cond_timedwait() on systems that use pthread. This is
problematic, since that function waits by default on CLOCK_REALTIME
and libc++ does not provide any mechanism to change from this
default.

Due to this, regardless of if condition_variable::wait_until() is
called with a chrono::system_clock or chrono::steady_clock parameter,
condition_variable::wait_until() will wait using CLOCK_REALTIME. This
is not accurate to the C++ standard as calling
condition_variable::wait_until() with a chrono::steady_clock parameter
should use CLOCK_MONOTONIC.

This is particularly problematic because CLOCK_REALTIME is a bad
choice as it is subject to discontinuous time adjustments, that may
cause condition_variable::wait_until() to immediately timeout or wait
indefinitely.

This change fixes this issue with a new POSIX function,
pthread_cond_clockwait() proposed on
http://austingroupbugs.net/view.php?id=1216. The new function is
similar to pthread_cond_timedwait() with the addition of a clock
parameter that allows it to wait using either CLOCK_REALTIME or
CLOCK_MONOTONIC, thus allowing condition_variable::wait_until() to
wait using CLOCK_REALTIME for chrono::system_clock and CLOCK_MONOTONIC
for chrono::steady_clock.

pthread_cond_clockwait() is implemented in glibc (2.30 and later) and
Android's bionic (Android API version 30 and later).

This change additionally makes wait_for() and wait_until() with clocks
other than chrono::system_clock use CLOCK_MONOTONIC.<Paste>

llvm-svn: 372016

4 years ago[Clang][Codegen] Disable arm_acle.c test.
Roman Lebedev [Mon, 16 Sep 2019 17:46:08 +0000 (17:46 +0000)]
[Clang][Codegen] Disable arm_acle.c test.

This test is broken by design. Clang codegen tests should not depend
on llvm middle-end behaviour, they should *only* test clang codegen.
Yet this test runs whole optimization pipeline.
I've really tried to fix it, but there isn't just a few things
that depend on passes, but everything there does.

llvm-svn: 372015

4 years ago[Clang][Codegen] Relax available-externally-suppress.c test
Roman Lebedev [Mon, 16 Sep 2019 17:46:01 +0000 (17:46 +0000)]
[Clang][Codegen] Relax available-externally-suppress.c test

That test is broken by design.
It depends on llvm middle-end behavior.
No clang codegen test should be doing that.
This one is salvageable by relaxing check lines.

llvm-svn: 372014

4 years ago[X86][AVX] matchShuffleWithSHUFPD - add support for zeroable operands
Simon Pilgrim [Mon, 16 Sep 2019 17:30:33 +0000 (17:30 +0000)]
[X86][AVX] matchShuffleWithSHUFPD - add support for zeroable operands

Determine if all of the uses of LHS/RHS operands can be replaced with a zero vector.

llvm-svn: 372013

4 years ago[ARM] A predicate cast of a predicate cast is a predicate cast
David Green [Mon, 16 Sep 2019 17:29:07 +0000 (17:29 +0000)]
[ARM] A predicate cast of a predicate cast is a predicate cast

The adds some very basic folding of PREDICATE_CASTS, removing cases when they
are chained together. These would already be removed eventually, as these are
lowered to copies. This just allows it to happen earlier, which can help other
simplifications.

Differential Revision: https://reviews.llvm.org/D67591

llvm-svn: 372012

4 years ago[OPENMP]Fix parsing/sema for function templates with declare simd.
Alexey Bataev [Mon, 16 Sep 2019 17:06:31 +0000 (17:06 +0000)]
[OPENMP]Fix parsing/sema for function templates with declare simd.

Need to return original declaration group with FunctionTemplateDecl, not
the inner FunctionDecl, to correctly handle parsing of directives with
the templates parameters.

llvm-svn: 372011

4 years ago[SimplifyCFG] FoldTwoEntryPHINode(): consider *total* speculation cost, not per-BB...
Roman Lebedev [Mon, 16 Sep 2019 16:18:24 +0000 (16:18 +0000)]
[SimplifyCFG] FoldTwoEntryPHINode(): consider *total* speculation cost, not per-BB cost

Summary:
Previously, if the threshold was 2, we were willing to speculatively
execute 2 cheap instructions in both basic blocks (thus we were willing
to speculatively execute cost = 4), but weren't willing to speculate
when one BB had 3 instructions and other one had no instructions,
even thought that would have total cost of 3.

This looks inconsistent to me.
I don't think `cmov`-like instructions will start executing
until both of it's inputs are available: https://godbolt.org/z/zgHePf
So i don't see why the existing behavior is the correct one.

Also, let's add it's own `cl::opt` for this threshold,
with default=4, so it is not stricter than the previous threshold:
will allow to fold when there are 2 BB's each with cost=2.
And since the logic has changed, it will also allow to fold when
one BB has cost=3 and other cost=1, or there is only one BB with cost=4.

This is an alternative solution to D65148:
This fix is mainly motivated by `signbit-like-value-extension.ll` test.
That pattern comes up in JPEG decoding, see e.g.
`Figure F.12 – Extending the sign bit of a decoded value in V`
of `ITU T.81` (JPEG specification).
That branch is not predictable, and it is within the innermost loop,
so the fact that that pattern ends up being stuck with a branch
instead of `select` (i.e. `CMOV` for x86) is unlikely to be beneficial.

This has great results on the final assembly (vanilla test-suite + RawSpeed): (metric pass - D67240)
| metric                                 |     old |     new | delta |      % |
| x86-mi-counting.NumMachineFunctions    |   37720 |   37721 |     1 |  0.00% |
| x86-mi-counting.NumMachineBasicBlocks  |  773545 |  771181 | -2364 | -0.31% |
| x86-mi-counting.NumMachineInstructions | 7488843 | 7486442 | -2401 | -0.03% |
| x86-mi-counting.NumUncondBR            |  135770 |  135543 |  -227 | -0.17% |
| x86-mi-counting.NumCondBR              |  423753 |  422187 | -1566 | -0.37% |
| x86-mi-counting.NumCMOV                |   24815 |   25731 |   916 |  3.69% |
| x86-mi-counting.NumVecBlend            |      17 |      17 |     0 |  0.00% |

We significantly decrease basic block count, notably decrease instruction count,
significantly decrease branch count and very significantly increase `cmov` count.

Performance-wise, unsurprisingly, this has great effect on
target RawSpeed benchmark. I'm seeing 5 **major** improvements:
```
Benchmark                                                                                             Time             CPU      Time Old      Time New       CPU Old       CPU New
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Samsung/NX3000/_3184416.SRW/threads:8/process_time/real_time_pvalue                                 0.0000          0.0000      U Test, Repetitions: 49 vs 49
Samsung/NX3000/_3184416.SRW/threads:8/process_time/real_time_mean                                  -0.3064         -0.3064      226.9913      157.4452      226.9800      157.4384
Samsung/NX3000/_3184416.SRW/threads:8/process_time/real_time_median                                -0.3057         -0.3057      226.8407      157.4926      226.8282      157.4828
Samsung/NX3000/_3184416.SRW/threads:8/process_time/real_time_stddev                                -0.4985         -0.4954        0.3051        0.1530        0.3040        0.1534
Kodak/DCS760C/86L57188.DCR/threads:8/process_time/real_time_pvalue                                  0.0000          0.0000      U Test, Repetitions: 49 vs 49
Kodak/DCS760C/86L57188.DCR/threads:8/process_time/real_time_mean                                   -0.1747         -0.1747       80.4787       66.4227       80.4771       66.4146
Kodak/DCS760C/86L57188.DCR/threads:8/process_time/real_time_median                                 -0.1742         -0.1743       80.4686       66.4542       80.4690       66.4436
Kodak/DCS760C/86L57188.DCR/threads:8/process_time/real_time_stddev                                 +0.6089         +0.5797        0.0670        0.1078        0.0673        0.1062
Sony/DSLR-A230/DSC08026.ARW/threads:8/process_time/real_time_pvalue                                 0.0000          0.0000      U Test, Repetitions: 49 vs 49
Sony/DSLR-A230/DSC08026.ARW/threads:8/process_time/real_time_mean                                  -0.1598         -0.1598      171.6996      144.2575      171.6915      144.2538
Sony/DSLR-A230/DSC08026.ARW/threads:8/process_time/real_time_median                                -0.1598         -0.1597      171.7109      144.2755      171.7018      144.2766
Sony/DSLR-A230/DSC08026.ARW/threads:8/process_time/real_time_stddev                                +0.4024         +0.3850        0.0847        0.1187        0.0848        0.1175
Canon/EOS 77D/IMG_4049.CR2/threads:8/process_time/real_time_pvalue                                  0.0000          0.0000      U Test, Repetitions: 49 vs 49
Canon/EOS 77D/IMG_4049.CR2/threads:8/process_time/real_time_mean                                   -0.0550         -0.0551      280.3046      264.8800      280.3017      264.8559
Canon/EOS 77D/IMG_4049.CR2/threads:8/process_time/real_time_median                                 -0.0554         -0.0554      280.2628      264.7360      280.2574      264.7297
Canon/EOS 77D/IMG_4049.CR2/threads:8/process_time/real_time_stddev                                 +0.7005         +0.7041        0.2779        0.4725        0.2775        0.4729
Canon/EOS 5DS/2K4A9929.CR2/threads:8/process_time/real_time_pvalue                                  0.0000          0.0000      U Test, Repetitions: 49 vs 49
Canon/EOS 5DS/2K4A9929.CR2/threads:8/process_time/real_time_mean                                   -0.0354         -0.0355      316.7396      305.5208      316.7342      305.4890
Canon/EOS 5DS/2K4A9929.CR2/threads:8/process_time/real_time_median                                 -0.0354         -0.0356      316.6969      305.4798      316.6917      305.4324
Canon/EOS 5DS/2K4A9929.CR2/threads:8/process_time/real_time_stddev                                 +0.0493         +0.0330        0.3562        0.3737        0.3563        0.3681
```

That being said, it's always best-effort, so there will likely
be cases where this worsens things.

Reviewers: efriedma, craig.topper, dmgreen, jmolloy, fhahn, Carrot, hfinkel, chandlerc

Reviewed By: jmolloy

Subscribers: xbolva00, hiraditya, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D67318

llvm-svn: 372009

4 years ago[clangd] Simplify semantic highlighting visitor
Ilya Biryukov [Mon, 16 Sep 2019 16:16:03 +0000 (16:16 +0000)]
[clangd] Simplify semantic highlighting visitor

Summary:
- Functions to compute highlighting kinds for things are separated from
  the ones that add highlighting tokens.
  This keeps each of them more focused on what they're doing: getting
  locations and figuring out the kind of the entity, correspondingly.

- Less special cases in visitor for various nodes.

This change is an NFC.

Reviewers: hokein

Reviewed By: hokein

Subscribers: MaskRay, jkorous, arphaman, kadircet, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D67341

llvm-svn: 372008

4 years ago[InstCombine] remove unneeded one-use checks for icmp fold
Sanjay Patel [Mon, 16 Sep 2019 16:15:25 +0000 (16:15 +0000)]
[InstCombine] remove unneeded one-use checks for icmp fold

Related folds were added in:
rL125734
...the code comment about register pressure is discussed in
more detail in:
https://bugs.llvm.org/show_bug.cgi?id=2698

But 10 years later, perf testing bzip2 with this change now
shows a slight (0.2% average) improvement on Haswell although
that's probably within test noise.

Given that this is IR canonicalization, we shouldn't be worried
about register pressure though; the backend should be able to
adjust for that as needed.

This is part of solving PR43310 the theoretically right way:
https://bugs.llvm.org/show_bug.cgi?id=43310
...ie, if we don't cripple basic transforms, then we won't
need to add special-case code to detect larger patterns.

rL371940 and rL371981 are related patches in this series.

llvm-svn: 372007

4 years ago[InstCombine] move tests for icmp+add; NFC
Sanjay Patel [Mon, 16 Sep 2019 15:33:40 +0000 (15:33 +0000)]
[InstCombine] move tests for icmp+add; NFC

llvm-svn: 372004

4 years ago[ARM] Add patterns for BSWAP intrinsic on MVE
Oliver Cruickshank [Mon, 16 Sep 2019 15:20:10 +0000 (15:20 +0000)]
[ARM] Add patterns for BSWAP intrinsic on MVE

BSWAP can use the VREV instruction on MVE to produce better results than
expanding.

llvm-svn: 372002

4 years ago[ARM] Add patterns for bitreverse intrinsic on MVE
Oliver Cruickshank [Mon, 16 Sep 2019 15:20:03 +0000 (15:20 +0000)]
[ARM] Add patterns for bitreverse intrinsic on MVE

BITREVERSE can use the VBRSR which will reverse and right shift.
Shifting right by 0 will just reverse the bits.

llvm-svn: 372001

4 years ago[ARM] Lower CTTZ on MVE
Oliver Cruickshank [Mon, 16 Sep 2019 15:19:56 +0000 (15:19 +0000)]
[ARM] Lower CTTZ on MVE

Lower CTTZ on MVE using VBRSR and VCLS which will reverse the bits and
count the leading zeros, equivalent to a count trailing zeros (CTTZ).

llvm-svn: 372000

4 years ago[ARM] Add patterns for CTLZ on MVE
Oliver Cruickshank [Mon, 16 Sep 2019 15:19:49 +0000 (15:19 +0000)]
[ARM] Add patterns for CTLZ on MVE

CTLZ intrinsic can use the VCLS instruction on MVE, which produces
better results than expanding.

llvm-svn: 371999

4 years ago[ExecutionEngine] Don't dereference a dyn_cast result. NFCI.
Simon Pilgrim [Mon, 16 Sep 2019 15:19:11 +0000 (15:19 +0000)]
[ExecutionEngine] Don't dereference a dyn_cast result. NFCI.

The static analyzer is warning about potential null dereferences of dyn_cast<> results - in these cases we can safely use cast<> directly as we know that these cases should all be the correct type, which is why its working atm and anyway cast<> will assert if they aren't.

llvm-svn: 371998

4 years ago[libFuzzer] Remove unused version of FuzzedDataProvider.h.
Max Moroz [Mon, 16 Sep 2019 15:00:21 +0000 (15:00 +0000)]
[libFuzzer] Remove unused version of FuzzedDataProvider.h.

Summary: The actual version lives in compiler-rt/include/fuzzer/.

Reviewers: Dor1s

Reviewed By: Dor1s

Subscribers: delcypher, #sanitizers, llvm-commits

Tags: #llvm, #sanitizers

Differential Revision: https://reviews.llvm.org/D67623

llvm-svn: 371997

4 years ago[LV] Add ARM MVE tail-folding tests
Sjoerd Meijer [Mon, 16 Sep 2019 14:56:26 +0000 (14:56 +0000)]
[LV] Add ARM MVE tail-folding tests

Now that the vectorizer can do tail-folding (rL367592), and the ARM backend
understands MVE masked loads/stores (rL371932), it's time to add the MVE
tail-folding equivalent of the X86 tests that I added.

llvm-svn: 371996

4 years ago[SystemZ] Call erase() on the right MBB in SystemZTargetLowering::emitSelect()
Jonas Paulsson [Mon, 16 Sep 2019 14:49:36 +0000 (14:49 +0000)]
[SystemZ]  Call erase() on the right MBB in SystemZTargetLowering::emitSelect()

Since MBB was split *before* MI, the MI(s) will reside in JoinMBB (MBB) at
the point of erasing them, so calling StartMBB->erase() is actually wrong,
although it is "working" by all appearances.

Review: Ulrich Weigand
llvm-svn: 371995

4 years ago[NFC] remove unused functions
Guillaume Chatelet [Mon, 16 Sep 2019 14:48:58 +0000 (14:48 +0000)]
[NFC] remove unused functions

Reviewers: courbet

Subscribers: hiraditya, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D67616

llvm-svn: 371994

4 years agoAMDGPU/GlobalISel: Fail select of G_INSERT non-32-bit source
Matt Arsenault [Mon, 16 Sep 2019 14:26:14 +0000 (14:26 +0000)]
AMDGPU/GlobalISel: Fail select of G_INSERT non-32-bit source

This was producing an illegal copy which would hit an assert
later. Error on selection for now until this is implemented.

llvm-svn: 371993

4 years agoAMDGPU/GlobalISel: Fix some broken run lines
Matt Arsenault [Mon, 16 Sep 2019 14:14:40 +0000 (14:14 +0000)]
AMDGPU/GlobalISel: Fix some broken run lines

llvm-svn: 371992

4 years agoAMDGPU/GlobalISel: Fix RegBankSelect for G_FRINT and G_FCEIL
Matt Arsenault [Mon, 16 Sep 2019 14:14:37 +0000 (14:14 +0000)]
AMDGPU/GlobalISel: Fix RegBankSelect for G_FRINT and G_FCEIL

llvm-svn: 371991

4 years agoAMDGPU/GlobalISel: Remove another illegal select test
Matt Arsenault [Mon, 16 Sep 2019 14:14:31 +0000 (14:14 +0000)]
AMDGPU/GlobalISel: Remove another illegal select test

llvm-svn: 371990

4 years ago[X86][NFC] Add a `use-aa` feature.
Clement Courbet [Mon, 16 Sep 2019 14:05:28 +0000 (14:05 +0000)]
[X86][NFC] Add a `use-aa` feature.

Summary:
This allows enabling useaa on the command-line and will allow enabling the
feature on a per-CPU basis where benchmarking shows improvements.

This is modelled after the ARM/AArch64 target.

Reviewers: RKSimon, andreadb, craig.topper

Subscribers: javed.absar, kristof.beyls, hiraditya, ychen, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D67266

llvm-svn: 371989

4 years ago[InstCombine] add/move tests for icmp with add operand; NFC
Sanjay Patel [Mon, 16 Sep 2019 14:05:19 +0000 (14:05 +0000)]
[InstCombine] add/move tests for icmp with add operand; NFC

llvm-svn: 371988

4 years ago[clangd][vscode] update the development doc.
Haojian Wu [Mon, 16 Sep 2019 14:03:06 +0000 (14:03 +0000)]
[clangd][vscode] update the development doc.

llvm-svn: 371986

4 years agoMove some definitions from Sema to Basic to fix shared libs build
Erich Keane [Mon, 16 Sep 2019 13:58:59 +0000 (13:58 +0000)]
Move some definitions from Sema to Basic to fix shared libs build

r371875 moved some functionality around to a Basic header file, but
didn't move its definitions as well.  This patch moves some things
around so that shared library building can work.

llvm-svn: 371985

4 years ago[docs][llvm-strings] Write llvm-strings documentation
James Henderson [Mon, 16 Sep 2019 13:56:12 +0000 (13:56 +0000)]
[docs][llvm-strings] Write llvm-strings documentation

Previously we only had a stub document.

Reviewed by: MaskRay

Differential Revision: https://reviews.llvm.org/D67554

llvm-svn: 371984

4 years ago[docs][llvm-size] Write llvm-size documentation
James Henderson [Mon, 16 Sep 2019 13:20:37 +0000 (13:20 +0000)]
[docs][llvm-size] Write llvm-size documentation

Previously we only had a stub document.

Reviewed by: serge-sans-paille, MaskRay

Differential Revision: https://reviews.llvm.org/D67555

llvm-svn: 371983

4 years ago[ARM] Fold VCMP into VPT
David Green [Mon, 16 Sep 2019 13:02:41 +0000 (13:02 +0000)]
[ARM] Fold VCMP into VPT

MVE has VPT instructions, which perform the duties of both a VCMP and a VPST in
a single instruction, performing the compare and starting the VPT block in one.
This teaches the MVEVPTBlockPass to fold them, searching back through the
basicblock for a valid VCMP and creating the VPT from its operands.

There are some changes to the VPT instructions to accommodate this, altering
the order of the operands to match the VCMP better, and changing P0 register
defs to be VPR defs, as is used in other places.

Differential Revision: https://reviews.llvm.org/D66577

llvm-svn: 371982

4 years ago[InstCombine] remove unneeded one-use checks for icmp fold
Sanjay Patel [Mon, 16 Sep 2019 12:54:34 +0000 (12:54 +0000)]
[InstCombine] remove unneeded one-use checks for icmp fold

This fold and several others were added in:
rL125734 <https://reviews.llvm.org/rL125734>
...with no explanation for the one-use checks other than the code
comments about register pressure.

Given that this is IR canonicalization, we shouldn't be worried
about register pressure though; the backend should be able to
adjust for that as needed.

This is part of solving PR43310 the theoretically right way:
https://bugs.llvm.org/show_bug.cgi?id=43310
...ie, if we don't cripple basic transforms, then we won't
need to add special-case code to detect larger patterns.

rL371940 is a related patch in this series.

llvm-svn: 371981

4 years ago[clangd] Bump vscode-clangd v0.0.17
Haojian Wu [Mon, 16 Sep 2019 12:51:07 +0000 (12:51 +0000)]
[clangd] Bump vscode-clangd v0.0.17

CHANGELOG:
- added semantic highlighting support (under the clangd.semanticHighlighting
  flag);
- better error message when clangd fails to execute refactoring-like
  actions;
- improved the readme doc;

llvm-svn: 371980

4 years ago[InstCombine] add icmp tests with extra uses; NFC
Sanjay Patel [Mon, 16 Sep 2019 12:19:18 +0000 (12:19 +0000)]
[InstCombine] add icmp tests with extra uses; NFC

llvm-svn: 371979

4 years ago[InstCombine] fix comments to match code; NFC
Sanjay Patel [Mon, 16 Sep 2019 12:12:05 +0000 (12:12 +0000)]
[InstCombine] fix comments to match code; NFC

This blob was written before match() existed, so it
could probably be reduced significantly.

But I suspect it isn't well tested, so tests would have
to be added to reduce risk from logic changes.

llvm-svn: 371978

4 years agogn build: Merge r371976
Nico Weber [Mon, 16 Sep 2019 11:33:54 +0000 (11:33 +0000)]
gn build: Merge r371976

llvm-svn: 371977

4 years agoImplement semantic selections.
Utkarsh Saxena [Mon, 16 Sep 2019 11:29:35 +0000 (11:29 +0000)]
Implement semantic selections.

Summary:
For a given cursor position, it returns ranges that are interesting to the user.
Currently the semantic ranges correspond to the nodes of the syntax trees.

Subscribers: mgorny, jkorous, arphaman, kadircet, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D67358

llvm-svn: 371976

4 years ago[VPlanSLP] Don't dereference a cast_or_null<VPInstruction> result. NFCI.
Simon Pilgrim [Mon, 16 Sep 2019 11:22:44 +0000 (11:22 +0000)]
[VPlanSLP] Don't dereference a cast_or_null<VPInstruction> result. NFCI.

The static analyzer is warning about a potential null dereference of the cast_or_null result, I've split the cast_or_null check from the ->getUnderlyingInstr() call to avoid this, but it appears that we weren't seeing any null pointers in the dumped bundles in the first place.

llvm-svn: 371975

4 years ago[SLPVectorizer] Assert that we find a LastInst to silence analyzer null dereference...
Simon Pilgrim [Mon, 16 Sep 2019 10:48:16 +0000 (10:48 +0000)]
[SLPVectorizer] Assert that we find a LastInst to silence analyzer null dereference warning. NFCI.

llvm-svn: 371974

4 years ago[SLPVectorizer] Don't dereference a dyn_cast result. NFCI.
Simon Pilgrim [Mon, 16 Sep 2019 10:35:09 +0000 (10:35 +0000)]
[SLPVectorizer] Don't dereference a dyn_cast result. NFCI.

The static analyzer is warning about potential null dereferences of dyn_cast<> results - in these cases we can safely use cast<> directly as we know that these cases should all be the correct type, which is why its working atm and anyway cast<> will assert if they aren't.

llvm-svn: 371973

4 years agoAdded return statement to fix compile and build warning:
Sjoerd Meijer [Mon, 16 Sep 2019 10:30:37 +0000 (10:30 +0000)]
Added return statement to fix compile and build warning:

llvm-rtdyld.cpp:966:7: warning: variable ‘Result’ set but not used

llvm-svn: 371972

4 years ago[clangd] Fix a crash when renaming operator.
Haojian Wu [Mon, 16 Sep 2019 10:16:56 +0000 (10:16 +0000)]
[clangd] Fix a crash when renaming operator.

Summary:
The renamelib uses a tricky way to calculate the end location by relying
on decl name, this is incorrect for the overloaded operator (the name is
"operator++" instead of "++"), which will cause out-of-file offset.

We also disable renaming operator symbol, this case is tricky, and
renamelib doesnt handle it properly.

Reviewers: ilya-biryukov

Subscribers: MaskRay, jkorous, arphaman, kadircet, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D67607

llvm-svn: 371971

4 years ago[ELF][ARM] Fix -Werror buildbots NFC.
Peter Smith [Mon, 16 Sep 2019 10:07:53 +0000 (10:07 +0000)]
[ELF][ARM] Fix -Werror buildbots NFC.

Provide a missing initializer to get rid of warning provoking buildbot
failures.

error: missing field 'rel' initializer
[-Werror,-Wmissing-field-initializers]

llvm-svn: 371970

4 years agoChange signature of __builtin_rotateright64 back to unsigned
Karl-Johan Karlsson [Mon, 16 Sep 2019 09:52:23 +0000 (09:52 +0000)]
Change signature of __builtin_rotateright64 back to unsigned

The signature of __builtin_rotateright64 was by misstake changed from
unsigned to signed in r360863, this patch will change it back to
unsigned as intended.

This fixes pr43309

Reviewers: efriedma, hans

Reviewed By: hans

Differential Revision: https://reviews.llvm.org/D67606

llvm-svn: 371969

4 years agoFix the rst doc, unbreak buildbot.
Haojian Wu [Mon, 16 Sep 2019 09:46:53 +0000 (09:46 +0000)]
Fix the rst doc, unbreak buildbot.

llvm-svn: 371968

4 years ago[SVE][Inline-Asm] Add constraints for SVE predicate registers
Kerry McLaughlin [Mon, 16 Sep 2019 09:45:27 +0000 (09:45 +0000)]
[SVE][Inline-Asm] Add constraints for SVE predicate registers

Summary:
Adds the following inline asm constraints for SVE:
  - Upl: One of the low eight SVE predicate registers, P0 to P7 inclusive
  - Upa: SVE predicate register with full range, P0 to P15

Reviewers: t.p.northover, sdesmalen, rovka, momchil.velikov, cameron.mcinally, greened, rengolin

Reviewed By: rovka

Subscribers: javed.absar, tschuett, rkruppe, psnobl, cfe-commits, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D66524

llvm-svn: 371967

4 years agogn build: Merge r371965
Nico Weber [Mon, 16 Sep 2019 09:43:26 +0000 (09:43 +0000)]
gn build: Merge r371965

llvm-svn: 371966

4 years ago[ELF][ARM] Implement --fix-cortex-a8 to fix erratum 657417
Peter Smith [Mon, 16 Sep 2019 09:38:38 +0000 (09:38 +0000)]
[ELF][ARM] Implement --fix-cortex-a8 to fix erratum 657417

The --fix-cortex-a8 option implements a linker workaround for the
coretex-a8 erratum 657417. A summary of the erratum conditions is:
- A 32-bit Thumb-2 branch instruction B.w, Bcc.w, BL, BLX spans two
4KiB regions.
- The destination of the branch is to the first 4KiB region.
- The instruction before the branch is a 32-bit Thumb-2 non-branch
instruction.

The linker fix is to redirect the branch to a patch not in the first
4KiB region. The patch forwards the branch on to its target.

The cortex-a8, is an old CPU, with the first implementation of this
workaround in ld.bfd appearing in 2009. The cortex-a8 has been used in
early Android Phones and there are some critical applications that still
need to run on a cortex-a8 that have the erratum. The patch is applied
roughly 10 times on LLD and 20 on Clang when they are built with
--fix-cortex-a8 on an Arm system.

The formal erratum description is avaliable in the ARM Core Cortex-A8
(AT400/AT401) Errata Notice document. This is available from Arm on
request but it seems to be findable via a web search.

Differential Revision: https://reviews.llvm.org/D67284

llvm-svn: 371965

4 years ago[clang-tidy] performance-inefficient-vector-operation: Support proto repeated field
Haojian Wu [Mon, 16 Sep 2019 08:54:10 +0000 (08:54 +0000)]
[clang-tidy] performance-inefficient-vector-operation: Support proto repeated field

Summary:
Finds calls that add element to protobuf repeated field in a loop
without calling Reserve() before the loop. Calling Reserve() first can avoid
unnecessary memory reallocations.

A new option EnableProto is added to guard this feature.

Patch by Cong Liu!

Reviewers: gribozavr, alexfh, hokein, aaron.ballman

Reviewed By: hokein

Subscribers: lebedev.ri, xazax.hun, Eugene.Zelenko, cfe-commits

Tags: #clang, #clang-tools-extra

Differential Revision: https://reviews.llvm.org/D67135

llvm-svn: 371963

4 years ago[test] Add -z separate-code to fix tests that ae sensitive to exact addresses after...
Fangrui Song [Mon, 16 Sep 2019 07:52:30 +0000 (07:52 +0000)]
[test] Add -z separate-code to fix tests that ae sensitive to exact addresses after r371958

llvm-svn: 371962

4 years agogn build: Merge r371959
Nico Weber [Mon, 16 Sep 2019 07:34:23 +0000 (07:34 +0000)]
gn build: Merge r371959

llvm-svn: 371961

4 years ago[AArch64] Some more FP16 FMA pattern matching
Sjoerd Meijer [Mon, 16 Sep 2019 07:32:13 +0000 (07:32 +0000)]
[AArch64] Some more FP16 FMA pattern matching

After our previous machinecombiner exercises (rL371321, rL371818, rL371833), we
were still missing a few FP16 FMA patterns.

Differential Revision: https://reviews.llvm.org/D67576

llvm-svn: 371960

4 years ago[SystemZ] Merge the SystemZExpandPseudo pass into SystemZPostRewrite.
Jonas Paulsson [Mon, 16 Sep 2019 07:29:37 +0000 (07:29 +0000)]
[SystemZ]  Merge the SystemZExpandPseudo pass into SystemZPostRewrite.

SystemZExpandPseudo:s only job was to expand LOCRMux instructions into jump
sequences. This needs to be done if expandLOCRPseudo() or expandSELRPseudo()
fails to find a legal opcode (all registers "high" or "low"). This task has
now been moved to SystemZPostRewrite while removing the SystemZExpandPseudo
pass.

It is in fact preferred to expand these pseudos directly after register
allocation in SystemZPostRewrite since the hinted register combinations are
then not subject to later optimizations.

Review: Ulrich Weigand
https://reviews.llvm.org/D67432

llvm-svn: 371959

4 years ago[ELF][X86] Allow PT_LOAD to have overlapping p_offset ranges on EM_X86_64
Fangrui Song [Mon, 16 Sep 2019 07:05:34 +0000 (07:05 +0000)]
[ELF][X86] Allow PT_LOAD to have overlapping p_offset ranges on EM_X86_64

Port the D64906 technique to EM_X86_64.

Differential Revision: https://reviews.llvm.org/D67482

llvm-svn: 371958

4 years ago[ELF] Map the ELF header at imageBase
Fangrui Song [Mon, 16 Sep 2019 07:04:16 +0000 (07:04 +0000)]
[ELF] Map the ELF header at imageBase

If there is no readonly section, we map:

* The ELF header at imageBase+maxPageSize
* Program headers at imageBase+maxPageSize+sizeof(Ehdr)
* The first section .text at imageBase+maxPageSize+sizeof(Ehdr)+sizeof(program headers)

Due to the interaction between Writer<ELFT>::fixSectionAlignments and
LinkerScript::allocateHeaders,
`alignDown(p_vaddr(R PT_LOAD)) = alignDown(p_vaddr(RX PT_LOAD))`.
The RX PT_LOAD will override the R PT_LOAD at runtime, which is not ideal:

```
// PHDR at 0x401034, should be 0x400034
  PHDR           0x000034 0x00401034 0x00401034 0x000a0 0x000a0 R   0x4
// R PT_LOAD contains just Ehdr and program headers.
// At 0x401000, should be 0x400000
  LOAD           0x000000 0x00401000 0x00401000 0x000d4 0x000d4 R   0x1000
  LOAD           0x0000d4 0x004010d4 0x004010d4 0x00001 0x00001 R E 0x1000
```

* createPhdrs allocates the headers to the R PT_LOAD.
* fixSectionAlignments assigns `imageBase+maxPageSize+sizeof(Ehdr)+sizeof(program headers)` (formula: `alignTo(dot, maxPageSize) + dot % config->maxPageSize`) to addrExpr of .text
* allocateHeaders computes the minimum address among SHF_ALLOC sections, i.e. addr(.text)
* allocateHeaders sets address of ELF header to `addr(.text)-sizeof(Ehdr)-sizeof(program headers) = imageBase+maxPageSize`

The main observation is that when the SECTIONS command is not used, we
don't have to call allocateHeaders. This requires an assumption that
the presence of PT_PHDR and addresses of headers can be decided
regardless of address information.

This may seem natural because dot is not manipulated by a linker script.
The other thing is that we have to drop the special rule for -T<section>
in `getInitialDot`. If -Ttext is smaller than the image base, the headers
will not be allocated with the old behavior (allocateHeaders is called)
but always allocated with the new behavior.

The behavior change is not a problem. Whether and where headers are
allocated can vary among linkers, or ld.bfd across different versions
(--enable-separate-code or not). It is thus advised to use a linker
script with the PHDRS command to have a consistent behavior across
linkers. If PT_PHDR is needed, an explicit --image-base can be a simpler
alternative.

Differential Revision: https://reviews.llvm.org/D67325

llvm-svn: 371957

4 years agoAMDGPU/GlobalISel: Remove illegal select tests
Matt Arsenault [Mon, 16 Sep 2019 04:21:10 +0000 (04:21 +0000)]
AMDGPU/GlobalISel: Remove illegal select tests

These fail in a release build.

llvm-svn: 371955

4 years agoAMDGPU/GlobalISel: Select SMRD loads for more types
Matt Arsenault [Mon, 16 Sep 2019 00:54:07 +0000 (00:54 +0000)]
AMDGPU/GlobalISel: Select SMRD loads for more types

llvm-svn: 371954

4 years agoAMDGPU/GlobalISel: RegBankSelect for kill
Matt Arsenault [Mon, 16 Sep 2019 00:48:37 +0000 (00:48 +0000)]
AMDGPU/GlobalISel: RegBankSelect for kill

llvm-svn: 371953

4 years agoAMDGPU/GlobalISel: Legalize s1 source G_[SU]ITOFP
Matt Arsenault [Mon, 16 Sep 2019 00:37:10 +0000 (00:37 +0000)]
AMDGPU/GlobalISel: Legalize s1 source G_[SU]ITOFP

llvm-svn: 371952

4 years agoAMDGPU/GlobalISel: Set type on vgpr live in special arguments
Matt Arsenault [Mon, 16 Sep 2019 00:33:00 +0000 (00:33 +0000)]
AMDGPU/GlobalISel: Set type on vgpr live in special arguments

Fixes assertion with workitem ID intrinsics used in non-kernel
functions.

llvm-svn: 371951

4 years agoAMDGPU/GlobalISel: Select S16->S32 fptoint
Matt Arsenault [Mon, 16 Sep 2019 00:32:56 +0000 (00:32 +0000)]
AMDGPU/GlobalISel: Select S16->S32 fptoint

llvm-svn: 371950

4 years agoAMDGPU/GlobalISel: Select s32->s16 G_[US]ITOFP
Matt Arsenault [Mon, 16 Sep 2019 00:29:12 +0000 (00:29 +0000)]
AMDGPU/GlobalISel: Select s32->s16 G_[US]ITOFP

llvm-svn: 371949

4 years agoAMDGPU/GlobalISel: Fix VALU s16 fneg
Matt Arsenault [Mon, 16 Sep 2019 00:20:54 +0000 (00:20 +0000)]
AMDGPU/GlobalISel: Fix VALU s16 fneg

llvm-svn: 371948

4 years ago[Attributor] Heap-To-Stack Conversion
Stefan Stipanovic [Sun, 15 Sep 2019 21:47:41 +0000 (21:47 +0000)]
[Attributor] Heap-To-Stack Conversion

D53362 gives a prototype heap-to-stack conversion pass. With addition of new attributes in the attributor, this can now be revisted and improved. This will place it in the Attributor to make it easier to use new attributes (eg. nofree, nosync, willreturn, etc.) and other attributor features.

Reviewers: jdoerfert, uenoku, hfinkel, efriedma

Subscribers: lebedev.ri, xbolva00, hiraditya, llvm-commits

Differential Revision: https://reviews.llvm.org/D65408

llvm-svn: 371942

4 years agoCommit missing part of "Split many_tls_keys.cpp into two tests"
Kamil Rytarowski [Sun, 15 Sep 2019 21:04:50 +0000 (21:04 +0000)]
Commit missing part of "Split many_tls_keys.cpp into two tests"

https://reviews.llvm.org/D67428

This change was lost due to a file rename and modification.

llvm-svn: 371941

4 years ago[InstCombine] remove unneeded one-use checks for icmp fold
Sanjay Patel [Sun, 15 Sep 2019 20:56:34 +0000 (20:56 +0000)]
[InstCombine] remove unneeded one-use checks for icmp fold

This fold and several others were added in:
rL125734
...with no explanation for the one-use checks other than the code
comments about register pressure.

Given that this is IR canonicalization, we shouldn't be worried
about register pressure though; the backend should be able to
adjust for that as needed.

There are similar checks as noted with the TODO comments. I'm
hoping to remove those restrictions too, but if any of these
does cause a regression, it should be easier to correct by making
small, individual commits.

This is part of solving PR43310 the theoretically right way:
https://bugs.llvm.org/show_bug.cgi?id=43310
...ie, if we don't cripple basic transforms, then we won't
need to add special-case code to detect larger patterns.

llvm-svn: 371940

4 years ago[InstCombine] add icmp tests with extra uses; NFC
Sanjay Patel [Sun, 15 Sep 2019 20:13:27 +0000 (20:13 +0000)]
[InstCombine] add icmp tests with extra uses; NFC

llvm-svn: 371939

4 years ago[PowerPC][NFC] Add a testcase for fdiv expansion.
Jinsong Ji [Sun, 15 Sep 2019 20:02:25 +0000 (20:02 +0000)]
[PowerPC][NFC] Add a testcase for fdiv expansion.

Pre-commit for following patch.

llvm-svn: 371938

4 years ago[GlobalISel] findGISelOptimalMemOpLowering - remove dead initalization. NFCI.
Simon Pilgrim [Sun, 15 Sep 2019 16:56:06 +0000 (16:56 +0000)]
[GlobalISel] findGISelOptimalMemOpLowering - remove dead initalization. NFCI.

Fixes static analyzer warning that "Value stored to 'NewTySize' during its initialization is never read".

llvm-svn: 371937

4 years ago[LoadStoreVectorizer] vectorizeLoadChain - ensure we find a valid Type down the load...
Simon Pilgrim [Sun, 15 Sep 2019 16:44:35 +0000 (16:44 +0000)]
[LoadStoreVectorizer] vectorizeLoadChain - ensure we find a valid Type down the load chain. NFCI.

Silence static analyzer uninitialized variable warning by setting the LoadTy to null and then asserting we find a real value.

llvm-svn: 371936

4 years agoInterleavedLoadCombine - merge isa<> and dyn_cast<> duplicates. NFCI.
Simon Pilgrim [Sun, 15 Sep 2019 16:20:12 +0000 (16:20 +0000)]
InterleavedLoadCombine - merge isa<> and dyn_cast<> duplicates. NFCI.

Silence static analyzer null dereference warning of *dyn_cast<BinaryOperator> by merging with the isa<BinaryOperator> above.

llvm-svn: 371935

4 years ago[OpenMP] Fix OMPClauseReader::readClause() uninitialized variable warning. NFCI.
Simon Pilgrim [Sun, 15 Sep 2019 16:05:20 +0000 (16:05 +0000)]
[OpenMP] Fix OMPClauseReader::readClause() uninitialized variable warning. NFCI.

Fixes static analyzer uninitialized variable warning for the OMPClause - the function appears to cover all cases, but I've added an assertion to make sure.

llvm-svn: 371934

4 years ago[DebugInfo] Don't dereference a dyn_cast<PDBSymbolData> result. NFCI.
Simon Pilgrim [Sun, 15 Sep 2019 15:38:26 +0000 (15:38 +0000)]
[DebugInfo] Don't dereference a dyn_cast<PDBSymbolData> result. NFCI.

The static analyzer is warning about a potential null dereference - but as we're in DataMemberLayoutItem we should be able to guarantee that the Symbol is a PDBSymbolData type, allowing us to use cast<PDBSymbolData> - and if not assert will fire for us.

llvm-svn: 371933

4 years ago[ARM] Masked loads and stores
David Green [Sun, 15 Sep 2019 14:14:47 +0000 (14:14 +0000)]
[ARM] Masked loads and stores

Masked loads and store fit naturally with MVE, the instructions being easily
predicated. This adds lowering for the simple cases of masked loads and stores.
It does not yet deal with widening/narrowing or pre/post inc, and so is
currently behind an option.

The llvm masked load intrinsic will accept a "passthru" value, dictating the
values used for the zero masked lanes. In MVE the instructions write 0 to the
zero predicated lanes, so we need to match a passthru that isn't 0 (or undef)
with a select instruction to pull in the correct data after the load.

Differential Revision: https://reviews.llvm.org/D67186

llvm-svn: 371932

4 years ago[SLP] limit vectorization of Constant subclasses (PR33958)
Sanjay Patel [Sun, 15 Sep 2019 13:03:24 +0000 (13:03 +0000)]
[SLP] limit vectorization of Constant subclasses (PR33958)

This is a fix for:
https://bugs.llvm.org/show_bug.cgi?id=33958

It seems universally true that we would not want to transform this kind of
sequence on any target, but if that's not correct, then we could view this
as a target-specific cost model problem. We could also white-list ConstantInt,
ConstantFP, etc. rather than blacklist Global and ConstantExpr.

Differential Revision: https://reviews.llvm.org/D67362

llvm-svn: 371931

4 years ago[ARM] Simplify and update vmla test. NFC
David Green [Sun, 15 Sep 2019 11:53:05 +0000 (11:53 +0000)]
[ARM] Simplify and update vmla test. NFC

llvm-svn: 371930

4 years ago[CodeEmitter] Improve testing for APInt encoding
James Molloy [Sun, 15 Sep 2019 08:44:40 +0000 (08:44 +0000)]
[CodeEmitter] Improve testing for APInt encoding

I missed Artem's comment in D67487 before committing.

Differential Revision: https://reviews.llvm.org/D67487

llvm-svn: 371929

4 years ago[CodeEmitter] Support instruction widths > 64 bits
James Molloy [Sun, 15 Sep 2019 08:35:08 +0000 (08:35 +0000)]
[CodeEmitter] Support instruction widths > 64 bits

Some VLIW instruction sets are Very Long Indeed. Using uint64_t constricts the Inst encoding to 64 bits (naturally).

This change switches CodeEmitter to a mode that uses APInts when Inst's bitwidth is > 64 bits (NFC for existing targets).

When Inst.BitWidth > 64 the prototype changes to:

  void TargetMCCodeEmitter::getBinaryCodeForInstr(const MCInst &MI,
                                                  SmallVectorImpl<MCFixup> &Fixups,
                                                  APInt &Inst,
                                                  APInt &Scratch,
                                                  const MCSubtargetInfo &STI);

The Inst parameter returns the encoded instruction, the Scratch parameter is used internally for manipulating operands and is exposed so that the underlying storage can be reused between calls to getBinaryCodeForInstr. The goal is to elide any APInt constructions that we can.

Similarly the operand encoding prototype changes to:

  getMachineOpValue(const MCInst &MI, const MCOperand &MO, APInt &op, SmallVectorImpl<MCFixup> &Fixups, const MCSubtargetInfo &STI);

That is, the operand is passed by reference as APInt rather than returned as uint64_t.

To reiterate, this APInt mode is enabled only when Inst.BitWidth > 64, so this change is NFC for existing targets.

llvm-svn: 371928

4 years agolld-link: Make Options.td formatting more self-consistent.
Nico Weber [Sat, 14 Sep 2019 23:41:42 +0000 (23:41 +0000)]
lld-link: Make Options.td formatting more self-consistent.

Also tighten up help strings for /force, --start-lib, and --end-lib.

Differential Revision: https://reviews.llvm.org/D67457

llvm-svn: 371927

4 years agocompiler-rt/builtins: Make check-builtins run tests on macOS.
Nico Weber [Sat, 14 Sep 2019 22:22:47 +0000 (22:22 +0000)]
compiler-rt/builtins: Make check-builtins run tests on macOS.

Differential Revision: https://reviews.llvm.org/D66984

llvm-svn: 371926

4 years agoAdd debug check for null pointers passed to <string_view>
Eric Fiselier [Sat, 14 Sep 2019 19:55:28 +0000 (19:55 +0000)]
Add debug check for null pointers passed to <string_view>

llvm-svn: 371925

4 years ago[Diagnostics] Added silence note for -Wsizeof-array-div; suggest extra parens
David Bolvansky [Sat, 14 Sep 2019 19:38:55 +0000 (19:38 +0000)]
[Diagnostics] Added silence note for -Wsizeof-array-div; suggest extra parens

llvm-svn: 371924

4 years ago[TargetLowering] SimplifyDemandedBits - add EXTRACT_SUBVECTOR support.
Simon Pilgrim [Sat, 14 Sep 2019 16:38:26 +0000 (16:38 +0000)]
[TargetLowering] SimplifyDemandedBits - add EXTRACT_SUBVECTOR support.

Call SimplifyDemandedBits on the source vector.

llvm-svn: 371923

4 years ago[lldb] Code cleanup: FormattersContainer.h: Use range-based for loops.
Jan Kratochvil [Sat, 14 Sep 2019 15:46:51 +0000 (15:46 +0000)]
[lldb] Code cleanup: FormattersContainer.h: Use range-based for loops.

Suggested for an other loop by Pavel Labath in:
https://reviews.llvm.org/D66654#inline-605808

llvm-svn: 371922

4 years ago[InstSimplify] simplifyUnsignedRangeCheck(): handle few tautological cases (PR43251)
Roman Lebedev [Sat, 14 Sep 2019 13:47:27 +0000 (13:47 +0000)]
[InstSimplify] simplifyUnsignedRangeCheck(): handle few tautological cases (PR43251)

Summary:
This is split off from D67356, since these cases produce a constant,
no real need to keep them in instcombine.

Alive proofs:
https://rise4fun.com/Alive/u7Fk
https://rise4fun.com/Alive/4lV

https://bugs.llvm.org/show_bug.cgi?id=43251

Reviewers: spatel, nikic, xbolva00

Reviewed By: spatel

Subscribers: hiraditya, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D67498

llvm-svn: 371921

4 years ago[clang-scan-deps] Add -M to work around -MT issue after r371918
Fangrui Song [Sat, 14 Sep 2019 07:25:27 +0000 (07:25 +0000)]
[clang-scan-deps] Add -M to work around -MT issue after r371918

gcc will complain if -MT is used but neither -M nor -MM is specified:

> cc1: error: to generate dependencies you must specify either -M or -MM

r371918 changed our behavior to match GCC, but apparently
clang-scan-deps is not happy.

llvm-svn: 371920

4 years ago[Driver] Fix multiple bugs related to dependency file options: -M -MM -MD -MMD -MT -MQ
Fangrui Song [Sat, 14 Sep 2019 06:01:22 +0000 (06:01 +0000)]
[Driver] Fix multiple bugs related to dependency file options: -M -MM -MD -MMD -MT -MQ

-M -o test.i => dependency file is test.d, not test.i
-MM -o test.i => dependency file is test.d, not test.i
-M -MMD => bogus warning -Wunused-command-line-argument
-M MT dummy => -w not rendered

llvm-svn: 371918

4 years ago[Driver] Improve Clang::getDependencyFileName and its tests after rC371853
Fangrui Song [Sat, 14 Sep 2019 04:13:15 +0000 (04:13 +0000)]
[Driver] Improve Clang::getDependencyFileName and its tests after rC371853

The test file name metadata-with-dots.c is confusing because -MD and -MMD
have nothing to do with metadata.

llvm-svn: 371917

4 years ago[ScheduleDAGMILive] Fix typo in comment.
Mingjie Xing [Sat, 14 Sep 2019 03:27:38 +0000 (03:27 +0000)]
[ScheduleDAGMILive] Fix typo in comment.

Differential Revision: https://reviews.llvm.org/D67478

llvm-svn: 371916

4 years ago[Attributor][Fix] Use right type to replace expressions
Johannes Doerfert [Sat, 14 Sep 2019 02:57:50 +0000 (02:57 +0000)]
[Attributor][Fix] Use right type to replace expressions

Summary: This should be obsolete once the functionality in D66967 is integrated.

Reviewers: uenoku, sstefan1

Subscribers: hiraditya, bollu, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D67231

llvm-svn: 371915

4 years ago[llvm-objcopy] Ignore -B --binary-architecture=
Fangrui Song [Sat, 14 Sep 2019 01:36:31 +0000 (01:36 +0000)]
[llvm-objcopy] Ignore -B --binary-architecture=

GNU objcopy documents that -B is only useful with architecture-less
input (i.e. "binary" or "ihex"). After D67144, -O defaults to -I, and
-B is essentially a NOP.

* If -O is binary/ihex, GNU objcopy ignores -B.
* If -O is elf*, -B provides the e_machine field in GNU objcopy.

So to convert a blob to an ELF, `-I binary -B i386:x86-64 -O elf64-x86-64` has to be specified.

`-I binary -B i386:x86-64 -O elf64-x86-64` creates an ELF with its
e_machine field set to EM_NONE in GNU objcopy, but a regular x86_64 ELF
in elftoolchain elfcopy. Follow the elftoolchain approach (ignoring -B)
to simplify code. Users that expect their command line portable should
specify -B.

Reviewed By: jhenderson

Differential Revision: https://reviews.llvm.org/D67215

llvm-svn: 371914

4 years ago[llvm-objcopy] Default --output-target to --input-target when unspecified
Fangrui Song [Sat, 14 Sep 2019 01:36:16 +0000 (01:36 +0000)]
[llvm-objcopy] Default --output-target to --input-target when unspecified

Fixes PR42171.

In GNU objcopy, if -O (--output-target) is not specified, the value is
copied from -I (--input-target).

```
objcopy -I binary -B i386:x86-64 a.txt b       # b is copied from a.txt
llvm-objcopy -I binary -B i386:x86-64 a.txt b  # b is an x86-64 object file
```

This patch changes our behavior to match GNU. With this change, we can
delete code related to -B handling (D67215).

Reviewed By: jakehehrlich

Differential Revision: https://reviews.llvm.org/D67144

llvm-svn: 371913

4 years ago[llvm-ar] Uncapitalize error messages and delete full stop
Fangrui Song [Sat, 14 Sep 2019 01:18:47 +0000 (01:18 +0000)]
[llvm-ar] Uncapitalize error messages and delete full stop

Most GNU binutils don't append full stops in error messages. This
convention has been adopted by a bunch of LLVM binary utilities. Make
llvm-ar follow the convention as well.

Reviewed By: grimar

Differential Revision: https://reviews.llvm.org/D67558

llvm-svn: 371912

4 years ago[llvm-objcopy] Add support for response files in llvm-strip and llvm-objcopy
Michael Pozulp [Sat, 14 Sep 2019 01:14:43 +0000 (01:14 +0000)]
[llvm-objcopy] Add support for response files in llvm-strip and llvm-objcopy

Summary: Addresses https://bugs.llvm.org/show_bug.cgi?id=42671

Reviewers: jhenderson, espindola, alexshap, rupprecht

Reviewed By: jhenderson

Subscribers: seiya, emaste, arichardson, jakehehrlich, MaskRay, abrachet, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D65372

llvm-svn: 371911