platform/upstream/llvm.git
5 years agoRevert "Fix lld detection in standalone compiler-rt."
Evgenii Stepanov [Tue, 22 Oct 2019 20:29:57 +0000 (13:29 -0700)]
Revert "Fix lld detection in standalone compiler-rt."

Breaks sanitizer-android buildbot.

This reverts commit d56203201f8a1f11abb913c4dfc0bf9c61432d1a.

5 years agofix a few typos to test git committing
Nico Weber [Tue, 22 Oct 2019 20:34:00 +0000 (16:34 -0400)]
fix a few typos to test git committing

5 years ago[RISCV] Add support for -ffixed-xX flags
Simon Cook [Tue, 22 Oct 2019 20:25:01 +0000 (21:25 +0100)]
[RISCV] Add support for -ffixed-xX flags

This adds support for reserving GPRs such that the compiler will not
choose a register for register allocation. The implementation follows
the same design as for AArch64; each reserved register becomes a target
feature and used for getting the reserved registers for a given
MachineFunction. The backend checks that it does not need to write to
any reserved register; if it does a relevant error is generated.

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

5 years ago[HIP] Add option -fgpu-allow-device-init
Yaxun (Sam) Liu [Tue, 22 Oct 2019 17:41:25 +0000 (13:41 -0400)]
[HIP] Add option -fgpu-allow-device-init

Add this option to allow device side class type global variables
with non-trivial ctor/dtor. device side init/fini functions will
be emitted, which will be executed by HIP runtime when
the fat binary is loaded/unloaded.

This feature is to facilitate implementation of device side
sanitizer which requires global vars with non-trival ctors.

By default this option is disabled.

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

5 years ago[DAGCombine][ARM] x ==/!= c -> (x - c) ==/!= 0 iff '-c' can be folded into the...
Roman Lebedev [Tue, 22 Oct 2019 19:51:10 +0000 (22:51 +0300)]
[DAGCombine][ARM] x ==/!= c  ->  (x - c) ==/!= 0  iff '-c' can be folded into the x node.

Summary:
This fold, helps recover from the rest of the D62266 ARM regressions.
https://rise4fun.com/Alive/TvpC

Note that while the fold is quite flexible, i've restricted it
to the single interesting pattern at the moment.

Reviewers: efriedma, craig.topper, spatel, RKSimon, deadalnix

Reviewed By: deadalnix

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

Tags: #llvm

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

5 years ago[NFC][LVI][CVP] Tests where pre-specified `add` no-wrap flags could be used by LVI
Roman Lebedev [Tue, 22 Oct 2019 19:16:46 +0000 (22:16 +0300)]
[NFC][LVI][CVP] Tests where pre-specified `add` no-wrap flags could be used by LVI

There's `ConstantRange::addWithNoWrap()`, LVI could use it to further
constrain the range, if an `add` already has some no-wrap flags specified.

5 years ago[AMDGPU] Updated fold-vgpr-copy.mir test. NFC.
Stanislav Mekhanoshin [Tue, 22 Oct 2019 19:43:23 +0000 (12:43 -0700)]
[AMDGPU] Updated fold-vgpr-copy.mir test. NFC.

5 years agoRelax assertions when there's really no entries. [NFC]
Michael Liao [Tue, 22 Oct 2019 16:11:25 +0000 (12:11 -0400)]
Relax assertions when there's really no entries. [NFC]

5 years agoTest commit - add clarification to README regarding Darwin.
Kit Barton [Tue, 22 Oct 2019 18:39:15 +0000 (11:39 -0700)]
Test commit - add clarification to README regarding Darwin.

5 years ago[AMDGPU] Allow tied operand subreg folding
Stanislav Mekhanoshin [Tue, 22 Oct 2019 18:07:15 +0000 (11:07 -0700)]
[AMDGPU] Allow tied operand subreg folding

Turns out it makes sense, contrarily to what comment said.

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

5 years agogn build: make sync build work with git revs now that svn is gone
Nico Weber [Tue, 22 Oct 2019 16:54:00 +0000 (12:54 -0400)]
gn build: make sync build work with git revs now that svn is gone

5 years ago[lldb] Adjust for the new class_rw_t layout.
Jonas Devlieghere [Tue, 22 Oct 2019 17:18:02 +0000 (10:18 -0700)]
[lldb] Adjust for the new class_rw_t layout.

The field holding the "ro" will now be a union. If the low bit is set,
then it isn't an ro and it needs to be dereferenced once more to get to
it. If the low bit isn't set, then it is a proper class_ro_t

No dedicated test is needed as this code path will trigger when running
the existing Objective-C tests under a current version of the runtime.

5 years agoUpdate git-llvm script to push to GitHub
Tom Stellard [Tue, 22 Oct 2019 16:19:39 +0000 (09:19 -0700)]
Update git-llvm script to push to GitHub

Summary:
Note: This patch should not be pushed until SVN has become read-only.
It should be the first patch committed directly to GitHub.

This patch updates git-llvm to check for merge commits and then push
changes to GitHub if none are found.  All logic related to SVN has been
removed.

Reviewers: jyknight

Subscribers: lenary, llvm-commits

Tags: #llvm

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

5 years ago[InstCombine] Signed saturation patterns
David Green [Tue, 22 Oct 2019 15:39:47 +0000 (15:39 +0000)]
[InstCombine] Signed saturation patterns

This adds an instcombine matcher for code that attempts to perform signed
saturating arithmetic by casting to a higher type. Unsigned cases are already
matched, this adds extra matches for the more complex signed cases, which
involves matching the min(max(add a b)) nodes with proper extends to ensure
legality.

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

llvm-svn: 375505

5 years ago [libcxx] Remove shared_ptr::make_shared
Zoe Carver [Tue, 22 Oct 2019 15:16:49 +0000 (15:16 +0000)]
[libcxx] Remove shared_ptr::make_shared

    Summary: This patch removes `shared_ptr::make_shared` as it is not part of the standard. This patch also adds __create_with_cntrl_block, which is a help function that can be used in std::allocate_shared and std::make_shared. This is the third patch (out of 4) from D66178.

    Reviewers: EricWF, mclow.lists, ldionne

    Subscribers: christof, dexonsmith, libcxx-commits

    Tags: #libc

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

