platform/upstream/llvm.git
5 years ago[NFC][CodeGen][X86][AArch64] Add tests for C++ std::midpoint() pattern (PR40965)
Roman Lebedev [Tue, 5 Mar 2019 20:18:47 +0000 (20:18 +0000)]
[NFC][CodeGen][X86][AArch64] Add tests for C++ std::midpoint() pattern (PR40965)

Tests only for integers, not floating point or pointers.

The scalar 8-bit case uses branch instead of CMOV,
because there is no no 8-bit CMOV.

Vector tests are for consistency, since it can be vectorized.

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

llvm-svn: 355436

5 years agoAdd logging to SBCompileUnit::GetNumLineEntries.
Jason Molenda [Tue, 5 Mar 2019 19:43:56 +0000 (19:43 +0000)]
Add logging to SBCompileUnit::GetNumLineEntries.

llvm-svn: 355435

5 years ago[clang-format] Fix lambdas returning template specialization that contains operator...
Jan Korous [Tue, 5 Mar 2019 19:27:24 +0000 (19:27 +0000)]
[clang-format] Fix lambdas returning template specialization that contains operator in parameter

A template specialization of a template foo<int N> can contain integer constants and a whole bunch of operators - e. g.  foo< 1 ? !0 : (3+1)%4 >

Inspired by https://reviews.llvm.org/D58922

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

llvm-svn: 355434

5 years agoRevert r355224 "[TableGen][SelectionDAG][X86] Add specific isel matchers for immAllZe...
Craig Topper [Tue, 5 Mar 2019 19:18:16 +0000 (19:18 +0000)]
Revert r355224 "[TableGen][SelectionDAG][X86] Add specific isel matchers for immAllZerosV/immAllOnesV. Remove bitcasts from X86 patterns that are no longer necessary."

This caused the first matcher in the isel table for many targets to Opc_Scope instead of Opc_SwitchOpcode. This leads to a significant increase in isel match failures.

llvm-svn: 355433

5 years ago[PGO] Clang part of change for context-sensitive PGO (part2)
Rong Xu [Tue, 5 Mar 2019 19:09:56 +0000 (19:09 +0000)]
[PGO] Clang part of change for context-sensitive PGO (part2)

Part 2 of CSPGO change in Clang: Add test cases.

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

llvm-svn: 355432

5 years ago[Subtarget] Merge ProcSched and ProcDesc arrays in MCSubtargetInfo into a single...
Craig Topper [Tue, 5 Mar 2019 18:54:38 +0000 (18:54 +0000)]
[Subtarget] Merge ProcSched and ProcDesc arrays in MCSubtargetInfo into a single array.

These arrays are both keyed by CPU name and go into the same tablegenerated file. Merge them so we only need to store keys once.

This also removes a weird space saving quirk where we used the ProcDesc.size() to create to build an ArrayRef for ProcSched.

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

llvm-svn: 355431

5 years ago[X86] In X86DomainReassignment.cpp add enclosed registers to EnclosedEdges
Guozhi Wei [Tue, 5 Mar 2019 18:54:34 +0000 (18:54 +0000)]
[X86] In X86DomainReassignment.cpp add enclosed registers to EnclosedEdges

The variable X86DomainReassignment::EnclosedEdges is used to store registers that have been enclosed in some closure, so those registers will be ignored when create new closures. But there is no registers has ever been put into this set, so a single register can be enclosed in multiple closures, it significantly increase compile time.

This patch adds a register into EnclosedEdges when it is enclosed into a closure.

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

llvm-svn: 355430

5 years ago[Subtarget] Create a separate SubtargetSubtargetKV struct for ProcDesc to remove...
Craig Topper [Tue, 5 Mar 2019 18:54:34 +0000 (18:54 +0000)]
[Subtarget] Create a separate SubtargetSubtargetKV struct for ProcDesc to remove fields from the stack tables that aren't needed for CPUs

The description for CPUs was just the CPU name wrapped with "Select the " and " processor". We can just do that directly in the help printer instead of making a separate version in the binary for each CPU.

Also remove the Value field that isn't needed and was always 0.

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

llvm-svn: 355429

5 years ago[Subtarget] Move SubtargetFeatureKV/SubtargetInfoKV from SubtargetFeature.h to MCSubt...
Craig Topper [Tue, 5 Mar 2019 18:54:30 +0000 (18:54 +0000)]
[Subtarget] Move SubtargetFeatureKV/SubtargetInfoKV from SubtargetFeature.h to MCSubtargetInfo.h. Move all code that operates on ProcFeatures and ProcDesc arrays to MCSubtargetInfo.

The SubtargetFeature class managed a list of features as strings. And it also had functions for setting bits in a FeatureBitset.

The methods that operated on the Feature list as strings are used in other parts of the backend. But the parts that operate on FeatureBitset are very tightly coupled to MCSubtargetInfo and requires passing in the arrays that MCSubtargetInfo owns. And the same struct type is used for ProcFeatures and ProcDesc.

This has led to MCSubtargetInfo having 2 arrays keyed by CPU name. One containing a mapping from a CPU name to its features. And one containing a mapping from CPU name to its scheduler model.

I would like to make a single CPU array containing all CPU information and remove some unneeded fields the ProcDesc array currently has. But I don't want to make SubtargetFeatures.h have to know about the scheduler model type and have to forward declare or pull in the header file.

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

llvm-svn: 355428

5 years agoReinstate libc++ patches now that the lldb formatter has been updated.
Davide Italiano [Tue, 5 Mar 2019 18:40:49 +0000 (18:40 +0000)]
Reinstate libc++ patches now that the lldb formatter has been updated.

"[libc++] Fix <atomic> failures on GCC"
"[libc++] Change memory_order to an enum class"
"[libc++] decoupling Freestanding atomic<T> from libatomic.a"

llvm-svn: 355427

5 years agoAMDGPU: Preserve undef flag when expanding SI_IF
Matt Arsenault [Tue, 5 Mar 2019 18:38:00 +0000 (18:38 +0000)]
AMDGPU: Preserve undef flag when expanding SI_IF

