platform/upstream/llvm.git
3 years ago[TableGen] Add frontend/backend phase timing capability.
Paul C. Anagnostopoulos [Thu, 22 Oct 2020 06:58:49 +0000 (02:58 -0400)]
[TableGen] Add frontend/backend phase timing capability.

Describe in the BackEnd Developer's Guide. Instrument a few backends.

Remove an old unused timing facility. Add a null backend for timing
the parser.

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

3 years ago[NFC] Small refactor to CompilationDatabase
Nathan James [Sat, 14 Nov 2020 14:03:35 +0000 (14:03 +0000)]
[NFC] Small refactor to CompilationDatabase

3 years ago[CostModel] make default size cost for libcalls small (again)
Sanjay Patel [Sat, 14 Nov 2020 13:04:14 +0000 (08:04 -0500)]
[CostModel] make default size cost for libcalls small (again)

This was changed recently with D90554 / f7eac51b9b3f
...because we had a regression testing blindspot for intrinsics
that are expected to be lowered to libcalls.

In general, we want the *size* cost for a scalar call to be cheap
even if the other costs are expensive - we expect it to just be
a branch with some optional stack manipulation.

It is likely that we will want to carve out some
exceptions/overrides to this rule as follow-up patches for
calls that have some general and/or target-specific difference
to the expected lowering.

This was noticed as a regression in unrolling, so we have a test
for that now along with a couple of direct cost model tests.

If the assumed scalarization costs for the oversized vector
calls are not realistic, that would be another follow-up
refinement of the cost models.

3 years ago[CostModel] add tests for math library calls; NFC
Sanjay Patel [Fri, 13 Nov 2020 23:01:39 +0000 (18:01 -0500)]
[CostModel] add tests for math library calls; NFC

3 years ago[Coroutines] Make sure that async coroutine context size is a multiple of the alignme...
Arnold Schwaighofer [Sat, 14 Nov 2020 01:57:22 +0000 (17:57 -0800)]
[Coroutines] Make sure that async coroutine context size is a multiple of the alignment requirement

This simplifies the code the allocator has to executed

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

3 years ago[git-clang-format] Process CUDA header files
mydeveloperday [Sat, 14 Nov 2020 12:37:52 +0000 (12:37 +0000)]
[git-clang-format] Process CUDA header files

Clang supports compiling CUDA source files,
CUDA header files may contain CUDA specific code
that is why they have special extension, which
can be recognized by nvcc (CUDA compiler driver)
as CUDA source file.
Format them by default as well.

Reviewed By: MyDeveloperDay

Patch By: tomilov

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

3 years ago[TableGen] Clean up more .td files
Paul C. Anagnostopoulos [Fri, 13 Nov 2020 15:31:53 +0000 (10:31 -0500)]
[TableGen] Clean up more .td files

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

3 years agoRevert "clang-misexpect: Profile Guided Validation of Performance Annotations in...
Roman Lebedev [Sat, 14 Nov 2020 06:44:14 +0000 (09:44 +0300)]
Revert "clang-misexpect: Profile Guided Validation of Performance Annotations in LLVM"

See discussion in https://bugs.llvm.org/show_bug.cgi?id=45073 / https://reviews.llvm.org/D66324#2334485
the implementation is known-broken for certain inputs,
the bugreport was up for a significant amount of timer,
and there has been no activity to address it.
Therefore, just completely rip out all of misexpect handling.

I suspect, fixing it requires redesigning the internals of MD_misexpect.
Should anyone commit to fixing the implementation problem,
starting from clean slate may be better anyways.

This reverts commit 7bdad08429411e7d0ecd58cd696b1efe3cff309e,
and some of it's follow-ups, that don't stand on their own.

3 years ago[sanitizer] Fix Android API level parsing on arm
Vitaly Buka [Sat, 14 Nov 2020 09:52:44 +0000 (01:52 -0800)]
[sanitizer] Fix Android API level parsing on arm

3 years agoMake -fintegrated-cc1 work with cc1as
Fangrui Song [Sat, 14 Nov 2020 09:16:16 +0000 (01:16 -0800)]
Make -fintegrated-cc1 work with cc1as

Tested 0.018s faster on my machine.

3 years ago[sanitizer] Fix test on arm 32bit
Vitaly Buka [Sat, 14 Nov 2020 08:02:29 +0000 (00:02 -0800)]
[sanitizer] Fix test on arm 32bit

Make test values suitable for PC alignment arithmetic used
in StackTrace::Print().

3 years ago[RISCV] Add test cases for fsrw/fslw that don't sign extend the result. NFC
Craig Topper [Sat, 14 Nov 2020 07:29:05 +0000 (23:29 -0800)]
[RISCV] Add test cases for fsrw/fslw that don't sign extend the result. NFC

These currently fail to select fsrw/fslw.

3 years ago[test] Fix const-addr-no-neg-offset.ll under NPM
Arthur Eubanks [Sat, 14 Nov 2020 07:29:36 +0000 (23:29 -0800)]
[test] Fix const-addr-no-neg-offset.ll under NPM