llvm-svn: 375504

5 years ago[InstCombine] Signed saturation tests. NFC
David Green [Tue, 22 Oct 2019 14:49:40 +0000 (14:49 +0000)]
[InstCombine] Signed saturation tests. NFC

llvm-svn: 375503

5 years ago[MIParser] Set RegClassOrRegBank during instruction parsing
Petar Avramovic [Tue, 22 Oct 2019 14:25:37 +0000 (14:25 +0000)]
[MIParser] Set RegClassOrRegBank during instruction parsing

MachineRegisterInfo::createGenericVirtualRegister sets
RegClassOrRegBank to static_cast<RegisterBank *>(nullptr).
MIParser on the other hand doesn't. When we attempt to constrain
Register Class on such VReg, additional COPY is generated.
This way we avoid COPY instructions showing in test that have MIR
input while they are not present with llvm-ir input that was used
to create given MIR for a -run-pass test.

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

llvm-svn: 375502

5 years ago[MIPS GlobalISel] Select MSA vector generic and builtin add
Petar Avramovic [Tue, 22 Oct 2019 13:51:57 +0000 (13:51 +0000)]
[MIPS GlobalISel] Select MSA vector generic and builtin add

Select vector G_ADD for MIPS32 with MSA. We have to set bank
for vector operands to fprb and selectImpl will do the rest.
__builtin_msa_addv_<format> will be transformed into G_ADD
in legalizeIntrinsic and selected in the same way.
__builtin_msa_addvi_<format> will be directly selected into
ADDVI_<format> in legalizeIntrinsic. MIR tests for it have
unnecessary additional copies. Capture current state of tests
with run-pass=legalizer with a test in test/CodeGen/MIR/Mips.

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

llvm-svn: 375501

5 years ago[ThinLTO] Add code comment. NFC
Eugene Leviant [Tue, 22 Oct 2019 12:57:23 +0000 (12:57 +0000)]
[ThinLTO] Add code comment. NFC

llvm-svn: 375500

5 years ago[Alignment][NFC] Convert StoreInst to MaybeAlign
Guillaume Chatelet [Tue, 22 Oct 2019 12:55:32 +0000 (12:55 +0000)]
[Alignment][NFC] Convert StoreInst to MaybeAlign

Summary:
This is patch is part of a series to introduce an Alignment type.
See this thread for context: http://lists.llvm.org/pipermail/llvm-dev/2019-July/133851.html
See this patch for the introduction of the type: https://reviews.llvm.org/D64790

Reviewers: courbet

Subscribers: hiraditya, jfb, llvm-commits

Tags: #llvm

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

llvm-svn: 375499

5 years ago[Alignment][NFC] Convert LoadInst to MaybeAlign
Guillaume Chatelet [Tue, 22 Oct 2019 12:35:55 +0000 (12:35 +0000)]
[Alignment][NFC] Convert LoadInst to MaybeAlign

Summary:
This is patch is part of a series to introduce an Alignment type.
See this thread for context: http://lists.llvm.org/pipermail/llvm-dev/2019-July/133851.html
See this patch for the introduction of the type: https://reviews.llvm.org/D64790

Reviewers: courbet

Subscribers: hiraditya, jfb, llvm-commits

Tags: #llvm

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

llvm-svn: 375498

5 years ago[PowerPC] Turn on CR-Logical reducer pass
Nemanja Ivanovic [Tue, 22 Oct 2019 12:20:38 +0000 (12:20 +0000)]
[PowerPC] Turn on CR-Logical reducer pass

This re-commits r375152 which was pulled in r375233 because it broke
the EXPENSIVE_CHECKS bot on Windows.

The reason for the failure was a bug in the pass that the commit turned
on by default. This patch fixes that bug and turns the pass back on.
This patch has been verified on the buildbot that originally failed
thanks to Simon Pilgrim.

Differential revision: https://reviews.llvm.org/D52431

llvm-svn: 375497

5 years ago[Alignment][NFC] Use MaybeAlign in AttrBuilder
Guillaume Chatelet [Tue, 22 Oct 2019 11:57:52 +0000 (11:57 +0000)]
[Alignment][NFC] Use MaybeAlign in AttrBuilder

Summary:
This is patch is part of a series to introduce an Alignment type.
See this thread for context: http://lists.llvm.org/pipermail/llvm-dev/2019-July/133851.html
See this patch for the introduction of the type: https://reviews.llvm.org/D64790

Reviewers: courbet

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

llvm-svn: 375496

5 years ago[Alignment][NFC] Attributes use Align/MaybeAlign
Guillaume Chatelet [Tue, 22 Oct 2019 09:51:06 +0000 (09:51 +0000)]
[Alignment][NFC] Attributes use Align/MaybeAlign

Summary:
This is patch is part of a series to introduce an Alignment type.
See this thread for context: http://lists.llvm.org/pipermail/llvm-dev/2019-July/133851.html
See this patch for the introduction of the type: https://reviews.llvm.org/D64790

Reviewers: courbet

Subscribers: jholewinski, hiraditya, llvm-commits

Tags: #llvm

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

llvm-svn: 375495

5 years ago[ThinLTO] Don't internalize during promotion
Eugene Leviant [Tue, 22 Oct 2019 09:24:12 +0000 (09:24 +0000)]
[ThinLTO] Don't internalize during promotion

Differential revision: https://reviews.llvm.org/D69107

llvm-svn: 375493

5 years ago[LLVMDebugInfoPDB] - Use cantFail() instead of assert().
George Rimar [Tue, 22 Oct 2019 08:52:45 +0000 (08:52 +0000)]
[LLVMDebugInfoPDB] - Use cantFail() instead of assert().

Currently injected-sources-native.test fails with "Expected<T>
value was in success state.
(Note: Expected<T> values in success mode must still be checked
prior to being destroyed)"
when llvm is compiled with LLVM_ENABLE_ABI_BREAKING_CHECKS in Release.