Fixes undefined value verifier error.

llvm-svn: 355426

5 years ago[X86] Enable 8-bit SHL to convert to LEA
Craig Topper [Tue, 5 Mar 2019 18:37:41 +0000 (18:37 +0000)]
[X86] Enable 8-bit SHL to convert to LEA

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

llvm-svn: 355425

5 years ago[X86] Allow 8-bit INC/DEC to be converted to LEA.
Craig Topper [Tue, 5 Mar 2019 18:37:37 +0000 (18:37 +0000)]
[X86] Allow 8-bit INC/DEC to be converted to LEA.

We already do this for 16/32/64 as well as 8-bit add with register/immediate. Might as well do it for 8-bit INC/DEC too.

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

llvm-svn: 355424

5 years ago[X86] Enable 8-bit OR with disjoint bits to convert to LEA
Craig Topper [Tue, 5 Mar 2019 18:37:33 +0000 (18:37 +0000)]
[X86] Enable 8-bit OR with disjoint bits to convert to LEA

We already support 8-bits adds in convertToThreeAddress. But we can also support 8-bit OR if the bits are disjoint. We already do this for 16/32/64.

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

llvm-svn: 355423

5 years ago[DataFormatters] Fix regression in libc++ std::atomic formatter caused by https:...
Shafik Yaghmour [Tue, 5 Mar 2019 18:34:35 +0000 (18:34 +0000)]
[DataFormatters] Fix regression in libc++ std::atomic formatter caused by https://reviews.llvm.org/D56913

rdar://problem/48568543

llvm-svn: 355422

5 years ago[CUDA][HIP][Sema] Fix template kernel with function as template parameter
Yaxun Liu [Tue, 5 Mar 2019 18:19:35 +0000 (18:19 +0000)]
[CUDA][HIP][Sema] Fix template kernel with function as template parameter

If a kernel template has a function as its template parameter, a device function should be
allowed as template argument since a kernel can call a device function. However,
currently if the kernel template is instantiated in a host function, clang will emit an error
message saying the device function is an invalid candidate for the template parameter.

This happens because clang checks the reference to the device function during parsing
the template arguments. At this point, the template is not instantiated yet. Clang incorrectly
assumes the device function is called by the host function and emits the error message.

This patch fixes the issue by disabling checking of device function during parsing template
arguments and deferring the check to the instantion of the template. At that point, the
template decl is already available, therefore the check can be done against the instantiated
function template decl.

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

llvm-svn: 355421

5 years ago[SLP] Fix invalid triple in X86 tests
Florian Hahn [Tue, 5 Mar 2019 17:56:35 +0000 (17:56 +0000)]
[SLP] Fix invalid triple in X86 tests

x86-64 is an invalid architecture in triples. Changing it to the correct
triple (x86_64) changes some tests, because SLP is not deemed profitable
any more.

Reviewers: ABataev, RKSimon, spatel

Reviewed By: RKSimon

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

llvm-svn: 355420

5 years agoAllow bundle size to be 0 in clang-offload-bundler
Yaxun Liu [Tue, 5 Mar 2019 17:52:32 +0000 (17:52 +0000)]
Allow bundle size to be 0 in clang-offload-bundler

HIP uses clang-offload-bundler to create fat binary. The bundle for host is empty.
Currently clang-offload-bundler checks if the bundle size is 0 when unbundling.
If so it will exit without unbundling the remaining bundles. This causes
clang-offload-bundler not being able to unbundle fat binaries generated for HIP.

This patch allows bundles size to be 0 when clang-offload-bundler unbundles
input files.

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

llvm-svn: 355419

5 years ago[OPENMP]Target region: emit const firstprivates as globals with constant
Alexey Bataev [Tue, 5 Mar 2019 17:47:18 +0000 (17:47 +0000)]
[OPENMP]Target region: emit const firstprivates as globals with constant
memory.

If the variable with the constant non-scalar type is firstprivatized in
the target region, the local copy is created with the data copying.
Instead, we allocate the copy in the constant memory and avoid extra
copying in the outlined target regions. This global copy is used in the
target regions without loss of the performance.

llvm-svn: 355418

5 years ago[libcxx] Revert set of atomic patches that broke lldb.
Davide Italiano [Tue, 5 Mar 2019 17:38:33 +0000 (17:38 +0000)]
[libcxx] Revert set of atomic patches that broke lldb.

Revert "[libc++] Fix <atomic> failures on GCC"
Revert "[libc++] Change memory_order to an enum class"
Revert "[libc++] decoupling Freestanding atomic<T> from libatomic.a"

The lldb formatter nededs to be updated. Shafik and Louis will
coordinate to do so.

llvm-svn: 355417

5 years ago[scudo][standalone] Add bytemap classes
Kostya Kortchinsky [Tue, 5 Mar 2019 17:36:11 +0000 (17:36 +0000)]
[scudo][standalone] Add bytemap classes

Summary:
The bytemap classes will be used by the primary32 allocator to associate
classes with memory regions. It's similar to the sanitizer_common one
except for the fact that the base (level1) maps are mapped instead of
being static to reduce the memory footprint of an uninitialized allocator.

Reviewers: vitalybuka, eugenis, morehouse, flowerhack, dmmoore415, mcgrathr

Reviewed By: vitalybuka, morehouse

Subscribers: mgorny, delcypher, jfb, #sanitizers, llvm-commits

Tags: #llvm, #sanitizers

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

llvm-svn: 355416

5 years agoRevert "[lldbtest] Check against the correct name for libcxxabi (macOS)."
Davide Italiano [Tue, 5 Mar 2019 17:21:55 +0000 (17:21 +0000)]
Revert "[lldbtest] Check against the correct name for libcxxabi (macOS)."

This passes locally but breaks on the bots. Maybe an SDK difference.
Reverting while I investigate.

llvm-svn: 355415