3 years ago[scudo/standalone] Fix leak in ThreadedGlobalQuarantine test
Roland McGrath [Sat, 14 Nov 2020 06:22:54 +0000 (22:22 -0800)]
[scudo/standalone] Fix leak in ThreadedGlobalQuarantine test

This unit test code was using malloc without a corresponding free.
When the system malloc is not being overridden by the code under
test, it might an asan/lsan allocator that notices leaks.

Reviewed By: phosek

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

3 years ago[clang-tidy] Fix crash in bugprone-redundant-branch-condition on ExprWithCleanups
Zinovy Nis [Sun, 8 Nov 2020 18:01:45 +0000 (21:01 +0300)]
[clang-tidy] Fix crash in bugprone-redundant-branch-condition on ExprWithCleanups

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

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

3 years agoRevert "Switch libLLVMFrontendOpenACC to be a regular CMake library and not a "compon...
Mehdi Amini [Sat, 14 Nov 2020 04:14:05 +0000 (04:14 +0000)]
Revert "Switch libLLVMFrontendOpenACC to be a regular CMake library and not a "component""

This reverts commit e7ed27653292b2ec545e87204031282b4b237754.

Build is broken with  -DLLVM_LINK_LLVM_DYLIB=ON

3 years ago[lldb] Mark command-process-connect as unsupported on Windows
Jonas Devlieghere [Sat, 14 Nov 2020 04:01:18 +0000 (20:01 -0800)]
[lldb] Mark command-process-connect as unsupported on Windows

Windows doesn't support remote connections.

3 years ago[mlir] refactor common idiom into AffineMap method
Aart Bik [Sat, 14 Nov 2020 02:11:47 +0000 (18:11 -0800)]
[mlir] refactor common idiom into AffineMap method

motivated by a refactoring in the new sparse code (yet to be merged), this avoids some lengthy code dup

Reviewed By: mehdi_amini

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

3 years agoSwitch libLLVMFrontendOpenACC to be a regular CMake library and not a "component"
Mehdi Amini [Sat, 14 Nov 2020 02:18:18 +0000 (02:18 +0000)]
Switch libLLVMFrontendOpenACC to be a regular CMake library and not a "component"

This library is only used in Flang at the moment and not tested withing LLVM.
Having it as a component is breaking llvm-config:

  $ bin/llvm-config --shared-mode
  llvm-config: error: component libraries and shared library

  llvm-config: error: missing: [...]/lib/libLLVMFrontendOpenACC.a

This will reverted when unit-tests are provided for it.

Reviewed By: clementval

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

3 years ago[lldb] Make `process connect` behave the same in sync and async mode.
Jonas Devlieghere [Sat, 14 Nov 2020 01:30:34 +0000 (17:30 -0800)]
[lldb] Make `process connect` behave the same in sync and async mode.

I think the check for whether the process is connected is totally bogus
in the first place, but on the off-chance that's it's not, we should
behave the same in synchronous and asynchronous mode.

3 years agoAdd an assertion in SmallVector::push_back()
Mehdi Amini [Fri, 13 Nov 2020 22:37:25 +0000 (22:37 +0000)]
Add an assertion in SmallVector::push_back()

This assertion ensures the input value isn't part of the vector when
growing is required. In such cases the vector will grow and the input
value is invalidated before being read from.

This found 14 failed Tests.

Reviewed By: bkramer

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

3 years agoReplace sequences of v.push_back(v[i]); v.erase(&v[i]); with std::rotate (NFC)
Mehdi Amini [Sat, 14 Nov 2020 00:46:30 +0000 (00:46 +0000)]
Replace sequences of v.push_back(v[i]); v.erase(&v[i]); with std::rotate (NFC)

The code has a few sequence that looked like:

    Ops.push_back(Ops[0]);
    Ops.erase(Ops.begin());

And are equivalent to:

    std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end());

The latter has the advantage of never reallocating the vector, which
would be a bug in the original code as push_back would read from the
memory it deallocated.

3 years ago[mlir] Make linalg-bufferize run on FuncOp
Sean Silva [Fri, 13 Nov 2020 23:27:29 +0000 (15:27 -0800)]
[mlir] Make linalg-bufferize run on FuncOp

That way, it runs in parallel across functions.

3 years ago[flang] Fix "EQ" comparison of arrays
Peter Steinfeld [Fri, 13 Nov 2020 17:31:41 +0000 (09:31 -0800)]
[flang] Fix "EQ" comparison of arrays

When comparing arrays whose shapes do not conform, the contant folding
code ran into problems trying to get the value of an extent that did not
exist.  There were actually two problems.  First, the routine
"CheckConformance()" was returning "true" when the compiler was unable
to get the extent of an array.  Second, the function
"ApplyElementwise()" was calling "CheckConformance()" prior to folding
the elements of two arrays, but it was ignoring the return value.

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