The problem is that getStringForID returns Expected<StringRef>
and Expected value must always be checked, even if it is in success state.
Checking with assert only helps in Debug and is wrong.

Differential revision: https://reviews.llvm.org/D69251

llvm-svn: 375492

5 years ago[FrontendTests] Try again to make test not write an output file
Benjamin Kramer [Tue, 22 Oct 2019 08:44:34 +0000 (08:44 +0000)]
[FrontendTests] Try again to make test not write an output file

Setting the output stream to nulls seems to work.

llvm-svn: 375491

5 years ago[builtins][test] Avoid unportable mmap call in clear_cache_test.c
Rainer Orth [Tue, 22 Oct 2019 08:44:25 +0000 (08:44 +0000)]
[builtins][test] Avoid unportable mmap call in clear_cache_test.c

Within the last two weeks, the Builtins-*-sunos :: clear_cache_test.c started to FAIL
on Solaris.  Running it under truss shows

  mmap(0x00000000, 128, PROT_READ|PROT_WRITE|PROT_EXEC, MAP_PRIVATE|MAP_ANON, 0, 0) Err#22 EINVAL
  _exit(1)

While there are several possible reasons mmap can return EINVAL on Solaris, it turns
out it's this one (from mmap(2)):

  MAP_ANON  was  specified,  but the file descriptor was not
   -1.

And indeed even the Linux mmap(2) documents this as unportable:

  MAP_ANONYMOUS
          The mapping is not backed by any file; its contents are initial‐
          ized to zero.  The fd argument is ignored; however, some  imple‐
          mentations require fd to be -1 if MAP_ANONYMOUS (or MAP_ANON) is
          specified, and portable applications should  ensure  this.   The

This patch follows this advise.  Tested on x86_64-pc-linux-gnu, amd64-pc-solaris2.11
and sparcv9-sun-solaris2.11.

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

llvm-svn: 375490

5 years agoRevert "[FrontendTests] Don't actually run the full compiler, parsing is sufficient."
Benjamin Kramer [Tue, 22 Oct 2019 08:37:15 +0000 (08:37 +0000)]
Revert "[FrontendTests] Don't actually run the full compiler, parsing is sufficient."

This reverts commit 375488.

llvm-svn: 375489

5 years ago[FrontendTests] Don't actually run the full compiler, parsing is sufficient.
Benjamin Kramer [Tue, 22 Oct 2019 08:10:51 +0000 (08:10 +0000)]
[FrontendTests] Don't actually run the full compiler, parsing is sufficient.

llvm-svn: 375488

5 years ago[clang-fuzzer] Update proto fuzzer example for r375453.
Benjamin Kramer [Tue, 22 Oct 2019 07:51:37 +0000 (07:51 +0000)]
[clang-fuzzer] Update proto fuzzer example for r375453.

llvm-svn: 375487

5 years ago[CMake] [WinMsvc] Look for includes and libs in ${MSVC_BASE}/atlmfc
Martin Storsjo [Tue, 22 Oct 2019 06:36:27 +0000 (06:36 +0000)]
[CMake] [WinMsvc] Look for includes and libs in ${MSVC_BASE}/atlmfc

This is necessary if building with the DIA SDK enabled.

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

llvm-svn: 375486

5 years ago[CMake] Allow overriding MSVC_DIA_SDK_DIR via CMake
Martin Storsjo [Tue, 22 Oct 2019 06:36:21 +0000 (06:36 +0000)]
[CMake] Allow overriding MSVC_DIA_SDK_DIR via CMake

This eases using it in cross-msvc setups.

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

llvm-svn: 375485

5 years agogn build: Merge r375483
GN Sync Bot [Tue, 22 Oct 2019 05:09:35 +0000 (05:09 +0000)]
gn build: Merge r375483

llvm-svn: 375484

5 years agoRefactor DependencyScanningTool to its own file
Kousik Kumar [Tue, 22 Oct 2019 05:05:18 +0000 (05:05 +0000)]
Refactor DependencyScanningTool to its own file

Summary:
There's no behavior change - just moving DependencyScanningTool to its own file
since this tool can be reused across both clang-scan-deps binary and an interface
exposed as part of libClang APIs.

Reviewers: arphaman, jkorous, Bigcheese, dexonsmith

Subscribers: mgorny, cfe-commits

Tags: #clang

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

llvm-svn: 375483

5 years agoMinor coding style fix. NFC.
Michael Liao [Tue, 22 Oct 2019 04:32:30 +0000 (04:32 +0000)]
Minor coding style fix. NFC.

llvm-svn: 375478

5 years agofix PythonDataObjectsTest.TestExceptions on windows
Lawrence D'Anna [Tue, 22 Oct 2019 04:00:37 +0000 (04:00 +0000)]
fix PythonDataObjectsTest.TestExceptions on windows

Looks like on windows googlemock regexes treat newlines differently
from on darwin.    This patch fixes the regex in this test so it
will work on both.

Fixes: https://reviews.llvm.org/D69214
llvm-svn: 375477

5 years agoremove multi-argument form of PythonObject::Reset()
Lawrence D'Anna [Tue, 22 Oct 2019 02:32:37 +0000 (02:32 +0000)]
remove multi-argument form of PythonObject::Reset()

Summary:
With this patch, only the no-argument form of `Reset()` remains in
PythonDataObjects.   It also deletes PythonExceptionState in favor of
PythonException, because the only call-site of PythonExceptionState was
also using Reset, so I cleaned up both while I was there.

Reviewers: JDevlieghere, clayborg, labath, jingham

Reviewed By: labath

Subscribers: mgorny, lldb-commits

Tags: #lldb

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

llvm-svn: 375475

5 years ago[lit] Move increase_process_limit to ParallelRun
Julian Lettner [Tue, 22 Oct 2019 01:13:30 +0000 (01:13 +0000)]
[lit] Move increase_process_limit to ParallelRun

Increasing the process limit only makes sense when we use multiple
processes.

llvm-svn: 375474

