platform/upstream/llvm.git
5 years ago[lldb] [test] Mark newly running test XFAIL on NetBSD
Michal Gorny [Tue, 30 Jul 2019 06:12:03 +0000 (06:12 +0000)]
[lldb] [test] Mark newly running test XFAIL on NetBSD

The test was not previously run due to decorator bug (fixed in r366903).
It is not a regression and is probably related to the other failing
test, so just disable it.

llvm-svn: 367285

5 years ago[llvm-objdump] Add warning messages if disassembly + source for problematic inputs
Michael Pozulp [Tue, 30 Jul 2019 05:28:26 +0000 (05:28 +0000)]
[llvm-objdump] Add warning messages if disassembly + source for problematic inputs

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

Reviewers: jhenderson, rupprecht, grimar

Reviewed By: jhenderson, grimar

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

llvm-svn: 367284

5 years ago[NFC][PowerPC] Add test case for D65063
Zi Xuan Wu [Tue, 30 Jul 2019 05:22:03 +0000 (05:22 +0000)]
[NFC][PowerPC] Add test case for D65063

llvm-svn: 367283

5 years ago[NFC] use C++11 in AlignOf.h, remove AlignedCharArray
JF Bastien [Tue, 30 Jul 2019 04:03:33 +0000 (04:03 +0000)]
[NFC] use C++11 in AlignOf.h, remove AlignedCharArray

I removed all uses of AlignedCharArray since the minimum MSVC version can handle
alignas on char arrays correctly. We can therefore remove AlignedCharArray.

This patch also updates AlignedCharArrayUnion to use C++11.

llvm-svn: 367282

5 years ago[PowerPC] [Clang] Add platform guards to PPC vector intrinsics headers
Qiu Chaofan [Tue, 30 Jul 2019 02:18:11 +0000 (02:18 +0000)]
[PowerPC] [Clang] Add platform guards to PPC vector intrinsics headers

Move the platform check out of PPC Linux toolchain code and add platform guards
to the intrinsic headers, since they are supported currently only on 64-bit
PowerPC targets.

Reviewed By: Jinsong Ji

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

llvm-svn: 367281

5 years ago[FileCollector] test: disable the directory entry collection checks on windows
Alex Lorenz [Tue, 30 Jul 2019 00:27:33 +0000 (00:27 +0000)]
[FileCollector] test: disable the directory entry collection checks on windows

Looks like one of the entries isn't found on windows. I'm investigating why.
In the meantime, I'll disable this part of the test on windows.

llvm-svn: 367280

5 years ago[clang-doc] Fix expected output in tests
Diego Astiazaran [Tue, 30 Jul 2019 00:07:34 +0000 (00:07 +0000)]
[clang-doc] Fix expected output in tests

Removes conversion of html paths in output. These will always be in
posix-style paths.

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

llvm-svn: 367279

5 years ago[FileCollector] Add a VFS that records FS accesses using the FileCollector
Alex Lorenz [Mon, 29 Jul 2019 23:38:30 +0000 (23:38 +0000)]
[FileCollector] Add a VFS that records FS accesses using the FileCollector

This patch adds a VFS that can be overlaid on top of another VFS
to record file system accesses using the FileCollector.
This can help to gather files that are needed for reproducers.

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

llvm-svn: 367278

5 years ago[NFC] avoid AlignedCharArray in LLVM
JF Bastien [Mon, 29 Jul 2019 23:37:48 +0000 (23:37 +0000)]
[NFC] avoid AlignedCharArray in LLVM

As discussed in D65249, don't use AlignedCharArray or std::aligned_storage. Just use alignas(X) char Buf[Size];. This will allow me to remove AlignedCharArray entirely, and works on the current minimum version of Visual Studio.

llvm-svn: 367277

5 years agoFix Linux build
JF Bastien [Mon, 29 Jul 2019 23:28:44 +0000 (23:28 +0000)]
Fix Linux build

r367274 broke it

llvm-svn: 367276

5 years ago[NFC] avoid AlignedCharArray in lldb
JF Bastien [Mon, 29 Jul 2019 23:17:08 +0000 (23:17 +0000)]
[NFC] avoid AlignedCharArray in lldb

As discussed in D65249, don't use AlignedCharArray or std::aligned_storage. Just use alignas(X) char Buf[Size];. This will allow me to remove AlignedCharArray entirely, and works on the current minimum version of Visual Studio.

llvm-svn: 367275

5 years ago[NFC] avoid AlignedCharArray in clang
JF Bastien [Mon, 29 Jul 2019 23:12:48 +0000 (23:12 +0000)]
[NFC] avoid AlignedCharArray in clang

As discussed in D65249, don't use AlignedCharArray or std::aligned_storage. Just use alignas(X) char Buf[Size];. This will allow me to remove AlignedCharArray entirely, and works on the current minimum version of Visual Studio.

llvm-svn: 367274

5 years ago[CMake] Move project() call to main CMake file
Haibo Huang [Mon, 29 Jul 2019 23:09:31 +0000 (23:09 +0000)]
[CMake] Move project() call to main CMake file

Summary:
The main CMake file don't have a project() call. In this case, cmake will run a dummy project(Project ) at the very beginning. Even before cmake_minimum_required. And a series of compiler detections will be triggered.

This is problematic if we depends on some policy to be set. E.g. CMP0056. try_compile will fail before we have a chance to do anything.

Subscribers: mgorny, lldb-commits

Tags: #lldb

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

llvm-svn: 367273

5 years ago[DependencyCollector] Make maybeAddDependency virtual (NFC)
Jonas Devlieghere [Mon, 29 Jul 2019 23:02:11 +0000 (23:02 +0000)]
[DependencyCollector] Make maybeAddDependency virtual (NFC)

Make DependencyCollector::maybeAddDependency, just like its other
methods, which I made virtual a while ago. The motivation for this
change is still the LLDB reproducer.

llvm-svn: 367271

5 years ago[docs] Add a note about where UBSan emits logs
Vedant Kumar [Mon, 29 Jul 2019 22:54:43 +0000 (22:54 +0000)]
[docs] Add a note about where UBSan emits logs

llvm-svn: 367270

5 years ago[DebugInfo] Don't emit incorrect descriptions of thunk params (PR42627)
Vedant Kumar [Mon, 29 Jul 2019 22:49:55 +0000 (22:49 +0000)]
[DebugInfo] Don't emit incorrect descriptions of thunk params (PR42627)