3 years ago[MemProf][NewPM] Make memprof passes required
Arthur Eubanks [Thu, 12 Nov 2020 21:40:03 +0000 (13:40 -0800)]
[MemProf][NewPM] Make memprof passes required

Just like other sanitizers.
Fixes check-memprof under NPM.

Reviewed By: leonardchan

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

3 years ago[AMDGPU] Mark sin/cos load folding as modifying the function.
Stanislav Mekhanoshin [Fri, 13 Nov 2020 22:33:43 +0000 (14:33 -0800)]
[AMDGPU] Mark sin/cos load folding as modifying the function.

When the load value is folded into the sin/cos operation, the
AMDGPU library calls simplifier could still mark the function
as unmodified. Instead ensure if there is an early return,
return whether the load was folded into the sin/cos call.

Authored by MJDSys

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

3 years agoFrontend: Remove unused parameter from ASTUnit::LoadFromCompilerInvocationAction...
Duncan P. N. Exon Smith [Sun, 8 Nov 2020 01:44:09 +0000 (20:44 -0500)]
Frontend: Remove unused parameter from ASTUnit::LoadFromCompilerInvocationAction, NFC

Drop `IncludeBriefCommentsInCodeCompletion` since it is always `false`.

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

3 years ago[WebAssembly] Move GlobalTLSAddress handling to WebAssemblyISelLowering. NFC
Sam Clegg [Fri, 13 Nov 2020 05:43:57 +0000 (21:43 -0800)]
[WebAssembly] Move GlobalTLSAddress handling to WebAssemblyISelLowering. NFC

I'm not why it was added to DAGToDAG oringally but it seems
to make sense alongside the non-TLS version:  LowerGlobalAddress

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

3 years ago[CMake] Explicity set up RPATH for the runtime libs on Win to ARM Linux cross builds.
Vladimir Vereschaka [Fri, 13 Nov 2020 22:21:27 +0000 (14:21 -0800)]
[CMake] Explicity set up RPATH for the runtime libs on Win to ARM Linux cross builds.

Since RPATH initialization was disabled for the runtime libraries to
avoid overwriting RPATH unconditionally we need to explicity set up it
for the Win to Arm Linux cross builds.

See some details here: https://reviews.llvm.org/D91099

3 years ago[ORC] Fix missing return value.
Lang Hames [Fri, 13 Nov 2020 21:26:06 +0000 (08:26 +1100)]
[ORC] Fix missing return value.

3 years ago[LoopUnroll] add test for full unroll that is sensitive to cost-model; NFC
Sanjay Patel [Fri, 13 Nov 2020 21:05:07 +0000 (16:05 -0500)]
[LoopUnroll] add test for full unroll that is sensitive to cost-model; NFC

See discussion in D90554.

3 years ago[ObjC][ARC] Add and use a function which finds and returns the single
Akira Hatanaka [Fri, 13 Nov 2020 18:40:40 +0000 (10:40 -0800)]
[ObjC][ARC] Add and use a function which finds and returns the single
dependency. NFC

Use findSingleDependency in place of FindDependencies and stop passing a
set of Instructions around. Modify FindDependencies to return a boolean
flag which indicates whether the dependencies it has found are all
valid.

3 years agoMove variable declarations to functions in which they are used. NFC
Akira Hatanaka [Fri, 13 Nov 2020 17:56:12 +0000 (09:56 -0800)]
Move variable declarations to functions in which they are used. NFC

3 years ago[GlobalISel] Add convenience matchers for nots and all-ones constants
Jessica Paquette [Fri, 13 Nov 2020 19:28:55 +0000 (11:28 -0800)]
[GlobalISel] Add convenience matchers for nots and all-ones constants

Add a convenience matcher which handles

```
G_XOR %not_reg, -1
```

And a convenience matcher which returns true if an integer constant is
all-ones.

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

3 years ago[DFSan][NewPM] Handle dfsan under NPM
Arthur Eubanks [Thu, 12 Nov 2020 21:19:04 +0000 (13:19 -0800)]
[DFSan][NewPM] Handle dfsan under NPM

Make it required. Since it's a module pass, optnone won't test it, so
extend the clang test to also use opt-bisect now that it's supported.

14/16 check-dfsan tests failed with NPM enabled, now all pass.

Reviewed By: leonardchan

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

3 years ago[KnownBits] Combine abs() implementations
Nikita Popov [Fri, 13 Nov 2020 21:17:26 +0000 (22:17 +0100)]
[KnownBits] Combine abs() implementations

ValueTracking was using a more powerful abs() implementation. Roll
it into KnownBits::abs(). Also add an exhaustive test for abs(),
in both the poisoning and non-poisoning variants.

3 years agoSerialization: Merge three diagnostics to simplify ASTReader::getInputFile, NFC
Duncan P. N. Exon Smith [Thu, 12 Nov 2020 17:53:49 +0000 (12:53 -0500)]
Serialization: Merge three diagnostics to simplify ASTReader::getInputFile, NFC

Clean up the logic for `err_fe_{pch,module,ast}_file_modified` to use a
`select` like other ASTReader diagnostics. There should be no
functionality change here, just a cleanup.

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

