platform/upstream/llvm.git
3 years ago[AArch64][NEON] Match (or (and -a b) (and (a+1) b)) => bit select
Bradley Smith [Mon, 12 Apr 2021 12:06:25 +0000 (13:06 +0100)]
[AArch64][NEON] Match (or (and -a b) (and (a+1) b)) => bit select

With this patch vbslq_f32(vnegq_s32(a), b, c) lowers to a BIT instruction.

Co-authored-by: Paul Walker <paul.walker@arm.com>
Differential Revision: https://reviews.llvm.org/D100304

3 years ago[clangd] Only allow remote index to be enabled from user config.
Sam McCall [Thu, 15 Apr 2021 10:52:58 +0000 (12:52 +0200)]
[clangd] Only allow remote index to be enabled from user config.

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

3 years agoFix bug in .eh_frame/.debug_frame PC offset calculation for DW_EH_PE_pcrel
Alex Orlov [Thu, 15 Apr 2021 11:06:20 +0000 (15:06 +0400)]
Fix bug in .eh_frame/.debug_frame PC offset calculation for DW_EH_PE_pcrel

This fixes the following bugs:
https://bugs.llvm.org/show_bug.cgi?id=27249
https://bugs.llvm.org/show_bug.cgi?id=46414

Reviewed By: MaskRay

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

3 years ago[VPlan] Add VPRecipeBase::mayHaveSideEffects.
Florian Hahn [Thu, 15 Apr 2021 09:42:40 +0000 (10:42 +0100)]
[VPlan] Add VPRecipeBase::mayHaveSideEffects.

Add an initial version of a helper to determine whether a recipe may
have side-effects.

Reviewed By: a.elovikov

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

3 years ago[lldb] Fix incorrect test data in FileSpecTest.IsRelative
Raphael Isemann [Thu, 15 Apr 2021 08:02:51 +0000 (10:02 +0200)]
[lldb] Fix incorrect test data in FileSpecTest.IsRelative

Found by clang-tidy's bugprone-suspicious-missing-comma.

3 years agoadd test case for ignoring -flto=auto and -flto=jobserver
Matthias Klose [Thu, 15 Apr 2021 10:18:25 +0000 (12:18 +0200)]
add test case for ignoring -flto=auto and -flto=jobserver

as requested in https://reviews.llvm.org/D99501, test that the two new options are ignored.

Reviewed By: tejohnson, fhahn

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

3 years ago[DAGCombiner] Fold step_vector with add/mul/shl
Jun Ma [Thu, 8 Apr 2021 05:09:24 +0000 (13:09 +0800)]
[DAGCombiner] Fold step_vector with add/mul/shl

This patch implements some DAG combines for STEP_VECTOR:
add step_vector(C1), step_vector(C2) -> step_vector(C1+C2)
add (add X step_vector(C1)), step_vector(C2) -> add X step_vector(C1+C2)
mul step_vector(C1), C2 -> step_vector(C1*C2)
shl step_vector(C1), C2 -> step_vector(C1<<C2)

TestPlan: check-llvm

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

3 years ago[SVE][LoopVectorize] Fix crash in InnerLoopVectorizer::widenPHIInstruction
David Sherwood [Tue, 23 Mar 2021 16:28:09 +0000 (16:28 +0000)]
[SVE][LoopVectorize] Fix crash in InnerLoopVectorizer::widenPHIInstruction

There were a few places in widenPHIInstruction where calculations of
offsets were failing to take the runtime calculation of VF into
account for scalable vectors. I've fixed those cases in this patch
as well as adding an assert that we should not be scalarising for
scalable vectors.

Tests are added here:

  Transforms/LoopVectorize/AArch64/sve-widen-phi.ll

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

3 years ago[RISCV] Pre-commit vector shuffle test cases
Fraser Cormack [Wed, 14 Apr 2021 08:18:36 +0000 (09:18 +0100)]
[RISCV] Pre-commit vector shuffle test cases

This codegen will be improved by future patches.

3 years ago[AA] Updates for D95543.
dfukalov [Tue, 13 Apr 2021 17:00:12 +0000 (20:00 +0300)]
[AA] Updates for D95543.

Addressing latter comments in D95543:
- `AliasResult::Result` renamed to `AliasResult::Kind`
- Offset printing added for `PartialAlias` case in `-aa-eval`
- Removed VisitedPhiBBs check from BasicAA'

Reviewed By: nikic

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

3 years ago[AArch64] Use type-legalization cost for code size memop cost.
Florian Hahn [Thu, 15 Apr 2021 08:22:32 +0000 (09:22 +0100)]
[AArch64] Use type-legalization cost for code size memop cost.

At the moment, getMemoryOpCost returns 1 for all inputs if CostKind is
CodeSize or SizeAndLatency. This fools LoopUnroll into thinking memory
operations on large vectors have a cost of one, even if they will get
expanded to a large number of memory operations in the backend.

This patch updates getMemoryOpCost to return the cost for the type
legalization for both CodeSize and SizeAndLatency. This should more
accurately reflect the number of memory operations required.

I am not sure how latency should properly be included in SizeAndLatency
from the description, but returning the size cost should be clearly more
accurate.

This does not cause any binary changes when building
MultiSource/SPEC2000/SPEC2006 with -O3 -flto for AArch64, likely because
large vector memops are not really formed by code emitted from Clang.
But using the C/C++ matrix extension can easily result in code with very
large vector operations directly from Clang, e.g.
https://clang.godbolt.org/z/6xzxcTGvb

Reviewed By: samparker

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

