platform/upstream/llvm.git
4 years agoscudo: Replace ALIGNED macro with standard alignas specifier.
Peter Collingbourne [Thu, 9 Apr 2020 20:37:27 +0000 (13:37 -0700)]
scudo: Replace ALIGNED macro with standard alignas specifier.

alignas was introduced in C++11 and is already being used throughout LLVM.

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

4 years ago[MS] Mark vbase dtors used when marking dtor used
Reid Kleckner [Tue, 11 Feb 2020 00:16:17 +0000 (16:16 -0800)]
[MS] Mark vbase dtors used when marking dtor used

In the MS C++ ABI, the complete destructor variant for a class with
virtual bases is emitted whereever it is needed, instead of directly
alongside the base destructor variant. The complete destructor calls the
base destructor of the current class and the base destructors of each
virtual base. In order for this to work reliably, translation units that
use the destructor of a class also need to mark destructors of virtual
bases of that class used.

Fixes PR38521

Reviewed By: rsmith

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

4 years ago[NFC] Make Type::isVectorTy call isa<VectorType>
Christopher Tetreault [Thu, 9 Apr 2020 20:52:54 +0000 (13:52 -0700)]
[NFC] Make Type::isVectorTy call isa<VectorType>

Reviewers: sdesmalen, efriedma, dexonsmith

Reviewed By: efriedma

Subscribers: tschuett, llvm-commits

Tags: #llvm

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

4 years ago[SanitizerCoverage] Add compiler-rt test for -fsanitize-coverage=inline-bool-flag
Pratyai Mazumder [Thu, 9 Apr 2020 09:41:58 +0000 (02:41 -0700)]
[SanitizerCoverage] Add compiler-rt test for -fsanitize-coverage=inline-bool-flag

Reviewers: kcc, vitalybuka

Reviewed By: vitalybuka

Subscribers: dberris, #sanitizers, llvm-commits

Tags: #sanitizers

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

4 years agoFix syntax error
Christopher Tetreault [Thu, 9 Apr 2020 20:46:05 +0000 (13:46 -0700)]
Fix syntax error

4 years ago[opaque pointer types] Remove deprecated Instruction/IRBuilder APIs.
Eli Friedman [Sat, 4 Apr 2020 01:02:15 +0000 (18:02 -0700)]
[opaque pointer types] Remove deprecated Instruction/IRBuilder APIs.

Removes deprecated overloads of LoadInst constructor, CallInst::create,
InvokeInst::Create, IRBuilder::CreateCall, IRBuilder::CreateInvoke.
(Leaving around deprecated IRBuilder::CreateLoad for now.)

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

4 years ago[mlir][Vector] Update lowering of vector ops to llvm intrinsics to use row-major.
Nicolas Vasilache [Thu, 9 Apr 2020 20:36:45 +0000 (16:36 -0400)]
[mlir][Vector] Update lowering of vector ops to llvm intrinsics to use row-major.

Summary:
LLVM matrix intrinsics recently introduced an option to support row-major mode.
This matches the MLIR vector model, this revision switches to row-major.

A corner case related to degenerate sizes was also fixed upstream.
This revision removes the guard against this corner case.

A bug was uncovered on the output vector construction which this revision also fixes.

Lastly, this has been tested on a small size and benchmarked independently: no visible performance regression is observed.

In the future, when matrix intrinsics support per op attribute, we can more aggressively translate to that and avoid inserting MLIR-level transposes.

This has been tested independently to work on small matrices.

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

4 years agoClean up usages of asserting vector getters in Type
Christopher Tetreault [Thu, 9 Apr 2020 20:13:41 +0000 (13:13 -0700)]
Clean up usages of asserting vector getters in Type

Summary:
Remove usages of asserting vector getters in Type in preparation for the
VectorType refactor. The existence of these functions complicates the
refactor while adding little value.

Reviewers: rriddle, sdesmalen, efriedma

Reviewed By: sdesmalen

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

4 years agoFix an unused-variable warning in Release mode.
James Y Knight [Thu, 9 Apr 2020 20:34:14 +0000 (16:34 -0400)]
Fix an unused-variable warning in Release mode.

4 years ago[opaque pointers] Fix uses of deprecated CreateCall/CreateInvoke.
Eli Friedman [Sat, 4 Apr 2020 04:27:00 +0000 (21:27 -0700)]
[opaque pointers] Fix uses of deprecated CreateCall/CreateInvoke.

4 years ago[mlir][Vector] Add lowering of 1-D vector transfer_read/write to masked load/store
Nicolas Vasilache [Thu, 9 Apr 2020 20:16:32 +0000 (16:16 -0400)]
[mlir][Vector] Add lowering of 1-D vector transfer_read/write to masked load/store

Summary:
This revision adds support to lower 1-D vector transfers to LLVM.
A mask of the vector length is created that compares the base offset + linear index to the dim of the vector.
In each position where this does not overflow (i.e. offset + vector index < dim), the mask is set to 1.

A notable fact is that the lowering uses llvm.dialect_cast to allow writing code in the simplest form by targeting the simplest mix of vector and LLVM dialects and
letting other conversions kick in.

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

4 years ago[flang] [NFC] Adjust README.md for upstreaming.
David Truby [Thu, 9 Apr 2020 20:12:54 +0000 (21:12 +0100)]
[flang] [NFC] Adjust README.md for upstreaming.

This changes the references and build instructions for Flang so that
they are correct now that F18 has been rechristened Flang and merged
with LLVM.

Reviewed at: https://github.com/flang-compiler/f18/pull/909

4 years ago[mlir][test] NFC - Rename cblas to mlir_test_cblas
Nicolas Vasilache [Thu, 9 Apr 2020 19:29:06 +0000 (15:29 -0400)]
[mlir][test] NFC - Rename cblas to mlir_test_cblas

The "cblas" lib under mlir/test is meant as a simple integration demonstration.
However it is installed and ends up conflicting with external projects who want to
define the real cblas.
Rename to avoid conflicts.

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

4 years agoClean up usages of asserting vector getters in Type
Christopher Tetreault [Thu, 9 Apr 2020 20:01:05 +0000 (13:01 -0700)]
Clean up usages of asserting vector getters in Type

Summary:
Remove usages of asserting vector getters in Type in preparation for the
VectorType refactor. The existence of these functions complicates the
refactor while adding little value.

Reviewers: arsenm, efriedma, sdesmalen

Reviewed By: arsenm

Subscribers: wdng, arsenm, jvesely, nhaehnle, hiraditya, kerbowa, llvm-commits

Tags: #llvm

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