3 years ago[NFC] Refactor function declaration addition in AsyncToLLVM
Rahul Joshi [Fri, 13 Nov 2020 19:58:40 +0000 (11:58 -0800)]
[NFC] Refactor function declaration addition in AsyncToLLVM

- Extract repeated code into helper function/lambdas.

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

3 years ago[RISCV] Add test case showing failure to use GREVIW for i32 bitreverse if result...
Craig Topper [Fri, 13 Nov 2020 20:38:20 +0000 (12:38 -0800)]
[RISCV] Add test case showing failure to use GREVIW for i32 bitreverse if result is not sign extended. NFC

3 years ago[mlir][vector] Support N-D vector in InsertMap/ExtractMap op
Thomas Raoux [Fri, 13 Nov 2020 20:16:47 +0000 (12:16 -0800)]
[mlir][vector] Support N-D vector in InsertMap/ExtractMap op

Support multi-dimension vector for InsertMap/ExtractMap op and update the
transformations. Currently the relation between IDs and dimension is implicitly
deduced from the types. We can then calculate an AffineMap based on it. In the
future the AffineMap could be part of the operation itself.

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

3 years ago[OpenMP] Add omp_calloc implementation
Nawrin Sultana [Fri, 6 Nov 2020 20:45:25 +0000 (14:45 -0600)]
[OpenMP] Add omp_calloc implementation

This patch adds omp_calloc implementation according to OpenMP 5.1
specification.

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

3 years ago[mlir][Linalg] Change LinalgDependenceGraph to use LinalgOp.
MaheshRavishankar [Fri, 13 Nov 2020 20:21:43 +0000 (12:21 -0800)]
[mlir][Linalg] Change LinalgDependenceGraph to use LinalgOp.

Using LinalgOp will reduce the repeated conversion from Operation <->
LinalgOp.

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

3 years agoemacs: Add callbr to keyword list
Matt Arsenault [Fri, 25 Sep 2020 15:57:13 +0000 (11:57 -0400)]
emacs: Add callbr to keyword list

3 years agoGlobalISel: Fix typos
Matt Arsenault [Fri, 25 Sep 2020 16:59:28 +0000 (12:59 -0400)]
GlobalISel: Fix typos

3 years ago[WebAssembly] Rename atomic.notify and *.atomic.wait
Heejin Ahn [Fri, 13 Nov 2020 12:24:47 +0000 (04:24 -0800)]
[WebAssembly] Rename atomic.notify and *.atomic.wait

- atomic.notify -> memory.atomic.notify
- i32.atomic.wait -> memory.atomic.wait32
- i64.atomic.wait -> memory.atomic.wait64

See https://github.com/WebAssembly/threads/pull/149.

Reviewed By: tlively

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

3 years ago[AlwaysInliner] Call mergeAttributesForInlining after inlining
Guozhi Wei [Fri, 13 Nov 2020 19:57:29 +0000 (11:57 -0800)]
[AlwaysInliner] Call mergeAttributesForInlining after inlining

Like inlineCallIfPossible and InlinerPass, after inlining mergeAttributesForInlining
should be called to merge callee's attributes to caller. But it is not called in
AlwaysInliner, causes caller's attributes inconsistent with inlined code.

Attached test case demonstrates that attribute "min-legal-vector-width"="512" is
not merged into caller without this patch, and it causes failure in SelectionDAG
when lowering the inlined AVX512 intrinsic.

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

3 years ago[RISCV] Add test case for failure to use GREVIW for i32 bswap if result is not sign...
Craig Topper [Fri, 13 Nov 2020 19:45:05 +0000 (11:45 -0800)]
[RISCV] Add test case for failure to use GREVIW for i32 bswap if result is not sign extended. NFC

3 years ago[WebAssembly] Remove a temporarily added RUN line
Heejin Ahn [Fri, 13 Nov 2020 11:43:45 +0000 (03:43 -0800)]
[WebAssembly] Remove a temporarily added RUN line

This RUN line was added as a temporary measure to undo the damage done
by D79655. Everyone's build system should be fine by now.

Reviewed By: tlively

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

3 years agoExtend the dfsan store/load callback with write/read address
Jianzhou Zhao [Fri, 13 Nov 2020 19:46:32 +0000 (19:46 +0000)]
Extend the dfsan store/load callback with write/read address

This helped debugging.

Reviewed-by: morehouse
Differential Revision: https://reviews.llvm.org/D91236

3 years agoThe AssertRecognizer used the module from a frames SC without checking it was non...
Jim Ingham [Fri, 13 Nov 2020 19:36:17 +0000 (11:36 -0800)]
The AssertRecognizer used the module from a frames SC without checking it was non-null.

I only have a crash report for this.  I could reproduce it with a slightly older
lldb by running an expression that called pthread_kill, but we started making modules
for our expression JIT code, so that no longer triggers the bug.  I can't think of another
good way to test it but the fix is obvious.