3 years agoNFC put the armv6m entry with the other Cortex-M entries
Jason Molenda [Thu, 15 Apr 2021 09:00:36 +0000 (02:00 -0700)]
NFC put the armv6m entry with the other Cortex-M entries

The armv6m entry in cores_match() got separated from its
friends armv7m and armv7em.  Reuniting them to make it
easier to keep them updated in all at the same time.

3 years ago[flang] Update the regression tests to use the new driver when enabled
Andrzej Warzynski [Mon, 12 Apr 2021 12:27:49 +0000 (12:27 +0000)]
[flang] Update the regression tests to use the new driver when enabled

This patch updates most of the remaining regression tests (~400) to use
`flang-new` rather then `f18` when `FLANG_BUILD_NEW_DRIVER` is set.
This allows us to share more Flang regression tests between `f18` and
`flang-new`. A handful of tests have not been ported yet - these are
currently either failing or not supported by the new driver.

Summary of changes:
  * RUN lines in tests are updated to use `%flang_fc1` instead of `%f18`
  * option spellings in tests are updated to forms accepted by both `f18` and
    `flang-new`
  * variables in Bash scripts are renamed (e.g. F18 --> FLANG_FC1)
The updated tests will now be run with the new driver, `flang-new`,
whenever it is enabled (i.e when `FLANG_BUILD_NEW_DRIVER` is set).

Although this patch touches many files, vast majority of the changes are
automatic:
```
grep -IEZlr "%f18" flang/test/ | xargs -0 -l sed -i 's/%f18/%flang_fc1/g
```

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

3 years ago[NFC][LoopVectorize] Remove unnecessary VF.isScalable asserts
David Sherwood [Fri, 26 Mar 2021 10:43:00 +0000 (10:43 +0000)]
[NFC][LoopVectorize] Remove unnecessary VF.isScalable asserts

There are a few places in LoopVectorize.cpp where we have been too
cautious in adding VF.isScalable() asserts and it can be confusing.
It also makes it more difficult to see the genuine places where
work needs doing to improve scalable vectorization support.

This patch changes getMemInstScalarizationCost to return an
invalid cost instead of firing an assert for scalable vectors. Also,
vectorizeInterleaveGroup had multiple asserts all for the same
thing. I have removed all but one assert near the start of the
function, and added a new assert that we aren't dealing with masks
for scalable vectors.

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

3 years ago[clang][deps] NFC: Improve documentation
Jan Svoboda [Wed, 14 Apr 2021 12:56:20 +0000 (14:56 +0200)]
[clang][deps] NFC: Improve documentation

Fix typos and simplify wording

3 years agoMark armv6m compat with armv7em; match armv7em being compat with armv6m
Jason Molenda [Thu, 15 Apr 2021 08:28:58 +0000 (01:28 -0700)]
Mark armv6m compat with armv7em; match armv7em being compat with armv6m

armv7em and armv6m in ArchSpec cores_match() will return true.
There was a small bug where the reverse order would not return true.

rdar://76387176

3 years agoAdd convenient composed tsan constants
Martijn Vels [Thu, 15 Apr 2021 07:03:05 +0000 (09:03 +0200)]
Add convenient composed tsan constants

This change adds convenient composed constants to be used for tsan_read_try_lock annotations, reducing the boilerplate at the instrumentation site.

Reviewed By: dvyukov

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

3 years ago[AArch64] Fix windows vararg functions with floats in the fixed args
Martin Storsjö [Sat, 10 Apr 2021 04:40:33 +0000 (07:40 +0300)]
[AArch64] Fix windows vararg functions with floats in the fixed args

On Windows, float arguments are normally passed in float registers
in the calling convention for regular functions. For variable
argument functions, floats are passed in integer registers. This
already was done correctly since many years.

However, the surprising bit was that floats among the fixed arguments
also are supposed to be passed in integer registers, contrary to regular
functions. (This also seems to be the behaviour on ARM though, both
on Windows, but also on e.g. hardfloat linux.)

In the calling convention, don't promote shorter floats to f64, but
convert them to integers of the same length. (Floats passed as part of
the actual variable arguments are promoted to double already on the
C/Clang level; the LLVM vararg calling convention doesn't do any
extra promotion of f32 to f64 - this matches how it works on X86 too.)

Technically, this is an ABI break compared to older LLVM versions,
but it fixes compatibility with the official platform ABI. (In practice,
floats among the fixed arguments in variable argument functions is
a pretty rare construct.)

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

3 years ago[clang] [test] Share patterns in CodeGen/ms_abi_aarch64.c between cases. NFC.
Martin Storsjö [Wed, 14 Apr 2021 11:54:42 +0000 (14:54 +0300)]
[clang] [test] Share patterns in CodeGen/ms_abi_aarch64.c between cases. NFC.

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

3 years agoReland "[lit] Handle plain negations directly in the internal shell"
Martin Storsjö [Thu, 18 Mar 2021 07:44:01 +0000 (09:44 +0200)]
Reland "[lit] Handle plain negations directly in the internal shell"

Keep running "not --crash" via the external "not" executable, but
for plain negations, and for cases that use the shell "!" operator,
just skip that argument and invert the return code.

The libcxx tests only use the shell operator "!" for negations,
never the "not" executable, because libcxx tests can be run without
having a fully built llvm tree available providing the "not"
executable.

This allows using the internal shell for libcxx tests.

It should be possible to reland this now that D99938 fixed the
one test failure in clang-tidy that broke when "not" was handled
internally, letting lit/python execute grep.exe directly instead
of via not.exe. (See D99330 and D99406 for more commentery on the
exact issue that broke and other potential ways of fixing it.)

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