4 years ago[CUDA] Accept -x cu to indicate language is CUDA, transfer CUDA language flag to...
ADRA [Thu, 9 Apr 2020 20:02:38 +0000 (13:02 -0700)]
[CUDA] Accept -x cu to indicate language is CUDA, transfer CUDA language flag to header-file arguments

Summary:
* accept -x cu to indicate language is CUDA
* transfer CUDA language flag to header-file arguments

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

4 years agoFix lifetime call in landingpad blocking Simplifycfg pass
Zequan Wu [Thu, 9 Apr 2020 18:06:19 +0000 (11:06 -0700)]
Fix lifetime call in landingpad blocking Simplifycfg pass

Fix lifetime call in landingpad blocks simplifycfg from removing the
landingpad.

Reviewed By: rnk

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

4 years ago[lld][WebAssembly] Handle 4gb max memories
Thomas Lively [Fri, 3 Apr 2020 23:18:29 +0000 (16:18 -0700)]
[lld][WebAssembly] Handle 4gb max memories

Summary:
A previous change (53211a) had updated the argument parsing to handle
large max memories, but 4294967296 would still wrap to zero after the
options were parsed. This change updates the configuration to use a
64-bit integer to store the max memory to avoid that overflow.

Reviewers: sbc100

Subscribers: dschuff, jgravelle-google, aheejin, sunfish, llvm-commits

Tags: #llvm

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

4 years ago[lldb/test] Fix typo to disable reproducer's test phase
Med Ismail Bennani [Thu, 9 Apr 2020 19:54:17 +0000 (21:54 +0200)]
[lldb/test] Fix typo to disable reproducer's test phase

4 years agoClean up usages of asserting vector getters in Type
Christopher Tetreault [Thu, 9 Apr 2020 19:43:18 +0000 (12:43 -0700)]
Clean up usages of asserting vector getters in Type

Summary:
Remove usages of asserting vector getters in Type in preparation for the
VectorType refactor. The existence of these functions complicates the
refactor while adding little value.

Reviewers: grosbach, efriedma, sdesmalen

Reviewed By: efriedma

Subscribers: hiraditya, dmgreen, llvm-commits

Tags: #llvm

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

4 years ago[mlir] Add a new RewritePattern::hasBoundedRewriteRecursion hook.
River Riddle [Thu, 9 Apr 2020 19:38:52 +0000 (12:38 -0700)]
[mlir] Add a new RewritePattern::hasBoundedRewriteRecursion hook.

Summary: Some pattern rewriters, like dialect conversion, prohibit the unbounded recursion(or reapplication) of patterns on generated IR. Most patterns are not written with recursive application in mind, so will generally explode the stack if uncaught. This revision adds a hook to RewritePattern, `hasBoundedRewriteRecursion`, to signal that the pattern can safely be applied to the generated IR of a previous application of the same pattern. This allows for establishing a contract between the pattern and rewriter that the pattern knows and can handle the potential recursive application.

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

4 years agoClean up usages of asserting vector getters in Type
Christopher Tetreault [Thu, 9 Apr 2020 19:19:23 +0000 (12:19 -0700)]
Clean up usages of asserting vector getters in Type

Summary:
Remove usages of asserting vector getters in Type in preparation for the
VectorType refactor. The existence of these functions complicates the
refactor while adding little value.

Reviewers: sunfish, sdesmalen, efriedma

Reviewed By: efriedma

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[llvm-objdump][NFC] MachODump.cpp interface cleanup
Hubert Tong [Thu, 9 Apr 2020 19:32:09 +0000 (15:32 -0400)]
[llvm-objdump][NFC] MachODump.cpp interface cleanup

Continuing from D77388, this patch moves interface declarations
associated with `MachODump.cpp` into the headers corresponding to the
file that defines the variable. At the same time, these externs are
moved into the `llvm::objdump` namespace. The externs defined in
`MachODump.cpp` that are not referenced outside of it are given internal
linkage.

This patch does not rename the external functions defined by
`MachODump.cpp` that are not clearly named as being specific to Mach-O.

Reviewed By: jhenderson, MaskRay

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

4 years ago[PowerPC][Future] Fix for 75828ef615da
Stefan Pintilie [Thu, 9 Apr 2020 19:31:37 +0000 (19:31 +0000)]
[PowerPC][Future] Fix for 75828ef615da

Used unsigned long where uint64_t should have been used by mistake.
Fixed in this patch.

4 years ago[lldb] Disable failing register tests for reproducers
Med Ismail Bennani [Thu, 9 Apr 2020 19:05:17 +0000 (21:05 +0200)]
[lldb] Disable failing register tests for reproducers

4 years ago[CostModel][X86] Add shuffle costs for some common sub-128bit vectors
Simon Pilgrim [Thu, 9 Apr 2020 18:55:51 +0000 (19:55 +0100)]
[CostModel][X86] Add shuffle costs for some common sub-128bit vectors

v2i8/v4i8/v8i8 + v2i16/v4i16 all show up in vectorizer code and by just using the legalized types (v16i8/v8i16) we're highly exaggerating the actual cost of the shuffle.

4 years ago[nfc] [lldb] Unindent code
Jan Kratochvil [Thu, 9 Apr 2020 18:43:00 +0000 (20:43 +0200)]
[nfc] [lldb] Unindent code

It removes some needless deep indentation and some redundant statements.
It prepares the code for a more clean next patch - DWARF index callbacks
D77327.

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

4 years agoPreserve the owning module information from DWARF in the synthesized AST
Adrian Prantl [Wed, 4 Mar 2020 17:30:12 +0000 (09:30 -0800)]
Preserve the owning module information from DWARF in the synthesized AST

Types that came from a Clang module are nested in DW_TAG_module tags
in DWARF. This patch recreates the Clang module hierarchy in LLDB and
1;95;0csets the owning module information accordingly. My primary motivation
is to facilitate looking up per-module APINotes for individual
declarations, but this likely also has other applications.

This reapplies the previously reverted commit, but without support for
ClassTemplateSpecializations, which I'm going to look into separately.

rdar://problem/59634380

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

4 years ago[lldb/Reproducers] Add a small artificial delay before exiting
Jonas Devlieghere [Thu, 9 Apr 2020 18:01:33 +0000 (11:01 -0700)]
[lldb/Reproducers] Add a small artificial delay before exiting

Add a small artificial delay in replay mode before exiting to ensure
that all asynchronous events have completed. This should reduce the
level of replay flakiness on some of the slower bots.

4 years ago[libc] Collect objects only from visible deps of an object library.
Siva Chandra Reddy [Wed, 1 Apr 2020 23:05:55 +0000 (16:05 -0700)]
[libc] Collect objects only from visible deps of an object library.

A typo in an earlier change allowed this check to be missed.

Reviewers: abrachet

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