3 years agoSerialization: Rename three AST diagnostics, NFC
Duncan P. N. Exon Smith [Fri, 13 Nov 2020 17:00:08 +0000 (12:00 -0500)]
Serialization: Rename three AST diagnostics, NFC

All three diagnostics have a select between "PCH", "module", and "AST"
in the text. The most generic of these is "AST", so rename them from
`err_module_...` to `err_ast_...`.

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

3 years ago[RISCV] Add RORW/ROLW/RORIW/ROLIW test cases that don't sign extend the result. NFC
Craig Topper [Fri, 13 Nov 2020 18:26:11 +0000 (10:26 -0800)]
[RISCV] Add RORW/ROLW/RORIW/ROLIW test cases that don't sign extend the result. NFC

This shows that we currently fail to select RORIW/ROLIW.

3 years ago[PowerPC] Add paired vector load and store builtins and intrinsics
Baptiste Saleil [Fri, 13 Nov 2020 18:32:57 +0000 (12:32 -0600)]
[PowerPC] Add paired vector load and store builtins and intrinsics

This patch adds the Clang builtins and LLVM intrinsics to load and store vector pairs.

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

3 years agoPass the source range when diagnosing an unknown attribute
Aaron Ballman [Fri, 13 Nov 2020 18:27:28 +0000 (10:27 -0800)]
Pass the source range when diagnosing an unknown attribute

This way, the whole attribute gets highlighted with diagnostics instead
of just the scope name in an attribute like [[clang::unknown]].

3 years agoSerialization: Hoist the check for in-flight diagnostics in ASTReader::getInputFile...
Duncan P. N. Exon Smith [Thu, 12 Nov 2020 18:05:07 +0000 (13:05 -0500)]
Serialization: Hoist the check for in-flight diagnostics in ASTReader::getInputFile, NFC

This logic seems easier to follow without the `Error()` helper, and
checking `DiagnosticsEngine::isDiagnosticInFlight` just once up front.

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

3 years ago[AArch64][GlobalISel] Select G_SELECT cc, t, (G_SUB 0, x) -> CSNEG t, x, cc
Jessica Paquette [Tue, 3 Nov 2020 22:59:29 +0000 (14:59 -0800)]
[AArch64][GlobalISel] Select G_SELECT cc, t, (G_SUB 0, x) -> CSNEG t, x, cc

When we see

```
%sub = G_SUB 0, %x
%select = G_SELECT %cc, %t, %sub
```

Fold away the G_SUB by producing

```
%select = CSNEG %t, %x, cc
```

Simple IR example: https://godbolt.org/z/K8TEnh

This is valid on both sides of the select, but for now, just handle one side.
It may make more sense to handle swapping sides during post-legalizer lowering.

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

3 years ago[Local] Emit nsw for inbounds offset calculation
Nikita Popov [Fri, 13 Nov 2020 17:38:26 +0000 (18:38 +0100)]
[Local] Emit nsw for inbounds offset calculation

In line with D90708, we can use nsw for the inbounds offset
calculation -- the muls were already using nsw, but the adds were
not.

3 years ago[AArch64][GlobalISel] NFC: Use CmpInst::isUnsigned instead of static helper
Jessica Paquette [Fri, 13 Nov 2020 17:28:37 +0000 (09:28 -0800)]
[AArch64][GlobalISel] NFC: Use CmpInst::isUnsigned instead of static helper

Reducing some code duplication.

We had a helper for checking if a predicate is unsigned. Remove that and use
the existing function in Instructions.cpp.

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

3 years ago[WebAssembly] Added R_WASM_FUNCTION_OFFSET_I64 for use with DWARF DW_AT_low_pc
Wouter van Oortmerssen [Thu, 12 Nov 2020 23:05:05 +0000 (15:05 -0800)]
[WebAssembly] Added R_WASM_FUNCTION_OFFSET_I64 for use with DWARF DW_AT_low_pc

Needed for wasm64, see discussion in https://reviews.llvm.org/D91203

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

3 years ago[CostModel][X86] Remove unused CHECK prefixes
Simon Pilgrim [Fri, 13 Nov 2020 17:29:54 +0000 (17:29 +0000)]
[CostModel][X86] Remove unused CHECK prefixes

Allows us to remove the "CHECK: {{^}}" hack and help simplify D91275

3 years ago[Local] Clean up EmitGEPOffset
Nikita Popov [Wed, 4 Nov 2020 21:13:40 +0000 (22:13 +0100)]
[Local] Clean up EmitGEPOffset

Handle the emission of the add in a single place, instead of three
different ones.

Don't emit an unnecessary add with zero to start with. It will get
dropped by InstCombine, but we may as well not create it in the
first place. This also means that InstCombine does not need to
specially handle this extra add.

This is conceptually NFC, but can affect worklist order etc.

3 years ago[lldb] Fix SymbolFile/PDB/udt-layout.test
Jonas Devlieghere [Fri, 13 Nov 2020 17:29:51 +0000 (09:29 -0800)]
[lldb] Fix SymbolFile/PDB/udt-layout.test