3 years agoRevert "[SCEV] Don't walk uses of phis without SCEV expression when forgetting"
Nikita Popov [Thu, 15 Apr 2021 07:43:52 +0000 (09:43 +0200)]
Revert "[SCEV] Don't walk uses of phis without SCEV expression when forgetting"

This reverts commit faf9f11589ce892b31d271917cf840f8ca903221.

Issues with this patch have been reported in
https://reviews.llvm.org/D100264#2689917 and
https://bugs.llvm.org/show_bug.cgi?id=49967.

3 years ago[NewGVN] Add phi-of-ops operands if no real PHI is created.
Florian Hahn [Thu, 15 Apr 2021 07:25:10 +0000 (08:25 +0100)]
[NewGVN] Add phi-of-ops operands if no real PHI is created.

If the PHI-of-ops simplifies to an existing value, no real PHI is
created, which means the dependencies between the
PHI-of-ops and its operands is not materialized in IR. At the
moment, we fail to create a real PHI node for the PHI-of-ops,
because the PHI-of-ops root instruction is not re-visited if
one of the PHI-of-ops operands changes. We need to add the
operands as additional users in this case.

Even with this patch, there are still some dependencies
missing. I will continue tackling the outstanding
reporeted crashes in this area.

Fixes PR36501, PR42422, PR42557.

Reviewed By: asbirlea

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

3 years ago[RISCV] Add a PatFrag to shorten repeated (XLenVT (VLOp GPR:$vl)) in V extension...
Craig Topper [Thu, 15 Apr 2021 05:31:35 +0000 (22:31 -0700)]
[RISCV] Add a PatFrag to shorten repeated (XLenVT (VLOp GPR:$vl)) in V extension patterns.

Reduces the amount of changes needed in D100288.

3 years ago[RISCV][Clang] Add vmv and vfmv series intrinsic functions.
Zakk Chen [Sun, 11 Apr 2021 13:50:57 +0000 (06:50 -0700)]
[RISCV][Clang] Add vmv and vfmv series intrinsic functions.

Authored-by: Roger Ferrer Ibanez <rofirrim@gmail.com>
Co-Authored-by: Zakk Chen <zakk.chen@sifive.com>
Reviewed By: craig.topper, Jim

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

3 years ago[scudo] Restore zxtest compatibility
Vitaly Buka [Tue, 13 Apr 2021 23:44:06 +0000 (16:44 -0700)]
[scudo] Restore zxtest compatibility

Reviewed By: cryptoad

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

3 years agoFix the build of `mlir-doc` (again)
Mehdi Amini [Thu, 15 Apr 2021 05:17:04 +0000 (05:17 +0000)]
Fix the build of `mlir-doc` (again)

This is more fallout from add_mlir_doc() API change

3 years ago[Test] Propagate nofree attribute from function to calls
Max Kazantsev [Thu, 15 Apr 2021 04:49:48 +0000 (11:49 +0700)]
[Test] Propagate nofree attribute from function to calls

3 years agoFix Interface doc generation after recent change to add_mlir_doc() API
Mehdi Amini [Thu, 15 Apr 2021 04:14:33 +0000 (04:14 +0000)]
Fix Interface doc generation after recent change to add_mlir_doc() API

This is basically fixing the build of `mlir-doc`

3 years ago[AMDGPU] Disable forceful inline of non-kernel functions which use LDS.
hsmahesha [Thu, 15 Apr 2021 03:42:46 +0000 (09:12 +0530)]
[AMDGPU] Disable forceful inline of non-kernel functions which use LDS.

Now since LDS uses within non-kernel functions are being handled in the
pass - LowerModuleLDS, we *NO* need to *forcefully* inline non-kernel
functions just because they use LDS. Do forceful inlining only when the
pass - LowerModuleLDS is not enabled. It is enabled by default.

Reviewed By: JonChesterfield

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

3 years agoChange add_mlir_doc CMake macro to take the tablegen command as last argument to...
Mehdi Amini [Thu, 15 Apr 2021 01:04:59 +0000 (01:04 +0000)]
Change add_mlir_doc CMake macro to take the tablegen command as last argument to allow extra flags

This is useful for expressing specific table-gen options, like selecting
a particular dialect to print.
Use it to fix the documentation for the `pdl_interp` dialect which is now
generating the first dialect it finds in its input which is `pdl`.

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

3 years ago[libcxx][NFC] adjusts formatting rules
Christopher Di Bella [Wed, 31 Mar 2021 22:46:28 +0000 (22:46 +0000)]
[libcxx][NFC] adjusts formatting rules

This will reduce the amount of noisy feedback during reviews.

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

3 years agofix comment typos to cycle bots
Nico Weber [Thu, 15 Apr 2021 02:12:56 +0000 (22:12 -0400)]
fix comment typos to cycle bots

3 years ago[gn build] Port b7459a10dad1
LLVM GN Syncbot [Thu, 15 Apr 2021 01:52:03 +0000 (01:52 +0000)]
[gn build] Port b7459a10dad1

3 years ago[lldb] Simplify output for skipped categories in dotest.py
Jonas Devlieghere [Thu, 15 Apr 2021 01:49:57 +0000 (18:49 -0700)]
[lldb] Simplify output for skipped categories in dotest.py

Print a single line listing all the categories that are being skipped,
rather than relying on the check.*Support() functions specifying why a
particular category will be skipped. If we know why a category got
skipped, still print that in verbose mode.

The motivation for this change is that sometimes engineers misidentify
the output of these messages as the cause for a test failure (e.g. not
being able to build libc++ or libstdc++).

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

3 years ago[DWARF] Fix crash for DWARFDie::dump.
Alexander Yermolovich [Thu, 15 Apr 2021 00:04:19 +0000 (17:04 -0700)]
[DWARF] Fix crash for DWARFDie::dump.