The `this` parameter of a thunk requires adjustment. Stop emitting an
incorrect dbg.declare pointing to the unadjusted pointer.

We could describe the adjusted value instead, but there may not be much
benefit in doing so as users tend not to debug thunks.

Robert O'Callahan reports that this matches gcc's behavior.

Fixes PR42627.

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

llvm-svn: 367269

5 years agoFix tests with modules enabled
Eric Fiselier [Mon, 29 Jul 2019 22:48:51 +0000 (22:48 +0000)]
Fix tests with modules enabled

llvm-svn: 367268

5 years agoEnsure __config_site definitions are passed to modules tests.
Eric Fiselier [Mon, 29 Jul 2019 22:48:34 +0000 (22:48 +0000)]
Ensure __config_site definitions are passed to modules tests.

The test configuration contained a bug where we only raised
the __config_site commands to the command line if modules were
enabled for all of the libc++ tests. However there are special
modules-only tests, and these tests weren't getting the correct
defines.

This patch corrects that issue.

llvm-svn: 367267

5 years ago[llvm-lipo] Fix test on Windows
Anusha Basana [Mon, 29 Jul 2019 22:27:27 +0000 (22:27 +0000)]
[llvm-lipo] Fix test on Windows

Error message outputs with lowercase on Windows.
Made test work on Widnows.

For example:
llvm-lipo: error: 'i386': no such file or directory

llvm-svn: 367266

5 years agoRevert "[compiler-rt] Appending COMPILER_RT_LIBCXX_PATH -isystem include for xray...
Francis Visoiu Mistrih [Mon, 29 Jul 2019 22:08:12 +0000 (22:08 +0000)]
Revert "[compiler-rt] Appending COMPILER_RT_LIBCXX_PATH -isystem include for xray (2)"

This reverts commit r367250. It's failing on green dragon:
http://lab.llvm.org:8080/green/job/clang-stage1-RA/482/console.

llvm-svn: 367265

5 years ago[clang-doc] Fix failing tests on Windows
Diego Astiazaran [Mon, 29 Jul 2019 22:03:39 +0000 (22:03 +0000)]
[clang-doc] Fix failing tests on Windows

Tests on Windows were failing due to path separator differences.
Links in HTML should use posix-style paths.

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

llvm-svn: 367264

5 years ago[clang-tidy]: Google: new check 'google-upgrade-googletest-case'
Eric Fiselier [Mon, 29 Jul 2019 21:38:56 +0000 (21:38 +0000)]
[clang-tidy]: Google: new check 'google-upgrade-googletest-case'

Introduce a new check to upgrade user code based on API changes in Googletest.

The check finds uses of old Googletest APIs with "case" in their name and replaces them with the new APIs named with "suite".

Patch by Alex Strelnikov (strel@google.com)
Reviewed as D62977.

llvm-svn: 367263

5 years ago[Symbolication] Remove some dead code. Nothing exciting.
Davide Italiano [Mon, 29 Jul 2019 21:25:51 +0000 (21:25 +0000)]
[Symbolication] Remove some dead code. Nothing exciting.

llvm-svn: 367262

5 years ago[Symbolication] Remove a duplicate assignment.
Davide Italiano [Mon, 29 Jul 2019 21:25:45 +0000 (21:25 +0000)]
[Symbolication] Remove a duplicate assignment.

llvm-svn: 367261

5 years ago[Symbolication] Fix unicode compatibility between 2 and 3.
Davide Italiano [Mon, 29 Jul 2019 21:25:37 +0000 (21:25 +0000)]
[Symbolication] Fix unicode compatibility between 2 and 3.

Triples are always ASCII for now, but we were handed out a
unicode object.

<rdar://problem/53592772>

llvm-svn: 367260

5 years agogit-llvm: Restore compatibility with git 1.8.3.
James Y Knight [Mon, 29 Jul 2019 21:01:11 +0000 (21:01 +0000)]
git-llvm: Restore compatibility with git 1.8.3.

llvm-svn: 367259

5 years ago[Reproducers] Pass FileCollector around as a shared_ptr (NFC)
Jonas Devlieghere [Mon, 29 Jul 2019 20:54:02 +0000 (20:54 +0000)]
[Reproducers] Pass FileCollector around as a shared_ptr (NFC)

Instead of passing the FileCollector around as a reference or raw
pointer, use a shared_ptr. This change's motivation is twofold. First it
adds compatibility for the newly added `FileCollectorFileSystem`.
Secondly, it addresses a lifetime issue we only see when LLDB is used
from Xcode, where a reference to the FileCollector outlives the
reproducer instance.

llvm-svn: 367258

5 years ago[IR] Consolidate fixed metadata kind definitions (NFC)
Vedant Kumar [Mon, 29 Jul 2019 20:24:20 +0000 (20:24 +0000)]
[IR] Consolidate fixed metadata kind definitions (NFC)

Put the list of fixed metadata kinds in one place.

Testing: check-llvm with+without LLVM_ENABLE_MODULES=On

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

llvm-svn: 367257

5 years ago[driver][test] Use /dev/null in as-options.s instead
Jordan Rupprecht [Mon, 29 Jul 2019 20:09:20 +0000 (20:09 +0000)]
[driver][test] Use /dev/null in as-options.s instead

llvm-svn: 367256

5 years agoGive the 'signed/unsigned wchar_t' extension a warning flag, and follow
Richard Smith [Mon, 29 Jul 2019 20:00:46 +0000 (20:00 +0000)]
Give the 'signed/unsigned wchar_t' extension a warning flag, and follow
GCC 9 in promoting it to an error by default.

llvm-svn: 367255

5 years agoWhen determining whether a lambda-expression is implicitly constexpr,
Richard Smith [Mon, 29 Jul 2019 19:59:45 +0000 (19:59 +0000)]
When determining whether a lambda-expression is implicitly constexpr,
check the formal rules rather than seeing if the normal checks produce a
diagnostic.

This fixes the handling of C++2a extensions in lambdas in C++17 mode,
as well as some corner cases in earlier language modes where we issue
diagnostics for things other than not satisfying the formal constexpr
requirements.

llvm-svn: 367254

5 years ago[driver][test] Update as-options.s to not write to a readonly tree
Jordan Rupprecht [Mon, 29 Jul 2019 19:57:31 +0000 (19:57 +0000)]
[driver][test] Update as-options.s to not write to a readonly tree

The as-options.s test writes to the build tree as of r367165. Some build systems configure this to be readonly, so this fails. Explicitly write to the output tree using `%t` to avoid this.

