platform/upstream/llvm.git
3 years ago[Sema] Use isa<> instead of dyn_cast<> as pointer is never dereferenced. NFCI.
Simon Pilgrim [Sun, 15 Nov 2020 12:56:32 +0000 (12:56 +0000)]
[Sema] Use isa<> instead of dyn_cast<> as pointer is never dereferenced. NFCI.

We are only checking for the class type. Fixes Wshadow warnings.

3 years ago[mlir] NFC: tiny fix in comment.
Christian Sigg [Fri, 13 Nov 2020 16:22:41 +0000 (17:22 +0100)]
[mlir] NFC: tiny fix in comment.

Reviewed By: ftynse, mehdi_amini

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

3 years agoRevert "[SCEV] Factor out part of wrap flag detection logic [NFC-ish]"
Nikita Popov [Sun, 15 Nov 2020 09:19:44 +0000 (10:19 +0100)]
Revert "[SCEV] Factor out part of wrap flag detection logic [NFC-ish]"

This reverts commit 1ec6e1eb8a084bffae8a40236eb9925d8026dd07.

This change causes a significant compile-time regression:
https://llvm-compile-time-tracker.com/compare.php?from=dd0b8b94d0796bd895cc998dd163b4fbebceb0b8&to=1ec6e1eb8a084bffae8a40236eb9925d8026dd07&stat=instructions

I assume that this is due to the non-NFC part of the change, which
now performs expensive nowrap inference even for nowrap flags that
are not used by the particular code.

3 years ago[sanitizer] Fix setup of android-thread-properties-api
Vitaly Buka [Sun, 15 Nov 2020 07:22:57 +0000 (23:22 -0800)]
[sanitizer] Fix setup of android-thread-properties-api

3 years ago[SCEV] Factor out part of wrap flag detection logic [NFC-ish]
Philip Reames [Sun, 15 Nov 2020 03:15:46 +0000 (19:15 -0800)]
[SCEV] Factor out part of wrap flag detection logic [NFC-ish]

In an effort to make code around flag determination more readable, and (possibly) prepare for a follow up change, factor out some of the flag detection logic.  In the process, reduce the number of locations we mutate wrap flags by a couple.

Note that this isn't NFC.  The old code tried for NSW xor (NUW || NW).  This is, two different paths computed different sets of wrap flags.  The new code will try for all three.  The result is that some expressions end up with a few extra flags set.

3 years ago[sanitizer] Add timeouts for adb calls
Vitaly Buka [Sun, 15 Nov 2020 02:43:24 +0000 (18:43 -0800)]
[sanitizer] Add timeouts for adb calls

3 years ago[DCE] Port -redundant-dbg-inst-elim to NPM
Arthur Eubanks [Sat, 14 Nov 2020 07:40:33 +0000 (23:40 -0800)]
[DCE] Port -redundant-dbg-inst-elim to NPM

This is used to test RemoveRedundantDbgInstrs(), which is used by other
passes.

Reviewed By: ychen

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

3 years agoAdd forgotten in 888d06d file.
Vassil Vassilev [Sat, 14 Nov 2020 21:32:23 +0000 (21:32 +0000)]
Add forgotten in 888d06d file.

3 years agoMove the test compiler setup in a common place. NFCI
Vassil Vassilev [Sat, 14 Nov 2020 21:29:18 +0000 (21:29 +0000)]
Move the test compiler setup in a common place. NFCI

This patch reduces the copy paste in the unittest/CodeGen folder by moving the
common compiler setup phase in a header file.

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

3 years agoRecommit "[VPlan] Use VPValue def for VPWidenSelectRecipe."
Florian Hahn [Fri, 13 Nov 2020 14:15:53 +0000 (14:15 +0000)]
Recommit "[VPlan] Use VPValue def for VPWidenSelectRecipe."

This reverts the revert commit c8d73d939fa4fda9c87b3979225d02d63062bd68.

It includes a fix for cases where we missed inserting VPValues
for some selects, which should fix PR48142.

3 years ago[mlir] Add passes to passes.md to cleanup empty tabs on website index
Jacques Pienaar [Sat, 14 Nov 2020 19:25:24 +0000 (11:25 -0800)]
[mlir] Add passes to passes.md to cleanup empty tabs on website index

3 years ago[AArch64] Remove unused check prefixes. NFC
David Green [Sat, 14 Nov 2020 18:30:17 +0000 (18:30 +0000)]
[AArch64] Remove unused check prefixes. NFC

3 years ago[mlir][shape] Make attr-dict placement consistent
Jacques Pienaar [Sat, 14 Nov 2020 18:29:01 +0000 (10:29 -0800)]
[mlir][shape] Make attr-dict placement consistent

Also follows what we do in std ops too and move it before :.

3 years ago[Driver][test] Fix cc1-spawnprocess.c
Fangrui Song [Sat, 14 Nov 2020 17:53:34 +0000 (09:53 -0800)]
[Driver][test] Fix cc1-spawnprocess.c

3 years ago[TableGen] Fix missing braces in if statement
Paul C. Anagnostopoulos [Sat, 14 Nov 2020 17:37:48 +0000 (12:37 -0500)]
[TableGen] Fix missing braces in if statement

3 years agoFix build (`ninja check` without running `ninja` first)
Mehdi Amini [Sat, 14 Nov 2020 16:57:28 +0000 (16:57 +0000)]
Fix build (`ninja check` without running `ninja` first)

9218ff50f9 removed the BUILD.txt file, and as a subtle side-effect
libLLVMFrontendOpenACC wasn't a dependency of `ninja check` anymore.
However llvm-config requires all components to be built, and the
relevant test is broken when libLLVMFrontendOpenACC isn't built.

Unittest for libLLVMFrontendOpenACC are pending, but this addition
should fix some bots in the meantime.

3 years ago[llvm][NFC] Remove unnecessary vector creation in Annotations
Nathan James [Sat, 14 Nov 2020 15:55:09 +0000 (15:55 +0000)]
[llvm][NFC] Remove unnecessary vector creation in Annotations

3 years ago[BasicAA] Remove unnecessary size limitation
Nikita Popov [Sat, 14 Nov 2020 15:48:41 +0000 (16:48 +0100)]
[BasicAA] Remove unnecessary size limitation

We're dropping a common offset from both GEPs here. It's not
necessary for the access sizes to be the same as well.

3 years ago[ARM] Remove more unused check prefixes, NFC
David Green [Sat, 14 Nov 2020 15:37:53 +0000 (15:37 +0000)]
[ARM] Remove more unused check prefixes, NFC

3 years agoFix build after 54f9ee334
Nico Weber [Sat, 14 Nov 2020 15:23:22 +0000 (10:23 -0500)]
Fix build after 54f9ee334

3 years ago[gn build] (manually) merge e51631ca4cf
Nico Weber [Sat, 14 Nov 2020 15:12:01 +0000 (10:12 -0500)]
[gn build] (manually) merge e51631ca4cf

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