Update the test for 406ad187486b4277fc82a2c0714ae53396e47928

3 years ago[CGProfile] allows bitcast in metadata node storing function pointers
Yuanfang Chen [Fri, 13 Nov 2020 17:27:10 +0000 (09:27 -0800)]
[CGProfile] allows bitcast in metadata node storing function pointers

For example,  during RAUW in IRMover, the `Function` ValueAsMetadata in "CG Profile" could become bitcast.

Reviewed By: tejohnson

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

3 years ago[GlobalISel] Add matchers for specific constants and a matcher for negations
Jessica Paquette [Fri, 13 Nov 2020 00:42:32 +0000 (16:42 -0800)]
[GlobalISel] Add matchers for specific constants and a matcher for negations

It's fairly common to need matchers for a specific constant value, or for
common idioms like finding a negated register.

Add

- `m_SpecificICst`, which returns true when matching a specific value..
- `m_ZeroInt`, which returns true when an integer 0 is matched.
- `m_Neg`, which returns when a register is negated.

Also update a few places which use idioms related to the new matchers.

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

3 years ago[clangd] Canonicalize LLVM_ENABLE_ZLIB
Kadir Cetinkaya [Fri, 13 Nov 2020 17:19:52 +0000 (18:19 +0100)]
[clangd] Canonicalize LLVM_ENABLE_ZLIB

It is used in our lit test's configuration now.

3 years ago[SCEV] Fix nsw flags for GEP expressions
Nikita Popov [Mon, 2 Nov 2020 20:40:08 +0000 (21:40 +0100)]
[SCEV] Fix nsw flags for GEP expressions

The SCEV code for constructing GEP expressions currently assumes
that the addition of the base and all the offsets is nsw if the GEP
is inbounds. While the addition of the offsets is indeed nsw, the
addition to the base address is not, as the base address is
interpreted as an unsigned value.

Fix the GEP expression code to not assume nsw for the base+offset
calculation. However, do assume nuw if we know that the offset is
non-negative. With this, we use the same behavior as the
construction of GEP addrecs does. (Modulo the fact that we
disregard SCEV unification, as the pre-existing FIXME points out).

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

3 years ago[gn build] Port 8741a76f
Arthur Eubanks [Fri, 13 Nov 2020 17:17:52 +0000 (09:17 -0800)]
[gn build] Port 8741a76f

3 years ago[ValueTracking] Don't set nsw flag for inbounds addition
Nikita Popov [Mon, 2 Nov 2020 18:08:37 +0000 (19:08 +0100)]
[ValueTracking] Don't set nsw flag for inbounds addition

When computing the known bits for a GEP, don't set the nsw flag
when adding an offset to an address. The nsw flag only applies to
pure offset additions (see also D90708).

The nsw flag is only used in a very minor way by the code, to the
point that I was not able to come up with a test case where it
makes a difference.

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

3 years ago[libc++] Install GDB in the Docker images
Louis Dionne [Fri, 13 Nov 2020 16:41:11 +0000 (11:41 -0500)]
[libc++] Install GDB in the Docker images

This will allow running the GDB pretty printer tests.

3 years ago[LangRef] Clarify GEP inbounds wrapping semantics
Nikita Popov [Tue, 3 Nov 2020 19:39:50 +0000 (20:39 +0100)]
[LangRef] Clarify GEP inbounds wrapping semantics

Clarify the semantics of GEP inbounds, in particular with regard
to what it means for wrapping. This cleans up some confusion on
when it is legal to apply nuw/nsw flags to various parts of the
GEP calculation.

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

3 years ago[KnownBits] Merge the minimum shift amount and leading/trailing shift value bits...
Simon Pilgrim [Fri, 13 Nov 2020 16:25:44 +0000 (16:25 +0000)]
[KnownBits] Merge the minimum shift amount and leading/trailing shift value bits handling.

By starting with the source shift value minimum leading/trailing bits, we can then add the minimum known shift amount to more accurately predict the minimum leading/trailing bits of the result.

This is currently only covered by the exhaustive unit tests in KnownBitsTests.cpp, but will help with some of the regressions encountered in D90479 (PR44526).

3 years agoclang: Don't assert on no_unique_address fields in @encode()
Nico Weber [Mon, 2 Nov 2020 17:00:24 +0000 (12:00 -0500)]
clang: Don't assert on no_unique_address fields in @encode()

Just skip (non-bitfield) zero-sized fields, like we do with empty bases.

The class->struct conversion in the test is because -std=c++20 else deletes some default methods
due to non-accessible base dtors otherwise.

As a side-effect of writing the test, I discovered that D76801 did an ABI breaking change of sorts
for Objective-C's @encode. But it's been in for a while, so I'm not sure if we want to row back on
that or now.

Fixes PR48048.

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

3 years ago[MLIR] Allow setting "CodeView" flag in LLVMIR translation on MSVC.
Scott Todd [Fri, 13 Nov 2020 16:30:36 +0000 (17:30 +0100)]
[MLIR] Allow setting "CodeView" flag in LLVMIR translation on MSVC.