llvm-svn: 367253

5 years ago[PowerPC][NFC]Fix a typo in comment.
Jinsong Ji [Mon, 29 Jul 2019 19:27:54 +0000 (19:27 +0000)]
[PowerPC][NFC]Fix a typo in comment.

llvm-svn: 367252

5 years ago[X86] Fix typo in comment. We're looking at a right shift not a left shift. NFC
Craig Topper [Mon, 29 Jul 2019 19:22:51 +0000 (19:22 +0000)]
[X86] Fix typo in comment. We're looking at a right shift not a left shift. NFC

llvm-svn: 367251

5 years ago[compiler-rt] Appending COMPILER_RT_LIBCXX_PATH -isystem include for xray (2)
Puyan Lotfi [Mon, 29 Jul 2019 19:21:58 +0000 (19:21 +0000)]
[compiler-rt] Appending COMPILER_RT_LIBCXX_PATH -isystem include for xray (2)

Second attempt.

Haven't found a better way to pass the libcxx include path for building
compiler-rt with libcxx; this seems to be missing only for xray.

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

llvm-svn: 367250

5 years agoFix taint-generic.c on Windows, handle case in OS error
Reid Kleckner [Mon, 29 Jul 2019 18:48:50 +0000 (18:48 +0000)]
Fix taint-generic.c on Windows, handle case in OS error

llvm-svn: 367249

5 years ago[llvm-lipo] Implement -replace
Anusha Basana [Mon, 29 Jul 2019 18:46:34 +0000 (18:46 +0000)]
[llvm-lipo] Implement -replace

Replaces specified architecture in universal binary input file with
slice from the file_name argument passed into the replace command.

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

llvm-svn: 367248

5 years agoTest load unloading of modules with libraries-svr4
Antonio Afonso [Mon, 29 Jul 2019 18:12:55 +0000 (18:12 +0000)]
Test load unloading of modules with libraries-svr4

Summary:
This doubles the 3 tests running right now on linux by also executing each test with libraries-svr4 enabled.
Not sure if there's a better way to do this as I had to copy/paste all the decorators as well...

Reviewers: labath, clayborg, xiaobai

Reviewed By: labath

Subscribers: srhines, lldb-commits

Tags: #lldb

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

llvm-svn: 367247

5 years ago[compiler-rt] Reverting r367239 (xray include path) to fix bot build breakage.
Puyan Lotfi [Mon, 29 Jul 2019 17:50:39 +0000 (17:50 +0000)]
[compiler-rt] Reverting r367239 (xray include path) to fix bot build breakage.

llvm-svn: 367246

5 years agogn build: Merge r367071
Vitaly Buka [Mon, 29 Jul 2019 17:48:02 +0000 (17:48 +0000)]
gn build: Merge r367071

> llvm-svn: 366289

llvm-svn: 367245

5 years ago[UpdateTestChecks] Emit warning when invalid value for -check-prefix(es) option
David Bolvansky [Mon, 29 Jul 2019 17:41:00 +0000 (17:41 +0000)]
[UpdateTestChecks] Emit warning when invalid value for -check-prefix(es) option

Summary:
The script is silent for the following issue:
FileCheck %s -check-prefix=CHECK,POPCOUNT

FileCheck will catch it later, but I think we can warn here too.

Now it warns:
 ./update_llc_test_checks.py file.ll
WARNING: Supplied prefix 'CHECK,POPCOUNT' is invalid. Prefix must contain only alphanumeric characters, hyphens and underscores. Did you mean --check-prefixes=CHECK,POPCOUNT?

Reviewers: lebedev.ri, spatel, RKSimon, craig.topper, nikic, gbedwell

Reviewed By: RKSimon

Subscribers: llvm-commits

Tags: #llvm

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

llvm-svn: 367244

5 years ago[Remarks] Update error message format string
Francis Visoiu Mistrih [Mon, 29 Jul 2019 17:40:34 +0000 (17:40 +0000)]
[Remarks] Update error message format string

All the clang-cmake-armv{7,8} bots are failing this test. This is an
attempt to fix this.

llvm-svn: 367243

5 years agoThinLTOBitcodeWriter: Include globals associated with type metadata globals in the...
Peter Collingbourne [Mon, 29 Jul 2019 17:22:40 +0000 (17:22 +0000)]
ThinLTOBitcodeWriter: Include globals associated with type metadata globals in the merged module.

Globals that are associated with globals with type metadata need to appear
in the merged module because they will reference the global's section directly.

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

llvm-svn: 367242

5 years ago[lldb] Qualify includes of Properties[Enum].inc files. NFC
Jordan Rupprecht [Mon, 29 Jul 2019 17:22:10 +0000 (17:22 +0000)]
[lldb] Qualify includes of Properties[Enum].inc files. NFC

Summary:
This is a bit more explicit, and makes it possible to build LLDB without
varying the -I lines per-directory.
(The latter is useful because many build systems only allow this to be
configured per-library, and LLDB is insufficiently layered to be split into
multiple libraries on stricter build systems).

(My comment on D65185 has some more context)

Reviewers: JDevlieghere, labath, chandlerc, jdoerfert

Reviewed By: labath

Subscribers: mgorny, lldb-commits

Tags: #lldb

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

Patch by Sam McCall!

llvm-svn: 367241

5 years ago[X86] resolveTargetShuffleInputs - add depth to limit recursion.
Simon Pilgrim [Mon, 29 Jul 2019 17:17:58 +0000 (17:17 +0000)]
[X86] resolveTargetShuffleInputs - add depth to limit recursion.

Avoids slow downs from calls to ComputeNumSignBits/computeKnownBits going too deep.

llvm-svn: 367240

5 years agoAppending COMPILER_RT_LIBCXX_PATH include path to -isystem for compiler-rt xray
Puyan Lotfi [Mon, 29 Jul 2019 16:46:35 +0000 (16:46 +0000)]
Appending COMPILER_RT_LIBCXX_PATH include path to -isystem for compiler-rt xray

Haven't found a better way to pass the libcxx include path for building
compiler-rt with libcxx; this seems to be missing only for xray.

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

llvm-svn: 367239

5 years ago[lldb] Also include the array definition in Properties.inc
Jonas Devlieghere [Mon, 29 Jul 2019 16:41:30 +0000 (16:41 +0000)]
[lldb] Also include the array definition in Properties.inc

Right now our Properties.inc only generates the initializer for the
options list but not the array declaration boilerplate around it. As the
array definition is identical for all arrays, we might as well also let
the Properties.inc generate it alongside the initializers.