When DIE is extracted manually, the DieArray is empty. When dump is invoked on aforementioned DIE it tries to extract child, even if Dump options say otherwise. Resulting in crash.

Reviewed By: dblaikie

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

3 years agoRevert "Simplify BitVector code"
Sterling Augustine [Thu, 15 Apr 2021 01:03:58 +0000 (18:03 -0700)]
Revert "Simplify BitVector code"

This reverts commit 82f0e3d3ea6bf927e3397b2fb423abbc5821a30f.

The change breaks the asan buildbots.

https://lab.llvm.org/buildbot/#/builders/99/builds/2835

3 years ago[llvm-objdump] try to fix section-filter.test in full builds after 51aa61e74bdb
Nico Weber [Thu, 15 Apr 2021 00:58:51 +0000 (20:58 -0400)]
[llvm-objdump] try to fix section-filter.test in full builds after 51aa61e74bdb

3 years ago[llvm-objdump] try to fix hexagon tests more after 51aa61e74bdb
Nico Weber [Thu, 15 Apr 2021 00:50:03 +0000 (20:50 -0400)]
[llvm-objdump] try to fix hexagon tests more after 51aa61e74bdb

3 years ago[llvm-objdump] try to fix hexagon and riscv tests after 1035123ac50db
Nico Weber [Thu, 15 Apr 2021 00:39:52 +0000 (20:39 -0400)]
[llvm-objdump] try to fix hexagon and riscv tests after 1035123ac50db

3 years ago[hwasan] Fix lock contention on thread creation.
Evgenii Stepanov [Mon, 12 Apr 2021 20:35:32 +0000 (13:35 -0700)]
[hwasan] Fix lock contention on thread creation.

Do not hold the free/live thread list lock longer than necessary.
This change speeds up the following benchmark 10x.

constexpr int kTopThreads = 50;
constexpr int kChildThreads = 20;
constexpr int kChildIterations = 8;

void Thread() {
  for (int i = 0; i < kChildIterations; ++i) {
    std::vector<std::thread> threads;
    for (int i = 0; i < kChildThreads; ++i)
      threads.emplace_back([](){});
    for (auto& t : threads)
      t.join();
  }
}

int main() {
  std::vector<std::thread> threads;
  for (int i = 0; i < kTopThreads; ++i)
    threads.emplace_back(Thread);
  for (auto& t : threads)
    t.join();
}

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

3 years ago[llvm-objdump] Switch command-line parsing from llvm::cl to OptTable
Nico Weber [Tue, 13 Apr 2021 02:31:08 +0000 (22:31 -0400)]
[llvm-objdump] Switch command-line parsing from llvm::cl to OptTable

This is similar to D83530, but for llvm-objdump.

The motivation is the desire to add an `llvm-otool` symlink to
llvm-objdump that behaves like macOS's `otool`, using the same
technique the at llvm-objcopy uses to behave like `strip` (etc).

This change for the most part preserves behavior. In some cases,
it increases compatibility with GNU objdump a bit. For example,
the long options now require two dashes, and the long options
taking arguments for the most part now require a `=` in front
of the value. Exceptions are flags where tests passed the
value separately, for these the separate form is kept as
an alias to the = form.

The one-letter short form args are now joined or separate
and long longer accept a =, which also matches GNU objdump.

cl::opt<>s in libraries now have to be explicitly plumbed
through. This patch does that for --x86-asm-syntax=, but
there's hope that we can remove that again.

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

3 years ago[Sema] Fold VLA types in compound literals to constant arrays.
Eli Friedman [Wed, 10 Mar 2021 18:51:00 +0000 (10:51 -0800)]
[Sema] Fold VLA types in compound literals to constant arrays.

Similar to variables with an initializer, this is never valid in
standard C, so we can safely constant-fold as an extension.  I ran into
this construct in a couple proprietary codebases.

While I'm here, drive-by fix for 090dd647: we should only fold variables
with VLA types, not arbitrary variably modified types.

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

3 years agoReapply "[InferAttributes] Materialize all infered attributes for declaration"" and...
Philip Reames [Wed, 14 Apr 2021 23:06:25 +0000 (16:06 -0700)]
Reapply "[InferAttributes] Materialize all infered attributes for declaration"" and follow on patches.

This reverts commit ab98f2c7129a52e216fd7e088b964cf4af27b0f2 and 98eea392cdbcdb7360e58b46e9329573f092cd96.

It includes a fix for the clang test which triggered the revert.  I failed to notice this one because there was another AMDGPU llvm test with a similiar name and the exact same text in the error message.  Odd.  Since only one build bot reported the clang test, I didn't notice that one.

3 years ago[LLLDB] Adding additional check LibCppStdFunctionCallableInfo based on crash reports
Shafik Yaghmour [Wed, 14 Apr 2021 23:25:23 +0000 (16:25 -0700)]
[LLLDB] Adding additional check LibCppStdFunctionCallableInfo based on crash reports

We have seen several crashes in LibCppStdFunctionCallableInfo(...) but we don't have a
reproducer. The last crash pointed to last call to line_entry_helper(...) and symbol
was a nullptr. So adding a check for this case.

3 years ago[AST][Introspection] Fix args not being set.
Nathan James [Wed, 14 Apr 2021 23:19:40 +0000 (00:19 +0100)]
[AST][Introspection] Fix args not being set.

This field isn't set in the constructor.
Tweak its accessor to return an ArrayRef.

3 years ago[AST][NFC] Remove temporary ASTTU file from Introspection generation.
Nathan James [Wed, 14 Apr 2021 23:14:52 +0000 (00:14 +0100)]
[AST][NFC] Remove temporary ASTTU file from Introspection generation.