Reviewed By: ftynse, mehdi_amini

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

3 years agoAMDGPU/GlobalISel: Regenerate some checks
Matt Arsenault [Wed, 11 Nov 2020 17:11:17 +0000 (12:11 -0500)]
AMDGPU/GlobalISel: Regenerate some checks

Fixes indentation confusing diff in future patch.

3 years agoAMDGPU: Factor out large flat offset splitting
Matt Arsenault [Thu, 12 Nov 2020 15:59:15 +0000 (10:59 -0500)]
AMDGPU: Factor out large flat offset splitting

3 years ago[gn build] (semi-manually) Port 6a8099e0f61
Nico Weber [Fri, 13 Nov 2020 16:20:23 +0000 (11:20 -0500)]
[gn build] (semi-manually) Port 6a8099e0f61

3 years agoGlobalISel: Directly expose getDefSrcRegIgnoringCopies utility
Matt Arsenault [Wed, 11 Nov 2020 15:24:23 +0000 (10:24 -0500)]
GlobalISel: Directly expose getDefSrcRegIgnoringCopies utility

It's useful to get both the instruction and register at the same time.

3 years ago[clangd] Ensure we test for compatibility of serialized index format
Kadir Cetinkaya [Wed, 11 Nov 2020 10:08:14 +0000 (11:08 +0100)]
[clangd] Ensure we test for compatibility of serialized index format

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

3 years ago[clangd] Assert on varint encoding
Kadir Cetinkaya [Fri, 13 Nov 2020 09:13:42 +0000 (10:13 +0100)]
[clangd] Assert on varint encoding

5th byte of a varint can't be bigger than 0x0f, fix a test and add an
assertion.

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

3 years ago[WebAssembly] Add new relocation type for TLS data symbols
Sam Clegg [Wed, 11 Nov 2020 01:46:52 +0000 (17:46 -0800)]
[WebAssembly] Add new relocation type for TLS data symbols

These relocations represent offsets from the __tls_base symbol.

Previously we were just using normal MEMORY_ADDR relocations and relying
on the linker to select a segment-offset rather and absolute value in
Symbol::getVirtualAddress().  Using an explicit relocation type allows
allow us to clearly distinguish absolute from relative relocations based
on the relocation information alone.

One place this is useful is being able to reject absolute relocation in
the PIC case, but still accept TLS relocations.

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

3 years agoAMDGPU: Refactor getBaseWithOffsetUsingSplitOR usage
Matt Arsenault [Wed, 11 Nov 2020 17:56:22 +0000 (12:56 -0500)]
AMDGPU: Refactor getBaseWithOffsetUsingSplitOR usage

3 years ago[NFC][IntrRefLDV] Remove dead code from transferSpillOrRestoreInst()
Djordje Todorovic [Thu, 5 Nov 2020 15:17:40 +0000 (07:17 -0800)]
[NFC][IntrRefLDV] Remove dead code from transferSpillOrRestoreInst()

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

3 years agoRevert "[NFC] Move code between functions as a preparation step for further improvement"
David Zarzycki [Fri, 13 Nov 2020 15:50:44 +0000 (10:50 -0500)]
Revert "[NFC] Move code between functions as a preparation step for further improvement"

This reverts commit 08016ac32b746b27be43d92255bf22a12012e244.

A bunch of tests are failing my local two stage builder.

3 years ago[lld][WebAssembly] Add test for TLS BSS data. NFC.
Sam Clegg [Wed, 11 Nov 2020 04:52:01 +0000 (20:52 -0800)]
[lld][WebAssembly] Add test for TLS BSS data. NFC.

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

3 years ago[libc++] Only check for GCC's empty string storage on macOS and iOS
Louis Dionne [Thu, 12 Nov 2020 16:02:14 +0000 (11:02 -0500)]
[libc++] Only check for GCC's empty string storage on macOS and iOS

We don't need to do that on other Apple platforms, since they never
shipped libstdc++. I also added a comment extracted from the original
commit by Howard Hinnant (e115af2777f6).

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

3 years ago[libc++] Port the time functions to z/OS
Zbigniew Sarbinowski [Thu, 12 Nov 2020 18:38:52 +0000 (13:38 -0500)]
[libc++] Port the time functions to z/OS

This patch adds a shim for missing time functions on z/OS, and adds a
layer of indirection to account for differences in the timespec struct
on different systems.

This was originally committed as 173b51169b83 and reverted in 777ca48c9f08
because the original commit also checked-in unrelated changes.

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

3 years ago[OpenMP][Tool] Update archer to accept new OpenMP 5.1 enum values
Joachim Protze [Wed, 4 Nov 2020 12:25:15 +0000 (13:25 +0100)]
[OpenMP][Tool] Update archer to accept new OpenMP 5.1 enum values

OpenMP 5.1 adds an extra enum entry for ompt_scope_t, which makes the related
switch statement incomplete.
Also adding cases for newly added barrier variants.

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