Unfortunately we cannot do the same for enums, as there's this magic
ePropertyExperimental, which needs to come at the end to be interpreted
correctly. Hopefully we can get rid of this in the future and do the
same for the property enums.

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

llvm-svn: 367238

5 years agoAMDGPU/LoadStoreOptimizer: combine MMOs when merging instructions
Tom Stellard [Mon, 29 Jul 2019 16:40:58 +0000 (16:40 +0000)]
AMDGPU/LoadStoreOptimizer: combine MMOs when merging instructions

Summary:
The LoadStoreOptimizer was creating instructions with 2
MachineMemOperands, which meant they were assumed to alias with all other instructions,
because MachineInstr:mayAlias() returns true when an instruction has multiple
MachineMemOperands.

This was preventing these instructions from being merged again, and was
giving the scheduler less freedom to reorder them.

Reviewers: arsenm, nhaehnle

Reviewed By: arsenm

Subscribers: kzhuravl, jvesely, wdng, yaxunl, dstuttard, tpr, t-tye, hiraditya, llvm-commits

Tags: #llvm

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

llvm-svn: 367237

5 years ago[llvm-objcopy] Improve --add-section argument string parsing
Sergey Dmitriev [Mon, 29 Jul 2019 16:22:40 +0000 (16:22 +0000)]
[llvm-objcopy] Improve --add-section argument string parsing

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

llvm-svn: 367236

5 years ago[AMDGPU] Fix typo in error message
Jay Foad [Mon, 29 Jul 2019 16:17:13 +0000 (16:17 +0000)]
[AMDGPU] Fix typo in error message

llvm-svn: 367235

5 years ago[lldb] Increase testsuite packet-timeout 5secs -> 1min
Jan Kratochvil [Mon, 29 Jul 2019 16:10:16 +0000 (16:10 +0000)]
[lldb] Increase testsuite packet-timeout 5secs -> 1min

rL357954 did increase `packet-timeout` 1sec -> 5secs. Which is IMO about the
maximum timeout reasonable for regular use. But for testsuite I think the
timeout should be higher as the testsuite runs in parallel and it can be run
even on slow hosts and with other load (moreover if it runs on some slow arch).

I have chosen 60 secs, that should be enough hopefully.  Larger value could
make debugging with hanging `lldb-server` annoying.

This patch was based on this testsuite timeout:
http://lab.llvm.org:8014/builders/lldb-x86_64-fedora/builds/546/steps/test/logs/stdio
FAIL: test_connect (TestGDBRemoteClient.TestGDBRemoteClient)
   Test connecting to a remote gdb server
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/jkratoch/slave-lldb-x86_64-fedora/lldb-x86_64-fedora/llvm/tools/lldb/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/TestGDBRemoteClient.py", line 13, in test_connect
    process = self.connect(target)
  File "/home/jkratoch/slave-lldb-x86_64-fedora/lldb-x86_64-fedora/llvm/tools/lldb/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/gdbclientutils.py", line 480, in connect
    self.assertTrue(error.Success(), error.description)
AssertionError: False is not True : failed to get reply to handshake packet

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

llvm-svn: 367234

5 years ago[NFC][FPEnv] Pre-commit tests for canonicalize negated operand of fdiv.
Cameron McInally [Mon, 29 Jul 2019 16:09:56 +0000 (16:09 +0000)]
[NFC][FPEnv] Pre-commit tests for canonicalize negated operand of fdiv.

llvm-svn: 367233

5 years ago[X86] combineX86ShufflesRecursively - start recursion at depth = 0. NFCI.
Simon Pilgrim [Mon, 29 Jul 2019 15:57:06 +0000 (15:57 +0000)]
[X86] combineX86ShufflesRecursively - start recursion at depth = 0. NFCI.

As discussed on rL367171, we have a problem where the depth recursion used in combineX86ShufflesRecursively was subtly different to computeKnownBits etc. - it starts at Depth=1 instead of Depth=0 like the others and has a different maximum recursion depth.

This NFC patch fixes the recursion depth to start at 0, so we can more easily reuse depth values in calls from combineX86ShufflesRecursively and its helper functions in computeKnownBits etc.

llvm-svn: 367232

5 years agoSymbolVendor: Make SectionAddressesChanged a passthrough
Pavel Labath [Mon, 29 Jul 2019 15:53:36 +0000 (15:53 +0000)]
SymbolVendor: Make SectionAddressesChanged a passthrough

Summary:
This moves the implementation of the function into the SymbolFile class,
making it possible to excise the SymbolVendor passthrough functions in
follow-up patches.

Reviewers: clayborg, jingham, JDevlieghere

Subscribers: lldb-commits

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

llvm-svn: 367231

5 years ago[RISCV] Fix uninitialized variable after call to evaluateConstantImm
Francis Visoiu Mistrih [Mon, 29 Jul 2019 15:52:13 +0000 (15:52 +0000)]
[RISCV] Fix uninitialized variable after call to evaluateConstantImm

For llvm/test/MC/RISCV/rv64i-aliases-invalid.s, UBSan reports:

lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp:371:9: runtime error:
load of value 3879186881, which is not a valid value for type
'RISCVMCExpr::VariantKind'
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior
lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp:371:9 in

It turns out that evaluateConstantImm does not set `VK` and it remains
unitialized when doing comparisons in `isImmXLenLI()`.

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

llvm-svn: 367230

5 years ago[OpenCL] Rename builtin definition classes
Sven van Haastregt [Mon, 29 Jul 2019 14:55:29 +0000 (14:55 +0000)]
[OpenCL] Rename builtin definition classes

Factor out some of the renames from D63434 and D63442, and generate
half type convert_ builtins.

Patch by Pierre Gondois and Sven van Haastregt.

llvm-svn: 367229

5 years ago[lldb] [test] Mark three new tests XFAIL on NetBSD
Michal Gorny [Mon, 29 Jul 2019 14:32:40 +0000 (14:32 +0000)]
[lldb] [test] Mark three new tests XFAIL on NetBSD

llvm-svn: 367228

5 years ago[InstCombine] fold fadd+fneg with fdiv/fmul betweena
Sanjay Patel [Mon, 29 Jul 2019 13:50:25 +0000 (13:50 +0000)]
[InstCombine] fold fadd+fneg with fdiv/fmul betweena

The backend already does this via isNegatibleForFree(),
but we may want to alter the fneg IR canonicalizations
that currently exist, so we need to try harder to fold
fneg in IR to avoid regressions.