4 years ago[flang] Temporarily XFAIL failing test Fir/fir-ops.fir
David Truby [Thu, 9 Apr 2020 17:35:49 +0000 (18:35 +0100)]
[flang] Temporarily XFAIL failing test Fir/fir-ops.fir

4 years ago[clang-tidy] misc-unused-parameters: Don't remove parameter from lambda
Matthias Gehre [Tue, 7 Apr 2020 21:36:53 +0000 (23:36 +0200)]
[clang-tidy] misc-unused-parameters: Don't remove parameter from lambda

Summary:
Previously, the check would fix
```
using fn = void(int);
void f(fn *);
void test() {
  // CHECK-MESSAGES: :[[@LINE+2]]:12: warning: parameter 'I' is unused
  // CHECK-FIXES: {{^}}  f([](int  /*I*/) {
  f([](int I) { return; });
}
```
into
`f([]() { return; });` which breaks compilation. Now the check is disabled from Lambdas.

The AST is not so easy to use. For
```
    auto l = [](int) {  return;  };
    f(l);
```
one gets
```
 `-CallExpr <line:7:5, col:8> 'void'
      |-ImplicitCastExpr <col:5> 'void (*)(fn *)' <FunctionToPointerDecay>
      | `-DeclRefExpr <col:5> 'void (fn *)' lvalue Function 0x55a91a545e28 'f' 'void (fn *)'
      `-ImplicitCastExpr <col:7> 'void (*)(int)' <UserDefinedConversion>
        `-CXXMemberCallExpr <col:7> 'void (*)(int)'
          `-MemberExpr <col:7> '<bound member function type>' .operator void (*)(int) 0x55a91a546850
            `-ImplicitCastExpr <col:7> 'const (lambda at line:6:14)' lvalue <NoOp>
              `-DeclRefExpr <col:7> '(lambda at line:6:14)':'(lambda at line:6:14)' lvalue Var 0x55a91a5461c0 'l' '(lambda at line:6:14)':'(lambda at line:6:14)'