We can use the Preprocessor to remap this file, cleaning up the cmake code.

Reviewed By: steveire

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

3 years ago[AST] Use IntrusiveRefCntPtr for Introspection LocationCall.
Nathan James [Wed, 14 Apr 2021 23:12:21 +0000 (00:12 +0100)]
[AST] Use IntrusiveRefCntPtr for Introspection LocationCall.

Reviewed By: steveire

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

3 years ago[libcxx][nfc] Assign [ranges.primitives] in "RangesStatus."
zoecarver [Wed, 14 Apr 2021 23:09:45 +0000 (16:09 -0700)]
[libcxx][nfc] Assign [ranges.primitives] in "RangesStatus."

3 years agoRevert "Fix buildbots after 61a85da"
Nico Weber [Wed, 14 Apr 2021 22:47:46 +0000 (18:47 -0400)]
Revert "Fix buildbots after 61a85da"

This reverts commit c609d533634416fc701939d39bf1e43f293e84dc.
61a85da was reverted in ab98f2c7

3 years agoRevert "[InferAttributes] Materialize all infered attributes for declaration"
Nico Weber [Wed, 14 Apr 2021 22:41:02 +0000 (18:41 -0400)]
Revert "[InferAttributes] Materialize all infered attributes for declaration"

Breaks check-clang, see comments on D100400

Also revert follow-up "[NFC] Move a recently added utility into a location to enable reuse"

This reverts commit 3ce61fb6d697d49db471c7077b88b3b9ec9dec66.
This reverts commit 61a85da88235983da565bda0160367461fa0f382.

3 years agoNFC: Remove condition to simplify code
Stephen Kelly [Thu, 25 Mar 2021 14:11:38 +0000 (14:11 +0000)]
NFC: Remove condition to simplify code

The run method is only called if there is a match with a binding.

3 years agoFix buildbots after 61a85da
Philip Reames [Wed, 14 Apr 2021 22:15:54 +0000 (15:15 -0700)]
Fix buildbots after 61a85da

3 years ago[flang] Fix typo caught by clang build
peter klausler [Wed, 14 Apr 2021 21:59:59 +0000 (14:59 -0700)]
[flang] Fix typo caught by clang build

An inadvertent ! operator was (fortunately) flagged as a
warning by clang; remove it.

Differential Review: https://reviews.llvm.org/D100513

3 years ago[NFC] Move a recently added utility into a location to enable reuse
Philip Reames [Wed, 14 Apr 2021 22:05:16 +0000 (15:05 -0700)]
[NFC] Move a recently added utility into a location to enable reuse

About to refresh a patch that uses this in FunctionAtrrs, doing the move seperately to control build times.

3 years ago[InferAttributes] Materialize all infered attributes for declaration
Philip Reames [Wed, 14 Apr 2021 21:43:53 +0000 (14:43 -0700)]
[InferAttributes] Materialize all infered attributes for declaration

We have some cases today where attributes can be inferred from another on access, but the result is not explicitly materialized in IR. This change is a step towards changing that.

Why? Two main reasons:

* Human clarity. It's really confusing trying to figure out why a transform is triggering when the IR doesn't appear to have the required attributes.
* This avoids the need to special case declarations in e.g. functionattrs. Since we can assume the attribute is present, we can work directly from attributes (and only attributes) without also needing to query accessors on Function to avoid missing cases due to unannotated (but infered on use) declarations. (This piece will appear must easier to follow once D100226 also lands.)

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

3 years ago[mlir] Fix passArg of ViewOpGraphPass
Chia-hung Duan [Wed, 14 Apr 2021 21:41:55 +0000 (14:41 -0700)]
[mlir] Fix passArg of ViewOpGraphPass

Reviewed By: jpienaar

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

3 years agoUse PassPipelineCLParser in mlir-reduce
Chia-hung Duan [Wed, 14 Apr 2021 21:34:17 +0000 (14:34 -0700)]
Use PassPipelineCLParser in mlir-reduce

We are able to config the reducer pass pipeline through command-line.

Reviewed By: jpienaar, rriddle

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

3 years ago[lldb] Add addressing_bits to KNOWN_HOST_INFO_KEYS and sort the list
Jonas Devlieghere [Wed, 14 Apr 2021 21:14:54 +0000 (14:14 -0700)]
[lldb] Add addressing_bits to KNOWN_HOST_INFO_KEYS and sort the list

This fixes TestGdbRemoteHostInfo on Apple Silicon.

3 years ago[WebAssembly] Codegen for i64x2.extend_{low,high}_i32x4_{s,u}
Thomas Lively [Wed, 14 Apr 2021 20:43:09 +0000 (13:43 -0700)]
[WebAssembly] Codegen for i64x2.extend_{low,high}_i32x4_{s,u}

Removes the builtins and intrinsics used to opt in to using these instructions
and replaces them with normal ISel patterns now that they are no longer
prototypes.

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

3 years agoRefactor the architecture of mlir-reduce
Chia-hung Duan [Wed, 14 Apr 2021 20:19:36 +0000 (13:19 -0700)]
Refactor the architecture of mlir-reduce

Add iterator for ReductionNode traversal and use range to indicate the
region we would like to keep. Refactor the interaction between
Pass/Tester/ReductionNode.
Now it'll be easier to add new traversal type and OpReducer

Reviewed By: jpienaar, rriddle

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

3 years ago[AST] Add introspection support for more base nodes
Stephen Kelly [Wed, 17 Mar 2021 22:56:39 +0000 (22:56 +0000)]
[AST] Add introspection support for more base nodes