5 years agoFix lld detection in standalone compiler-rt.
Evgeniy Stepanov [Mon, 21 Oct 2019 23:59:45 +0000 (23:59 +0000)]
Fix lld detection in standalone compiler-rt.

Summary:
Right now all hwasan tests on Android are silently disabled because they
require "has_lld" and standalone compiler-rt can not (and AFAIK was
never able to) set it.

Reviewers: pcc, dyung

Subscribers: dberris, mgorny, #sanitizers, llvm-commits

Tags: #sanitizers, #llvm

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

llvm-svn: 375472

5 years ago[hwasan] Workaround unwinder issues in try-catch test.
Evgeniy Stepanov [Mon, 21 Oct 2019 23:57:12 +0000 (23:57 +0000)]
[hwasan] Workaround unwinder issues in try-catch test.

Android links the unwinder library to every DSO. The problem is,
unwinder has global state, and hwasan implementation of personality
function wrapper happens to rub it the wrong way.

Switch the test to static libc++ as a temporary workaround.

llvm-svn: 375471

5 years ago[X86][BMI] Pull out schedule classes from bmi_andn<> and bmi_bls<>
Simon Pilgrim [Mon, 21 Oct 2019 23:41:40 +0000 (23:41 +0000)]
[X86][BMI] Pull out schedule classes from bmi_andn<> and bmi_bls<>

Stop hardwiring classes

llvm-svn: 375470

5 years ago[NFC] Fix typos in CMake comment
Louis Dionne [Mon, 21 Oct 2019 23:38:32 +0000 (23:38 +0000)]
[NFC] Fix typos in CMake comment

llvm-svn: 375469

5 years agoFix -fuse-init-array decision logic on NetBSD
Joerg Sonnenberger [Mon, 21 Oct 2019 23:35:33 +0000 (23:35 +0000)]
Fix -fuse-init-array decision logic on NetBSD

For NetBSD 9 and later, it is the default. On older versions, only ARM
and AArch64 use it by default.

llvm-svn: 375468

5 years ago[Implicit Modules] Add -cc1 option -fmodules-strict-context-hash which includes searc...
Michael J. Spencer [Mon, 21 Oct 2019 22:51:13 +0000 (22:51 +0000)]
[Implicit Modules] Add -cc1 option -fmodules-strict-context-hash which includes search paths and diagnostics.

This is a recommit of r375322 and r375327 with a fix for the Windows test breakage.

llvm-svn: 375466

5 years agowhitespace cleanup
Adrian Prantl [Mon, 21 Oct 2019 22:48:27 +0000 (22:48 +0000)]
whitespace cleanup

llvm-svn: 375465

5 years agoFactor out common test functionality into a helper class. (NFC)
Adrian Prantl [Mon, 21 Oct 2019 22:46:53 +0000 (22:46 +0000)]
Factor out common test functionality into a helper class. (NFC)

llvm-svn: 375464

5 years ago[X86][SSE] Add OR(EXTRACTELT(X,0),OR(EXTRACTELT(X,1))) -> MOVMSK+CMP reduction combine
Simon Pilgrim [Mon, 21 Oct 2019 22:36:31 +0000 (22:36 +0000)]
[X86][SSE] Add OR(EXTRACTELT(X,0),OR(EXTRACTELT(X,1))) -> MOVMSK+CMP reduction combine

llvm-svn: 375463

5 years ago[X86][SSE] Add OR(EXTRACTELT(X,0),OR(EXTRACTELT(X,1))) movmsk v2X64 tests
Simon Pilgrim [Mon, 21 Oct 2019 22:36:07 +0000 (22:36 +0000)]
[X86][SSE] Add OR(EXTRACTELT(X,0),OR(EXTRACTELT(X,1))) movmsk v2X64 tests

llvm-svn: 375462

5 years ago[examples] Add a dependency on ExecutionEngine to LLJITWithObjectCache example.
Lang Hames [Mon, 21 Oct 2019 22:29:29 +0000 (22:29 +0000)]
[examples] Add a dependency on ExecutionEngine to LLJITWithObjectCache example.

ExecutionEngine.cpp contains the anchor() for the ObjectCache base class, so we
need an explicit dependency on it.

Patch by Stephen Neuendorffer. Thanks Stephen!

llvm-svn: 375461

5 years agoAMDGPU/GlobalISel: Legalize fast unsafe FDIV
Austin Kerbow [Mon, 21 Oct 2019 22:18:26 +0000 (22:18 +0000)]
AMDGPU/GlobalISel: Legalize fast unsafe FDIV

Reviewers: arsenm

Reviewed By: arsenm

Subscribers: kzhuravl, jvesely, wdng, nhaehnle, yaxunl, rovka, dstuttard, tpr, t-tye, hiraditya, Petar.Avramovic, llvm-commits

Tags: #llvm

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

llvm-svn: 375460

5 years agoXFAIL TestLocalVariables.py on Windows
Jonas Devlieghere [Mon, 21 Oct 2019 22:16:28 +0000 (22:16 +0000)]
XFAIL TestLocalVariables.py on Windows

This test has been failing for a while on the Windows bot.

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

llvm-svn: 375459

5 years ago[lit] Simplify test scheduling via multiprocessing.Pool
Julian Lettner [Mon, 21 Oct 2019 21:57:18 +0000 (21:57 +0000)]
[lit] Simplify test scheduling via multiprocessing.Pool

llvm-svn: 375458

5 years agoAMDGPU: Select basic interp directly from intrinsics
Matt Arsenault [Mon, 21 Oct 2019 21:49:44 +0000 (21:49 +0000)]
AMDGPU: Select basic interp directly from intrinsics

llvm-svn: 375457

5 years ago[lit] Remove redundancy from names and comments
Julian Lettner [Mon, 21 Oct 2019 21:41:59 +0000 (21:41 +0000)]
[lit] Remove redundancy from names and comments

llvm-svn: 375456

5 years ago[CVP] No-wrap deduction for `shl`
Roman Lebedev [Mon, 21 Oct 2019 21:31:19 +0000 (21:31 +0000)]
[CVP] No-wrap deduction for `shl`