```
There is no direct use of the `operator()(int I)` of the lambda, so the `!Indexer->getOtherRefs(Function).empty()`
does not fire. In the future, we might be able to use the conversion operator `operator void (*)(int)` to mark
the call operator as having an "other ref".

Reviewers: aaron.ballman, alexfh, hokein, njames93

Subscribers: xazax.hun, cfe-commits

Tags: #clang

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

4 years ago[RISCV] Add Clang frontend support for Bitmanip extension
Scott Egerton [Thu, 9 Apr 2020 16:51:26 +0000 (17:51 +0100)]
[RISCV] Add Clang frontend support for Bitmanip extension

This adds the __riscv_bitmanip macro and the 'b' target feature to enable it.

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

4 years ago[RISCV] Support experimental/unratified extensions
Simon Cook [Thu, 9 Apr 2020 16:51:16 +0000 (17:51 +0100)]
[RISCV] Support experimental/unratified extensions

This adds support for enabling experimental/unratified RISC-V ISA
extensions in the -march string in the case where an explicit version
number has been declared, and the -menable-experimental-extensions flag
has been provided.

This follows the design as discussed on the mailing lists in the
following RFC: http://lists.llvm.org/pipermail/llvm-dev/2020-January/138364.html

Since the RISC-V toolchain definition currently rejects any extension
with an explicit version number, the parsing logic has been tweaked to
support this, and to allow standard extensions to have their versions
checked in future patches.

The bitmanip 'b' extension has been added as a first use of this support,
it should easily extend to other as yet unratified extensions (such as
the vector 'v' extension).

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

4 years ago[RISCV] Add MC layer support for proposed Bit Manipulation extension (version 0.92)
Paolo Savini [Thu, 9 Apr 2020 16:51:10 +0000 (17:51 +0100)]
[RISCV] Add MC layer support for proposed Bit Manipulation extension (version 0.92)

This adds the instruction encoding and mnenomics for the proposed
RISC-V Bit Manipulation extension (version 0.92). It is implemented with
each category of instruction as its own target feature, with the 'b'
extension feature enabling all options. Since this extension is not yet
ratified, all target features are prefixed with 'experimental-' to note
their status.

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

4 years ago[libc++/abi] Add scripts for building libc++ and libc++abi on Apple platforms
Louis Dionne [Wed, 8 Apr 2020 19:26:31 +0000 (15:26 -0400)]
[libc++/abi] Add scripts for building libc++ and libc++abi on Apple platforms

These scripts allow creating dylibs that are very close to the dylibs
shipped on Apple platforms.

4 years ago[PPC][AIX] Implement variadic function handling in LowerFormalArguments_AIX
jasonliu [Thu, 9 Apr 2020 15:52:57 +0000 (15:52 +0000)]
[PPC][AIX] Implement variadic function handling in LowerFormalArguments_AIX

Summary:
This patch adds support for handling of variadic functions for AIX.
This includes ensuring that use and consume correct type of
va_list (char *va_list) for AIX.

Authored by: ZarkoCA

Reviewers: cebowleratibm, sfertile, jasonliu

Reviewed by: jasonliu

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

4 years ago[PowerPC][Future] Initial support for PCRel addressing for constant pool loads
Stefan Pintilie [Thu, 9 Apr 2020 16:17:23 +0000 (11:17 -0500)]
[PowerPC][Future] Initial support for PCRel addressing for constant pool loads

Add initial support for PC Relative addressing for constant pool loads.
This includes adding a new relocation for @pcrel and adding a new PowerPC flag
to identify PC relative addressing.

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

4 years ago[VE] Support (m)0 and (m)1 operands
Kazushi (Jam) Marukawa [Thu, 9 Apr 2020 16:08:04 +0000 (18:08 +0200)]
[VE] Support (m)0 and (m)1 operands

Summary:
VE has special operands to represent 0b000...000111...111 (`(m)0`) and
0b111...111000...000 (`(m)1`) bit sequences.  This patch supports those
operands not only in machine instructions but also in DAG lowering.

Reviewed By: simoll

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

4 years ago[X86] Remove redundant VMOVDDUPZ128rmk/VMOVDDUPZ128rmkz isel patterns.
Craig Topper [Thu, 9 Apr 2020 15:33:51 +0000 (08:33 -0700)]
[X86] Remove redundant VMOVDDUPZ128rmk/VMOVDDUPZ128rmkz isel patterns.

These patterns are identical to the pattern for the instruction.

4 years ago[LV] Add VPValue operands to VPBlendRecipe (NFCI)
Gil Rapaport [Mon, 6 Apr 2020 11:02:34 +0000 (14:02 +0300)]
[LV] Add VPValue operands to VPBlendRecipe (NFCI)

InnerLoopVectorizer's code called during VPlan execution still relies on
original IR's def-use relations to decide which vector code to generate,
limiting VPlan transformations ability to modify def-use relations and still
have ILV generate the vector code.
This commit introduces VPValues for VPBlendRecipe to use as the values to
blend. The recipe is generated with VPValues wrapping the phi's incoming values
of the scalar phi. This reduces ingredient def-use usage by ILV as a step
towards full VPlan-based def-use relations.

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

4 years ago[flang] Add dependency on libSemantics to libEvaluate.
David Truby [Thu, 9 Apr 2020 15:39:18 +0000 (16:39 +0100)]
[flang] Add dependency on libSemantics to libEvaluate.

When building flang with LLVM HEAD, the unittests fail to link with ld.bfd or
ld.gold due to a linker ordering issue. Adding libSemantics as a dependency to
libEvaluate seems to fix that issue.

Reviewed at: https://github.com/flang-compiler/f18/pull/1104

4 years ago[SCCP] Add tests with AND/OR branch conditions.
Florian Hahn [Thu, 9 Apr 2020 15:36:51 +0000 (16:36 +0100)]
[SCCP] Add tests with AND/OR branch conditions.

4 years ago[OPENMP]Fix the test to pacify buildbots, NFC.
Alexey Bataev [Thu, 9 Apr 2020 15:28:02 +0000 (11:28 -0400)]
[OPENMP]Fix the test to pacify buildbots, NFC.

4 years ago[llvm][nfc] InstructionCostDetail encapsulation
Mircea Trofin [Wed, 8 Apr 2020 21:54:33 +0000 (14:54 -0700)]
[llvm][nfc] InstructionCostDetail encapsulation

Ensured initialized fields; encapsulad delta calulations and evaluation
of threshold having had changed; assertion for CostThresholdMap
dereference, to indicate design intent.

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

4 years ago[Flang] add flang as a new subproject in cmake
Eric Schweitz [Thu, 9 Apr 2020 15:13:11 +0000 (16:13 +0100)]
[Flang] add flang as a new subproject in cmake

Summary: This patch is some minor prep work for merging the flang(f18) project into the monorepo.  This patch adds "flang" as a supported target for the LLVM_ENABLE_PROJECTS option.

Reviewers: fhahn, tstellar, jdoerfert, beanz, DavidTruby

Reviewed By: DavidTruby

Subscribers: hfinkel, DavidTruby, aartbik, mgorny, llvm-commits

Tags: #flang, #llvm

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

4 years ago[flang] Merge flang-compiler/f18
David Truby [Thu, 9 Apr 2020 15:11:58 +0000 (16:11 +0100)]
[flang] Merge flang-compiler/f18

This is the initial merge of flang-compiler, which is done in this way
principally to preserve the history and git-blame, without generating a large
number of commits on the first-parent history of LLVM.

If you don't care about the flang history during a bisect remember that you can
supply paths to git-bisect, e.g. `git bisect start clang llvm`.

The history of f18 was rewritten to:

* Put the code under /flang/.
* Linearize the history.
* Rewrite commit messages so that issue and PR numbers point to the old repository.

Credit to Peter Waller for writing the flatten and merge script.

Updates: flang-compiler/f18#876 (submission into llvm-project)
Mailing-list: http://lists.llvm.org/pipermail/llvm-dev/2020-January/137989.html ([llvm-dev] Flang landing in the monorepo - next Monday!)
Mailing-list: http://lists.llvm.org/pipermail/llvm-dev/2019-December/137661.html ([llvm-dev] Flang landing in the monorepo)

Co-authored-by: Peter Waller <peter.waller@arm.com>
4 years ago[ELF][test] Improve reproduce tests and enable for Windows
Andrew Ng [Wed, 8 Apr 2020 19:21:16 +0000 (20:21 +0100)]
[ELF][test] Improve reproduce tests and enable for Windows

This patch changes the reproduce tests so that they no longer extract
the "long" paths of the generated reproduce tar archives. This
extraction prevented them from being run on Windows due to potential
issues relating to the Windows path length limit.

This patch also reduces the use of diff in these tests, as this was
raised as a performance concern in review D77659 and deemed unnecessary.

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

4 years ago[flang] Remove flatten and merge upstreaming script.
David Truby [Mon, 6 Apr 2020 13:38:50 +0000 (14:38 +0100)]
[flang] Remove flatten and merge upstreaming script.

Original-commit: flang-compiler/f18@21f3c455e842e0dab4a92db7ed8282f08eac930d

4 years ago[flang] Adjust README.md for upstreaming to LLVM.
David Truby [Mon, 6 Apr 2020 13:38:20 +0000 (14:38 +0100)]
[flang] Adjust README.md for upstreaming to LLVM.

Original-commit: flang-compiler/f18@24d23963b879d6586a7e19b89a905341627fe5b1

4 years ago[LV] FoldTail w/o Primary Induction
Ayal Zaks [Mon, 6 Apr 2020 22:53:59 +0000 (01:53 +0300)]
[LV] FoldTail w/o Primary Induction

Introduce a new VPWidenCanonicalIVRecipe to generate a canonical vector
induction for use in fold-tail-with-masking, if a primary induction is absent.

The canonical scalar IV having start = 0 and step = VF*UF, created during code
-gen to control the vector loop, is widened into a canonical vector IV having
start = {<Part*VF, Part*VF+1, ..., Part*VF+VF-1> for 0 <= Part < UF} and
step = <VF*UF, VF*UF, ..., VF*UF>.

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

4 years ago[analyzer][AnalysisOrderChecker] Display the CallEvent type in preCall/postCall
Kirstóf Umann [Sun, 1 Mar 2020 16:49:44 +0000 (17:49 +0100)]
[analyzer][AnalysisOrderChecker] Display the CallEvent type in preCall/postCall

Exactly what it says on the tin! The included testfile demonstrates why this is
important -- for C++ dynamic memory operators, we don't always recognize custom,
or even standard-specified new/delete operators as CXXAllocatorCall or
CXXDeallocatorCall.

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

4 years ago[OPENMP]Fix capturing of global variables in OpenMP regions.
Alexey Bataev [Wed, 8 Apr 2020 13:49:10 +0000 (09:49 -0400)]
[OPENMP]Fix capturing of global variables in OpenMP regions.

Summary:
The global variable should be captured in the region only if it was
privitized in the region or in any of the outer regions. Otherwise, it
should not be captured.

Reviewers: jdoerfert

Subscribers: yaxunl, guansong, cfe-commits, caomhin

Tags: #clang

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

4 years ago[InstCombine] remove stale FIXME comment; NFC
Sanjay Patel [Thu, 9 Apr 2020 14:33:27 +0000 (10:33 -0400)]
[InstCombine] remove stale FIXME comment; NFC

4 years ago[PowerPC][NFC] Add more check directives in only cxx_fast_tlscc lit test.
Sean Fertile [Fri, 3 Apr 2020 19:18:15 +0000 (15:18 -0400)]
[PowerPC][NFC] Add more check directives in only cxx_fast_tlscc lit test.

Use utils/update_llc_test_checks.py to add full CHECK directives to the
test for cxx_fast_tls calling convention. The calling convention is
arguably dead on PowerPC since dropping Darwin subtarget support in the PowerPC
backend. This test change helps show the atrocious code generation for
this lit test which was hidden by having few CHECK directives.

4 years ago[analyzer] Display the checker name in the text output
Kirstóf Umann [Fri, 20 Mar 2020 15:45:53 +0000 (16:45 +0100)]
[analyzer] Display the checker name in the text output

Exactly what it says on the tin! There is no reason I think not to have this.

Also, I added test files for checkers that emit warning under the wrong name.

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

4 years ago[RISCV] Implement evaluateBranch
Simon Cook [Thu, 9 Apr 2020 14:11:55 +0000 (15:11 +0100)]
[RISCV] Implement evaluateBranch

This implements the instruction analysis required to print branch
targets as part of llvm-objdump's disassembly.

Note, this only handles those branches which can be analyzed in a single
instruction, a future patch will handle multiple-instruction patterns,
such as AUIPC/LUI+JALR instruction pairs.

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

4 years ago[ASTMatchers] Fixed CastKind being parsed incorrectly for dynamic matchers
Nathan James [Mon, 6 Apr 2020 19:08:21 +0000 (20:08 +0100)]
[ASTMatchers] Fixed CastKind being parsed incorrectly for dynamic matchers

Summary: Requires hasCastKind arguments to have `CK_` prefixed to bring it in line with the documentation and other matchers that take enumerations.

Reviewers: klimek, aaron.ballman

Reviewed By: aaron.ballman

Subscribers: cfe-commits

Tags: #clang

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

4 years ago[analyzer] NFCi: Refactor CStringChecker: use strongly typed internal API
Balazs Benics [Thu, 9 Apr 2020 14:06:32 +0000 (16:06 +0200)]
[analyzer] NFCi: Refactor CStringChecker: use strongly typed internal API

Summary:
I wanted to extend the diagnostics of the CStringChecker with taintedness.
This requires the CStringChecker to be refactored to support a more flexible
reporting mechanism.

This patch does only refactorings, such:
 - eliminates always false parameters (like WarnAboutSize)
 - reduces the number of parameters
 - makes strong types differentiating *source* and *destination* buffers
   (same with size expressions)
 - binds the argument expression and the index, making diagnostics accurate
   and easy to emit
 - removes a bunch of default parameters to make it more readable
 - remove random const char* warning message parameters, making clear where
   and what is going to be emitted

Note that:
 - CheckBufferAccess now checks *only* one buffer, this removed about 100 LOC
   code duplication
 - not every function was refactored to use the /new/ strongly typed API, since
   the CString related functions are really closely coupled monolithic beasts,
   I will refactor them separately
 - all tests are preserved and passing; only the message changed at some places.
   In my opinion, these messages are holding the same information.

I would also highlight that this refactoring caught a bug in
clang/test/Analysis/string.c:454 where the diagnostic did not reflect reality.
This catch backs my effort on simplifying this monolithic CStringChecker.

Reviewers: NoQ, baloghadamsoftware, Szelethus, rengolin, Charusso

Reviewed By: NoQ

Subscribers: whisperity, xazax.hun, szepet, rnkovacs, a.sidorin,
mikhail.ramalho, donat.nagy, dkrupp, Charusso, martong, cfe-commits

Tags: #clang

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

4 years ago[OPENMP50] Fix PR45469: Consider variable-category of defaultmap clause as optional.
Alexey Bataev [Wed, 8 Apr 2020 19:19:54 +0000 (15:19 -0400)]
[OPENMP50] Fix PR45469: Consider variable-category of defaultmap clause as optional.

Summary:
According to the standard, variable-category is the optional part of the
defaultmap clause while the compiler always requires it. Turned it into
optional part.

Reviewers: jdoerfert

Subscribers: yaxunl, guansong, cfe-commits, caomhin

Tags: #clang

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

4 years agoAdd a missing dependency to DebugInfoDWARF unit tests
Pavel Labath [Thu, 9 Apr 2020 13:36:51 +0000 (15:36 +0200)]
Add a missing dependency to DebugInfoDWARF unit tests

BinaryFormat was already being used for various constants, but as of
b761a648 it is alse used for code.

This should fix the shared library build.

4 years ago[Hexagon] Default linker tests can fail if CLANG_DEFAULT_LINKER is used.
Sid Manning [Thu, 9 Apr 2020 13:32:35 +0000 (08:32 -0500)]
[Hexagon] Default linker tests can fail if CLANG_DEFAULT_LINKER is used.

These values are not always known since there is a configuration
option to set the default linker, CLANG_DEFAULT_LINKER.

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

4 years ago[ASTMatchers] Add support for dynamic matching of ofKind narrowing matcher
Nathan James [Thu, 9 Apr 2020 11:43:33 +0000 (12:43 +0100)]
[ASTMatchers] Add support for dynamic matching of ofKind narrowing matcher

Summary: Adds support for using the ofKind in clang-query and other dynamic matcher use cases

Reviewers: klimek, aaron.ballman, jdoerfert

Reviewed By: aaron.ballman

Subscribers: cfe-commits

Tags: #clang

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

4 years ago[NFC][X86] Refine code in X86AsmBackend
Shengchen Kan [Thu, 9 Apr 2020 05:56:04 +0000 (13:56 +0800)]
[NFC][X86] Refine code in X86AsmBackend

Summary: Move code to a better place, rename function, etc

Tags: #llvm

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

4 years ago[lldb] Disable the new Communication test on windows
Pavel Labath [Thu, 9 Apr 2020 13:19:24 +0000 (15:19 +0200)]
[lldb] Disable the new Communication test on windows

The ConnectionFileDescriptor class on windows does not support
interruption (see the BytesAvailable method). Therefore this test makes
no sense there.

4 years ago[lldb] Add parts accidentally left out of 769d704: Recommit "[lldb/Core] Fix a race...
Pavel Labath [Thu, 9 Apr 2020 12:41:51 +0000 (14:41 +0200)]
[lldb] Add parts accidentally left out of 769d704: Recommit "[lldb/Core] Fix a race in the Communication class"

I went to a great length to explain the reason why these changes were
needed, but I did not actually ammend the patch to include them. :(

4 years ago[SCCP] Add test case for binary ops with constant expressions.
Florian Hahn [Thu, 9 Apr 2020 12:38:43 +0000 (13:38 +0100)]
[SCCP] Add test case for binary ops with constant expressions.

4 years ago[InstCombine] replace undef in vector constant for safe shift transform (PR45447)
Sanjay Patel [Thu, 9 Apr 2020 11:55:55 +0000 (07:55 -0400)]
[InstCombine] replace undef in vector constant for safe shift transform (PR45447)

As noted in PR45447, we have a vector-constant-with-undef-element transform bug:
https://bugs.llvm.org/show_bug.cgi?id=45447

We replace undefs with a safe constant (0 or -1) based on the (non-)negative
predicate constraint.

So this is correct:
http://volta.cs.utah.edu:8080/z/WZE36H
...but this is not:
http://volta.cs.utah.edu:8080/z/boj8gJ

Previously, we were relying on getSafeVectorConstantForBinop() in the related fold (D76800).
But that's making an assumption about what qualifies as "safe", and that assumption may
not always hold.

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

4 years ago[libFuzzer] Fix typo in seed_inputs flag description. NFC.
Marek Kurdej [Thu, 9 Apr 2020 11:53:03 +0000 (13:53 +0200)]
[libFuzzer] Fix typo in seed_inputs flag description. NFC.

4 years agotsan: don't instrument __attribute__((naked)) functions
Anton Bikineev [Sat, 4 Apr 2020 19:55:10 +0000 (21:55 +0200)]
tsan: don't instrument __attribute__((naked)) functions

Naked functions are required to not have compiler generated
prologues/epilogues, hence no instrumentation is needed for them.

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

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

4 years ago[DWARF] Detect extraction errors in DWARFFormValue::extractValue
Pavel Labath [Thu, 2 Apr 2020 13:09:08 +0000 (15:09 +0200)]
[DWARF] Detect extraction errors in DWARFFormValue::extractValue

Summary:
Although the function had a bool return value, it was always returning
true. Presumably this is because the main type of errors one can
encounter here is running off the end of the stream, and until very
recently, the DataExtractor class made it very difficult to detect that.

The situation has changed now, and we can easily detect errors here,
which this patch does.

Reviewers: dblaikie, aprantl

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

4 years agoRecommit "[lldb/Core] Fix a race in the Communication class"
Pavel Labath [Thu, 2 Apr 2020 11:54:54 +0000 (13:54 +0200)]
Recommit "[lldb/Core] Fix a race in the Communication class"

The synchronization logic in the previous had a subtle bug. Moving of
the "m_read_thread_did_exit = true" into the critical section made it
possible for some threads calling SynchronizeWithReadThread call to get
stuck. This could happen if there were already past the point where they
checked this variable. In that case, they would block on waiting for the
eBroadcastBitNoMorePendingInput event, which would never come as the
read thread was blocked on getting the synchronization mutex.

The new version moves that line out of the critical section and before
the sending of the eBroadcastBitNoMorePendingInput event, and also adds
some comments to explain why the things need to be in this sequence:
- m_read_thread_did_exit = true: prevents new threads for waiting on
  events
- eBroadcastBitNoMorePendingInput: unblock any current thread waiting
  for the event
- Disconnect(): close the connection. This is the only bit that needs to
  be in the critical section, and this is to ensure that we don't close
  the connection while the synchronizing thread is mucking with it.

Original commit message follows:

Communication::SynchronizeWithReadThread is called whenever a process
stops to ensure that we process all of its stdout before we report the
stop. If the process exits, we first call this method, and then close
the connection.

However, when the child process exits, the thread reading its stdout
will usually (but not always) read an EOF because the other end of the
pty has been closed. In response to an EOF, the Communication read
thread closes it's end of the connection too.

This can result in a race where the read thread is closing the
connection while the synchronizing thread is attempting to get its
attention via Connection::InterruptRead.

The fix is to hold the synchronization mutex while closing the
connection.

I've found this issue while tracking down a rare flake in some of the
vscode tests. I am not sure this is the cause of those failures (as I
would have expected this issue to manifest itself differently), but it
is an issue nonetheless.

The attached test demonstrates the steps needed to reproduce the race.
It will fail under tsan without this patch.

Reviewers: clayborg, JDevlieghere

Subscribers: mgorny, lldb-commits

Tags: #lldb

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

4 years ago[Driver][X86] Add -mpad-max-prefix-size
Shengchen Kan [Tue, 7 Apr 2020 04:25:03 +0000 (12:25 +0800)]
[Driver][X86] Add -mpad-max-prefix-size

Summary:
The option `-mpad-max-prefix-size` performs some checking and delegate to MC option `-x86-pad-max-prefix-size`. This option is designed for eliminate NOPs when we need to align something by adding redundant prefixes to instructions, e.g. it can be used along with `-malign-branch`, `-malign-branch-boundary` to prefix padding branch.

It has similar (but slightly different) effect as GAS's option `-malign-branch-prefix-size`, e.g. `-mpad-max-prefix-size` can also elminate NOPs emitted by align directive, so we use a different name here. I remove the option `-malign-branch-prefix-size` since is unimplemented and not needed. If we need to be compatible with GAS, we can make `-malign-branch-prefix-size` an alias for this option later.

Reviewers: jyknight, reames, MaskRay, craig.topper, LuoYuanke

Reviewed By: MaskRay, LuoYuanke

Subscribers: annita.zhang, cfe-commits

Tags: #clang

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

4 years ago[gn build] Port 44f0d7f1364
LLVM GN Syncbot [Thu, 9 Apr 2020 11:26:04 +0000 (11:26 +0000)]
[gn build] Port 44f0d7f1364

4 years agoRevert "[Codegen/Statepoint] Allow usage of registers for non gc deopt values."
Serguei Katkov [Thu, 9 Apr 2020 11:24:47 +0000 (18:24 +0700)]
Revert "[Codegen/Statepoint] Allow usage of registers for non gc deopt values."

This reverts commit a0275705bb5aa938119c3e7c8bc957a823450b17.

It causes buildbot failures building LLVM with BUILD_SHARED_LIBS due to a linker error.

4 years ago[obj2yaml] - Do not dump the segment's "Align" field when it is equal to 1.
Georgii Rymar [Wed, 8 Apr 2020 10:10:01 +0000 (13:10 +0300)]
[obj2yaml] - Do not dump the segment's "Align" field when it is equal to 1.

yaml2obj sets the `Align` to 1 by default, hence we can stop
dumping it to reduce the output.

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

4 years ago[NFC] Fix Z3 version detection regexp
Balazs Benics [Thu, 26 Mar 2020 11:30:27 +0000 (12:30 +0100)]
[NFC] Fix Z3 version detection regexp

Summary:
We use the `major.minor.build` version format in this file, except when we try
to parse the result of the test binary.
In that regular expression, we expect the `major.minor.build.rev` format, which
is never fulfilled.

Reviewers: NoQ, george.karpenkov, alexandre.isoard, serge-sans-paille

Reviewed By: NoQ

Subscribers: mgorny, mikhail.ramalho, Charusso, martong, llvm-commits

Tags: #llvm

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

4 years agoRevert "[lldb/Core] Fix a race in the Communication class"
Pavel Labath [Thu, 9 Apr 2020 10:49:56 +0000 (12:49 +0200)]
Revert "[lldb/Core] Fix a race in the Communication class"

This reverts commit ebb071345cdae2509c55f9eec76090926fee86a2 -- it seems
to introduce a deadlock in some circumstances.

4 years ago[LV] Assert no DbgInfoIntrinsic calls are passed to widening (NFC).
Florian Hahn [Thu, 9 Apr 2020 10:30:02 +0000 (11:30 +0100)]
[LV] Assert no DbgInfoIntrinsic calls are passed to widening (NFC).

When building a VPlan, BasicBlock::instructionsWithoutDebug() is used to
iterate over the instructions in a block. This means that no recipes
should be created for debug info intrinsics already and we can turn the
early exit into an assertion.

Reviewers: Ayal, gilr, rengolin, aprantl

Reviewed By: aprantl

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

4 years ago[gn build] Port a0275705bb5
LLVM GN Syncbot [Thu, 9 Apr 2020 10:13:53 +0000 (10:13 +0000)]
[gn build] Port a0275705bb5

4 years agoTemporarily revert "[Attributor] Unify testing (=updates,...)"
Florian Hahn [Thu, 9 Apr 2020 10:07:36 +0000 (11:07 +0100)]
Temporarily revert "[Attributor] Unify testing (=updates,...)"

This patch reverts the 2 patches below, as on most systems the disabled
tests actually pass and that causes most bots to be red, including
  http://green.lab.llvm.org/green/job/clang-stage1-RA/8541/
  http://green.lab.llvm.org/green/job/clang-stage1-cmake-RA-expensive/15646/
  http://lab.llvm.org:8011/builders/clang-ppc64le-linux-lnt/builds/23690
  http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-bootstrap/builds/16751

* [Attributor] Disable three tests until the SCC update bug was fixed
  commit 2ae1a76c27295370d552f57352508b7af4dba791.

* [Attributor] Unify testing (=updates,prefixes,run configurations,...)
  2bcf5793e14577ed3c9f15a77a35179ae544fff4.

4 years ago[lldb/Core] Fix a race in the Communication class
Pavel Labath [Thu, 2 Apr 2020 11:54:54 +0000 (13:54 +0200)]
[lldb/Core] Fix a race in the Communication class

Summary:
Communication::SynchronizeWithReadThread is called whenever a process
stops to ensure that we process all of its stdout before we report the
stop. If the process exits, we first call this method, and then close
the connection.

However, when the child process exits, the thread reading its stdout
will usually (but not always) read an EOF because the other end of the
pty has been closed. In response to an EOF, the Communication read
thread closes it's end of the connection too.

This can result in a race where the read thread is closing the
connection while the synchronizing thread is attempting to get its
attention via Connection::InterruptRead.

The fix is to hold the synchronization mutex while closing the
connection.

I've found this issue while tracking down a rare flake in some of the
vscode tests. I am not sure this is the cause of those failures (as I
would have expected this issue to manifest itself differently), but it
is an issue nonetheless.

The attached test demonstrates the steps needed to reproduce the race.
It will fail under tsan without this patch.

Reviewers: clayborg, JDevlieghere

Subscribers: mgorny, lldb-commits

Tags: #lldb

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

4 years ago[Codegen/Statepoint] Allow usage of registers for non gc deopt values.
Serguei Katkov [Tue, 7 Apr 2020 04:29:25 +0000 (11:29 +0700)]
[Codegen/Statepoint] Allow usage of registers for non gc deopt values.

The change introduces the usage of physical registers for non-gc deopt values.
This require runtime support to know how to take a value from register.
By default usage is off and can be switched on by option.

The change also introduces additional fix-up patch which forces the spilling
of caller saved registers (clobbered after the call) and re-writes statepoint
to use spill slots instead of caller saved registers.

Reviewers: reames, dantrushin
Reviewed By: reames, dantrushin
Subscribers: mgorny, hiraditya, mgrang, llvm-commits
Differential Revision: https://reviews.llvm.org/D77371

4 years ago[CodeGen] Fix a simple FIXME. NFC.
Jay Foad [Thu, 9 Apr 2020 09:42:16 +0000 (10:42 +0100)]
[CodeGen] Fix a simple FIXME. NFC.

4 years ago[SanitizerCoverage] Add -fsanitize-coverage=inline-bool-flag
Pratyai Mazumder [Thu, 9 Apr 2020 09:33:36 +0000 (02:33 -0700)]
[SanitizerCoverage] Add -fsanitize-coverage=inline-bool-flag

Reviewers: kcc, vitalybuka

Reviewed By: vitalybuka

Subscribers: cfe-commits, llvm-commits

Tags: #clang

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

4 years agoFix typo in comment
Jay Foad [Thu, 9 Apr 2020 09:15:07 +0000 (10:15 +0100)]
Fix typo in comment

4 years ago[AMDGPU] Remove outdated comment
Jay Foad [Thu, 9 Apr 2020 09:13:53 +0000 (10:13 +0100)]
[AMDGPU] Remove outdated comment

4 years ago[LLD][ELF][ARM] Fix 32-bit Arm builders, by making test case smaller
Peter Smith [Thu, 9 Apr 2020 08:53:00 +0000 (09:53 +0100)]
[LLD][ELF][ARM] Fix 32-bit Arm builders, by making test case smaller

Use AT(address) to force the creation of 3 small segments rather than
a single giant one, causing the Arm v8 builder to run out of memory.

4 years ago[compiler-rt] Don't print warning about missing testingsupport if not including tests
Raul Tambre [Thu, 9 Apr 2020 09:18:42 +0000 (02:18 -0700)]
[compiler-rt] Don't print warning about missing testingsupport if not including tests

Reviewers: samsonov, vitalybuka

Reviewed By: vitalybuka

Subscribers: dberris, mgorny, #sanitizers

Tags: #sanitizers

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

4 years ago[VPlan] Add & use VPValue operands for VPWidenCallRecipe (NFC).
Florian Hahn [Thu, 9 Apr 2020 09:23:21 +0000 (10:23 +0100)]
[VPlan] Add & use VPValue operands for VPWidenCallRecipe (NFC).

This patch adds VPValue versions for the arguments of the call to
VPWidenCallRecipe and uses them during code-generation.

Similar to D76373 this reduces ingredient def-use usage by ILV as
a step towards full VPlan-based def-use relations.

Reviewers: Ayal, gilr, rengolin

Reviewed By: gilr

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

4 years ago[Docs] Add more FP option description for llc
Qiu Chaofan [Thu, 9 Apr 2020 09:13:01 +0000 (17:13 +0800)]
[Docs] Add more FP option description for llc

This patch adds missing description of enable-no-signed-zeros-fp-math
and enable-no-trapping-fp-math options of llc.

Reviewed By: jhenderson

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

4 years ago[KnownBits] Move AND, OR and XOR logic into KnownBits
Jay Foad [Wed, 5 Feb 2020 16:15:53 +0000 (16:15 +0000)]
[KnownBits] Move AND, OR and XOR logic into KnownBits

Summary:
There are at least three clients for KnownBits calculations:
ValueTracking, SelectionDAG and GlobalISel. To reduce duplication the
common logic should be moved out of these clients and into KnownBits
itself.

This patch does this for AND, OR and XOR calculations by implementing
and using appropriate operator overloads KnownBits::operator& etc.

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[clang-tidy] [doc] Fix hicpp-noexcept-move alias links.
Marek Kurdej [Thu, 9 Apr 2020 08:42:04 +0000 (10:42 +0200)]
[clang-tidy] [doc] Fix hicpp-noexcept-move alias links.

4 years ago[ValueTracking] Simplify KnownBits construction
Jay Foad [Thu, 9 Apr 2020 07:52:45 +0000 (08:52 +0100)]
[ValueTracking] Simplify KnownBits construction

Use the simpler BitWidth constructor instead of the copy constructor to
make it clear when we don't actually need to copy an existing KnownBits
value. Split out from D74539. NFC.

4 years ago[RDA] Avoid negative shift UB
Nikita Popov [Thu, 9 Apr 2020 07:47:15 +0000 (09:47 +0200)]
[RDA] Avoid negative shift UB

Avoid "left shift of negative value -1" ubsan errors by casting
to uintptr_t before performing the shift, rather than after.

4 years ago[lldb] Fixing the bug that the "log timer" has no tab completion
Shu Anzai [Thu, 9 Apr 2020 06:11:55 +0000 (08:11 +0200)]
[lldb] Fixing the bug that the "log timer" has no tab completion

I fixed the bug that the "log timer" has no tab command.

Original code has the only CommandObjectLogTimer class, but it is not
sufficient. Thus I divided the content of CommandObjectLog class into
CommandObjectLogEnable class, CommandObjectLogDisable class,
CommandObjectLogDump class, CommandObjectLogReset class,
CommandObjectLogIncrement class.

Reviewed by: teemperor

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

4 years ago[FPEnv] Use single enum to represent rounding mode
Serge Pavlov [Thu, 26 Mar 2020 07:51:09 +0000 (14:51 +0700)]
[FPEnv] Use single enum to represent rounding mode

Now compiler defines 5 sets of constants to represent rounding mode.
These are:

1. `llvm::APFloatBase::roundingMode`. It specifies all 5 rounding modes
defined by IEEE-754 and is used in `APFloat` implementation.

2. `clang::LangOptions::FPRoundingModeKind`. It specifies 4 of 5 IEEE-754
rounding modes and a special value for dynamic rounding mode. It is used
in clang frontend.

3. `llvm::fp::RoundingMode`. Defines the same values as
`clang::LangOptions::FPRoundingModeKind` but in different order. It is
used to specify rounding mode in in IR and functions that operate IR.

4. Rounding mode representation used by `FLT_ROUNDS` (C11, 5.2.4.2.2p7).
Besides constants for rounding mode it also uses a special value to
indicate error. It is convenient to use in intrinsic functions, as it
represents platform-independent representation for rounding mode. In this
role it is used in some pending patches.

5. Values like `FE_DOWNWARD` and other, which specify rounding mode in
library calls `fesetround` and `fegetround`. Often they represent bits
of some control register, so they are target-dependent. The same names
(not values) and a special name `FE_DYNAMIC` are used in
`#pragma STDC FENV_ROUND`.