llvm-svn: 367227

5 years ago[ValueTracking] Remove volatile check in isGuaranteedToTransferExecutionToSuccessor
Hideto Ueno [Mon, 29 Jul 2019 13:35:34 +0000 (13:35 +0000)]
[ValueTracking] Remove volatile check in isGuaranteedToTransferExecutionToSuccessor

Summary: As clarified in D53184, volatile load and store do not trap. Therefore, we should remove volatile checks for instructions in  `isGuaranteedToTransferExecutionToSuccessor`.

Reviewers: jdoerfert, efriedma, nikic

Reviewed By: nikic

Subscribers: hiraditya, jfb, llvm-commits

Tags: #llvm

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

llvm-svn: 367226

5 years agoclang-format clang/lib/Format
Nico Weber [Mon, 29 Jul 2019 13:26:48 +0000 (13:26 +0000)]
clang-format clang/lib/Format

llvm-svn: 367225

5 years ago[InstCombine] reduce code for fadd with fneg operand; NFC
Sanjay Patel [Mon, 29 Jul 2019 13:20:46 +0000 (13:20 +0000)]
[InstCombine] reduce code for fadd with fneg operand; NFC

llvm-svn: 367224

5 years ago[InstCombine] add tests for fadd with negated operand; NFC
Sanjay Patel [Mon, 29 Jul 2019 12:49:36 +0000 (12:49 +0000)]
[InstCombine] add tests for fadd with negated operand; NFC

llvm-svn: 367222

5 years ago[AMDGPU] Add amdgpu_kernel for consistency with other tests
Jay Foad [Mon, 29 Jul 2019 11:48:17 +0000 (11:48 +0000)]
[AMDGPU] Add amdgpu_kernel for consistency with other tests

llvm-svn: 367221

5 years ago[DAGCombine] narrowInsertExtractVectorBinOp - early out for binops that change value...
Simon Pilgrim [Mon, 29 Jul 2019 11:34:45 +0000 (11:34 +0000)]
[DAGCombine] narrowInsertExtractVectorBinOp - early out for binops that change value type. NFCI.

This is implicit in the value type checks in getSubVectorSrc - this just makes it upfront and obvious.

llvm-svn: 367220

5 years agodoc: Fix Google C++ Style Guide link.
Rafael Stahl [Mon, 29 Jul 2019 11:00:23 +0000 (11:00 +0000)]
doc: Fix Google C++ Style Guide link.

llvm-svn: 367219

5 years ago[DivergenceAnalysis] Add methods for querying divergence at use
Jay Foad [Mon, 29 Jul 2019 10:22:09 +0000 (10:22 +0000)]
[DivergenceAnalysis] Add methods for querying divergence at use

Summary:
The existing isDivergent(Value) methods query whether a value is
divergent at its definition. However even if a value is uniform at its
definition, a use of it in another basic block can be divergent because
of divergent control flow between the def and the use.

This patch adds new isDivergent(Use) methods to DivergenceAnalysis,
LegacyDivergenceAnalysis and GPUDivergenceAnalysis.

This might allow D63953 or other similar workarounds to be removed.

Reviewers: alex-t, nhaehnle, arsenm, rtaylor, rampitec, simoll, jingyue

Reviewed By: nhaehnle

Subscribers: jfb, jvesely, wdng, hiraditya, llvm-commits

Tags: #llvm

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

llvm-svn: 367218

5 years ago[SystemZ] Regenerate <8 x i31> store test
Simon Pilgrim [Mon, 29 Jul 2019 09:49:23 +0000 (09:49 +0000)]
[SystemZ] Regenerate <8 x i31> store test

To help show the diffs from an upcoming SimplifyDemandedBits patch.

llvm-svn: 367216

5 years agoMark test/MC/RISCV/rv{32,64}i-aliases-invalid.s unsupported also on Windows
Hans Wennborg [Mon, 29 Jul 2019 09:49:04 +0000 (09:49 +0000)]
Mark test/MC/RISCV/rv{32,64}i-aliases-invalid.s unsupported also on Windows

Because they fail there too.

FAIL: LLVM :: MC/RISCV/rv32i-aliases-invalid.s (24397 of 32659)
******************** TEST 'LLVM :: MC/RISCV/rv32i-aliases-invalid.s' FAILED ********************
Script:
--
: 'RUN: at line 2';   not c:\src\llvm.monorepo\build.release2\bin\llvm-mc.exe C:\src\llvm.monorepo\llvm\test\MC\RISCV\rv32i-aliases-invalid.s -triple=riscv32 -riscv-no-aliases 2>&1 | c:\src\llvm.monorepo\build.release2\bin\filecheck.exe C:\src\llvm.monorepo\llvm\test\MC\RISCV\rv32i-aliases-invalid.s
: 'RUN: at line 3';   not c:\src\llvm.monorepo\build.release2\bin\llvm-mc.exe C:\src\llvm.monorepo\llvm\test\MC\RISCV\rv32i-aliases-invalid.s -triple=riscv32 2>&1 | c:\src\llvm.monorepo\build.release2\bin\filecheck.exe C:\src\llvm.monorepo\llvm\test\MC\RISCV\rv32i-aliases-invalid.s
--
Exit Code: 1

Command Output (stdout):
--
$ ":" "RUN: at line 2"
$ "not" "c:\src\llvm.monorepo\build.release2\bin\llvm-mc.exe" "C:\src\llvm.monorepo\llvm\test\MC\RISCV\rv32i-aliases-invalid.s" "-triple=riscv32" "-riscv-no-aliases"
$ "c:\src\llvm.monorepo\build.release2\bin\filecheck.exe" "C:\src\llvm.monorepo\llvm\test\MC\RISCV\rv32i-aliases-invalid.s"
C:\src\llvm.monorepo\llvm\test\MC\RISCV\rv32i-aliases-invalid.s:10:21: error: CHECK: expected string not found in input
li t4, foo # CHECK: :[[@LINE]]:8: error: immediate must be an integer in the range [-21474836484294967295]
                    ^
<stdin>:5:1: note: scanning from here
li x0, -2147483649 # CHECK: :[[@LINE]]:8: error: immediate must be an integer in the range [-21474836484294967295]
^
<stdin>:5:1: note: with "@LINE" equal to "10"
li x0, -2147483649 # CHECK: :[[@LINE]]:8: error: immediate must be an integer in the range [-21474836484294967295]
^
<stdin>:5:38: note: possible intended match here
li x0, -2147483649 # CHECK: :[[@LINE]]:8: error: immediate must be an integer in the range [-21474836484294967295]
                                     ^