Summary:
This is the last `OverflowingBinaryOperator` for which we don't deduce flags.
D69217 taught `ConstantRange::makeGuaranteedNoWrapRegion()` about it.

The effect is better than of the `mul` patch (D69203):

| statistic                              |     old |     new | delta | % change |
| correlated-value-propagation.NumAddNUW |    7145 |    7144 |    -1 | -0.0140% |
| correlated-value-propagation.NumAddNW  |   12126 |   12125 |    -1 | -0.0082% |
| correlated-value-propagation.NumAnd    |     443 |     446 |     3 |  0.6772% |
| correlated-value-propagation.NumNSW    |    5986 |    7158 |  1172 | 19.5790% |
| correlated-value-propagation.NumNUW    |   10512 |   13304 |  2792 | 26.5601% |
| correlated-value-propagation.NumNW     |   16498 |   20462 |  3964 | 24.0272% |
| correlated-value-propagation.NumShlNSW |       0 |    1172 |  1172 |          |
| correlated-value-propagation.NumShlNUW |       0 |    2793 |  2793 |          |
| correlated-value-propagation.NumShlNW  |       0 |    3965 |  3965 |          |
| instcount.NumAShrInst                  |   13824 |   13790 |   -34 | -0.2459% |
| instcount.NumAddInst                   |  277584 |  277586 |     2 |  0.0007% |
| instcount.NumAndInst                   |   66061 |   66056 |    -5 | -0.0076% |
| instcount.NumBrInst                    |  709153 |  709147 |    -6 | -0.0008% |
| instcount.NumICmpInst                  |  483709 |  483708 |    -1 | -0.0002% |
| instcount.NumSExtInst                  |   79497 |   79496 |    -1 | -0.0013% |
| instcount.NumShlInst                   |   40691 |   40654 |   -37 | -0.0909% |
| instcount.NumSubInst                   |   61997 |   61996 |    -1 | -0.0016% |
| instcount.NumZExtInst                  |   68208 |   68211 |     3 |  0.0044% |
| instcount.TotalBlocks                  |  843916 |  843910 |    -6 | -0.0007% |
| instcount.TotalInsts                   | 7387528 | 7387448 |   -80 | -0.0011% |

Reviewers: nikic, reames, sanjoy, timshen

Reviewed By: nikic

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

llvm-svn: 375455

5 years agoFound more timeouts to unify.
Adrian Prantl [Mon, 21 Oct 2019 20:50:45 +0000 (20:50 +0000)]
Found more timeouts to unify.

llvm-svn: 375454

5 years ago[clang-fuzzer] Add new fuzzer target for Objective-C
David Goldman [Mon, 21 Oct 2019 20:45:02 +0000 (20:45 +0000)]
[clang-fuzzer] Add new fuzzer target for Objective-C

Summary:
- Similar to that of `clang-fuzzer` itself but instead only
  targets Objective-C source files via cc1

- Also adds an example corpus directory containing some
  input for Objective-C

Subscribers: mgorny, jfb, cfe-commits

Tags: #clang

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

llvm-svn: 375453

5 years ago[GISel][CombinerHelper] Add a combine turning shuffle_vector into concat_vectors
Quentin Colombet [Mon, 21 Oct 2019 20:39:58 +0000 (20:39 +0000)]
[GISel][CombinerHelper] Add a combine turning shuffle_vector into concat_vectors

Teach the CombinerHelper how to turn shuffle_vectors, that
concatenate vectors, into concat_vectors and add this combine
to the AArch64 pre-legalizer combiner.

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

llvm-svn: 375452

5 years agoAMDGPU: Use CopyToReg for interp intrinsic lowering
Matt Arsenault [Mon, 21 Oct 2019 19:53:49 +0000 (19:53 +0000)]
AMDGPU: Use CopyToReg for interp intrinsic lowering

This doesn't use the default value, so doesn't benefit from the hack
to help optimize it.

llvm-svn: 375450

5 years agoAMDGPU: Erase redundant redefs of m0 in SIFoldOperands
Matt Arsenault [Mon, 21 Oct 2019 19:53:46 +0000 (19:53 +0000)]
AMDGPU: Erase redundant redefs of m0 in SIFoldOperands

Only handle simple inter-block redefs of m0 to the same value. This
avoids interference from redefs of m0 in SILoadStoreOptimzer. I was
initially teaching that pass to ignore redefs of m0, but having them
not exist beforehand is much simpler.

This is in preparation for deleting the current special m0 handling in
SIFixSGPRCopies to allow the register coalescer to handle the
difficult cases.

llvm-svn: 375449

5 years agoAMDGPU: Stop adding m0 implicit def to SGPR spills
Matt Arsenault [Mon, 21 Oct 2019 19:42:29 +0000 (19:42 +0000)]
AMDGPU: Stop adding m0 implicit def to SGPR spills

r375293 removed the SGPR spilling with scalar stores path, so this is
no longer necessary. This also always had the defect of adding the def
even when this path wasn't in use.

llvm-svn: 375448

5 years agoAMDGPU: Slightly restructure m0 init code
Matt Arsenault [Mon, 21 Oct 2019 19:42:26 +0000 (19:42 +0000)]
AMDGPU: Slightly restructure m0 init code

This will allow using another operation to produce the glue in a
future change.

llvm-svn: 375447

5 years ago[AMDGPU] Select AGPR in PHI operand legalization
Stanislav Mekhanoshin [Mon, 21 Oct 2019 19:25:27 +0000 (19:25 +0000)]
[AMDGPU] Select AGPR in PHI operand legalization

If a PHI defines AGPR legalize its operands to AGPR.
At the moment we can get an AGPR PHI with VGPR operands.
I am not aware of any problems as it seems to be handled
gracefully in RA, but this is not right anyway.

It also slightly decreases VGPR pressure in some cases
because we do not have to a copy via VGPR.

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

llvm-svn: 375446

5 years ago[X86] Rename matchBitOpReduction to matchScalarReduction. NFCI.
Simon Pilgrim [Mon, 21 Oct 2019 19:19:50 +0000 (19:19 +0000)]
[X86] Rename matchBitOpReduction to matchScalarReduction. NFCI.