5 years agoTableGen: Allow lists to be concatenated through '#'
Javed Absar [Tue, 5 Mar 2019 17:16:07 +0000 (17:16 +0000)]
TableGen:  Allow lists to be concatenated through '#'

Currently one can concatenate strings using hash(#),
but not lists, although that would be a natural thing to do.

This patch allows one to write something like:
def : A<!listconcat([1,2], [3,4])>;
simply as :
def : A<[1,2] # [3,4]>;

This was missing feature was highlighted by Nicolai
at FOSDEM talk.

Reviewed by: nhaehnle, hfinkel

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

llvm-svn: 355414

5 years ago[lldb] Disable some of TestJITLoaderGDB.py tests on Windows
Yury Delendik [Tue, 5 Mar 2019 17:09:26 +0000 (17:09 +0000)]
[lldb] Disable some of TestJITLoaderGDB.py tests on Windows

The test expect sample executable code be built, but fails on Windows.

Review comment https://reviews.llvm.org/D57689#1418597

Tags: #lldb

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

llvm-svn: 355413

5 years ago[X86][SSE] Regenerate vector zero tests
Simon Pilgrim [Tue, 5 Mar 2019 16:52:14 +0000 (16:52 +0000)]
[X86][SSE] Regenerate vector zero tests

llvm-svn: 355412

5 years ago[SDAG] move FP constant folding to helper function; NFC
Sanjay Patel [Tue, 5 Mar 2019 16:42:33 +0000 (16:42 +0000)]
[SDAG] move FP constant folding to helper function; NFC

llvm-svn: 355411

5 years ago[HIP] Do not unbundle object files for -fno-gpu-rdc
Yaxun Liu [Tue, 5 Mar 2019 16:07:56 +0000 (16:07 +0000)]
[HIP] Do not unbundle object files for -fno-gpu-rdc

When -fno-gpu-rdc is set, device code is compiled, linked, and assembled into fat binary
and embedded as string in object files. The object files are normal object files which
can be linked by host linker. In the linking stage, the object files should not be unbundled
when -fno-gpu-rdc is set since they are normal object files, not bundles. The object files
only need to be unbundled when -fgpu-rdc is set.

Currently clang always unbundles object files, disregarding -fgpu-rdc option.

This patch fixes that.

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

llvm-svn: 355410

5 years ago[libc++] Fix <atomic> failures on GCC
Louis Dionne [Tue, 5 Mar 2019 15:49:58 +0000 (15:49 +0000)]
[libc++] Fix <atomic> failures on GCC

Summary:
In https://reviews.llvm.org/D58201, we turned memory_order into an enum
class in C++20 mode. However, we were not casting memory_order to its
underlying type correctly for the GCC implementation, which broke the
build bots. I also fixed a test that was failing in C++17 mode on GCC 5.

Reviewers: EricWF, jfb, mclow.lists

Subscribers: zoecarver

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

llvm-svn: 355409

5 years agoRevert "[GlobalISel][AArch64] Add selection support for G_EXTRACT_VECTOR_ELT"
Jessica Paquette [Tue, 5 Mar 2019 15:47:00 +0000 (15:47 +0000)]
Revert "[GlobalISel][AArch64] Add selection support for G_EXTRACT_VECTOR_ELT"

This broke test-suite::aarch64_neon_intrinsics.test

Reverting while I look into it.

Example failure:
http://lab.llvm.org:8011/builders/clang-cmake-aarch64-quick/builds/17740

llvm-svn: 355408

5 years ago[X86] Add SMULO/UMULO combine tests
Simon Pilgrim [Tue, 5 Mar 2019 15:36:45 +0000 (15:36 +0000)]
[X86] Add SMULO/UMULO combine tests

Include scalar and vector test variants covering the folds in DAGCombiner (vector isn't currently supported - PR40442)

llvm-svn: 355407

5 years agoRevert "Fix embedded Python initialization according to changes in version 3.7"
Tatyana Krasnukha [Tue, 5 Mar 2019 15:27:33 +0000 (15:27 +0000)]
Revert "Fix embedded Python initialization according to changes in version 3.7"

Testsuite hangs on Windows likely due to these changes.

llvm-svn: 355406

5 years agoFix typo in constant vector
Simon Pilgrim [Tue, 5 Mar 2019 15:06:01 +0000 (15:06 +0000)]
Fix typo in constant vector

llvm-svn: 355405

5 years ago[X86] Add SADDO/UADDO and SSUBO/USUBO combine tests
Simon Pilgrim [Tue, 5 Mar 2019 14:52:42 +0000 (14:52 +0000)]
[X86] Add SADDO/UADDO and SSUBO/USUBO combine tests

Include scalar and vector test variants covering the folds in DAGCombiner (vector isn't currently supported - PR40442)

llvm-svn: 355404

5 years ago[libc++] Change memory_order to an enum class
Louis Dionne [Tue, 5 Mar 2019 14:50:25 +0000 (14:50 +0000)]
[libc++] Change memory_order to an enum class

This implements P0439R0.

Thanks to Zoe Carver for the patch.
Differential Revision: https://reviews.llvm.org/D58201

llvm-svn: 355403

5 years agoAdds property to force enabling of GDB JIT loader for MacOS
Yury Delendik [Tue, 5 Mar 2019 14:23:53 +0000 (14:23 +0000)]
Adds property to force enabling of GDB JIT loader for MacOS

Summary:
Based on https://gist.github.com/thlorenz/30bf0a3f67b1d97b2945#patching-and-rebuilding

The functionality was disabled at https://github.com/llvm/llvm-project/commit/521c2278abb16f0148cef1bd061cadb01ef43192

Reviewers: jingham

Subscribers: lldb-commits

Tags: #lldb

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

llvm-svn: 355402

5 years ago[clang-tidy] Fix bugprone-string-constructor crash
Alexander Kornienko [Tue, 5 Mar 2019 14:09:57 +0000 (14:09 +0000)]
[clang-tidy] Fix bugprone-string-constructor crash

llvm-svn: 355401

5 years ago[X86] Add test cases for D58874
Simon Pilgrim [Tue, 5 Mar 2019 13:52:09 +0000 (13:52 +0000)]
[X86] Add test cases for D58874

Add scalar and vector test cases for missing (add (add (xor a, -1), b), 1) -> (sub b, a) fold

llvm-svn: 355400

5 years ago[llvm-objcopy] - Simplify `isCompressable` and fix the issue relative.
George Rimar [Tue, 5 Mar 2019 13:07:43 +0000 (13:07 +0000)]
[llvm-objcopy] - Simplify `isCompressable` and fix the issue relative.

When --compress-debug-sections is given, llvm-objcopy do not compress
sections that have "ZLIB" header in data. Normally this signature is used
in zlib-gnu compression format. But if zlib-gnu used then the name of the compressed
section should start from .z* (e.g .zdebug_info). If it does not, then it is not
a zlib-gnu format and section should be treated as a normal uncompressed section.

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

llvm-svn: 355399

5 years agoOne more UserIDResolver fix
Pavel Labath [Tue, 5 Mar 2019 12:51:20 +0000 (12:51 +0000)]
One more UserIDResolver fix

The intention in r355323 has been to implement a no-op resolver in the
HostInfoBase class, which will then be shadowed a an implementation in
the HostInfoPosix class. However, I add the shadowing declaration in
HostInfoPosix.h, and instead had implemented the HostInfoBase function
in HostInfoPosix.cpp. This has lead to undefined symbols on windows, and
a subsequent implementation of a no-op resolver in HostInfoWindows
(r355329).

Since now there is no point on having a no-op resolver in the base
class, I just remove the base declaration altogether, and have
HostInfoPosix implement the (newly-declared) HostInfoPosix version of
that function.

llvm-svn: 355398

5 years ago[sanitizers] Don't use Windows Trace Logging with Clang in MSVC mode either
Martin Storsjo [Tue, 5 Mar 2019 12:50:06 +0000 (12:50 +0000)]
[sanitizers] Don't use Windows Trace Logging with Clang in MSVC mode either

The TraceLoggingProvider.h header does work with clang-cl in general
these days with Win SDK 10.0.17763.0, but when compiled in 32 bit x86
mode, with the -Z7 flag, compilation fails with the following error:

fatal error: error in backend: assembler label '' can not be undefined

With older Win SDKs, there are other build failures (regardless of
architecture or the -Z7 flag).

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

llvm-svn: 355397

5 years ago[analyzer] Fix taint propagation in GenericTaintChecker
Kristof Umann [Tue, 5 Mar 2019 12:42:59 +0000 (12:42 +0000)]
[analyzer] Fix taint propagation in GenericTaintChecker

The gets function has no SrcArgs. Because the default value for isTainted was
false, it didn't mark its DstArgs as tainted.

Patch by Gábor Borsik!

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

llvm-svn: 355396

5 years ago[ASTMatchers] Improved formatting in a documentation comment
Dmitri Gribenko [Tue, 5 Mar 2019 12:38:18 +0000 (12:38 +0000)]
[ASTMatchers] Improved formatting in a documentation comment

llvm-svn: 355395

5 years ago[AMDGPU] Fix DPP operand order in atomic optimizer
Carl Ritson [Tue, 5 Mar 2019 12:21:44 +0000 (12:21 +0000)]
[AMDGPU] Fix DPP operand order in atomic optimizer

Summary:
Ensure order of operands in DPP atomic optimizer final WWM step is appropriate for sub instructions.

Change-Id: I631d050e1c00a3b4bc7c11a90437064403c4cf30

Reviewers: sheredom, tpr

Reviewed By: sheredom

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

Tags: #llvm

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

llvm-svn: 355394

5 years ago[SCEV] Ensure that isHighCostExpansion takes into account what is being divided
David Green [Tue, 5 Mar 2019 12:12:18 +0000 (12:12 +0000)]
[SCEV] Ensure that isHighCostExpansion takes into account what is being divided

A SCEV is not low-cost just because you can divide it by a power of 2. We need to also
check what we are dividing to make sure it too is not a high-code expansion. This helps
to not expand the exit value of certain loops, helping not to bloat the code.

The change in no-iv-rewrite.ll is reverting back to what it was testing before rL194116,
and looks a lot like the other tests in replace-loop-exit-folds.ll.

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

llvm-svn: 355393

5 years ago[lldb] Fix linux host build after r355342
Alexander Kornienko [Tue, 5 Mar 2019 12:05:35 +0000 (12:05 +0000)]
[lldb] Fix linux host build after r355342

llvm-svn: 355392

5 years ago[llvm-objcopy] - Report "no zlib available" error properly when --compress-debug...
George Rimar [Tue, 5 Mar 2019 11:32:14 +0000 (11:32 +0000)]
[llvm-objcopy] - Report "no zlib available" error properly when --compress-debug-sections is used.

If zlib is not available, and --compress-debug-sections is passed,
we want to report an error. Currently, it is only reported for
--compress_debug_sections= form of the option.

Fixes the https://bugs.llvm.org/show_bug.cgi?id=40886.

I do not think there is a way to write a test for this.

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

llvm-svn: 355391

5 years ago[ASTImporter] Fix redecl failures of Class and ClassTemplate
Gabor Marton [Tue, 5 Mar 2019 11:23:24 +0000 (11:23 +0000)]
[ASTImporter] Fix redecl failures of Class and ClassTemplate

Summary:
Redecl chains of classes and class templates are not handled well
currently. We want to handle them similarly to functions, i.e. try to
keep the structure of the original AST as much as possible. The aim is
to not squash a prototype with a definition, rather we create both and
put them in a redecl chain.

Reviewers: a_sidorin, shafik, a.sidorin

Subscribers: rnkovacs, dkrupp, Szelethus, gamesh411, jdoerfert, cfe-commits

Tags: #clang

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

llvm-svn: 355390

5 years ago[SCEV] Add some extra tests for IndVarSimplifys loop exit values. NFC.
David Green [Tue, 5 Mar 2019 11:18:55 +0000 (11:18 +0000)]
[SCEV] Add some extra tests for IndVarSimplifys loop exit values. NFC.

Add some tests for various loops of the form:
  while(S >= 32) {
    S -= 32;
    something();
  };
  return S;

llvm-svn: 355389

5 years agoFix embedded Python initialization according to changes in version 3.7
Tatyana Krasnukha [Tue, 5 Mar 2019 11:18:45 +0000 (11:18 +0000)]
Fix embedded Python initialization according to changes in version 3.7

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

llvm-svn: 355388

5 years ago[WebAssembly] Rename a variable in LateEHPrepare (NFC)
Heejin Ahn [Tue, 5 Mar 2019 11:11:34 +0000 (11:11 +0000)]
[WebAssembly] Rename a variable in LateEHPrepare (NFC)

llvm-svn: 355387

5 years agoAdd wildcard support to all update_*_test_checks.py scripts (PR37500)
Simon Pilgrim [Tue, 5 Mar 2019 10:44:37 +0000 (10:44 +0000)]
Add wildcard support to all update_*_test_checks.py scripts (PR37500)

We can already update multiple files in each update call, this extends it to work with wildcards as well in the same way as update_mca_test_checks.py (to support shells that won't do this for us - windows command prompt etc.)

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

llvm-svn: 355386

5 years ago[ARM] Fix select_cc lowering for fp16
Oliver Stannard [Tue, 5 Mar 2019 10:42:34 +0000 (10:42 +0000)]
[ARM] Fix select_cc lowering for fp16

When lowering a select_cc node where the true and false values are of type f16,
we can't use a general conditional move because the FP16 instructions do not
support conditional execution. Instead, we must ensure that the condition code
is one of the four supported by the VSEL instruction.

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

llvm-svn: 355385

5 years ago[AMDGPU] Omit KILL instructions from hazard recognizer
David Stuttard [Tue, 5 Mar 2019 10:25:16 +0000 (10:25 +0000)]
[AMDGPU] Omit KILL instructions from hazard recognizer

Summary:
In some cases the KILL was causing a hazard to be introduced as these were
scheduled into hazard slots, but don't result in an instruction.

KILL shouldn't be considered for hazard recognition.

Change-Id: Ib6d2a2160f8c94cd0ce611ab198c7e4f46aeffcf

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

Tags: #llvm

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

llvm-svn: 355384

5 years ago[ELF][test] chmod u+w to prevent annoying rm prompt
Fangrui Song [Tue, 5 Mar 2019 09:56:50 +0000 (09:56 +0000)]
[ELF][test] chmod u+w to prevent annoying rm prompt

If the permission does not permit writing and the standard input is a
terminal, rm gives an annoying prompt. chmod u+w to make the output
directory easier to delete.

llvm-svn: 355382

5 years ago[NFC] Simplify BufferedStackTrace::UnwindImpl
Vitaly Buka [Tue, 5 Mar 2019 05:52:34 +0000 (05:52 +0000)]
[NFC] Simplify BufferedStackTrace::UnwindImpl

llvm-svn: 355381

5 years ago[NFC] Move isUnwinding check into ScopedUnwinding
Vitaly Buka [Tue, 5 Mar 2019 05:40:05 +0000 (05:40 +0000)]
[NFC] Move isUnwinding check into ScopedUnwinding

llvm-svn: 355380

5 years ago[LangRef] Add 'callbr' instruction to the 'blockaddress' section.
Craig Topper [Tue, 5 Mar 2019 05:23:37 +0000 (05:23 +0000)]
[LangRef] Add 'callbr' instruction to the 'blockaddress' section.

llvm-svn: 355379

5 years ago[PowerPC] fix killed/dead flag after convert x-form to d-form tranformation.
Chen Zheng [Tue, 5 Mar 2019 04:56:54 +0000 (04:56 +0000)]
[PowerPC] fix killed/dead flag after convert x-form to d-form tranformation.
Differential Revision: https://reviews.llvm.org/D58428

llvm-svn: 355378

5 years ago[NFC] Move ScopedUnwinding from .h to .cc
Vitaly Buka [Tue, 5 Mar 2019 04:36:56 +0000 (04:36 +0000)]
[NFC] Move ScopedUnwinding from .h to .cc

llvm-svn: 355377

5 years ago[NFC] Reorder ifs in BufferedStackTrace::UnwindImpl
Vitaly Buka [Tue, 5 Mar 2019 04:36:49 +0000 (04:36 +0000)]
[NFC] Reorder ifs in BufferedStackTrace::UnwindImpl

llvm-svn: 355376

5 years ago[Expression] Remove unused parameter from Evaluate
Alex Langford [Tue, 5 Mar 2019 03:33:34 +0000 (03:33 +0000)]
[Expression] Remove unused parameter from Evaluate

llvm-svn: 355375

5 years ago[ARM][MC] Update one test case in 'test/MC/Disassembler/ARM/invalid-armv7.txt'
Xing GUO [Tue, 5 Mar 2019 03:07:56 +0000 (03:07 +0000)]
[ARM][MC] Update one test case in 'test/MC/Disassembler/ARM/invalid-armv7.txt'

Summary:
Instruction `[0xfe 0xf0 0x20 0xe3]` is a valid instruction on ARM-v7, which is `dbg #14`. See:
https://www.cl.cam.ac.uk/research/srg/han/ACS-P35/zynq/ARMv7-A-R-manual.pdf
(Page: 377)

```
Encoding A1:
DBG<c> #<option>

|31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16|15 14 13 12 11 10 09 08 07 06 05 04 03 02 01 00|
|      cond | 0  0  1  1  0| 0| 1  0| 0  0  0  0| 1  1  1  1| 0  0  0  0| 1  1  1  1|    option |
```

Reviewers: fhahn, efriedma

Reviewed By: efriedma

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

Tags: #llvm

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

llvm-svn: 355374

5 years ago[AMDGPU] Implement AMDGPUMCInstrAnalysis
Scott Linder [Tue, 5 Mar 2019 03:02:00 +0000 (03:02 +0000)]
[AMDGPU] Implement AMDGPUMCInstrAnalysis

Implement MCInstrAnalysis for AMDGPU, with default implementations save
for `evaluateBranch`.

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

llvm-svn: 355373

5 years ago[NFC] Return on SANITIZER_MIPS && !IsValidFrame
Vitaly Buka [Tue, 5 Mar 2019 02:51:04 +0000 (02:51 +0000)]
[NFC] Return on SANITIZER_MIPS && !IsValidFrame

llvm-svn: 355372

5 years ago[NFC] Put bp into Unwind(.. false) for consistency
Vitaly Buka [Tue, 5 Mar 2019 02:50:57 +0000 (02:50 +0000)]
[NFC] Put bp into Unwind(.. false) for consistency

It's not used there anyway

llvm-svn: 355371

5 years ago[NFC] Move asan_inited and size reset on top of ::UnwindImpl
Vitaly Buka [Tue, 5 Mar 2019 02:50:49 +0000 (02:50 +0000)]
[NFC] Move asan_inited and size reset on top of  ::UnwindImpl

llvm-svn: 355370

5 years agoRevert "[NFC][Sanitizer] Cleanup ASan's GetStackTrace implementation"
Vitaly Buka [Tue, 5 Mar 2019 02:35:49 +0000 (02:35 +0000)]
Revert "[NFC][Sanitizer] Cleanup ASan's GetStackTrace implementation"

I've missed that UnwindSlow was removed from ScopedUnwinding.

This reverts commit 4ce918e3942f0333ccb7d65d6265f4fc5f5324be.

llvm-svn: 355369

5 years agoReplace clang::FileData with llvm::vfs::Status
Harlan Haskins [Tue, 5 Mar 2019 02:27:12 +0000 (02:27 +0000)]
Replace clang::FileData with llvm::vfs::Status

Summary:
FileData was only ever used as a container for the values in
llvm::vfs::Status, so they might as well be consolidated.

The `InPCH` member was also always set to false, and unused.

Subscribers: cfe-commits

Tags: #clang

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

llvm-svn: 355368

5 years agoFix -fsanitize=vptr badness in <__debug>
Eric Fiselier [Tue, 5 Mar 2019 02:10:31 +0000 (02:10 +0000)]
Fix -fsanitize=vptr badness in <__debug>

Summary:

This patch fixes a lifetime bug when inserting a new container into the debug database. It is
diagnosed by UBSAN when debug mode is enabled. This patch corrects how nodes are constructed
during insertion.

The fix requires unconditionally breaking the debug mode ABI. Users should not expect ABI
stability from debug mode.

Reviewers: ldionne, serge-sans-paille, EricWF

Reviewed By: EricWF

Subscribers: mclow.lists, christof, libcxx-commits

Tags: #libc

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

llvm-svn: 355367

5 years agoMake VCRuntime ABI configuration a first-class option.
Eric Fiselier [Tue, 5 Mar 2019 01:57:01 +0000 (01:57 +0000)]
Make VCRuntime ABI configuration a first-class option.

Summary:
On Windows we currently provide two separate ABI configurations. One which defers to `vcruntime` to provide the C++ runtime and another which doesn't.
Using `vcruntime` allows interoperability which programs compiled against the MSVC STL, and should be preferred whenever possible.

When deferring to `vcruntime` much of the ABI we provide changes. Including the layout of `<stdexcept>` types, their vtables, and how the linkage of their members.

This patch introduces the `_LIBCPP_ABI_VCRUNTIME` macro to denote this configuration. It also cleans up the existing configuration for using `vcruntime`.

This cleanup lays the groundwork for fixing a number of ABI and interoperability bugs in  `<stdexcept>`.

Reviewers: thomasanderson, ldionne, smeenai

Reviewed By: smeenai

Subscribers: jdoerfert, libcxx-commits, #libc

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

llvm-svn: 355366

5 years ago[clang-format][docs][NFC] Fix example for Allman brace breaking style
Jan Korous [Tue, 5 Mar 2019 01:45:31 +0000 (01:45 +0000)]
[clang-format][docs][NFC] Fix example for Allman brace breaking style

I assume the example is wrong as it's clearly missing line-breaks before
braces.

I just ran the example through clang-format with .clang-format like
this:
BreakBeforeBraces: Allman

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

llvm-svn: 355365

5 years agoRevert "[testsuite] Port crashlog and dependencies to Python 3."
Davide Italiano [Tue, 5 Mar 2019 01:34:47 +0000 (01:34 +0000)]
Revert "[testsuite] Port crashlog and dependencies to Python 3."

This revert the commit because it broke the bots. I need to find
a way that works with both versions.

llvm-svn: 355364

5 years agoRevert compiler-rt diffs for order file instrumentation to get bot green!
Manman Ren [Tue, 5 Mar 2019 01:21:40 +0000 (01:21 +0000)]
Revert compiler-rt diffs for order file instrumentation to get bot green!

This caused issues on Linux/Windows and other platforms.

r355343 355350 355350

llvm-svn: 355363

5 years agoPHI nodes are not `FPMathOperator` s
Sanjoy Das [Tue, 5 Mar 2019 01:15:08 +0000 (01:15 +0000)]
PHI nodes are not `FPMathOperator` s

Reviewers: chandlerc, arsenm

Reviewed By: arsenm

Subscribers: wdng, arsenm, mcrosier, jlebar, bixia, llvm-commits

Tags: #llvm

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

llvm-svn: 355362

5 years ago[X86] Reduce some patterns by using FP instructions for integer types even when AVX2...
Craig Topper [Tue, 5 Mar 2019 01:14:25 +0000 (01:14 +0000)]
[X86] Reduce some patterns by using FP instructions for integer types even when AVX2 is available and execution domain fixing will do the right thing

We have quite a few cases of using FP instructions for integer operations when only AVX1 is available. Then we switch to integer instructions with AVX2. In a lot of these cases execution domain fixing will take care of turning FP instructions into integer if its profitable.

With this patch we just keep on using the FP instructions even with AVX2. I've only handled some cases that don't require messing with patterns that are defined in the instruction definition. Those will require more subtle multiclass work possibly involving null_frag, hasSideEffects = 0, etc.

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

llvm-svn: 355361

5 years ago[BPF] Do not generate BTF sections unnecessarily
Yonghong Song [Tue, 5 Mar 2019 01:01:21 +0000 (01:01 +0000)]
[BPF] Do not generate BTF sections unnecessarily

If There is no types/non-empty strings, do not generate
.BTF section. If there is no func_info/line_info, do
not generate .BTF.ext section.

Signed-off-by: Yonghong Song <yhs@fb.com>
Differential Revision: https://reviews.llvm.org/D58936

llvm-svn: 355360

5 years ago[testsuite] Port crashlog and dependencies to Python 3.
Davide Italiano [Tue, 5 Mar 2019 00:53:38 +0000 (00:53 +0000)]
[testsuite] Port crashlog and dependencies to Python 3.

Fixes three tests in the testsuite.

llvm-svn: 355359

5 years agoFix the Xcode project for UserIDResolver.
Jim Ingham [Tue, 5 Mar 2019 00:52:12 +0000 (00:52 +0000)]
Fix the Xcode project for UserIDResolver.

llvm-svn: 355358

5 years agoAttemp to fix windows profile-rt build breakage.
Manman Ren [Tue, 5 Mar 2019 00:52:00 +0000 (00:52 +0000)]
Attemp to fix windows profile-rt build breakage.

Followup to D57530.

llvm-svn: 355357

5 years ago[lldbtest] Check against the correct name for libcxxabi (macOS).
Davide Italiano [Tue, 5 Mar 2019 00:47:15 +0000 (00:47 +0000)]
[lldbtest] Check against the correct name for libcxxabi (macOS).

llvm-svn: 355356

5 years ago[NFC][Sanitizer] Cleanup ASan's GetStackTrace implementation
Julian Lettner [Tue, 5 Mar 2019 00:41:15 +0000 (00:41 +0000)]
[NFC][Sanitizer] Cleanup ASan's GetStackTrace implementation

Cleanup ASan's  __sanitizer::BufferedStackTrace::UnwindImpl (formerly
GetStackTrace) implementation. Start with ASan because it is the most
complex implementation.

GetStackTrace implementations seem to have started out as exact copies
of the original implementation in ASan, but have diverged in subtle
ways. My goal is to parameterize this algorithm (via templating or
callbacks) so we can share the implementation and get rid of the
inversed dependency (sanitizer_common depends on concrete
implementations in asan, ubsan, etc.). This should also help us to avoid
those pesky linker errors caused by undefined, duplicate, and weak
symbols on Windows.

Reviewed By: vitalybuka

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

llvm-svn: 355355

5 years ago[cmake] Create exports for umbrella library targets
Shoaib Meenai [Tue, 5 Mar 2019 00:38:32 +0000 (00:38 +0000)]
[cmake] Create exports for umbrella library targets

When using the umbrella llvm-libraries and clang-libraries targets, we
should export all library targets, otherwise they'll be part of our
distribution but not usable from the CMake package.

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

llvm-svn: 355354

5 years ago[Host] Fix the build (and the modules build).
Davide Italiano [Tue, 5 Mar 2019 00:37:40 +0000 (00:37 +0000)]
[Host] Fix the build (and the modules build).

-> Add a missing include to find the base class.
-> Add a missing out-of-line declaration for a member function.

llvm-svn: 355353

5 years agoRevert "[DataFormatters] Fix regression in libc++ std::atomic formatter caused by...
Shafik Yaghmour [Tue, 5 Mar 2019 00:29:58 +0000 (00:29 +0000)]
Revert "[DataFormatters] Fix regression in libc++ std::atomic formatter caused by https://reviews.llvm.org/D56913"

This reverts commit r355351.

llvm-svn: 355352

5 years ago[DataFormatters] Fix regression in libc++ std::atomic formatter caused by https:...
Shafik Yaghmour [Tue, 5 Mar 2019 00:17:18 +0000 (00:17 +0000)]
[DataFormatters] Fix regression in libc++ std::atomic formatter caused by https://reviews.llvm.org/D56913

rdar://problem/48568543

llvm-svn: 355351

5 years agoAttemp to fix build brokage due to D57530.
Manman Ren [Mon, 4 Mar 2019 23:41:57 +0000 (23:41 +0000)]
Attemp to fix build brokage due to D57530.

By adding implementations for __llvm_profile_begin_orderfile for non-Darwin platforms.

llvm-svn: 355350

5 years agoFix invalid target triples in tests. (NFC)
Florian Hahn [Mon, 4 Mar 2019 23:37:41 +0000 (23:37 +0000)]
Fix invalid target triples in tests. (NFC)

llvm-svn: 355349

5 years ago[msan] Instrument x86 BMI intrinsics.
Evgeniy Stepanov [Mon, 4 Mar 2019 22:58:20 +0000 (22:58 +0000)]
[msan] Instrument x86 BMI intrinsics.

Summary:
They simply shuffle bits. MSan needs to do the same with shadow bits,
after making sure that the shuffle mask is fully initialized.

Reviewers: pcc, vitalybuka

Subscribers: hiraditya, #sanitizers, llvm-commits

Tags: #sanitizers, #llvm

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

llvm-svn: 355348

5 years ago[sanitizer] Intercept bzero.
Evgeniy Stepanov [Mon, 4 Mar 2019 22:58:11 +0000 (22:58 +0000)]
[sanitizer] Intercept bzero.

Summary:
Intercept bzero and enable existing __bzero interceptor in Linux.
bzero is deprecated but still used occasionally.

Reviewers: vitalybuka

Subscribers: srhines, kubamracek, #sanitizers, llvm-commits

Tags: #sanitizers, #llvm

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

llvm-svn: 355347

5 years ago[NFC] Fix PGO link error in shared libs build
Jordan Rupprecht [Mon, 4 Mar 2019 22:54:44 +0000 (22:54 +0000)]
[NFC] Fix PGO link error in shared libs build

llvm-svn: 355346

5 years ago[CodeGenPrepare] avoid crashing on non-canonical/degenerate code
Sanjay Patel [Mon, 4 Mar 2019 22:47:13 +0000 (22:47 +0000)]
[CodeGenPrepare] avoid crashing on non-canonical/degenerate code

The test is reduced from an example in the post-commit thread for:
rL354746
http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20190304/632396.html

While we must avoid dying here, the real question should be:
Why is non-canonical and/or degenerate code making it to CGP when
using the new pass manager?

llvm-svn: 355345

5 years ago[GlobalISel][AArch64] Add selection support for G_EXTRACT_VECTOR_ELT
Jessica Paquette [Mon, 4 Mar 2019 22:35:32 +0000 (22:35 +0000)]
[GlobalISel][AArch64] Add selection support for G_EXTRACT_VECTOR_ELT

This adds instruction selection support for G_EXTRACT_VECTOR_ELT for cases
where the index is defined by a G_CONSTANT.

It also factos out the lane copy opcode selection part into its own function,
`getLaneCopyOpcode`. This is used by both `selectUnmergeValues` and
`selectExtractElt`.

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

llvm-svn: 355344

5 years agoOrder File Instrumentation: dump the data in compiler-rt
Manman Ren [Mon, 4 Mar 2019 22:28:38 +0000 (22:28 +0000)]
Order File Instrumentation: dump the data in compiler-rt

The profile data will be dumped in a file default_xxx.profraw.order.

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

llvm-svn: 355343

5 years agoMove ProcessInfo from Host to Utility.
Zachary Turner [Mon, 4 Mar 2019 21:51:03 +0000 (21:51 +0000)]
Move ProcessInfo from Host to Utility.

There are set of classes in Target that describe the parameters of a
process - e.g. it's PID, name, user id, and similar. However, since it
is a bare description of a process and contains no actual functionality,
there's nothing specifically that makes this appropriate for being in
Target -- it could just as well be describing a process on the host, or
some hypothetical virtual process that doesn't even exist.

To cement this, I'm moving these classes to Utility. It's possible that
we can find a better place for it in the future, but as it is neither
Host specific nor Target specific, Utility seems like the most appropriate
place for the time being.

After this there is only 2 remaining references to Target from Host,
which I'll address in a followup.

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

llvm-svn: 355342

5 years ago[build.py] Allow clang-cl to build files starting with '/U'
Alex Langford [Mon, 4 Mar 2019 21:36:49 +0000 (21:36 +0000)]
[build.py] Allow clang-cl to build files starting with '/U'

Summary:
clang-cl tries to match cl's interface, and treats /U as "Removes a
predefined macro" as cl does. When you feed clang-cl a file that begins with
'/U' (e.g. /Users/xiaobai/foo.c), clang-cl will emit a warning and in some cases
an error, like so:

clang-9: warning: '/Users/xiaobai/foo.c' treated as the '/U' option [-Wslash-u-filename]
clang-9: note: Use '--' to treat subsequent arguments as filenames
clang-9: error: no input files

If you're using clang-cl, make sure '--' is passed before the source file.

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

llvm-svn: 355341

5 years ago[build] Rename clang-headers to clang-resource-headers
Shoaib Meenai [Mon, 4 Mar 2019 21:19:53 +0000 (21:19 +0000)]
[build] Rename clang-headers to clang-resource-headers

Summary:
The current install-clang-headers target installs clang's resource
directory headers. This is different from the install-llvm-headers
target, which installs LLVM's API headers. We want to introduce the
corresponding target to clang, and the natural name for that new target
would be install-clang-headers. Rename the existing target to
install-clang-resource-headers to free up the install-clang-headers name
for the new target, following the discussion on cfe-dev [1].

I didn't find any bots on zorg referencing install-clang-headers. I'll
send out another PSA to cfe-dev to accompany this rename.

[1] http://lists.llvm.org/pipermail/cfe-dev/2019-February/061365.html

Reviewers: beanz, phosek, tstellar, rnk, dim, serge-sans-paille

Subscribers: mgorny, javed.absar, jdoerfert, #sanitizers, openmp-commits, lldb-commits, cfe-commits, llvm-commits

Tags: #clang, #sanitizers, #lldb, #openmp, #llvm

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

llvm-svn: 355340

5 years ago[GlobalISel][AArch64] Legalize vector G_SELECT
Jessica Paquette [Mon, 4 Mar 2019 21:12:46 +0000 (21:12 +0000)]
[GlobalISel][AArch64] Legalize vector G_SELECT

Just scalarize it, and add a test showing it works.

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

llvm-svn: 355339

5 years agoFix wrong enum value in switch.
Evgeniy Stepanov [Mon, 4 Mar 2019 21:00:28 +0000 (21:00 +0000)]
Fix wrong enum value in switch.

llvm-svn: 355338

5 years ago[ConstantHoisting] avoid hang/crash from unreachable blocks (PR40930)
Sanjay Patel [Mon, 4 Mar 2019 20:57:14 +0000 (20:57 +0000)]
[ConstantHoisting] avoid hang/crash from unreachable blocks (PR40930)

I'm not too familiar with this pass, so there might be a better
solution, but this appears to fix the degenerate:
PR40930
PR40931
PR40932
PR40934
...without affecting any real-world code.

As we've seen in several other passes, when we have unreachable blocks,
they can contain semi-bogus IR and/or cause unexpected conditions. We
would not typically expect these patterns to make it this far, but we
have to guard against them anyway.

llvm-svn: 355337

5 years ago[libc++] Remove old CMake workaround
Louis Dionne [Mon, 4 Mar 2019 20:52:14 +0000 (20:52 +0000)]
[libc++] Remove old CMake workaround

We haven't had any complaints so far, and I don't think anybody builds
libc++ from source for that old platform anymore.

llvm-svn: 355336