Fix the logic of detecting pseudo-virtual getBeginLoc etc on Stmt and
Decl subclasses.

Adjust the test infrastructure to filter out invalid source locations.
This makes the tests more clear about which nodes have which locations.

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

3 years agoMake test runnable on read-only file systems.
Sterling Augustine [Wed, 14 Apr 2021 20:28:57 +0000 (13:28 -0700)]
Make test runnable on read-only file systems.

3 years ago[AST] Replace asserts with a condition
Stephen Kelly [Wed, 14 Apr 2021 18:03:33 +0000 (19:03 +0100)]
[AST] Replace asserts with a condition

As was done for other locations in commit 54272e5b (NFC:
Replace asserts with if() in SourceLocation accessors, 2019-01-07).

Extracted from  https://reviews.llvm.org/D99231

3 years ago[lldb-vscode] Reduce chattiness of progress events
Walter Erquinigo [Wed, 14 Apr 2021 04:45:03 +0000 (21:45 -0700)]
[lldb-vscode] Reduce chattiness of progress events

Progress events internally have a completed count and a total count, which can mean that for a job with 20000 total counts, then there will be 20000 events fired. Sending all these events to the IDE can break it. For example, debugging a huge binary resulted in around 50 million messages, which rendered the IDE useless, as it was spending all of its resources simply parsing messages and updating the UI.

A way to fix this is to send unique percentage updates, which are at most 100 per job, which is not much. I was able to debug that big target and confirm that only unique percentage notifications are sent. I can't write a test for this because the current test is flaky. I'll figure out later how to make the test reliable, but fixing this will unblock us from deploy a new version of lldb-vscode.

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

3 years ago[mlir] Use default lli JIT in Integration tests
Emilio Cota [Wed, 14 Apr 2021 19:42:09 +0000 (12:42 -0700)]
[mlir] Use default lli JIT in Integration tests