error: command failed with exit status: 1

--

--
********************
Testing: 0 .. 10.. 20.. 30.. 40.. 50.. 60.. 70
FAIL: LLVM :: MC/RISCV/rv64i-aliases-invalid.s (24416 of 32659)
******************** TEST 'LLVM :: MC/RISCV/rv64i-aliases-invalid.s' FAILED ********************
Script:
--
: 'RUN: at line 2';   not c:\src\llvm.monorepo\build.release2\bin\llvm-mc.exe C:\src\llvm.monorepo\llvm\test\MC\RISCV\rv64i-aliases-invalid.s -triple=riscv64 -riscv-no-aliases 2>&1 | c:\src\llvm.monorepo\build.release2\bin\filecheck.exe C:\src\llvm.monorepo\llvm\test\MC\RISCV\rv64i-aliases-invalid.s
: 'RUN: at line 3';   not c:\src\llvm.monorepo\build.release2\bin\llvm-mc.exe C:\src\llvm.monorepo\llvm\test\MC\RISCV\rv64i-aliases-invalid.s -triple=riscv64 2>&1 | c:\src\llvm.monorepo\build.release2\bin\filecheck.exe C:\src\llvm.monorepo\llvm\test\MC\RISCV\rv64i-aliases-invalid.s
--
Exit Code: 1

Command Output (stdout):
--
$ ":" "RUN: at line 2"
$ "not" "c:\src\llvm.monorepo\build.release2\bin\llvm-mc.exe" "C:\src\llvm.monorepo\llvm\test\MC\RISCV\rv64i-aliases-invalid.s" "-triple=riscv64" "-riscv-no-aliases"
$ "c:\src\llvm.monorepo\build.release2\bin\filecheck.exe" "C:\src\llvm.monorepo\llvm\test\MC\RISCV\rv64i-aliases-invalid.s"
C:\src\llvm.monorepo\llvm\test\MC\RISCV\rv64i-aliases-invalid.s:6:21: error: CHECK: expected string not found in input
li t4, foo # CHECK: :[[@LINE]]:8: error: operand must be a constant 64-bit integer
                    ^
<stdin>:2:1: note: scanning from here
li t5, 0x10000000000000000 # CHECK: :[[@LINE]]:8: error: unknown operand
^
<stdin>:2:1: note: with "@LINE" equal to "6"
li t5, 0x10000000000000000 # CHECK: :[[@LINE]]:8: error: unknown operand
^
<stdin>:13:67: note: possible intended match here
C:\src\llvm.monorepo\llvm\test\MC\RISCV\rv64i-aliases-invalid.s:12:13: error: immediate must be an integer in the range [0, 63]
                                                                  ^

error: command failed with exit status: 1
llvm-svn: 367215

5 years ago[ARM] Regenerate rotation tests
Simon Pilgrim [Mon, 29 Jul 2019 09:48:07 +0000 (09:48 +0000)]
[ARM] Regenerate rotation tests

llvm-svn: 367214

5 years ago[AMDGPU] Regenerate v2i16 insertelement tests.
Simon Pilgrim [Mon, 29 Jul 2019 09:47:07 +0000 (09:47 +0000)]
[AMDGPU] Regenerate v2i16 insertelement tests.

To help show the diffs from an upcoming SimplifyDemandedBits patch.

llvm-svn: 367213