The first 4 sets of constants are target independent and could have the
same numerical representation. It would simplify conversion between the
representations. Also now `clang::LangOptions::FPRoundingModeKind` and
`llvm::fp::RoundingMode` do not contain the value for IEEE-754 rounding
direction `roundTiesToAway`, although it is supported natively on
some targets.

This change defines all the rounding mode type via one `llvm::RoundingMode`,
which also contains rounding mode for IEEE rounding direction `roundTiesToAway`.

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

4 years ago[SanitizerCoverage] sancov/inline-bool-flag instrumentation.
Pratyai Mazumder [Thu, 9 Apr 2020 05:02:41 +0000 (22:02 -0700)]
[SanitizerCoverage] sancov/inline-bool-flag instrumentation.

Summary:
New SanitizerCoverage feature `inline-bool-flag` which inserts an
atomic store of `1` to a boolean (which is an 8bit integer in
practice) flag on every instrumented edge.

Implementation-wise it's very similar to `inline-8bit-counters`
features. So, much of wiring and test just follows the same pattern.

Reviewers: kcc, vitalybuka

Reviewed By: vitalybuka

Subscribers: llvm-commits, hiraditya, jfb, cfe-commits, #sanitizers

Tags: #clang, #sanitizers, #llvm

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

4 years ago[NFC][SanitizerCoverage] Simplify alignment calculation
Vitaly Buka [Thu, 9 Apr 2020 05:13:19 +0000 (22:13 -0700)]
[NFC][SanitizerCoverage] Simplify alignment calculation

This reverts commit e42f2a0cd8b8007c816d0e63f5000c444e29105e.

4 years ago[Attributor] Disable three tests until the SCC update bug was fixed
Johannes Doerfert [Thu, 9 Apr 2020 05:31:41 +0000 (00:31 -0500)]
[Attributor] Disable three tests until the SCC update bug was fixed

D76588 exposed an SCC update bug in three tests which manifests
sometimes, e.g., on this bot that runs expensive checks:
  http://lab.llvm.org:8011/builders/llvm-clang-x86_64-expensive-checks-win/builds/23032/steps/test-check-all/logs/FAIL%3A%20LLVM%3A%3Afp80.ll

We disable the tests temporarily to investigate.

4 years ago[gn build] Port a3dc9490004
LLVM GN Syncbot [Thu, 9 Apr 2020 05:18:49 +0000 (05:18 +0000)]
[gn build] Port a3dc9490004