3 years ago[gn build] more hotfix after 17df195f70 to unbreak llvm-config tests
Nico Weber [Fri, 13 Nov 2020 15:02:54 +0000 (10:02 -0500)]
[gn build] more hotfix after 17df195f70 to unbreak llvm-config tests

3 years ago[TableGen] Enhance the six comparison bang operators.
Paul C. Anagnostopoulos [Sun, 8 Nov 2020 16:52:30 +0000 (11:52 -0500)]
[TableGen] Enhance the six comparison bang operators.

Update the Programmer's Reference.

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

3 years agollvmbuildectomy - remove conflict file
serge-sans-paille [Fri, 13 Nov 2020 14:55:27 +0000 (15:55 +0100)]
llvmbuildectomy - remove conflict file

3 years ago[gn build] Port 8bb6347939b
Nico Weber [Fri, 13 Nov 2020 14:55:08 +0000 (09:55 -0500)]
[gn build] Port 8bb6347939b

3 years agollvmbuildectomy - support disabled native target
serge-sans-paille [Fri, 13 Nov 2020 14:49:27 +0000 (15:49 +0100)]
llvmbuildectomy - support disabled native target

3 years ago[gn build] (manually) merge 1d0676b54c4e3
Nico Weber [Fri, 13 Nov 2020 14:39:28 +0000 (09:39 -0500)]
[gn build] (manually) merge 1d0676b54c4e3

3 years ago[gn build] Hotfix to unbreak build after 9218ff50f9308
Nico Weber [Fri, 13 Nov 2020 14:26:43 +0000 (09:26 -0500)]
[gn build] Hotfix to unbreak build after 9218ff50f9308

3 years ago[DivergenceAnalysis] Use addRequiredTransitive
Piotr Sobczak [Tue, 10 Nov 2020 16:17:24 +0000 (17:17 +0100)]
[DivergenceAnalysis] Use addRequiredTransitive

For querying divergence the chained analysis passes are required
to be alive, for instance LoopInfoWrapperPass.

Ensure that by using addRequiredTransitive.

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

3 years agollvmbuildectomy - compatibility with ocaml bindings
serge-sans-paille [Fri, 13 Nov 2020 13:04:19 +0000 (14:04 +0100)]
llvmbuildectomy - compatibility with ocaml bindings

Use exact component name in add_ocaml_library.
Make expand_topologically compatible with new architecture.
Fix quoting in is_llvm_target_library.
Fix LLVMipo component name.
Write release note.

3 years agoAdd !annotation metadata and remarks pass.
Florian Hahn [Fri, 13 Nov 2020 09:46:55 +0000 (09:46 +0000)]
Add !annotation metadata and remarks pass.

This patch adds a new !annotation metadata kind which can be used to
attach annotation strings to instructions.

It also adds a new pass that emits summary remarks per function with the
counts for each annotation kind.

The intended uses cases for this new metadata is annotating
'interesting' instructions and the remarks should provide additional
insight into transformations applied to a program.

To motivate this, consider these specific questions we would like to get answered:

* How many stores added for automatic variable initialization remain after optimizations? Where are they?
* How many runtime checks inserted by a frontend could be eliminated? Where are the ones that did not get eliminated?

Discussed on llvm-dev as part of 'RFC: Combining Annotation Metadata and Remarks'
(http://lists.llvm.org/pipermail/llvm-dev/2020-November/146393.html)

Reviewed By: thegameg, jdoerfert

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

3 years ago[clang] Fix an assertion crash in delayed access check.
Haojian Wu [Fri, 13 Nov 2020 13:00:57 +0000 (14:00 +0100)]
[clang] Fix an assertion crash in delayed access check.

`TD->getTemplatedDecl()` might not be a DeclContext variant, which can
trigger an assertion inside `isa<>`.

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

3 years agoRevert "[AsmPrinter] fix -disable-debug-info option"
Hans Wennborg [Fri, 13 Nov 2020 12:46:13 +0000 (13:46 +0100)]
Revert "[AsmPrinter] fix -disable-debug-info option"

The test fails on Mac, see comment on the code review.

> This option was in a rather convoluted place, causing global parameters
> to be set in awkward and undesirable ways to try to account for it
> indirectly. Add tests for the -disable-debug-info option and ensure we
> don't print unintended markers from unintended places.
>
> Reviewed By: dstenb
>
> Differential Revision: https://reviews.llvm.org/D91083

This reverts commit 9606ef03f03904cec213db031b5ea6fd6052dc5d.

3 years agoReland [clang][cli] Port ObjCMTAction to new option parsing system
Jan Svoboda [Wed, 11 Nov 2020 10:05:24 +0000 (11:05 +0100)]
Reland [clang][cli] Port ObjCMTAction to new option parsing system

Merge existing marhsalling info kinds and add some primitives to
express flag options that contribute to a bitfield.

Depends on D82574

Original patch by Daniel Grumberg.

Reviewed By: Bigcheese

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