5 years ago[NFC][ARM[ParallelDSP] Cleanup of BinOpChain
Sam Parker [Mon, 29 Jul 2019 08:41:51 +0000 (08:41 +0000)]
[NFC][ARM[ParallelDSP] Cleanup of BinOpChain

- Remove some unused typedefs.
- Rename BinOpChain struct to MulCandidate.
- Remove the size method of MulCandidate.
- Store only the first input of the ValueList provided to
  MulCandidate, as it's the only value we care about. This means we
  don't have to perform any ugly (and unnecessary) iterations of the
  list later on.

llvm-svn: 367208

5 years ago[lldb][NFC] Split emitting and parsing in LLDBOptionDefEmitter
Raphael Isemann [Mon, 29 Jul 2019 08:22:41 +0000 (08:22 +0000)]
[lldb][NFC] Split emitting and parsing in LLDBOptionDefEmitter

Splitting the different logic is cleaner and we it will be easier
to implement the enum emitting (which otherwise would have to
reimplement the Record parsing).

llvm-svn: 367207

5 years ago[AMDGPU] Enable v4f16 and above for v_pk_fma instructions
David Stuttard [Mon, 29 Jul 2019 08:15:10 +0000 (08:15 +0000)]
[AMDGPU] Enable v4f16 and above for v_pk_fma instructions

Summary:
If isel is presented with <2 x half> vectors then it will correctly select
v_pk_fma style instructions.
If isel is presented with e.g. <4 x half> vectors it will scalarize, unlike for
other instruction types (such as fadd, fmul etc.)

Added extra support to enable this. Updated one of the tests to include a test
for this (as well as extending the test to GFX9)

Subscribers: arsenm, kzhuravl, jvesely, wdng, nhaehnle, yaxunl, tpr, t-tye, llvm-commits

Tags: #llvm

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

Change-Id: I50a4577a3f8223fb53992af3b7d26121f65b71ee
llvm-svn: 367206

5 years ago[NFC][ARM][ParallelDSP] Remove AreSymmetrical
Sam Parker [Mon, 29 Jul 2019 08:12:24 +0000 (08:12 +0000)]
[NFC][ARM][ParallelDSP] Remove AreSymmetrical

We explicitly search for a parallel mac and we only care about its
inputs, checking for symmetry doesn't add anything here.

llvm-svn: 367205

5 years ago[NFC][ARM][ParallelDSP] Remove PopulateLoads
Sam Parker [Mon, 29 Jul 2019 08:07:23 +0000 (08:07 +0000)]
[NFC][ARM][ParallelDSP] Remove PopulateLoads

We no longer have to check what loads are used, all this
is performed at the start of the transform, so it's not
doing anything now.

llvm-svn: 367204

5 years ago[obj2yaml] - Report a error when unable to resolve a sh_link reference properly.
George Rimar [Mon, 29 Jul 2019 07:58:29 +0000 (07:58 +0000)]
[obj2yaml] - Report a error when unable to resolve a sh_link reference properly.

Because of a bug we did not report a error in the case
shown in the test. With this patch we do.

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

llvm-svn: 367203

5 years ago[llvm-objcopy] - Reimplement strip-dwo-groups.test to stop using the precompiled...
George Rimar [Mon, 29 Jul 2019 07:55:39 +0000 (07:55 +0000)]
[llvm-objcopy] - Reimplement strip-dwo-groups.test to stop using the precompiled object.

When llvm-copy removes .dwo sections the index of symbol table,
the indices of the symbols and the indices of the sections which go
after the removed ones changes. That affects on SHT_GROUP sections,
which needs to be updated.

Initially this test used a precompiled object, I rewrote it to use YAML
and improved a bit.

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

llvm-svn: 367202

5 years ago[lldb][NFC] Remove DiagnosticManager::CopyDiagnostics
Raphael Isemann [Mon, 29 Jul 2019 07:37:17 +0000 (07:37 +0000)]
[lldb][NFC] Remove DiagnosticManager::CopyDiagnostics

The Diagnostic class in LLDB is suppossed to be inherited from,
so just copying the diagnostics like this is wrong. The function
is also unused, so lets just get rid of it instead of creating
some cloning facility for it.

llvm-svn: 367201

5 years agoReturn early. NFC.
Rui Ueyama [Mon, 29 Jul 2019 05:24:51 +0000 (05:24 +0000)]
Return early. NFC.

llvm-svn: 367200

5 years agoImprove MSVC visualizers for DeclSpec and TemplateName
Mike Spertus [Mon, 29 Jul 2019 03:34:40 +0000 (03:34 +0000)]
Improve MSVC visualizers for DeclSpec and TemplateName

DeclSpec now shows the TypeRep, ExprRep, or DeclRep as appropriate
TemplateName decodes and displays the StorageType
A few minor refinements to other types

llvm-svn: 367199

5 years ago[X86] Don't use PMADDWD for vector add reductions of multiplies if the mul inputs...
Craig Topper [Mon, 29 Jul 2019 01:36:58 +0000 (01:36 +0000)]
[X86] Don't use PMADDWD for vector add reductions of multiplies if the mul inputs have an additional user.

The pmaddwd inserts a truncate, if that truncate would end up
creating additional instructions instead of making a zext
narrower, then we shouldn't do it.

I've restricted this to only sse4.1 targets since on prior
targets the zext will be done in stages. So the truncate will
probably not create additional instructions. Might need some
more investigation of mul shrinking and the other pmaddwd
transform to be sure this is the right decision.

There might be a slight regression on AVX1 targets due to add
splitting. Hard to say for sure. Maybe we need to look into
using the vector reduction flag to use 2 narrow loads and a
blend instead of extracting and inserting.

llvm-svn: 367198

5 years ago[X86] Add test cases to show missing one use check in combineLoopMAddPattern.
Craig Topper [Mon, 29 Jul 2019 01:36:54 +0000 (01:36 +0000)]
[X86] Add test cases to show missing one use check in combineLoopMAddPattern.

llvm-svn: 367197

5 years ago[NFC][InstCombine] Revisit tests in shift-amount-reassociation-with-truncation-shl.ll
Roman Lebedev [Sun, 28 Jul 2019 21:31:58 +0000 (21:31 +0000)]
[NFC][InstCombine] Revisit tests in shift-amount-reassociation-with-truncation-shl.ll

llvm-svn: 367196

5 years ago[X86] In combineLoopMAddPattern and combineLoopSADPattern, preserve the vector reduct...
Craig Topper [Sun, 28 Jul 2019 18:45:42 +0000 (18:45 +0000)]
[X86] In combineLoopMAddPattern and combineLoopSADPattern, preserve the vector reduction flag on the final add. Handle unrolled loops by letting DAG combine revisit.

This reverts r340478 and r340631 and replaces them with a simpler
method of just letting DAG combine revisit the nodes to handle
the other operand.

llvm-svn: 367195

5 years ago[InstCombine] fold fsub+fneg with fdiv/fmul between
Sanjay Patel [Sun, 28 Jul 2019 17:10:06 +0000 (17:10 +0000)]
[InstCombine] fold fsub+fneg with fdiv/fmul between

The backend already does this via isNegatibleForFree(),
but we may want to alter the fneg IR canonicalizations
that currently exist, so we need to try harder to fold
fneg in IR to avoid regressions.

llvm-svn: 367194

5 years agoBuildbot fix for r367190
Gabor Borsik [Sun, 28 Jul 2019 14:57:41 +0000 (14:57 +0000)]
Buildbot fix for r367190

llvm-svn: 367193

5 years ago[ARM] MVE VPNOT
David Green [Sun, 28 Jul 2019 14:07:48 +0000 (14:07 +0000)]
[ARM] MVE VPNOT

This adds the patterns required to transform xor P0, -1 to a VPNOT. The
instruction operands have to change a little for this, adding an in and an out
VCCR reg and using a custom DecodeMVEVPNOT for the decode.

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

llvm-svn: 367192

5 years ago[ARM] Better patterns for fp <> predicate vectors
David Green [Sun, 28 Jul 2019 13:53:39 +0000 (13:53 +0000)]
[ARM] Better patterns for fp <> predicate vectors

These are some better patterns for converting between predicates and floating
points. Much like the extends, we select "1"/"-1" or "0" depending on the
predicate value. Or we perform a compare against 0 to convert to a predicate.

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

llvm-svn: 367191

5 years ago[analyzer] Add yaml parser to GenericTaintChecker
Gabor Borsik [Sun, 28 Jul 2019 13:38:04 +0000 (13:38 +0000)]
[analyzer] Add yaml parser to GenericTaintChecker

While we implemented taint propagation rules for several
builtin/standard functions, there's a natural desire for users to add
such rules to custom functions.

A series of patches will implement an option that allows users to
annotate their functions with taint propagation rules through a YAML
file. This one adds parsing of the configuration file, which may be
specified in the commands line with the analyzer config:
alpha.security.taint.TaintPropagation:Config. The configuration may
contain propagation rules, filter functions (remove taint) and sink
functions (give a warning if it gets a tainted value).

I also added a new header for future checkers to conveniently read YAML
files as checker options.

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

llvm-svn: 367190

5 years ago[NFC][InstCombine] Shift amount reassociation: can have trunc between shl's
Roman Lebedev [Sun, 28 Jul 2019 13:13:46 +0000 (13:13 +0000)]
[NFC][InstCombine] Shift amount reassociation: can have trunc between shl's

https://rise4fun.com/Alive/OQbM
Not so simple for lshr/ashr, so those maybe later.

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

llvm-svn: 367189

5 years agoDon't initialize interceptor_metadata_map unless SI_POSIX is set
Eugene Leviant [Sun, 28 Jul 2019 08:58:44 +0000 (08:58 +0000)]
Don't initialize interceptor_metadata_map unless SI_POSIX is set

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

llvm-svn: 367188

5 years ago[Attributor] Deduce "align" attribute
Hideto Ueno [Sun, 28 Jul 2019 07:04:01 +0000 (07:04 +0000)]
[Attributor] Deduce "align" attribute

Summary:
Deduce "align" attribute in attributor.

Reviewers: jdoerfert, sstefan1

Reviewed By: jdoerfert

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

llvm-svn: 367187

5 years ago[lldb] Also include the array definition in CommandOptions.inc
Raphael Isemann [Sun, 28 Jul 2019 06:24:07 +0000 (06:24 +0000)]
[lldb] Also include the array definition in CommandOptions.inc

Summary:
Right now our CommandOptions.inc only generates the initializer for the options list but
not the array declaration boilerplate around it. As the array definition is identical for all arrays,
we might as well also let the CommandOptions.inc generate it alongside the initializers.

This patch will also allow us to generate additional declarations related to that option list in
the future (e.g. a enum class representing the specific options which would make our
handling code less prone).

This patch also fixes a few option tables that didn't follow our naming style.

Reviewers: JDevlieghere

Reviewed By: JDevlieghere

Subscribers: abidh, lldb-commits

Tags: #lldb

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

llvm-svn: 367186

5 years ago[IR] Fix getPointerAlignment for CallBase
Hideto Ueno [Sun, 28 Jul 2019 06:17:46 +0000 (06:17 +0000)]
[IR] Fix getPointerAlignment for CallBase

Summary:
In current getPointerAlignemnt implementation, CallBase.getPointerAlignement(..) checks only parameter attriutes in the callsite.  For example,

```
declare align 8 i8* @foo()

define void @bar() {
    %a = tail call align 8 i8* @foo() ; getPointerAlignment returns 8
    %b = tail call i8* @foo() ; getPointerAlignemnt returns 0
    ret void
}
```

This patch will fix the problem.

Reviewers: jdoerfert

Reviewed By: jdoerfert

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

llvm-svn: 367185

5 years ago[FunctionAttrs] Annotate "willreturn" for intrinsics
Hideto Ueno [Sun, 28 Jul 2019 06:09:56 +0000 (06:09 +0000)]
[FunctionAttrs] Annotate "willreturn" for intrinsics

Summary:
In D62801, new function attribute `willreturn` was introduced. In short, a function with `willreturn` is guaranteed to come back to the call site(more precise definition is in LangRef).

In this patch, willreturn is annotated for LLVM intrinsics.

Reviewers: jdoerfert

Reviewed By: jdoerfert

Subscribers: jvesely, nhaehnle, sstefan1, llvm-commits

Tags: #llvm

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

llvm-svn: 367184

5 years agoFix PR35637: suboptimal codegen for `vector<unsigned char>`.
Eric Fiselier [Sun, 28 Jul 2019 04:37:02 +0000 (04:37 +0000)]
Fix PR35637: suboptimal codegen for `vector<unsigned char>`.

The optimizer is petulant and temperamental. In this case LLVM failed to lower
the the "insert at end" loop used by`vector<unsigned char>` to a `memset` despite
`memset` being substantially faster over a range of bytes.

LLVM has the ability to lower loops to `memset` whet appropriate, but the
odd nature of libc++'s loops prevented the optimization from taking places.

This patch addresses the issue by rewriting the loops from the form
`do [ ... --__n; } while (__n > 0);` to instead use a for loop over a pointer
range (For example: `for (auto *__i = ...; __i < __e; ++__i)`).

This patch also rewrites the asan annotations to unposion all additional memory
at the start of the loop instead of once per iterations. This could potentially
permit false negatives where the constructor of element N attempts to access
element N + 1 during its construction.

The before and after results for the `BM_ConstructSize/vector_byte/5140480_mean`
benchmark (run 5 times) are:

--------------------------------------------------------------------------------------------
Benchmark                                                 Time             CPU   Iterations
--------------------------------------------------------------------------------------------
Before
------
BM_ConstructSize/vector_byte/5140480_mean          12530140 ns     12469693 ns            N/A
BM_ConstructSize/vector_byte/5140480_median        12512818 ns     12445571 ns            N/A
BM_ConstructSize/vector_byte/5140480_stddev          106224 ns       107907 ns            5
-----
After
-----
BM_ConstructSize/vector_byte/5140480_mean            167285 ns       166500 ns            N/A
BM_ConstructSize/vector_byte/5140480_median          166749 ns       166069 ns            N/A
BM_ConstructSize/vector_byte/5140480_stddev            3242 ns         3184 ns            5

llvm-svn: 367183

5 years ago[Driver] Additional fixup of NOWARN test case from r367165
Bjorn Pettersson [Sat, 27 Jul 2019 20:22:47 +0000 (20:22 +0000)]
[Driver] Additional fixup of NOWARN test case from r367165

Same kind of fix as in r367176, but for "RUN on line 76"
this time.

I'll ask for a post-commit review, to ensure this
matches the intention with the test added in r367165.
But I think this at least will make the buildbots a
little bit happier.

llvm-svn: 367182

5 years ago[DAGCombine] narrowInsertExtractVectorBinOp - early out for illegal op. NFCI.
Simon Pilgrim [Sat, 27 Jul 2019 19:42:58 +0000 (19:42 +0000)]
[DAGCombine] narrowInsertExtractVectorBinOp - early out for illegal op. NFCI.

If the subvector binop is illegal then early-out and avoid the subvector searches.

llvm-svn: 367181

5 years agoStricter check for the memory access.
Joerg Sonnenberger [Sat, 27 Jul 2019 18:57:59 +0000 (18:57 +0000)]
Stricter check for the memory access.

The current pattern would trigger for scheduling changes of the
post-load computation, since those are commutable with the inline asm.
Avoid this by explicitly check the order of load vs asm block.

llvm-svn: 367180

5 years agoRegenerate UXTB tests
Simon Pilgrim [Sat, 27 Jul 2019 18:44:15 +0000 (18:44 +0000)]
Regenerate UXTB tests

llvm-svn: 367179