Now that 9b8e7a9d ("[lli] Honor the --entry-function flag in orc and
orc-lazy modes") fixed https://llvm.org/PR49906.

Reviewed By: mehdi_amini, aartbik

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

3 years agoSimplify BitVector code
serge-sans-paille [Tue, 13 Apr 2021 14:14:32 +0000 (16:14 +0200)]
Simplify BitVector code

Instead of managing memory by hand, delegate it to std::vector. This makes the
code much simpler, and also avoids repeatedly computing the storage size.

According to valgrind --tool=callgrind, this also slightly decreases the
instruction count, but by a small margin.

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

3 years agoRevert "Refactor the architecture of mlir-reduce"
Mehdi Amini [Wed, 14 Apr 2021 19:25:43 +0000 (19:25 +0000)]
Revert "Refactor the architecture of mlir-reduce"

This reverts commit a32846b1d0147f30f6dde4bfec453cd681937005.

The build is broken with -DBUILD_SHARED_LIBS=ON:

tools/mlir/lib/Reducer/CMakeFiles/obj.MLIRReduce.dir/Tester.cpp.o: In function `mlir::Tester::isInteresting(mlir::ModuleOp) const':
Tester.cpp:(.text._ZNK4mlir6Tester13isInterestingENS_8ModuleOpE+0xa8): undefined reference to `mlir::OpPrintingFlags::OpPrintingFlags()'
Tester.cpp:(.text._ZNK4mlir6Tester13isInterestingENS_8ModuleOpE+0xc6): undefined reference to `mlir::Operation::print(llvm::raw_ostream&, mlir::OpPrintingFlags)'

3 years agoUpdate OpBase.td AttrDef class to define default value for returnType and convertFrom...
Mehdi Amini [Tue, 13 Apr 2021 00:46:48 +0000 (00:46 +0000)]
Update OpBase.td AttrDef class to define default value for returnType and convertFromStorage (NFC)

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

3 years ago[lldb] Only override target arch if it is compatible
Fred Riss [Wed, 6 May 2020 00:49:24 +0000 (17:49 -0700)]
[lldb] Only override target arch if it is compatible

It looks like the goal of this code is to provide a more precise
architecture definition for the target when attaching to a process. When
attaching to a foreign debugserver, you might get into a situation where
the active (host) platform will give you bogus information on the target
process.

This change allows the platform to override the target arch only with a
compatible architecture. This fixes TestTargetXMLArch.py on Apple
Silicon. Another alternative would be to just fail in this scenario and
update the test(s).

3 years ago[lldb/test] Remove the "expect_captures" feature of lldb-server tests
Pavel Labath [Tue, 13 Apr 2021 16:02:20 +0000 (18:02 +0200)]
[lldb/test] Remove the "expect_captures" feature of lldb-server tests

This functionality is used exactly once, and it is trivial to implement
it differently (capture into two distinct variables, and compare for
equality afterwards).

3 years ago[lldb] Move QThreadSuffixSupported and QListThreadsInStopReply into llgs
Pavel Labath [Tue, 13 Apr 2021 14:07:28 +0000 (16:07 +0200)]
[lldb] Move QThreadSuffixSupported and QListThreadsInStopReply into llgs

These were in the shared llgs+platform code, but they only make sense
for llgs (as they deal with how the server reports information about
debugged processes).

3 years agofix typo to cycle bots
Nico Weber [Wed, 14 Apr 2021 18:59:18 +0000 (14:59 -0400)]
fix typo to cycle bots

3 years ago[InstCombine] Conditionally emit nowrap flags when combining two adds
Mehrnoosh Heidarpour [Wed, 14 Apr 2021 18:49:46 +0000 (20:49 +0200)]
[InstCombine] Conditionally emit nowrap flags when combining two adds

Currently, the InstCombineCompare is combining two add operations
into a single add operation which always has a nsw flag, without
checking the conditions to see if this flag should be present
according to the original two add operations or not.

This patch will change the InstCombineCompare to emit the nsw or
nuw only when these flags are allowed to be generated according to
the original add operations and remove the possibility of applying
wrong optimization with passes that will perform on the IR later
in the pipeline.

To confirm that the current results are buggy and the results after
proposed patch are the correct IR the following examples from Alive2
are attached; the same results can be seen in the case of nuw flag
and nsw is just used as an example. The following link shows that
the generated IR with current LLVM is a buggy IR when none of the
original add operations have nsw flag.
https://alive2.llvm.org/ce/z/WGaDrm
The following link proves that the generated IR after the patch in
the former case is the correct IR.
https://alive2.llvm.org/ce/z/wQ7G_e

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

3 years agofix typo to cycle bots
Nico Weber [Wed, 14 Apr 2021 18:52:41 +0000 (14:52 -0400)]
fix typo to cycle bots

3 years ago[gn build] Port f992cfba7173
LLVM GN Syncbot [Wed, 14 Apr 2021 18:37:22 +0000 (18:37 +0000)]
[gn build] Port f992cfba7173

3 years ago[gn build] Port e98060fa72cc
LLVM GN Syncbot [Wed, 14 Apr 2021 18:37:21 +0000 (18:37 +0000)]
[gn build] Port e98060fa72cc

3 years ago[gn build] try to make sync_source_lists_from_cmake.py py3-compatible
Nico Weber [Wed, 14 Apr 2021 18:27:36 +0000 (14:27 -0400)]
[gn build] try to make sync_source_lists_from_cmake.py py3-compatible

3 years ago[SROA][TBAA] Handle shift of regular TBAA nodes
William S. Moses [Sun, 4 Apr 2021 02:44:51 +0000 (22:44 -0400)]
[SROA][TBAA] Handle shift of regular TBAA nodes

SROA shifts TBAA nodes in a way that may present a problem for !tbaa but not !tbaa.struct nodes.

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

3 years ago[flang] Correct the interpretation of BIND(C,NAME='')
peter klausler [Wed, 14 Apr 2021 17:57:53 +0000 (10:57 -0700)]
[flang] Correct the interpretation of BIND(C,NAME='')

An empty NAME= should mean that there is no C binding, not the
binding that would result from BIND(C) without a NAME=.
See 18.10.2p2.

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

3 years ago[clang][FileManager] Support empty file name in getVirtualFileRef for serialized...
Alex Lorenz [Wed, 14 Apr 2021 18:27:03 +0000 (11:27 -0700)]
[clang][FileManager] Support empty file name in getVirtualFileRef for serialized diagnostics

After https://reviews.llvm.org/D90484 libclang is unable to read a serialized diagnostic file
which contains a diagnostic which came from a file with an empty filename. The reason being is
that the serialized diagnostic reader is creating a virtual file for the "" filename, which now
fails after the changes in https://reviews.llvm.org/D90484. This patch restores the previous
behavior in getVirtualFileRef by allowing it to construct a file entry ref with an empty name by
pretending its name is "." so that the directory entry can be created.

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

3 years ago[libc++] Move guards against std::auto_ptr outside of auto_ptr.h
Louis Dionne [Wed, 14 Apr 2021 18:06:55 +0000 (14:06 -0400)]
[libc++] Move guards against std::auto_ptr outside of auto_ptr.h

This makes it clear that headers like <memory> which include auto_ptr
only do that when compiling under an older Standard, or when the removed
feature is explicitly requested.

3 years ago[libc++] Move __memory/utilities.h to __memory/allocation_guard.h
Louis Dionne [Wed, 14 Apr 2021 18:00:48 +0000 (14:00 -0400)]
[libc++] Move __memory/utilities.h to __memory/allocation_guard.h

This matches the granularity of other headers that were split off of <__memory>.

3 years ago[libc++] Split up __memory/base.h into meaningful headers
Louis Dionne [Wed, 14 Apr 2021 17:59:03 +0000 (13:59 -0400)]
[libc++] Split up __memory/base.h into meaningful headers

3 years ago[libTooling] Add smart pointer support to the `access` Stencil
Shu-Chun Weng [Wed, 14 Apr 2021 07:08:40 +0000 (00:08 -0700)]
[libTooling] Add smart pointer support to the `access` Stencil

This extends smart pointer support beyond the existing `maybeDeref` and
`maybeAddressOf`.

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

3 years ago[WebAssembly] Codegen for f64x2.convert_low_i32x4_{s,u}
Thomas Lively [Wed, 14 Apr 2021 17:42:44 +0000 (10:42 -0700)]
[WebAssembly] Codegen for f64x2.convert_low_i32x4_{s,u}

Add a custom DAG combine and ISD opcode for detecting patterns like

  (uint_to_fp (extract_subvector ...))

before the extract_subvector is expanded to ensure that they will ultimately
lower to f64x2.convert_low_i32x4_{s,u} instructions. Since these instructions
are no longer prototypes and can now be produced via standard IR, this commit
also removes the target intrinsics and builtins that had been used to prototype
the instructions.

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

3 years agoclang-format: fix undefined behavior.
Martin Probst [Wed, 14 Apr 2021 17:28:51 +0000 (19:28 +0200)]
clang-format: fix undefined behavior.

The previous change failed to initialize the SymbolsMerged field.

3 years ago[COFF] Simplify ICF associated comdat handling
Reid Kleckner [Wed, 14 Apr 2021 17:39:48 +0000 (10:39 -0700)]
[COFF] Simplify ICF associated comdat handling

This is a different approach from D98993 that should achieve most of the
same benefit. The two changes are:
1. Sort the list of associated child sections by section name
2. Do not consider associated sections to have children themselves

This fixes the main issue, which was that we sometimes considered an
.xdata section to have a child .pdata section. That lead to slow links
and larger binaries (less xdata folding).

Otherwise, this should be NFC: we go back to ignoring .debug/.gljmp and
other metadata sections rather than only looking at pdata/xdata. We
discovered that we do care about other associated sections, like ASan
global registration metadata.

3 years ago[ValueTracking] Don't require strictly positive for mul nsw recurrence
Nikita Popov [Wed, 14 Apr 2021 17:37:47 +0000 (19:37 +0200)]
[ValueTracking] Don't require strictly positive for mul nsw recurrence

Just like in the mul nuw case, it's sufficient that the step is
non-zero. If the step is negative, then the values will jump
between positive and negative, "crossing" zero, but the value of
the recurrence is never actually zero.

3 years ago[NFC][libc++] Fixes a documentation typo.
Mark de Wever [Wed, 14 Apr 2021 17:33:03 +0000 (19:33 +0200)]
[NFC][libc++] Fixes a documentation typo.

3 years ago[flang] Fix Boolean flag arguments
peter klausler [Tue, 13 Apr 2021 23:04:42 +0000 (16:04 -0700)]
[flang] Fix Boolean flag arguments

Two sites in io-api.cpp pass the wrong Boolean flag value to
signify that a new anonymous unit is a formatted file.

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

3 years agoRefactor the architecture of mlir-reduce
Jacques Pienaar [Wed, 14 Apr 2021 17:16:30 +0000 (10:16 -0700)]
Refactor the architecture of mlir-reduce

Add iterator for ReductionNode traversal and use range to indicate the region we would like to keep. Refactor the interaction between Pass/Tester/ReductionNode.
Now it'll be easier to add new traversal type and OpReducer

Reviewed By: jpienaar, rriddle

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

3 years ago[SLP]Added a tests for shuffled matched tree entries, NFC.
Alexey Bataev [Wed, 14 Apr 2021 17:04:40 +0000 (10:04 -0700)]
[SLP]Added a tests for shuffled matched tree entries, NFC.

3 years agoRemove deprecated member functions (NFC)
Momchil Velikov [Wed, 14 Apr 2021 17:05:18 +0000 (18:05 +0100)]
Remove deprecated member functions (NFC)

Remove the member functions getByValAlign and getOrigAlign, there were
no users left.

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

3 years ago[ValueTracking] Don't require non-zero step for add nuw
Nikita Popov [Wed, 14 Apr 2021 17:04:01 +0000 (19:04 +0200)]
[ValueTracking] Don't require non-zero step for add nuw

It's okay if the step is zero, we'll just stay at the same non-zero
value in that case. The valuable part of this is that the step
doesn't even need to be a constant anymore.

3 years ago[ValueTracking] Add additional non-zero add recurrence test (NFC)
Nikita Popov [Wed, 14 Apr 2021 16:59:11 +0000 (18:59 +0200)]
[ValueTracking] Add additional non-zero add recurrence test (NFC)

Also drop a number of unused parameters from existing tests.

3 years ago[AMDGPU] Factor out SelectSAddrFI()
Stanislav Mekhanoshin [Tue, 13 Apr 2021 19:29:50 +0000 (12:29 -0700)]
[AMDGPU] Factor out SelectSAddrFI()

This is a service function generally useful for selection
of a FI in an SADDR. NFC for now, needed for future patch.

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

3 years ago[flang] Handle END= situations better in runtime input
peter klausler [Tue, 13 Apr 2021 23:07:58 +0000 (16:07 -0700)]
[flang] Handle END= situations better in runtime input

Debug the input path for READ statements with END= labels;
don't emit errors when the program can handle them.
BeginReadingRecord() member functions have been made
"bool" for more convenient handling of error cases,
and some code in IoErrorHandler has been cleaned up.

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

3 years ago[TTI] NFC: Change getArithmeticInstrCost to return InstructionCost
Sander de Smalen [Wed, 14 Apr 2021 15:53:01 +0000 (16:53 +0100)]
[TTI] NFC: Change getArithmeticInstrCost to return InstructionCost

This patch migrates the TTI cost interfaces to return an InstructionCost.

See this patch for the introduction of the type: https://reviews.llvm.org/D91174
See this thread for context: http://lists.llvm.org/pipermail/llvm-dev/2020-November/146408.html

Reviewed By: dmgreen

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

3 years ago[TTI] NFC: Change getFPOpCost to return InstructionCost
Sander de Smalen [Wed, 14 Apr 2021 15:52:51 +0000 (16:52 +0100)]
[TTI] NFC: Change getFPOpCost to return InstructionCost

This patch migrates the TTI cost interfaces to return an InstructionCost.

See this patch for the introduction of the type: https://reviews.llvm.org/D91174
See this thread for context: http://lists.llvm.org/pipermail/llvm-dev/2020-November/146408.html

Reviewed By: c-rhodes

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

3 years ago[TTI] NFC: Change getVectorInstrCost to return InstructionCost
Sander de Smalen [Wed, 27 Jan 2021 10:52:58 +0000 (10:52 +0000)]
[TTI] NFC: Change getVectorInstrCost to return InstructionCost

This patch migrates the TTI cost interfaces to return an InstructionCost.

See this patch for the introduction of the type: https://reviews.llvm.org/D91174
See this thread for context: http://lists.llvm.org/pipermail/llvm-dev/2020-November/146408.html

Reviewed By: dmgreen

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