platform/upstream/llvm.git
6 years ago[clang-tidy] Misplaced Operator in Strlen in Alloc
Adam Balogh [Thu, 23 Nov 2017 12:26:28 +0000 (12:26 +0000)]
[clang-tidy] Misplaced Operator in Strlen in Alloc

A possible error is to write `malloc(strlen(s+1))` instead of
`malloc(strlen(s)+1)`. Unfortunately the former is also valid syntactically,
but allocates less memory by two bytes (if s` is at least one character long,
undefined behavior otherwise) which may result in overflow cases. This check
detects such cases and also suggests the fix for them.

llvm-svn: 318906

6 years agoclang-tidy/rename_check.py: support for moving between modules
Alexander Kornienko [Thu, 23 Nov 2017 12:08:53 +0000 (12:08 +0000)]
clang-tidy/rename_check.py: support for moving between modules

llvm-svn: 318905

6 years ago[x86][icelake]BITALG
Coby Tayree [Thu, 23 Nov 2017 11:15:50 +0000 (11:15 +0000)]
[x86][icelake]BITALG
2/3
vpshufbitqmb encoding
3/3
vpshufbitqmb intrinsics
Differential Revision: https://reviews.llvm.org/D40222

llvm-svn: 318904

6 years agoelf-core: Split up parsing code into os-specific functions
Pavel Labath [Thu, 23 Nov 2017 10:50:34 +0000 (10:50 +0000)]
elf-core: Split up parsing code into os-specific functions

Summary:
We've had a single function responsible for splitting a core segment
into notes, and parsing the notes themselves, bearing in mind variations
between 4 supported OS types. This commit splits that code into 5
pieces:
- (os-independent) code for splitting a segment into individual notes
- per-os function for parsing the notes into thread information

Reviewers: clayborg, krytarowski, emaste, alexandreyy, kettenis

Subscribers: lldb-commits

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

llvm-svn: 318903

6 years agoAllow to set locale on Windows.
Martin Storsjo [Thu, 23 Nov 2017 10:38:18 +0000 (10:38 +0000)]
Allow to set locale on Windows.

Fix the problem PR31516 with setting locale on Windows by wrapping
_locale_t with a pointer-like class.

Reduces 74 test failures in std/localization test suite to 47 test
failures (on llvm clang, Visual Studio 2015). Number of test failures
doesn't depend on the platform (x86 or x64).

Patch by Andrey Khalyavin.

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

llvm-svn: 318902

6 years ago[MSan] Move the access address check before the shadow access for that address
Alexander Potapenko [Thu, 23 Nov 2017 08:34:32 +0000 (08:34 +0000)]
[MSan] Move the access address check before the shadow access for that address

MSan used to insert the shadow check of the store pointer operand
_after_ the shadow of the value operand has been written.
This happens to work in the userspace, as the whole shadow range is
always mapped. However in the kernel the shadow page may not exist, so
the bug may cause a crash.

This patch moves the address check in front of the shadow access.

llvm-svn: 318901

6 years agoDo not perform the analysis based warning if the warnings are ignored
Olivier Goffart [Thu, 23 Nov 2017 08:15:22 +0000 (08:15 +0000)]
Do not perform the analysis based warning if the warnings are ignored

This saves some cycles when compiling with "-w".

(Also fix a potential crash on invalid code for tools that tries to recover from some
errors, because analysis might compute the CFG which crashes if the code contains
invalid declaration. This does not happen normally with because we also don't perform
these analysis if there was an error.)

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

llvm-svn: 318900

6 years agoRevert r318822 "[llvm-tblgen] - Stop using std::string in RecordKeeper."
George Rimar [Thu, 23 Nov 2017 06:52:44 +0000 (06:52 +0000)]
Revert r318822 "[llvm-tblgen] - Stop using std::string in RecordKeeper."

It reported to have problems with memory sanitizers and DBUILD_SHARED_LIBS=ON.

llvm-svn: 318899

6 years ago[IRCE][NFC] Add no wrap flags to no-wrapping SCEV calculation
Max Kazantsev [Thu, 23 Nov 2017 06:14:39 +0000 (06:14 +0000)]
[IRCE][NFC] Add no wrap flags to no-wrapping SCEV calculation

In a lambda where we expect to have result within bounds, add respective `nsw/nuw` flags to
help SCEV just in case if it fails to figure them out on its own.

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

llvm-svn: 318898

6 years agoAdd additional 'UNSUPPORTED' to the test case.
Marshall Clow [Thu, 23 Nov 2017 05:43:25 +0000 (05:43 +0000)]
Add additional 'UNSUPPORTED' to the test case.

llvm-svn: 318897

6 years ago[DeclPrinter] Allow printing fully qualified name of function declaration
Serge Pavlov [Thu, 23 Nov 2017 05:38:20 +0000 (05:38 +0000)]
[DeclPrinter] Allow printing fully qualified name of function declaration

When requesting a tooltip for a function call in an IDE, the fully
qualified name helps to remove ambiguity in the function signature.

Patch by Nikolai Kosjar!

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

llvm-svn: 318896

6 years agoAdd backend name to AVR Target to enable runtime info to be fed back into TableGen
Leslie Zhai [Thu, 23 Nov 2017 04:11:11 +0000 (04:11 +0000)]
Add backend name to AVR Target to enable runtime info to be fed back into TableGen

llvm-svn: 318895

6 years ago[X86] Turn an if condition that should always be true into an assert. NFCI
Craig Topper [Thu, 23 Nov 2017 03:24:01 +0000 (03:24 +0000)]
[X86] Turn an if condition that should always be true into an assert. NFCI

If Values.size() == 0, we should have returned 0 or undef earlier. If it was 1, it's a splat and we already handled that too.

llvm-svn: 318894

6 years ago[X86] Remove unnecessary check for is128BitVector. NFC
Craig Topper [Thu, 23 Nov 2017 03:24:00 +0000 (03:24 +0000)]
[X86] Remove unnecessary check for is128BitVector. NFC

256 and 512 bit vectors were picked off earlier in the function. Lots of code between there and here already assumed 128-bit vectors.

llvm-svn: 318893

6 years ago[X86] Simplify some bitmasking and use llvm_unreachable to mark an impossible case...
Craig Topper [Thu, 23 Nov 2017 03:23:59 +0000 (03:23 +0000)]
[X86] Simplify some bitmasking and use llvm_unreachable to mark an impossible case. NFC

llvm-svn: 318892

6 years ago[X86] Remove a ternary operator that can only ever be false. NFC
Craig Topper [Thu, 23 Nov 2017 03:23:58 +0000 (03:23 +0000)]
[X86] Remove a ternary operator that can only ever be false. NFC

We are checking for AVX512 in an SSE1 only block.

llvm-svn: 318891

6 years ago[NFC] CodeGen: Handle shift amount type in DAGTypeLegalizer::SplitInteger
Yaxun Liu [Thu, 23 Nov 2017 03:08:51 +0000 (03:08 +0000)]
[NFC] CodeGen: Handle shift amount type in DAGTypeLegalizer::SplitInteger

This patch reverts change to X86TargetLowering::getScalarShiftAmountTy in
rL318727 and move the logic to DAGTypeLegalizer::SplitInteger.

The reason is that getScalarShiftAmountTy returns a shift amount type that
is suitable for common use cases in CodeGen. DAGTypeLegalizer::SplitInteger
is a rare situation which requires a shift amount type larger than what
getScalarShiftAmountTy. In this case, it is more reasonable to do special
handling of shift amount type in DAGTypeLegalizer::SplitInteger only. If
similar situations arises the logic may be moved to a separate function.

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

llvm-svn: 318890

6 years agoAdd [[nodiscard]] to std::async as part of P0600.
Marshall Clow [Thu, 23 Nov 2017 01:25:03 +0000 (01:25 +0000)]
Add [[nodiscard]] to std::async as part of P0600.

llvm-svn: 318889

6 years ago[AST] Fix some Clang-tidy modernize and Include What You Use warnings; other minor...
Eugene Zelenko [Thu, 23 Nov 2017 01:20:07 +0000 (01:20 +0000)]
[AST] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC).

llvm-svn: 318888

6 years agoInstrumentation.h: Remove dead/untested code for DFSan JIT support
David Blaikie [Thu, 23 Nov 2017 00:08:40 +0000 (00:08 +0000)]
Instrumentation.h: Remove dead/untested code for DFSan JIT support

llvm-svn: 318887

6 years agoRun clang-format on source/Host/common/Symbols.cpp
Stephane Sezer [Wed, 22 Nov 2017 23:56:32 +0000 (23:56 +0000)]
Run clang-format on source/Host/common/Symbols.cpp

I saw a bunch of style errors so this fixes them.

llvm-svn: 318886

6 years ago[X86] Regenerate the vector-popcnt and vector-tzcnt tests to get BITALG CHECK linse...
Craig Topper [Wed, 22 Nov 2017 23:35:12 +0000 (23:35 +0000)]
[X86] Regenerate the vector-popcnt and vector-tzcnt tests to get BITALG CHECK linse on all functions not just the vXi16/vXi8.

llvm-svn: 318885

6 years ago[AArch64] Adjust the cost model for Exynos M1 and M2
Evandro Menezes [Wed, 22 Nov 2017 22:48:50 +0000 (22:48 +0000)]
[AArch64] Adjust the cost model for Exynos M1 and M2

Fix the modeling of some loads and stores.

llvm-svn: 318884

6 years agoAdd testcase for pr34113.
Rafael Espindola [Wed, 22 Nov 2017 22:00:50 +0000 (22:00 +0000)]
Add testcase for pr34113.

llvm-svn: 318883

6 years ago[AST] Fix some Clang-tidy modernize and Include What You Use warnings; other minor...
Eugene Zelenko [Wed, 22 Nov 2017 21:32:07 +0000 (21:32 +0000)]
[AST] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC).

llvm-svn: 318882

6 years ago[OPENMP] Add support for cancel constructs in `target teams distribute
Alexey Bataev [Wed, 22 Nov 2017 21:12:03 +0000 (21:12 +0000)]
[OPENMP] Add support for cancel constructs in `target teams distribute
parallel for`.

Add support for cancel/cancellation point directives inside `target
teams distribute parallel for` directives.

llvm-svn: 318881

6 years agoMachONormalizedFile.h: Remove unimplemented function
David Blaikie [Wed, 22 Nov 2017 21:10:19 +0000 (21:10 +0000)]
MachONormalizedFile.h: Remove unimplemented function

dump had no definition, so op<< was never usable anyway - remove the
definition of the latter and the declaration of the former.

llvm-svn: 318880

6 years agowasm/OutputSegment.h: Include missing header
David Blaikie [Wed, 22 Nov 2017 21:10:17 +0000 (21:10 +0000)]
wasm/OutputSegment.h: Include missing header

llvm-svn: 318879

6 years agoIR printing improvement for loop passes
Fedor Sergeev [Wed, 22 Nov 2017 20:59:53 +0000 (20:59 +0000)]
IR printing improvement for loop passes

Summary:
Loop-pass printing is somewhat deficient since it does not provide the
context around the loop (e.g. preheader). This context information becomes
pretty essential when analyzing transformations that move stuff out of the loop.

Extending printLoop to cover preheader and exit blocks (if any).

Reviewers: sanjoy, silvas, weimingz

Reviewed By: sanjoy

Subscribers: apilipenko, skatkov, llvm-commits

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

llvm-svn: 318878

6 years ago[Hexagon] Implement buildVector32 and buildVector64 as utility functions
Krzysztof Parzyszek [Wed, 22 Nov 2017 20:56:23 +0000 (20:56 +0000)]
[Hexagon] Implement buildVector32 and buildVector64 as utility functions

Change LowerBUILD_VECTOR to use those functions. This commit will tempora-
rily affect constant vector generation (it will generate constant-extended
values instead of non-extended combines), but the code for the general case
should be better. The constant selection part will be fixed later.

llvm-svn: 318877

6 years ago[Hexagon] Add patterns to select A2_combine_ll and its variants
Krzysztof Parzyszek [Wed, 22 Nov 2017 20:55:41 +0000 (20:55 +0000)]
[Hexagon] Add patterns to select A2_combine_ll and its variants

llvm-svn: 318876

6 years ago[Hexagon] Remove trailing spaces, NFC
Krzysztof Parzyszek [Wed, 22 Nov 2017 20:43:00 +0000 (20:43 +0000)]
[Hexagon] Remove trailing spaces, NFC

llvm-svn: 318875

6 years ago[demangler] Support for abi_tag attribute
Erik Pilkington [Wed, 22 Nov 2017 20:38:22 +0000 (20:38 +0000)]
[demangler] Support for abi_tag attribute

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

llvm-svn: 318874

6 years agoAdd a missing include found by modules bot.
Paul Robinson [Wed, 22 Nov 2017 20:31:39 +0000 (20:31 +0000)]
Add a missing include found by modules bot.

llvm-svn: 318873

6 years ago[OPENMP] Add support for cancel constructs in [teams] distribute
Alexey Bataev [Wed, 22 Nov 2017 20:19:50 +0000 (20:19 +0000)]
[OPENMP] Add support for cancel constructs in [teams] distribute
parallel for directives.

Added codegen/sema support for cancel constructs in [teams] distribute
parallel for directives.

llvm-svn: 318872

6 years ago[X86] Support v32i16/v64i8 CTLZ using lookup table.
Craig Topper [Wed, 22 Nov 2017 20:05:57 +0000 (20:05 +0000)]
[X86] Support v32i16/v64i8 CTLZ using lookup table.

Had to tweak the setcc's used by the code to use a vXi1 result type with a sign extend back to vector size.

llvm-svn: 318871

6 years ago[X86] Move the BITALG setOperationAction code into the hasBWI section to match what...
Craig Topper [Wed, 22 Nov 2017 20:05:54 +0000 (20:05 +0000)]
[X86] Move the BITALG setOperationAction code into the hasBWI section to match what is done for VPOPCNTDQ in the AVX512F block. NFC

llvm-svn: 318870

6 years ago[X86] Sink the MGATHER setOperationActions for AVX2 into the AVX block where most...
Craig Topper [Wed, 22 Nov 2017 20:05:51 +0000 (20:05 +0000)]
[X86] Sink the MGATHER setOperationActions for AVX2 into the AVX block where most of the rest of the AVX2 legalization lives.

llvm-svn: 318869

6 years agoRemove unnecessary code.
Rafael Espindola [Wed, 22 Nov 2017 20:02:57 +0000 (20:02 +0000)]
Remove unnecessary code.

There is already an RAII in place to discard the temporary.

llvm-svn: 318868

6 years agoAllow TempFile::discard to be called twice.
Rafael Espindola [Wed, 22 Nov 2017 19:59:05 +0000 (19:59 +0000)]
Allow TempFile::discard to be called twice.

We already allowed keep+discard. It is important to be able to discard
a temporary if a rename fail. It is also convenient as it allows the
use of RAII for discarding.

Allow discarding twice for similar reasons.

llvm-svn: 318867

6 years agoRevert "[CodeGen] Fix vtable not receiving hidden visibility when using push(visibility)"
Petr Hosek [Wed, 22 Nov 2017 19:50:17 +0000 (19:50 +0000)]
Revert "[CodeGen] Fix vtable not receiving hidden visibility when using push(visibility)"

This reverts commit r318853: tests are failing on Windows bots

llvm-svn: 318866

6 years ago[libcxx] Implement std::to_address for C++20
Eric Fiselier [Wed, 22 Nov 2017 19:49:21 +0000 (19:49 +0000)]
[libcxx] Implement std::to_address for C++20

Summary: Now implements P0653R2 - Utility to convert to raw pointer.

Reviewers: mclow.lists, EricWF

Reviewed By: EricWF

Subscribers: cfe-commits

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

llvm-svn: 318865

6 years agoImplement p0137r1 - std::launder. Reviewed as https://reviews.llvm.org/D40144
Marshall Clow [Wed, 22 Nov 2017 19:49:03 +0000 (19:49 +0000)]
Implement p0137r1 - std::launder. Reviewed as https://reviews.llvm.org/D40144

llvm-svn: 318864

6 years ago[libcxx][fixup] Mark std::basic_istream::getline tests as failing for previous libcxx...
Volodymyr Sapsai [Wed, 22 Nov 2017 19:36:54 +0000 (19:36 +0000)]
[libcxx][fixup] Mark std::basic_istream::getline tests as failing for previous libcxx versions.

r318862 added a fix for 0-termination input array in case of an error. Previous
libcxx versions don't have the fix and corresponding tests should be failing.

llvm-svn: 318863

6 years ago[libcxx] Make std::basic_istream::getline 0-terminate input array in case of error.
Volodymyr Sapsai [Wed, 22 Nov 2017 18:52:36 +0000 (18:52 +0000)]
[libcxx] Make std::basic_istream::getline 0-terminate input array in case of error.

It covers the cases when the sentry object returns false and when an exception
was thrown. Corresponding standard paragraph is C++14 [istream.unformatted]p21:
  In any case, if n is greater than zero, it then stores a null character
  (using charT()) into the next successive location of the array.

Patch by Reimar Döffinger.

llvm-svn: 318862

6 years agoRemove unnecessary include.
Paul Robinson [Wed, 22 Nov 2017 18:39:26 +0000 (18:39 +0000)]
Remove unnecessary include.

llvm-svn: 318861

6 years ago[OPENMP] Added missed checks for for [simd] based directives.
Alexey Bataev [Wed, 22 Nov 2017 18:34:02 +0000 (18:34 +0000)]
[OPENMP] Added missed checks for for [simd] based directives.

Added missed checks/analysis for safelen/simdlen clauses + linear clause
in for [simd] based directives.

llvm-svn: 318860

6 years ago[scudo] Overhaul hardware CRC32 feature detection
Kostya Kortchinsky [Wed, 22 Nov 2017 18:30:44 +0000 (18:30 +0000)]
[scudo] Overhaul hardware CRC32 feature detection

Summary:
This patch aims at condensing the hardware CRC32 feature detection and making
it slightly more effective on Android.

The following changes are included:
- remove the `CPUFeature` enum, and get rid of one level of nesting of
  functions: we only used CRC32, so we just implement and use
  `hasHardwareCRC32`;
- allow for a weak `getauxval`: the Android toolchain is compiled at API level
  14 for Android ARM, meaning no `getauxval` at compile time, yet we will run
  on API level 27+ devices. The `/proc/self/auxv` fallback can work but is
  worthless for a process like `init` where the proc filesystem doesn't exist
  yet. If a weak `getauxval` doesn't exist, then fallback.
- couple of extra corrections.

Reviewers: alekseyshl

Reviewed By: alekseyshl

Subscribers: kubamracek, aemerson, srhines, kristof.beyls, llvm-commits

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

llvm-svn: 318859

6 years agoCachePruning: Allow limiting the number of files in the cache directory.
Peter Collingbourne [Wed, 22 Nov 2017 18:27:31 +0000 (18:27 +0000)]
CachePruning: Allow limiting the number of files in the cache directory.

The default limit is 1000000 but it can be configured with a cache
policy. The motivation is that some filesystems (notably ext4) have
a limit on the number of files that can be contained in a directory
(separate from the inode limit).

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

llvm-svn: 318857

6 years ago[DwarfDump] -debug-line=offset applies to .dwo too.
Paul Robinson [Wed, 22 Nov 2017 18:23:55 +0000 (18:23 +0000)]
[DwarfDump] -debug-line=offset applies to .dwo too.

llvm-svn: 318856

6 years ago[X86] Spell penryn correctly in some comments. NFC
Craig Topper [Wed, 22 Nov 2017 18:23:40 +0000 (18:23 +0000)]
[X86] Spell penryn correctly in some comments. NFC

llvm-svn: 318855

6 years ago[CodeGen] Fix vtable not receiving hidden visibility when using push(visibility)
Petr Hosek [Wed, 22 Nov 2017 17:59:30 +0000 (17:59 +0000)]
[CodeGen] Fix vtable not receiving hidden visibility when using push(visibility)

This change should resolve https://bugs.llvm.org/show_bug.cgi?id=35022

Patch by Jake Ehrlich

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

llvm-svn: 318853

6 years agoSimplify as-needed handling.
Rafael Espindola [Wed, 22 Nov 2017 17:50:42 +0000 (17:50 +0000)]
Simplify as-needed handling.

This is a reduction of a patch by Rui Ueyama.

llvm-svn: 318852

6 years ago[OPENMP] General improvement of code, NFC.
Alexey Bataev [Wed, 22 Nov 2017 17:19:31 +0000 (17:19 +0000)]
[OPENMP] General improvement of code, NFC.

llvm-svn: 318849

6 years agoFix for OMP doacross implementation on Power
Jonas Hahnfeld [Wed, 22 Nov 2017 17:15:20 +0000 (17:15 +0000)]
Fix for OMP doacross implementation on Power

Power has a weak consistency model so we need memory barriers to
make writes (both from runtime and from user code) available for
all threads.

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

llvm-svn: 318848

6 years ago[CMake] Re-enable libomptarget and restrict tests to Clang 6.0.0
Jonas Hahnfeld [Wed, 22 Nov 2017 17:15:18 +0000 (17:15 +0000)]
[CMake] Re-enable libomptarget and restrict tests to Clang 6.0.0

We have just fixed the codegen of omp_is_initial_device() to reliably work
when offloading to the same device, see commit r316001. This fixes the
failing tests that were the reason why we disabled the library for 5.0.

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

llvm-svn: 318847

6 years agoRemove extra minuses from command option
Tatyana Krasnukha [Wed, 22 Nov 2017 17:07:43 +0000 (17:07 +0000)]
Remove extra minuses from command option

Reviewers: labath, abidh, clayborg, ki.stfu

Reviewed By: labath, abidh, clayborg, ki.stfu

Subscribers: clayborg, ki.stfu, lldb-commits

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

llvm-svn: 318846

6 years ago[AMDGPU] Fix SITargetLowering::LowerCall for pointer info of byval argument
Yaxun Liu [Wed, 22 Nov 2017 16:13:35 +0000 (16:13 +0000)]
[AMDGPU] Fix SITargetLowering::LowerCall for pointer info of byval argument

SITargetLowering::LowerCall uses dummy pointer info for byval argument, which causes
flat load instead of buffer load.

This patch fixes that.

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

llvm-svn: 318844

6 years ago[OPENMP] Do not mark captured variables as artificial in debug info.
Alexey Bataev [Wed, 22 Nov 2017 16:02:03 +0000 (16:02 +0000)]
[OPENMP] Do not mark captured variables as artificial in debug info.

Captured variables should not be marked as artificial parameters in
outlined functions in debug info.

llvm-svn: 318843

6 years ago[DebugInfo] Dump a .debug_line section, including line-number program,
Paul Robinson [Wed, 22 Nov 2017 15:48:30 +0000 (15:48 +0000)]
[DebugInfo] Dump a .debug_line section, including line-number program,
without any compile units.

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

llvm-svn: 318842

6 years ago[AMDGPU][mc][tests] Updated generated lit tests for GFX8/9
Dmitry Preobrazhensky [Wed, 22 Nov 2017 15:47:27 +0000 (15:47 +0000)]
[AMDGPU][mc][tests] Updated generated lit tests for GFX8/9

Summary:
Added tests to better cover features introduced by commit rL318675.
See http://llvm.org/viewvc/llvm-project?view=revision&revision=318675

llvm-svn: 318841

6 years ago[FindAllSymbols] Cache regexes, creating them is expensive
Benjamin Kramer [Wed, 22 Nov 2017 15:38:23 +0000 (15:38 +0000)]
[FindAllSymbols] Cache regexes, creating them is expensive

This is a bit annoying because LLVM regexes are always mutable to store
errors. Assert that there are never errors and fix broken hardcoded
regexes.

llvm-svn: 318840

6 years ago[DWARFv5] Support DW_FORM_strp in the .debug_line.dwo header.
Paul Robinson [Wed, 22 Nov 2017 15:33:17 +0000 (15:33 +0000)]
[DWARFv5] Support DW_FORM_strp in the .debug_line.dwo header.

As a side effect, the .debug_line section will be dumped in physical
order, rather than in the order that compile units refer to their
associated portions of the .debug_line section.  These are probably
always the same order anyway, and no tests noticed the difference.

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

llvm-svn: 318839

6 years ago[DWARF] Fix handling of extended line-number opcodes
Paul Robinson [Wed, 22 Nov 2017 15:14:49 +0000 (15:14 +0000)]
[DWARF] Fix handling of extended line-number opcodes

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

llvm-svn: 318838

6 years ago[OpenMP] Adjust arguments of nvptx runtime functions
Jonas Hahnfeld [Wed, 22 Nov 2017 14:46:49 +0000 (14:46 +0000)]
[OpenMP] Adjust arguments of nvptx runtime functions

In the future the compiler will analyze whether the OpenMP
runtime needs to be (fully) initialized and avoid that overhead
if possible. The functions already take an argument to transfer
that information to the runtime, so pass in the default value 1.
(This is needed for binary compatibility with libomptarget-nvptx
currently being upstreamed.)

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

llvm-svn: 318836

6 years ago[OPENMP] Codegen for `target teams` directive.
Alexey Bataev [Wed, 22 Nov 2017 14:25:55 +0000 (14:25 +0000)]
[OPENMP] Codegen for `target teams` directive.

Added codegen of the clauses for `target teams` directive.

llvm-svn: 318834

6 years agoRemove unused variable.
Tatyana Krasnukha [Wed, 22 Nov 2017 13:35:04 +0000 (13:35 +0000)]
Remove unused variable.

llvm-svn: 318833

6 years agoTest commit. Fix typo in comment.
Tatyana Krasnukha [Wed, 22 Nov 2017 13:03:02 +0000 (13:03 +0000)]
Test commit. Fix typo in comment.

llvm-svn: 318832

6 years ago[MIPS] Write PLT0 entry in case of linking N64 ABI code
Simon Atanasyan [Wed, 22 Nov 2017 12:34:29 +0000 (12:34 +0000)]
[MIPS] Write PLT0 entry in case of linking N64 ABI code

llvm-svn: 318831

6 years agoAdd another test_macros.h include I missed to tuple.by.type.pass.cpp
Billy Robert O'Neal III [Wed, 22 Nov 2017 12:29:17 +0000 (12:29 +0000)]
Add another test_macros.h include I missed to tuple.by.type.pass.cpp

llvm-svn: 318830

6 years agoAMDGPU: Consider memory dependencies with moved instructions in SILoadStoreOptimizer
Nicolai Haehnle [Wed, 22 Nov 2017 12:25:21 +0000 (12:25 +0000)]
AMDGPU: Consider memory dependencies with moved instructions in SILoadStoreOptimizer

Summary:
This bug seems to have gone unnoticed because critical cases with LDS
instructions are eliminated by the peephole optimizer.

However, equivalent situations arise with buffer loads and stores
as well, so this fixes regressions since r317751 ("AMDGPU: Merge
S_BUFFER_LOAD_DWORD_IMM into x2, x4").

Fixes at least:
KHR-GL45.shader_storage_buffer_object.basic-operations-case1-cs
KHR-GL45.cull_distance.functional
piglit tes-input-gl_ClipDistance.shader_test
... and probably more

Change-Id: I0e371536288eb8e6afeaa241a185266fd45d129d

Reviewers: arsenm, mareko, rampitec

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

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

llvm-svn: 318829

6 years ago[ELF] Fix DT_MIPS_LOCAL_GOTNO value for thunks and linker scripts
James Henderson [Wed, 22 Nov 2017 12:04:21 +0000 (12:04 +0000)]
[ELF] Fix DT_MIPS_LOCAL_GOTNO value for thunks and linker scripts

The MIPS GOT section has a number of local entries based on the number of pages
needed for output sections referenced by GOT page relocations. The number is
recorded in the DT_MIPS_LOCAL_GOTNO dynamic section tag. However, the dynamic tag
is added before assignAddresses has been called, meaning that any section size used
to calculate the value will not include size modifications caused by, for example,
linker scripts and thunks.

This change moves the calculation of DT_MIPS_LOCAL_GOTNO until writeTo, by which
time the output section sizes have been finalized.

Reviewers: ruiu, rafael

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

llvm-svn: 318828

6 years ago[Docs] Update list of languages clang-format can format
Malcolm Parsons [Wed, 22 Nov 2017 10:47:35 +0000 (10:47 +0000)]
[Docs] Update list of languages clang-format can format

llvm-svn: 318827

6 years agoReturn early. NFC.
Rui Ueyama [Wed, 22 Nov 2017 09:06:42 +0000 (09:06 +0000)]
Return early. NFC.

llvm-svn: 318826

6 years agoAdd more blank lines to separate code chunks.
Rui Ueyama [Wed, 22 Nov 2017 09:06:27 +0000 (09:06 +0000)]
Add more blank lines to separate code chunks.

llvm-svn: 318825

6 years ago[DAGCombiner] Bugfix in isAlias().
Jonas Paulsson [Wed, 22 Nov 2017 08:58:30 +0000 (08:58 +0000)]
[DAGCombiner]  Bugfix in isAlias().

Since i1 is a legal type, this:

  NumBytes = Op1->getMemoryVT().getSizeInBits() >> 3;

is wrong and should be instead

  NumBytes = Op0->getMemoryVT().getStoreSize();

There seems to be more places where this should be fixed outside DAGCombiner.

Review: Hal Finkel
https://bugs.llvm.org/show_bug.cgi?id=35366

llvm-svn: 318824

6 years ago[X86] Add an X86ISD::MSCATTER node for consistency with the X86ISD::MGATHER.
Craig Topper [Wed, 22 Nov 2017 08:10:54 +0000 (08:10 +0000)]
[X86] Add an X86ISD::MSCATTER node for consistency with the X86ISD::MGATHER.

This makes the fact that X86 needs an explicit mask output not part of the type constraint for the ISD::MSCATTER.

This also gives the X86ISD::MGATHER/MSCATTER nodes a common base class simplifying the address selection code in X86ISelDAGToDAG.cpp

llvm-svn: 318823

6 years ago[llvm-tblgen] - Stop using std::string in RecordKeeper.
George Rimar [Wed, 22 Nov 2017 07:53:48 +0000 (07:53 +0000)]
[llvm-tblgen] - Stop using std::string in RecordKeeper.

RecordKeeper::getDef() is a hot place, it shows up in profiling
and it creates std::string instance for each search in RecordMap
though RecordKeeper::RecordMap can use StringRef as a key
instead to avoid that. Patch do that change.

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

llvm-svn: 318822

6 years ago[X86] Lower all ISD::MGATHER nodes to X86ISD:MGATHER.
Craig Topper [Wed, 22 Nov 2017 07:11:03 +0000 (07:11 +0000)]
[X86] Lower all ISD::MGATHER nodes to X86ISD:MGATHER.

Now we consistently represent the mask result without relying on isel ignoring it.

We now have a more general SDNode and type constraints to represent these nodes in isel patterns. This allows us to present both both vXi1 and XMM/YMM mask types with a single set of constraints.

llvm-svn: 318821

6 years ago[SelectionDAG] Add a isel matcher op to check the type of node results other than...
Craig Topper [Wed, 22 Nov 2017 07:11:01 +0000 (07:11 +0000)]
[SelectionDAG] Add a isel matcher op to check the type of node results other than result 0.

I plan to use this to check the type of the mask result of masked gathers in the X86 backend.

llvm-svn: 318820

6 years ago[SCEV] Strengthen variance condition in calculateLoopDisposition
Max Kazantsev [Wed, 22 Nov 2017 06:21:39 +0000 (06:21 +0000)]
[SCEV] Strengthen variance condition in calculateLoopDisposition

Given loops `L1` and `L2` with AddRecs `AR1` and `AR2` varying in them respectively.
When identifying loop disposition of `AR2` w.r.t. `L1`, we only say that it is varying if
`L1` contains `L2`. But there is also a possible situation where `L1` and `L2` are
consecutive sibling loops within the parent loop. In this case, `AR2` is also varying
w.r.t. `L1`, but we don't correctly identify it.

It can lead, for exaple, to attempt of incorrect folding. Consider:
  AR1 = {a,+,b}<L1>
  AR2 = {c,+,d}<L2>
  EXAR2 = sext(AR1)
  MUL = mul AR1, EXAR2
If we incorrectly assume that `EXAR2` is invariant w.r.t. `L1`, we can end up trying to
construct something like: `{a * {c,+,d}<L2>,+,b * {c,+,d}<L2>}<L1>`, which is incorrect
because `AR2` is not available on entrance of `L1`.

Both situations "`L1` contains `L2`" and "`L1` preceeds sibling loop `L2`" can be handled
with one check: "header of `L1` dominates header of `L2`". This patch replaces the old
insufficient check with this one.

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

llvm-svn: 318819

6 years agoAdd some tests for operations on const associative containers. Part of LWG#2542
Marshall Clow [Wed, 22 Nov 2017 06:02:27 +0000 (06:02 +0000)]
Add some tests for operations on const associative containers. Part of LWG#2542

llvm-svn: 318818

6 years ago[SCCP] Pick the right lattice value for constants.
Davide Italiano [Wed, 22 Nov 2017 03:04:55 +0000 (03:04 +0000)]
[SCCP] Pick the right lattice value for constants.

After the dataflow algorithm proves that an argument is constant,
it replaces it value with the integer constant and drops the lattice
value associated to the DEF.

e.g. in the example we have @f() that's called twice:
call @f(undef, ...)
call @f(2, ...)

`undef` MEET 2 = 2 so we replace the argument and all its uses with
the constant 2.

Shortly after, tryToReplaceWithConstantRange() tries to get the lattice
value for the argument we just replaced, causing an assertion.
This function is a little peculiar as it runs when we're doing replacement
and not as part of the solver but still queries the solver.

The fix is that of checking whether we replaced the value already and
get a temporary lattice value for the constant.

Thanks to Zhendong Su for the report!

Fixes PR35357.

llvm-svn: 318817

6 years ago[Driver] Make the use of relax relocations a per target option
Petr Hosek [Wed, 22 Nov 2017 01:38:31 +0000 (01:38 +0000)]
[Driver] Make the use of relax relocations a per target option

The support for relax relocations is dependent on the linker and
different toolchains within the same compiler can be using different
linkers some of which may or may not support relax relocations.

Give toolchains the option to control whether they want to use relax
relocations in addition to the existing (global) build system option.

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

llvm-svn: 318816

6 years ago[X86] Update CPUSupports code to reuse LLVM .def file [NFC]
Erich Keane [Wed, 22 Nov 2017 00:54:01 +0000 (00:54 +0000)]
[X86] Update CPUSupports code to reuse LLVM .def file [NFC]

llvm-svn: 318815

6 years ago[X86] Move the information about the feature bits used by compiler-rt and shared...
Craig Topper [Tue, 21 Nov 2017 23:36:42 +0000 (23:36 +0000)]
[X86] Move the information about the feature bits used by compiler-rt and shared by Host.cpp to a .def file and TargetParser.h so clang can make use of it.

Since we keep Host.cpp and compiler-rt relatively in sync, clang can use this information as a proxy.

llvm-svn: 318814

6 years ago[AST] Fix some Clang-tidy modernize and Include What You Use warnings; other minor...
Eugene Zelenko [Tue, 21 Nov 2017 23:26:08 +0000 (23:26 +0000)]
[AST] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC).

llvm-svn: 318813

6 years agoReplace assert(true) in tests with actual asserts. Reviewed as https://reviews.llvm...
Billy Robert O'Neal III [Tue, 21 Nov 2017 23:03:02 +0000 (23:03 +0000)]
Replace assert(true) in tests with actual asserts. Reviewed as https://reviews.llvm.org/D40324

In a17cd7c641c34b6c4bd4845a4d4fb590cb6c238c Marshall added assert(true) to the vector<bool>::size tests, which break on C1XX:

D:\Contest\gl0qojfu.5pe\src\qa\vc\libs\libcxx\upstream\test\std\containers\sequences\vector.bool\size.pass.cpp(62): error C2220: warning treated as error - no 'object' file generated
d:\contest\gl0qojfu.5pe\src\qa\vc\libs\libcxx\upstream\test\std\containers\sequences\vector.bool\size.pass.cpp(33) : warning C6326: Potential comparison of a constant with another constant.
d:\contest\gl0qojfu.5pe\src\qa\vc\libs\libcxx\upstream\test\std\containers\sequences\vector.bool\size.pass.cpp(52) : warning C6326: Potential comparison of a constant with another constant.

The corresponding test for vector::size asserts assert(c.size() == 3);, so I changed it to do that here.

llvm-svn: 318812

6 years ago[OpenMP] Fix tests after r318789
Richard Trieu [Tue, 21 Nov 2017 22:53:19 +0000 (22:53 +0000)]
[OpenMP] Fix tests after r318789

Update use of __tgt_target that had some 32bit types updated to 64bit.

llvm-svn: 318811

6 years agoRemove a broken win32 locale function redirection
Martin Storsjo [Tue, 21 Nov 2017 22:41:15 +0000 (22:41 +0000)]
Remove a broken win32 locale function redirection

One can't replace vsscanf(_l) with a sscanf(_l) that doesn't
take a va_list.

This has been untouched since it was added in SVN r140728, so
apparently it hasn't been used since. One reason for this mistake
originally might have been that there was no _vsscanf_l until MSVC
2015.

Since it's unused, just remove this define.

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

llvm-svn: 318810

6 years agoSilence some MSVC warnings about not all control paths returning a value; NFC.
Aaron Ballman [Tue, 21 Nov 2017 22:24:13 +0000 (22:24 +0000)]
Silence some MSVC warnings about not all control paths returning a value; NFC.

llvm-svn: 318809

6 years agoAdd missing test_macros.h inclusion.
Billy Robert O'Neal III [Tue, 21 Nov 2017 22:16:57 +0000 (22:16 +0000)]
Add missing test_macros.h inclusion.

llvm-svn: 318808

6 years ago[Hexagon] Add HexagonSubtarget::getVectorLength()
Krzysztof Parzyszek [Tue, 21 Nov 2017 22:13:16 +0000 (22:13 +0000)]
[Hexagon] Add HexagonSubtarget::getVectorLength()

llvm-svn: 318807

6 years ago[CodeGen] Detect empty domain because of parameters context.
Michael Kruse [Tue, 21 Nov 2017 22:11:10 +0000 (22:11 +0000)]
[CodeGen] Detect empty domain because of parameters context.

Isl does not allow generating isl_ast_expr from an isl_pw_aff that has an
empty domain (i.e. has no pieces). We already detected the case if the
isl_pw_aff comes with an empty domain.

isl_ast_build also considers the domain empty if it is disjoint with the
parameter context (e.g. parameters values that we exclude by runtime
versioning).

Intersect the access relation domain with the parameter context to
also detect such practically empty access domains. The effective
pointer used in the generated code is unimportand because it will never
be executed.

This fixes llvm.org/PR35362

llvm-svn: 318806

6 years agoObject: Improve COFF irsymtab comdat representation.
Peter Collingbourne [Tue, 21 Nov 2017 22:06:20 +0000 (22:06 +0000)]
Object: Improve COFF irsymtab comdat representation.

Change the representation of COFF comdats so that a COFF linker
is able to accurately resolve comdats between IR and native object
files. Specifically, apply name mangling to comdat names consistently
with native object files, and do not export comdats with an internal
leader because they do not affect symbol resolution.

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

llvm-svn: 318805

6 years agoChange (void) casts to TEST_IGNORE_NODISCARD, as requested by Eric. Reviewed as https...
Billy Robert O'Neal III [Tue, 21 Nov 2017 21:37:26 +0000 (21:37 +0000)]
Change (void) casts to TEST_IGNORE_NODISCARD, as requested by Eric. Reviewed as https://reviews.llvm.org/D40065

llvm-svn: 318804

6 years ago[TableGen] Improve error reporting
Evandro Menezes [Tue, 21 Nov 2017 21:33:52 +0000 (21:33 +0000)]
[TableGen] Improve error reporting

When searching for a resource unit, use the reference location instead of
the definition location in case of an error.

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

llvm-svn: 318803

6 years ago[scudo] Make getNumberOfCPUs Fuchsia compliant v2
Kostya Kortchinsky [Tue, 21 Nov 2017 21:14:00 +0000 (21:14 +0000)]
[scudo] Make getNumberOfCPUs Fuchsia compliant v2

Summary:
This change allows Fuchsia to boot properly using the Scudo allocator.

A first version of this commit was reverted by rL317834 because it broke Android
builds for toolchains generated with older NDKs. This commit introduces a
fall back to solve that issue.

Reviewers: cryptoad, krytarowski, rnk, alekseyshl

Reviewed By: cryptoad, krytarowski, alekseyshl

Subscribers: llvm-commits, srhines, kubamracek, krytarowski

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

llvm-svn: 318802

6 years ago[Hexagon] Make sure that RDF does not remove EH_LABELs
Krzysztof Parzyszek [Tue, 21 Nov 2017 21:05:51 +0000 (21:05 +0000)]
[Hexagon] Make sure that RDF does not remove EH_LABELs

Since EH_LABELs (and other labels) no longer have "side-effects", they
should be checked for separately.

llvm-svn: 318801

6 years ago[X86] Allow vpclmulqdq instructions to be commuted during isel to allow load folding.
Craig Topper [Tue, 21 Nov 2017 21:05:21 +0000 (21:05 +0000)]
[X86] Allow vpclmulqdq instructions to be commuted during isel to allow load folding.

The commuting patterns for the AVX version actually still had priority over the new patterns.

llvm-svn: 318800