This doesn't need to be just for bitops, but the ops do need to be fully associative.

llvm-svn: 375445

5 years agoReverted r375425 as it broke some buildbots.
Sander de Smalen [Mon, 21 Oct 2019 19:11:40 +0000 (19:11 +0000)]
Reverted r375425 as it broke some buildbots.

llvm-svn: 375444

5 years agoSemaTemplateDeduction - silence static analyzer getAs<> null dereference warnings...
Simon Pilgrim [Mon, 21 Oct 2019 19:08:31 +0000 (19:08 +0000)]
SemaTemplateDeduction - silence static analyzer getAs<> null dereference warnings. NFCI.

The static analyzer is warning about potential null dereferences, but in these cases we should be able to use castAs<> directly and if not assert will fire for us.

llvm-svn: 375443

5 years ago[Clang] Add VerboseOutputStream to CompilerInstance
Scott Linder [Mon, 21 Oct 2019 19:04:56 +0000 (19:04 +0000)]
[Clang] Add VerboseOutputStream to CompilerInstance

Remove one instance of a hardcoded output stream in
CompilerInstance::ExecuteAction. There are still other cases of output
being hard-coded to standard streams in ExecuteCompilerInvocation, but
this patch covers the case when no flags like -version or -help are
passed, namely the "X warnings and Y errors generated." diagnostic.

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

llvm-svn: 375442

5 years ago[NFC][CVP] Add `shl` no-wrap deduction test coverage
Roman Lebedev [Mon, 21 Oct 2019 18:35:26 +0000 (18:35 +0000)]
[NFC][CVP] Add `shl` no-wrap deduction test coverage

llvm-svn: 375441

5 years agoSemaExceptionSpec - silence static analyzer getAs<> null dereference warnings. NFCI.
Simon Pilgrim [Mon, 21 Oct 2019 18:28:31 +0000 (18:28 +0000)]
SemaExceptionSpec - silence static analyzer getAs<> null dereference warnings. NFCI.

The static analyzer is warning about potential null dereferences, but in these cases we should be able to use castAs<> directly and if not assert will fire for us.

llvm-svn: 375440

5 years ago[test] Merge Driver/as-w-warnings.c into as-no-warnings.c
Fangrui Song [Mon, 21 Oct 2019 18:04:52 +0000 (18:04 +0000)]
[test] Merge Driver/as-w-warnings.c into as-no-warnings.c

For -integrated-as RUN lines we can remove -target.

llvm-svn: 375439

5 years agoPrune include of DataLayout.h from include/clang/Basic/TargetInfo.h. NFC
Bjorn Pettersson [Mon, 21 Oct 2019 17:58:14 +0000 (17:58 +0000)]
Prune include of DataLayout.h from include/clang/Basic/TargetInfo.h. NFC

Summary:
Use a forward declaration of DataLayout instead of including
DataLayout.h in clangs TargetInfo.h. This reduces include
dependencies toward DataLayout.h (and other headers such as
DerivedTypes.h, Type.h that is included by DataLayout.h).

Needed to move implemantation of TargetInfo::resetDataLayout
from TargetInfo.h to TargetInfo.cpp.

Reviewers: rnk

Reviewed By: rnk

Subscribers: jvesely, nhaehnle, cfe-commits, llvm-commits

Tags: #clang

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

llvm-svn: 375438

5 years agoPrune Pass.h include from DataLayout.h. NFCI
Bjorn Pettersson [Mon, 21 Oct 2019 17:51:54 +0000 (17:51 +0000)]
Prune Pass.h include from DataLayout.h. NFCI

Summary:
Reduce include dependencies by no longer including Pass.h from
DataLayout.h. That include seemed irrelevant to DataLayout, as
well as being irrelevant to several users of DataLayout.

Reviewers: rnk

Reviewed By: rnk

Subscribers: mehdi_amini, hiraditya, cfe-commits, llvm-commits

Tags: #clang, #llvm

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

llvm-svn: 375436

5 years ago[PowerPC] Regenerate test for D52431
Simon Pilgrim [Mon, 21 Oct 2019 17:45:51 +0000 (17:45 +0000)]
[PowerPC] Regenerate test for D52431

llvm-svn: 375435

5 years agoFix Wdocumentation warning. NFCI.
Simon Pilgrim [Mon, 21 Oct 2019 17:45:18 +0000 (17:45 +0000)]
Fix Wdocumentation warning. NFCI.

llvm-svn: 375434

5 years ago[NFC] Add missing include to fix modules build
Raphael Isemann [Mon, 21 Oct 2019 17:43:38 +0000 (17:43 +0000)]
[NFC] Add missing include to fix modules build

This header doesn't seem to be parsable on its own and breaks the module build therefore with
the following error:

While building module 'LLVM_Backend' imported from llvm-project/llvm/lib/CodeGen/MachineScheduler.cpp:14:
In file included from <module-includes>:62:
llvm-project/llvm/include/llvm/CodeGen/MachinePipeliner.h:91:20: error: declaration of 'AAResultsWrapperPass' must be imported from module 'LLVM_Analysis.AliasAnalysis' before it is required
    AU.addRequired<AAResultsWrapperPass>();
                   ^
llvm-project/llvm/include/llvm/Analysis/AliasAnalysis.h:1157:7: note: previous declaration is here
class AAResultsWrapperPass : public FunctionPass {
      ^
llvm-project/llvm/lib/CodeGen/MachineScheduler.cpp:14:10: fatal error: could not build module 'LLVM_Backend'
 ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2 errors generated.

llvm-svn: 375433

5 years agoUnify timeouts in gdbserver tests and ensure they are larger if ASAN is enabled.
Adrian Prantl [Mon, 21 Oct 2019 17:19:42 +0000 (17:19 +0000)]
Unify timeouts in gdbserver tests and ensure they are larger if ASAN is enabled.

llvm-svn: 375431

5 years agoSystemZISelLowering - supportedAddressingMode - silence static analyzer dyn_cast...
Simon Pilgrim [Mon, 21 Oct 2019 17:16:03 +0000 (17:16 +0000)]
SystemZISelLowering - supportedAddressingMode - silence static analyzer dyn_cast<> null dereference warning. NFCI.

The static analyzer is warning about a potential null dereference, but we should be able to use cast<> directly and if not assert will fire for us.

llvm-svn: 375430

5 years agoGVNHoist - silence static analyzer dyn_cast<> null dereference warning in hasEHOrLoad...
Simon Pilgrim [Mon, 21 Oct 2019 17:15:49 +0000 (17:15 +0000)]
GVNHoist - silence static analyzer dyn_cast<> null dereference warning in hasEHOrLoadsOnPath call. NFCI.

The static analyzer is warning about a potential null dereference, but we should be able to use cast<> directly and if not assert will fire for us.

llvm-svn: 375429

5 years agoGuardWidening - silence static analyzer null dereference warning with assertion....
Simon Pilgrim [Mon, 21 Oct 2019 17:15:37 +0000 (17:15 +0000)]
GuardWidening - silence static analyzer null dereference warning with assertion. NFCI.

llvm-svn: 375428

5 years agoCrossDSOCFI - silence static analyzer dyn_cast<> null dereference warning. NFCI.
Simon Pilgrim [Mon, 21 Oct 2019 17:15:25 +0000 (17:15 +0000)]
CrossDSOCFI - silence static analyzer dyn_cast<> null dereference warning. NFCI.

The static analyzer is warning about a potential null dereference, but we should be able to use cast<> directly and if not assert will fire for us.

llvm-svn: 375427

5 years agoIndVarSimplify - silence static analyzer dyn_cast<> null dereference warning. NFCI.
Simon Pilgrim [Mon, 21 Oct 2019 17:15:05 +0000 (17:15 +0000)]
IndVarSimplify - silence static analyzer dyn_cast<> null dereference warning. NFCI.

The static analyzer is warning about a potential null dereference, but we should be able to use cast<> directly and if not assert will fire for us.

llvm-svn: 375426

5 years ago[AArch64][DebugInfo] Do not recompute CalleeSavedStackSize (Take 2)
Sander de Smalen [Mon, 21 Oct 2019 17:12:56 +0000 (17:12 +0000)]
[AArch64][DebugInfo] Do not recompute CalleeSavedStackSize (Take 2)

Commit message from D66935:

This patch fixes a bug exposed by D65653 where a subsequent invocation
of `determineCalleeSaves` ends up with a different size for the callee
save area, leading to different frame-offsets in debug information.

In the invocation by PEI, `determineCalleeSaves` tries to determine
whether it needs to spill an extra callee-saved register to get an
emergency spill slot. To do this, it calls 'estimateStackSize' and
manually adds the size of the callee-saves to this. PEI then allocates
the spill objects for the callee saves and the remaining frame layout
is calculated accordingly.

A second invocation in LiveDebugValues causes estimateStackSize to return
the size of the stack frame including the callee-saves. Given that the
size of the callee-saves is added to this, these callee-saves are counted
twice, which leads `determineCalleeSaves` to believe the stack has
become big enough to require spilling an extra callee-save as emergency
spillslot. It then updates CalleeSavedStackSize with a larger value.

Since CalleeSavedStackSize is used in the calculation of the frame
offset in getFrameIndexReference, this leads to incorrect offsets for
variables/locals when this information is recalculated after PEI.

This patch fixes the lldb unit tests in `functionalities/thread/concurrent_events/*`

Changes after D66935:

Ensures AArch64FunctionInfo::getCalleeSavedStackSize does not return
the uninitialized CalleeSavedStackSize when running `llc` on a specific
pass where the MIR code has already been expected to have gone through PEI.

Instead, getCalleeSavedStackSize (when passed the MachineFrameInfo) will try
to recalculate the CalleeSavedStackSize from the CalleeSavedInfo. In debug
mode, the compiler will assert the recalculated size equals the cached
size as calculated through a call to determineCalleeSaves.

This fixes two tests:
  test/DebugInfo/AArch64/asan-stack-vars.mir
  test/DebugInfo/AArch64/compiler-gen-bbs-livedebugvalues.mir
that otherwise fail when compiled using msan.

Reviewed By: omjavaid, efriedma

Tags: #llvm

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

llvm-svn: 375425

5 years agoPCH debug info: Avoid appending the source directory to an absolute path
Adrian Prantl [Mon, 21 Oct 2019 16:44:37 +0000 (16:44 +0000)]
PCH debug info: Avoid appending the source directory to an absolute path

When building a precompiled header in -fmodule-format=obj (i.e.,
`-gmodules) in an absolute path, the locig in
CGDebugInfo::createCompileUnit would unconditionally append the source
directory to the -main-file-name. This patch avoids that behavior for
absolute paths.

rdar://problem/46045865

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

llvm-svn: 375423

5 years ago[lldb] Add test for executing static initializers in expression command
Raphael Isemann [Mon, 21 Oct 2019 16:07:45 +0000 (16:07 +0000)]
[lldb] Add test for executing static initializers in expression command

llvm-svn: 375422

5 years agoFix Polly
Guillaume Chatelet [Mon, 21 Oct 2019 15:48:42 +0000 (15:48 +0000)]
Fix Polly

llvm-svn: 375421

5 years ago[NFC] Cleanup with variable name IsPPC64 & IsDarwin
Xiangling Liao [Mon, 21 Oct 2019 15:36:13 +0000 (15:36 +0000)]
[NFC] Cleanup with variable name IsPPC64 & IsDarwin

Clean up PPCAsmPrinter with IsPPC64 and IsDarwin.

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

llvm-svn: 375420

5 years ago[Alignment][NFC] Finish transition for `Loads`
Guillaume Chatelet [Mon, 21 Oct 2019 15:10:26 +0000 (15:10 +0000)]
[Alignment][NFC] Finish transition for `Loads`

Summary:
This is patch is part of a series to introduce an Alignment type.
See this thread for context: http://lists.llvm.org/pipermail/llvm-dev/2019-July/133851.html
See this patch for the introduction of the type: https://reviews.llvm.org/D64790

Reviewers: courbet

Subscribers: hiraditya, asbirlea, llvm-commits

Tags: #llvm

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

llvm-svn: 375419

5 years agoPre-commit test cases for D64713.
Jay Foad [Mon, 21 Oct 2019 15:01:59 +0000 (15:01 +0000)]
Pre-commit test cases for D64713.

llvm-svn: 375418

5 years ago[Types] Define a getWithNewBitWidth for Types and make use of it
David Green [Mon, 21 Oct 2019 14:51:49 +0000 (14:51 +0000)]
[Types] Define a getWithNewBitWidth for Types and make use of it

This is designed to change the bitwidth of a type without altering the number
of vector lanes. Also useful in D68651. Otherwise an NFC.

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

llvm-svn: 375417

5 years ago[Alignment][NFC] Instructions::getLoadStoreAlignment
Guillaume Chatelet [Mon, 21 Oct 2019 14:49:28 +0000 (14:49 +0000)]
[Alignment][NFC] Instructions::getLoadStoreAlignment

Summary:
This is patch is part of a series to introduce an Alignment type.
See this thread for context: http://lists.llvm.org/pipermail/llvm-dev/2019-July/133851.html
See this patch for the introduction of the type: https://reviews.llvm.org/D64790

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

llvm-svn: 375416

5 years ago[lldb] drop .symtab removal in minidebuginfo tests
Konrad Kleine [Mon, 21 Oct 2019 14:11:21 +0000 (14:11 +0000)]
[lldb] drop .symtab removal in minidebuginfo tests

Summary:
After D69041, we no longer have to manually remove the .symtab section
once yaml2obj was run.

Reviewers: espindola, alexshap

Subscribers: emaste, arichardson, MaskRay, lldb-commits

Tags: #lldb

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

llvm-svn: 375415

5 years ago[ARM] Extra qdadd patterns
David Green [Mon, 21 Oct 2019 14:06:49 +0000 (14:06 +0000)]
[ARM] Extra qdadd patterns

This adds some new qdadd patterns to go along with the other recently added
qadd's.

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

llvm-svn: 375414

5 years ago[Alignment][NFC] Add a helper function to DataLayout
Guillaume Chatelet [Mon, 21 Oct 2019 13:58:33 +0000 (13:58 +0000)]
[Alignment][NFC] Add a helper function to DataLayout

Summary:
This is patch is part of a series to introduce an Alignment type.
See this thread for context: http://lists.llvm.org/pipermail/llvm-dev/2019-July/133851.html
See this patch for the introduction of the type: https://reviews.llvm.org/D64790

Reviewers: courbet

Subscribers: llvm-commits

Tags: #llvm

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

llvm-svn: 375413

5 years ago[docs][llvm-ar] Update llvm-ar command guide
Owen Reynolds [Mon, 21 Oct 2019 13:13:31 +0000 (13:13 +0000)]
[docs][llvm-ar] Update llvm-ar command guide

The llvm-ar command guide had not been updated in some time, it was
missing current functionality and contained information that was out
of date. This change:
- Updates the use of reStructuredText directives, as seen in other tools
  command guides.
- Updates the command synopsis.
- Updates the descriptions of the tool behaviour.
- Updates the options section.
- Adds details of MRI script functionality.
- Removes the sections "Standards" and "File Format"

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

llvm-svn: 375412

5 years ago[ARM] Add qadd lowering from a sadd_sat
David Green [Mon, 21 Oct 2019 12:33:46 +0000 (12:33 +0000)]
[ARM] Add qadd lowering from a sadd_sat

This lowers a sadd_sat to a qadd by treating it as legal. Also adds qsub at the
same time.

The qadd instruction sets the q flag, but we already have many cases where we
do not model this in llvm.

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

llvm-svn: 375411

5 years ago[Alignment][NFC] TargetCallingConv::setByValAlign
Guillaume Chatelet [Mon, 21 Oct 2019 12:05:33 +0000 (12:05 +0000)]
[Alignment][NFC] TargetCallingConv::setByValAlign

Summary:
This is patch is part of a series to introduce an Alignment type.
See this thread for context: http://lists.llvm.org/pipermail/llvm-dev/2019-July/133851.html
See this patch for the introduction of the type: https://reviews.llvm.org/D64790

Reviewers: courbet

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

llvm-svn: 375410

5 years agoSimplify usage of setFPAttrs.
Jay Foad [Mon, 21 Oct 2019 11:32:41 +0000 (11:32 +0000)]
Simplify usage of setFPAttrs.

In some cases using the return value of setFPAttrs simplifies the code.
In other cases it complicates the code with ugly casts, so stop doing
it. NFC.

llvm-svn: 375409

5 years ago[llvm/Object] - Make ELFObjectFile::getRelocatedSection return Expected<section_iterator>
George Rimar [Mon, 21 Oct 2019 11:06:38 +0000 (11:06 +0000)]
[llvm/Object] - Make ELFObjectFile::getRelocatedSection return Expected<section_iterator>

It returns just a section_iterator currently and have a report_fatal_error call inside.
This change adds a way to return errors and handle them on caller sides.

The patch also changes/improves current users and adds test cases.

Differential revision: https://reviews.llvm.org/D69167

llvm-svn: 375408

5 years ago[Alignment][NFC] TargetCallingConv::setOrigAlign and TargetLowering::getABIAlignmentF...
Guillaume Chatelet [Mon, 21 Oct 2019 11:01:55 +0000 (11:01 +0000)]
[Alignment][NFC] TargetCallingConv::setOrigAlign and TargetLowering::getABIAlignmentForCallingConv

Summary:
This is patch is part of a series to introduce an Alignment type.
See this thread for context: http://lists.llvm.org/pipermail/llvm-dev/2019-July/133851.html
See this patch for the introduction of the type: https://reviews.llvm.org/D64790

Reviewers: courbet

Subscribers: sdardis, hiraditya, jrtc27, atanasyan, llvm-commits

Tags: #llvm

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

llvm-svn: 375407