platform/upstream/llvm.git
2 years ago[CSKY] Add floating operation support including float and double
Zi Xuan Wu [Thu, 27 Jan 2022 06:49:43 +0000 (14:49 +0800)]
[CSKY] Add floating operation support including float and double

CSKY arch has multiple FPU instruction versions such as FPU, FPUv2 and FPUv3 to implement floating operations.
For now, we just only support FPUv2 and FPUv3.

It includes the encoding, asm parsing of instructions and codegen of DAG nodes.

2 years ago[RISCV][CodeGen] Implement IR Intrinsic support for K extension
Wu Xinlong [Thu, 27 Jan 2022 03:59:13 +0000 (11:59 +0800)]
[RISCV][CodeGen] Implement IR Intrinsic support for K extension

This revision implements IR Intrinsic support for RISCV Scalar Crypto extension according to the specification of version [[ https://github.com/riscv/riscv-crypto/releases/tag/v1.0.0-scalar | 1.0]]
Co-author:@ksyx & @VincentWu & @lihongliang & @achieveartificialintelligence

Reviewed By: craig.topper

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

2 years ago[ELF] Parallelize computeIsPreemptible
Fangrui Song [Thu, 27 Jan 2022 07:45:03 +0000 (23:45 -0800)]
[ELF] Parallelize computeIsPreemptible

2 years ago[MLIR] NFC. Rename pass cmd-line to prefix affine
Uday Bondhugula [Thu, 27 Jan 2022 02:36:26 +0000 (08:06 +0530)]
[MLIR] NFC. Rename pass cmd-line to prefix affine

Prefix "affine-" to affine transform passes that were missing it -- to
avoid ambiguity and for uniformity. There were only two needed this.

Move mispaced affine coalescing test case file.

NFC.

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

2 years ago[MLIR] Fix integration tests broken by D118285
Uday Bondhugula [Thu, 27 Jan 2022 07:30:19 +0000 (13:00 +0530)]
[MLIR] Fix integration tests broken by D118285

[MLIR] Fix integration tests broken by D118285.

2 years agoAdd email addresses to create a topic via email in a specific category.
Tanya Lattner [Thu, 27 Jan 2022 07:22:04 +0000 (23:22 -0800)]
Add email addresses to create a topic via email in a specific category.

2 years ago[mlir] Finish replacing OwningRewritePatternList with RewritePatternSet
River Riddle [Wed, 26 Jan 2022 22:42:38 +0000 (14:42 -0800)]
[mlir] Finish replacing OwningRewritePatternList with RewritePatternSet

OwningRewritePatternList has been deprecated for ~10 months now, we can remove
the leftover using directives at this point.

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

2 years ago[mlir] Move ComposeSubView+ExpandOps from Standard to MemRef
River Riddle [Wed, 26 Jan 2022 22:18:21 +0000 (14:18 -0800)]
[mlir] Move ComposeSubView+ExpandOps from Standard to MemRef

These transformations already operate on memref operations (as part of
splitting up the standard dialect). Now that the operations have moved,
it's time for these transformations to move as well.

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

2 years ago[ELF] Optimize two vector. NFC
Fangrui Song [Thu, 27 Jan 2022 07:10:40 +0000 (23:10 -0800)]
[ELF] Optimize two vector. NFC

2 years ago[ELF] Optimize -Map. NFC
Fangrui Song [Thu, 27 Jan 2022 06:51:31 +0000 (22:51 -0800)]
[ELF] Optimize -Map. NFC

getVA is slow. Avoid calling it in the llvm::sort comparator.

2 years ago[ELF] Simplify InputSection::writeTo. NFC
Fangrui Song [Thu, 27 Jan 2022 06:03:26 +0000 (22:03 -0800)]
[ELF] Simplify InputSection::writeTo. NFC

2 years ago[NFC] Remove duplicate include
Jim Lin [Thu, 27 Jan 2022 01:52:45 +0000 (09:52 +0800)]
[NFC] Remove duplicate include

2 years ago[mlir][NFC] Add a using for llvm::SMLoc/llvm::SMRange to LLVM.h
River Riddle [Wed, 26 Jan 2022 23:49:53 +0000 (15:49 -0800)]
[mlir][NFC] Add a using for llvm::SMLoc/llvm::SMRange to LLVM.h

These are used pervasively during parsing.

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

2 years ago[mlir][NFC] Add a using for llvm::BitVector to LLVM.h
River Riddle [Wed, 26 Jan 2022 23:30:56 +0000 (15:30 -0800)]
[mlir][NFC] Add a using for llvm::BitVector to LLVM.h

BitVector is becoming widespread enough that we should add a proper using.

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

2 years ago[mlir:Function][NFC] Use BitVector instead of ArrayRef for indices when removing...
River Riddle [Mon, 24 Jan 2022 23:18:04 +0000 (15:18 -0800)]
[mlir:Function][NFC] Use BitVector instead of ArrayRef for indices when removing arguments/results

We already convert to BitVector internally, and other APIs (namely Operation::eraseOperands)
already use BitVector as well. Switching over provides a common format between
API and also reduces the amount of format conversions necessary.

Fixes #53325

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

2 years ago[mlir:PassOptions] Fix parsing of nested option values/better handle escaping
River Riddle [Mon, 24 Jan 2022 22:30:03 +0000 (14:30 -0800)]
[mlir:PassOptions] Fix parsing of nested option values/better handle escaping

The option parser currently does not properly handle nested options, meaning that
in some cases we can print pass pipelines that we can't actually parse back in. For example,
from #52885 we currently can't parse in inliner pipelines that have nested pipeline strings.

This commit adds handling for string values (e.g. "...") and nested options
(e.g. `foo{baz{bar=10 pizza=11}}`).

Fixes #52885

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

2 years ago[IVDescriptor] Get the exact FP instruction that does not allow reordering
Congzhe Cao [Thu, 27 Jan 2022 05:24:12 +0000 (00:24 -0500)]
[IVDescriptor] Get the exact FP instruction that does not allow reordering

This is a bugfix in IVDescriptor.cpp.

The helper function `RecurrenceDescriptor::getExactFPMathInst()`
is supposed to return the 1st FP instruction that does not allow
reordering. However, when constructing the RecurrenceDescriptor,
we trace the use-def chain staring from a PHI node and for each
instruction in the use-def chain, its descriptor overrides the
previous one. Therefore in the final RecurrenceDescriptor we
constructed, we lose previous FP instructions that does not allow
reordering.

Reviewed By: kmclaughlin

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

2 years ago[Test] Add test for or-reduce idiom symmetrical to and-reduce
Max Kazantsev [Thu, 27 Jan 2022 05:26:19 +0000 (12:26 +0700)]
[Test] Add test for or-reduce idiom symmetrical to and-reduce

2 years ago[Test] Add one more add-reduce test w/ pointer bitcasts
Max Kazantsev [Thu, 27 Jan 2022 05:13:07 +0000 (12:13 +0700)]
[Test] Add one more add-reduce test w/ pointer bitcasts

2 years ago[clang-tidy] Fix nested namespaces in `readability-static-definition-in-anonymous...
Evgeny Shulgin [Thu, 27 Jan 2022 00:55:14 +0000 (17:55 -0700)]
[clang-tidy] Fix nested namespaces in `readability-static-definition-in-anonymous-namespace` check

The check previously inspected only the immediate parent namespace.
`static` in a named namespace within an unnamed namespace is still
redundant.
We will use `Decl::isInAnonymousNamespace()` method that traverses the
namespaces hierarchy recursively.

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

2 years ago[ObjC] Emit selector load right before msgSend call.
Ahmed Bougacha [Thu, 27 Jan 2022 01:31:26 +0000 (17:31 -0800)]
[ObjC] Emit selector load right before msgSend call.

We currently emit the selector load early, but only because we need
it to compute the signature (so that we know which msgSend variant to
call).  We can prepare the signature with a plain undef, and replace
it with the materialized selector value if (and only if) needed, later.

Concretely, this usually doesn't have an effect, but tests need updating
because we reordered the receiver bitcast and the selector load, which
is always fine.

There is one notable change: with this, when a msgSend needs a
receiver null check, the selector is now loaded in the non-null
block, instead of before the null check.  That should be a mild
improvement.

2 years ago[libc++] Fix LWG3390: move_iterator now handles move-only iterators.
Arthur O'Dwyer [Fri, 14 Jan 2022 16:25:56 +0000 (11:25 -0500)]
[libc++] Fix LWG3390: move_iterator now handles move-only iterators.

This can't really be tested until C++20 move_iterator is completely implemented.

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

2 years ago[PowerPC] Add the Power10 XS[MAX|MIN]CQP instruction
Ting Wang [Thu, 27 Jan 2022 04:00:43 +0000 (23:00 -0500)]
[PowerPC] Add the Power10 XS[MAX|MIN]CQP instruction

Add the Power 10 instruction XS[MAX|MIN]CQP.

Reviewed By: shchenz, amyk

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

2 years ago[CMake][Fuchsia] Drop 32-bit ios runtimes
Petr Hosek [Thu, 27 Jan 2022 02:48:20 +0000 (18:48 -0800)]
[CMake][Fuchsia] Drop 32-bit ios runtimes

These are no longer supported in the recent Xcode SDK versions.

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

2 years ago[RISCV] Use vnsrl.wx with x0 instead of vnsrl.vi for truncate.
Craig Topper [Thu, 27 Jan 2022 02:20:04 +0000 (18:20 -0800)]
[RISCV] Use vnsrl.wx with x0 instead of vnsrl.vi for truncate.

This matches what the spec uses for the vncvt.x.x.w assembly
pseudoinstruction.

Reviewed By: kito-cheng

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

2 years ago[RISCV] Remove unused flags from FeatureKind in TargetParser.h. NFC
Craig Topper [Thu, 27 Jan 2022 02:19:52 +0000 (18:19 -0800)]
[RISCV] Remove unused flags from FeatureKind in TargetParser.h. NFC

These flags aren't used and we shouldn't add more flags for new
ratified extensions. So clear out the unused flags to avoid any
confusion.

Reviewed By: khchen

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

2 years ago[gn build] Format gn files
Arthur Eubanks [Thu, 27 Jan 2022 02:37:03 +0000 (18:37 -0800)]
[gn build] Format gn files

2 years ago[gn build] Move -fno-builtin to crt_code
Arthur Eubanks [Wed, 26 Jan 2022 22:54:11 +0000 (14:54 -0800)]
[gn build] Move -fno-builtin to crt_code

crt_code seems to correspond to SANITIZER_COMMON_CFLAGS which contains -fno-builtin.

Reviewed By: thakis

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

2 years ago[NFC] [AST] Move isSameEntity into ASTContext
Chuanqi Xu [Thu, 27 Jan 2022 02:26:40 +0000 (10:26 +0800)]
[NFC] [AST] Move isSameEntity into ASTContext

Currently we are trying to implement the semantics of C++ Modules. A big
challenge would be the ODR checking. Previously we did this in
ASTReader, it would handle the cases like:
```
module;
export module a_module;
import another_module; //  check the ODR consistency here
```
or
```
export module m;
import a_module;
import another_module; // check the ODR consistency here
```

However, it wouldn't handle the case:
```
import another_module; // When we check ODR here, everything looks fine.
```

In the case, the read process is ended. But we need to check the ODR
still. To reuse the facility we do in ASTReader, this patch moves the
corresponding codes into ASTContext. This should be good since there
were facilities like `hasSameTemplateName` and `hasSameType`.

Although the patch is a little bit big, all of the change should be
trivial.

Reviewed By: erichkeane

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

2 years ago[asan] Add missing #include of sanitizer_platform.h
Roland McGrath [Thu, 27 Jan 2022 00:39:36 +0000 (16:39 -0800)]
[asan] Add missing #include of sanitizer_platform.h

The "asan/asan_mapping.h" header relies on sanitizer_platform.h
macros, but doesn't directly include the header.  All the existing
uses until recently happened to be in places where some other header
had indirectly included sanitizer_platform.h first.  The addition of
asan_rtl_x86_64.S was the first place to use "asan/asan_mapping.h"
alone.  It so happens that its uses of the macros make having no
macros defined equivalent to SANITIZER_LINUX, so this did not affect
Linux builds.  But the assembly constants in asan_rtl_x86_64.S were
wrong for Fuchsia when SANITIZER_FUCHSIA was not properly defined.

Reviewed By: vitalybuka

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

2 years agoDefault to DWARFv4 on Windows
David Blaikie [Thu, 27 Jan 2022 02:00:43 +0000 (18:00 -0800)]
Default to DWARFv4 on Windows

2 years ago[clang] Use proper type to left shift after D117262
Arthur Eubanks [Thu, 27 Jan 2022 01:54:37 +0000 (17:54 -0800)]
[clang] Use proper type to left shift after D117262

Causing warnings like
warning C4334: '<<': result of 32-bit shift implicitly converted to 64 bits
as reported in D117262.

2 years ago[BOLT][TEST] Adjust tests for BOLT_CLANG_EXE=clang-{6..9}
Amir Ayupov [Thu, 27 Jan 2022 01:08:13 +0000 (17:08 -0800)]
[BOLT][TEST] Adjust tests for BOLT_CLANG_EXE=clang-{6..9}

Fix tests to pass with clang-6..9 on Ubuntu 20.04.

Reviewed By: yota9

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

2 years ago[mlir][amx] add a full tile matrix mult integral example to integration tests
Aart Bik [Thu, 27 Jan 2022 00:05:31 +0000 (16:05 -0800)]
[mlir][amx] add a full tile matrix mult integral example to integration tests

Reviewed By: dcaballe

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

2 years ago[NFC] Empty test commit, check commit access
Ting Wang [Thu, 27 Jan 2022 01:00:25 +0000 (20:00 -0500)]
[NFC] Empty test commit, check commit access

2 years agoRevert "Emit swift5 reflection section data in dsym bundle generated by dsymutil...
Shubham Sandeep Rastogi [Thu, 27 Jan 2022 00:58:49 +0000 (16:58 -0800)]
Revert "Emit swift5 reflection section data in dsym bundle generated by dsymutil in the Dwarf section."

This reverts commit 50f50f2582993a079dbcfb8e7ba48920f41e6be0.

2 years ago[libc++] Fix LWG3533 "Make `base() const&` consistent..."
Arthur O'Dwyer [Fri, 14 Jan 2022 16:44:31 +0000 (11:44 -0500)]
[libc++] Fix LWG3533 "Make `base() const&` consistent..."

Fixed in counted_iterator and transform_view::iterator.
The LWG issue also affected elements_view::iterator, but we haven't
implemented that one yet, and whoever does implement it will get
the fix for free if they just follow the working draft's wording.

Drive-by stop calling `.base()` on test iterators in the test,
and improve the transform_view::iterator/sentinel tests.

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

2 years ago[libc++] Make C++03 reference_wrapper more like C++11.
Arthur O'Dwyer [Sat, 22 Jan 2022 23:34:25 +0000 (18:34 -0500)]
[libc++] Make C++03 reference_wrapper more like C++11.

Remove a bunch of LIBCPP_CXX03_LANG. This is the result of a
rabbithole to re-eliminate the workaround I introduced into
std::cref in D117953. It turns out that Clang's C++03 mode
(the only compiler we care about C++03 for) now supports all
the things we were originally eschewing via LIBCPP_CXX03_LANG;
we can fully support these reference_wrapper features in
C++03 mode, and un-XFAIL the relevant tests.

Drive-by constexprify a few more tests.

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

2 years ago[libc++] Fix LWG3557 "static_cast expression in convertible_to has the wrong operand"
Arthur O'Dwyer [Sat, 22 Jan 2022 20:29:18 +0000 (15:29 -0500)]
[libc++] Fix LWG3557 "static_cast expression in convertible_to has the wrong operand"

https://cplusplus.github.io/LWG/issue3557
I think the code change is unobservable, so we could just close this as
"Nothing To Do" instead; but it seems appropriate to follow the Standard's
wording here as closely as possible.

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

2 years ago[libc++] [ranges] Fix LWG3470 "convertible-to-non-slicing seems to reject valid case"
Arthur O'Dwyer [Sat, 22 Jan 2022 04:29:41 +0000 (23:29 -0500)]
[libc++] [ranges] Fix LWG3470 "convertible-to-non-slicing seems to reject valid case"

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

2 years ago[FIX][clang] Fix unused private field in ExtractAPIVisitor
Zixu Wang [Thu, 27 Jan 2022 00:22:08 +0000 (16:22 -0800)]
[FIX][clang] Fix unused private field in ExtractAPIVisitor

Fix a build failure where an unused private field in ExtractAPIVisitor
triggered a warning turned into error.

2 years ago[lldb/test] Skip TestSBModule unless darwin
Med Ismail Bennani [Thu, 27 Jan 2022 00:05:12 +0000 (01:05 +0100)]
[lldb/test] Skip TestSBModule unless darwin

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
2 years agoRevert "[lldb/test] Try to fix TestSBModule failure"
Med Ismail Bennani [Thu, 27 Jan 2022 00:04:38 +0000 (01:04 +0100)]
Revert "[lldb/test] Try to fix TestSBModule failure"

This reverts commit 326516448c839d8f9cc515b20a34d0f3a6ee2374.

2 years ago[lldb/test] Try to fix TestSBModule failure
Med Ismail Bennani [Wed, 26 Jan 2022 23:57:54 +0000 (00:57 +0100)]
[lldb/test] Try to fix TestSBModule failure

This should fix https://lab.llvm.org/buildbot/#/builders/68/builds/25571

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
2 years ago[mlir][amx] fix some whitespace issues in AMX tests
Aart Bik [Wed, 26 Jan 2022 23:22:47 +0000 (15:22 -0800)]
[mlir][amx] fix some whitespace issues in AMX tests

Reviewed By: dcaballe

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

2 years agoRevert "[mlir][LLVM] Add support for operand_attrs to InlineAsmOp"
Mehdi Amini [Wed, 26 Jan 2022 23:59:24 +0000 (23:59 +0000)]
Revert "[mlir][LLVM] Add support for operand_attrs to InlineAsmOp"

This reverts commit e6ce2c0b8d5f8253791bf87145669c58328c30db.

The test is failing in CI right now.

2 years ago[gn build] Remove unnecessary include_dirs
Arthur Eubanks [Wed, 26 Jan 2022 23:40:30 +0000 (15:40 -0800)]
[gn build] Remove unnecessary include_dirs

These are already part of crt_code.

2 years ago[test][DAGCombine] Add more tests for carry diamond. NFC
Paweł Bylica [Wed, 26 Jan 2022 14:57:42 +0000 (15:57 +0100)]
[test][DAGCombine] Add more tests for carry diamond. NFC

2 years ago[BOLT] Fix DWARFv5 for aarch64
Vladislav Khmelevsky [Wed, 26 Jan 2022 22:59:10 +0000 (01:59 +0300)]
[BOLT] Fix DWARFv5 for aarch64

This patch reverts patch "DWARFv5 default: Switch bolt tests to use
DWARFv4 since Bolt doesn't support v5 yet" and places the -gdwarf-4 flag
to the global cflags config file.

Reviewed By: Amir

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

2 years ago[AMDGPU] Validate dst and src2 non-overlapping restriction in asm
Stanislav Mekhanoshin [Tue, 25 Jan 2022 00:22:49 +0000 (16:22 -0800)]
[AMDGPU] Validate dst and src2 non-overlapping restriction in asm

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

2 years ago[gn build] Don't pass -fuse-ld=lld to compiler-rt tests
Arthur Eubanks [Wed, 26 Jan 2022 22:50:27 +0000 (14:50 -0800)]
[gn build] Don't pass -fuse-ld=lld to compiler-rt tests

This was done for check-hwasan, but compiler-rt/test/hwasan/lit.cfg.py
already does that.

This makes check-asan (to be submitted) fail on Windows due to using
lld-link (as opposed to MSVC link.exe) in tests. That seems like a
problem that should be fixed, but that's orthogonal to this patch.

2 years ago[gn build] Remove incorrect interception dependency
Arthur Eubanks [Wed, 26 Jan 2022 23:07:20 +0000 (15:07 -0800)]
[gn build] Remove incorrect interception dependency

2 years ago[AMDGPU] Prevent aliasing of SrcC and Dst in MAI
Stanislav Mekhanoshin [Fri, 21 Jan 2022 20:12:31 +0000 (12:12 -0800)]
[AMDGPU] Prevent aliasing of SrcC and Dst in MAI

Form the MAI spec: It’s ok that Src_C and vDst are the exact same VGPRs
or Src_C and vDst are completely separated. The case that Src_C and vDst
are overlapping should be avoid as new value could be written to accumulator
input before it gets read.

Note that this inevitably increases register pressure to the point where
some programs will become uncompilable.

This patch separates MAC and FMA versions of MFMA instructions using either
tied dst and src2 or earlyclobber dst.

Fixes: SWDEV-318900

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

2 years ago[bazel] Port 480cd4cb
Benjamin Kramer [Wed, 26 Jan 2022 22:24:45 +0000 (23:24 +0100)]
[bazel] Port 480cd4cb

2 years ago[BOLT][docs] Add note regarding DWARF v5 support to README.md
Maksim Panchenko [Wed, 26 Jan 2022 21:52:40 +0000 (13:52 -0800)]
[BOLT][docs] Add note regarding DWARF v5 support to README.md

Reviewed By: Amir, yota9

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

2 years agoEmit swift5 reflection section data in dsym bundle generated by dsymutil in the Dwarf...
Shubham Sandeep Rastogi [Wed, 17 Nov 2021 23:05:58 +0000 (15:05 -0800)]
Emit swift5 reflection section data in dsym bundle generated by dsymutil in the Dwarf section.

Add support for Swift reflection metadata to dsymutil.

This patch adds support for copying Swift reflection metadata (__swift5_.* sections) from .o files to into the symbol-rich binary in the output .dSYM. The functionality is automatically enabled only if a .o file has reflection metadata sections and the binary doesn't. When copying dsymutil moves the section from the __TEXT segment to the __DWARF segment.

rdar://76973336

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

2 years ago[mlir][amx] add a full tile matrix mult example to integration tests
Aart Bik [Wed, 26 Jan 2022 19:58:17 +0000 (11:58 -0800)]
[mlir][amx] add a full tile matrix mult example to integration tests

Rationale:
Demonstrates the maximum tile size allowed for the f32 <= bf16 x bf16 op

Reviewed By: dcaballe

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

2 years ago[CMake] Use generator expression to get in-tree libc++ path
Petr Hosek [Wed, 26 Jan 2022 00:10:51 +0000 (16:10 -0800)]
[CMake] Use generator expression to get in-tree libc++ path

When using the in-tree libc++, we should be using the full path to
ensure that we're using the right library and not accidentally pick up
the system library.

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

2 years ago[RISCV] Add hasStdExtZbp() to hasAndNotCompare.
Craig Topper [Wed, 26 Jan 2022 21:39:36 +0000 (13:39 -0800)]
[RISCV] Add hasStdExtZbp() to hasAndNotCompare.

2 years ago[bazel] Enable layering_check for MLIR test directory
Jordan Rupprecht [Wed, 26 Jan 2022 21:37:42 +0000 (13:37 -0800)]
[bazel] Enable layering_check for MLIR test directory

This would have enabled me to notice the MLIR test file needed updating too, preventing the test file of 2074eef5db330ab437410bfb617b58ea70f4fbff from being necessary.

layering_check is already enabled in mlir/BUILD.bazel. I don't know why I didn't see the other breakage there.

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

2 years ago[RISCV] Minor code cleanups in RISCVISAInfo. NFCI
Craig Topper [Wed, 26 Jan 2022 20:50:38 +0000 (12:50 -0800)]
[RISCV] Minor code cleanups in RISCVISAInfo. NFCI

Pass StringRef by value instead of const reference.

Replace if () llvm_unreachable with an assert.

Replace size() == 0 with empty()

2 years ago[cc1as] Remove -Wa,--compress-debug-sections=zlib-gnu
Fangrui Song [Wed, 26 Jan 2022 21:28:51 +0000 (13:28 -0800)]
[cc1as] Remove -Wa,--compress-debug-sections=zlib-gnu

It's obsoleted and unlikely used. See D117744.

2 years ago[Driver] Remove obsoleted -gz=zlib-gnu
Fangrui Song [Wed, 26 Jan 2022 21:26:51 +0000 (13:26 -0800)]
[Driver] Remove obsoleted -gz=zlib-gnu

GCC added -gz=zlib-gnu in 2014 for -gz meaning change (.zdebug =>
SHF_COMPRESSED) and the legacy zlib-gnu hasn't gain adoption.

According to Debian Code Search (`gz=zlib-gnu`), no project uses -gz=zlib-gnu
(valgrind has a configure to use -gz=zlib). Any possible -gz=zlib-gnu user can
switch to -gz smoothly (supported by integrated assemblers for many years;
binutils 2.26).

Reviewed By: dblaikie

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

2 years ago[BOLT] Prepare BOLT for unit-testing
Vladislav Khmelevsky [Wed, 26 Jan 2022 20:45:46 +0000 (23:45 +0300)]
[BOLT] Prepare BOLT for unit-testing

This patch adds unit testing support for BOLT. In order to do this we will need at least do this changes on the code level:
* Make createMCPlusBuilder accessible externally
* Remove positional InputFilename argument to bolt utlity sources
And prepare the cmake and lit for the new tests.

Vladislav Khmelevsky,
Advanced Software Technology Lab, Huawei

Reviewed By: maksfb, Amir

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

2 years ago[CMake] Handle in-tree libc++ for sanitizer tests
Petr Hosek [Tue, 25 Jan 2022 17:42:28 +0000 (09:42 -0800)]
[CMake] Handle in-tree libc++ for sanitizer tests

We have been relying on the logic for C++ ABI library for sanitizer
tests but that's incorrect since most tests require a full C++ library
and not just C++ ABI. This change tries to address this by using the
dependency on libc++ if available.

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

2 years agoFix UB in DwarfExpression::emitLegacyZExt()
Adrian Prantl [Tue, 25 Jan 2022 21:29:22 +0000 (13:29 -0800)]
Fix UB in DwarfExpression::emitLegacyZExt()

A shift-left > 63 triggers a UBSAN failure. This patch kicks the can
down the road (to the consumer) by emitting a more compact
representation of the shift computation in DWARF expressions.

Relanding (I accidentally pushed an earlier version of the patch previously).

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

2 years ago[mlir] Add ODS support for enum attributes with grouped bit cases
Jeremy Furtek [Wed, 26 Jan 2022 21:00:21 +0000 (21:00 +0000)]
[mlir] Add ODS support for enum attributes with grouped bit cases

This diff modifies the tablegen specification and code generation for
BitEnumAttr attributes in MLIR Operation Definition Specification (ODS) files.
Specifically:

- there is a new tablegen class for "none" values (i.e. no bits set)
- single-bit enum cases are specified via bit index (i.e. [0, 31]) instead of
  the resulting enum integer value
- there is a new tablegen class to represent a "grouped" bitwise OR of other
  enum values

This diff is intended as an initial step towards improving "fastmath"
optimization support in MLIR, to allow more precise control of whether certain
floating point optimizations are applied in MLIR passes. "Fast" math options
for floating point MLIR operations would (following subsequent RFC and
discussion) be specified by using the improved enum bit support in this diff.
For example, a "fast" enum value would act as an alias for a group of other
cases (e.g. finite-math-only, no-signed-zeros, etc.), in a way that is similar
to support in C/C++ compilers (clang, gcc).

Reviewed By: rriddle

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

2 years agoUpdate the Bug Life Cycle docs for the switch to GitHub issues
Aaron Ballman [Wed, 26 Jan 2022 20:54:52 +0000 (15:54 -0500)]
Update the Bug Life Cycle docs for the switch to GitHub issues

This updates the Bug Life Cycle docs now that we've switched to GitHub
issues. The intent is to retain the same general process we used to
use for triaging bugs under Bugzilla, but with the facilities we have
available in GitHub.

2 years ago[gn build] Port b1d946cbf780
LLVM GN Syncbot [Wed, 26 Jan 2022 20:46:39 +0000 (20:46 +0000)]
[gn build] Port b1d946cbf780

2 years agoRevert "Fix UB in DwarfExpression::emitLegacyZExt()"
Adrian Prantl [Wed, 26 Jan 2022 20:46:07 +0000 (12:46 -0800)]
Revert "Fix UB in DwarfExpression::emitLegacyZExt()"

This reverts commit 216002c4bb708e6d6fd1895c8ea636470961f824
while investigating bot breakage.

2 years agoAMDGPU/GlobalISel: Fold wave address into mubuf addressing modes
Matt Arsenault [Wed, 12 Jan 2022 17:02:40 +0000 (12:02 -0500)]
AMDGPU/GlobalISel: Fold wave address into mubuf addressing modes

2 years agoGlobalISel: Avoid crash on asm with lying result types
Matt Arsenault [Wed, 19 Jan 2022 22:23:57 +0000 (17:23 -0500)]
GlobalISel: Avoid crash on asm with lying result types

The physical register in the asm has the wrong type for the declared
IR. It seems to work in the DAG by extracting the 4 elements that are
defined in the IR from the register, but that isn't handled here. This
doesn't seem to be a well tested path since other mismatched cases are
crashing the DAG asm handling.

2 years ago[libcxx][test] Narrow XFAIL for tests that pass with `msvc && stdlib=msvc`
Casey Carter [Tue, 4 Jan 2022 01:01:16 +0000 (17:01 -0800)]
[libcxx][test] Narrow XFAIL for tests that pass with `msvc && stdlib=msvc`

... but fail with `msvc && stdlib=libc++`.

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

2 years ago[libcxx] [test] Fix the locale.time.put.byname/put1 testcase on Linux and Windows
Martin Storsjö [Sun, 23 Jan 2022 23:16:46 +0000 (23:16 +0000)]
[libcxx] [test] Fix the locale.time.put.byname/put1 testcase on Linux and Windows

The Windows and Glibc abbreviated form of Saturday in French locale
is "sam." with a trailing period included. Account for this in the
test reference.

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

2 years agoAMDGPU/GlobalISel: Mostly fix BFI patterns
Matt Arsenault [Wed, 19 Jan 2022 17:36:39 +0000 (12:36 -0500)]
AMDGPU/GlobalISel: Mostly fix BFI patterns

Most importantly, fixes constant bus errors in the 64-bit cases. It's
surprising to me these were even passing the selection test using
SReg_* sources. Also fixes pattern matching in the 32-bit cases, with
simple operands.

These patterns aren't working in a few cases, like with mixed SGPR
inputs. The patterns aren't looking through the SGPR->VGPR copies like
they need to. The vector cases also have some unmerges of build_vector
which are obscuring the inputs.

2 years agoAMDGPU: Add some additional test coverage for BFI matching
Matt Arsenault [Wed, 19 Jan 2022 18:45:30 +0000 (13:45 -0500)]
AMDGPU: Add some additional test coverage for BFI matching

Try to stress constant bus restriction enforcement since some of these
are broken for GlobalISel. Split the r600 test because some of these
cases don't compile (and all the ones using return values are
discarded).

2 years agoAMDGPU: Switch bfi pattern test to generated checks and add gfx10
Matt Arsenault [Wed, 19 Jan 2022 18:21:58 +0000 (13:21 -0500)]
AMDGPU: Switch bfi pattern test to generated checks and add gfx10

2 years ago[mlir] Move std.generic_atomic_rmw to the memref dialect
River Riddle [Wed, 26 Jan 2022 02:41:02 +0000 (18:41 -0800)]
[mlir] Move std.generic_atomic_rmw to the memref dialect

This is part of splitting up the standard dialect. The move makes sense anyways,
given that the memref dialect already holds memref.atomic_rmw which is the non-region
sibling operation of std.generic_atomic_rmw (the relationship is even more clear given
they have nearly the same description % how they represent the inner computation).

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

2 years ago[mlir] Move the complex support of std.constant to a new complex.constant operation
River Riddle [Tue, 25 Jan 2022 21:20:01 +0000 (13:20 -0800)]
[mlir] Move the complex support of std.constant to a new complex.constant operation

This is part of splitting up the standard dialect.

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

2 years ago[mlir:GPU] Replace reference to LLVMFuncOp with FuncOpInterface
River Riddle [Tue, 25 Jan 2022 20:00:46 +0000 (12:00 -0800)]
[mlir:GPU] Replace reference to LLVMFuncOp with FuncOpInterface

The GPU dialect currently contains an explicit reference to  LLVMFuncOp
during verification to handle the situation where the kernel has already been
converted. This commit changes that reference to instead use FunctionOpInterface,
which has two main benefits:

* It allows for removing an otherwise unnecessary dependency on the LLVM dialect
* It removes hardcoded assumptions about the lowering path and use of the GPU dialect

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

2 years ago[clang] Fix -Wsubobject-linkage after D117262
Arthur Eubanks [Wed, 26 Jan 2022 19:41:47 +0000 (11:41 -0800)]
[clang] Fix -Wsubobject-linkage after D117262

/home/buildbot/llvm-avr-linux/llvm-avr-linux/llvm/clang/lib/CodeGen/Address.h:76:7: warning: 'clang::CodeGen::Address' has a field 'clang::CodeGen::Address::A' whose type uses the anonymous namespace [-Wsubobject-linkage]

https://lab.llvm.org/buildbot/#/builders/112/builds/12047

2 years ago[lldb/API] Add ability to check if module is backed by a file on disk
Med Ismail Bennani [Wed, 26 Jan 2022 19:40:24 +0000 (20:40 +0100)]
[lldb/API] Add ability to check if module is backed by a file on disk

This patch introduces a new SBAPI method: `SBModule::IsFileBacked`

As the name suggests, it tells the user if the module's object file is
on disk or in memory.

rdar://68538278

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

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
2 years ago[InstrProf][Correlate] Improve error messages
Ellis Hoag [Tue, 25 Jan 2022 20:35:23 +0000 (12:35 -0800)]
[InstrProf][Correlate] Improve error messages

Improve the error messages when using `llvm-profdata` to correlate profiles with debug info.

Reviewed By: kyulee, phosek

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

2 years ago[clang] Add an extract-api driver option
Zixu Wang [Thu, 20 Jan 2022 18:30:56 +0000 (10:30 -0800)]
[clang] Add an extract-api driver option

This is the initial commit for the clang-extract-api RFC
<https://lists.llvm.org/pipermail/cfe-dev/2021-September/068768.html>
Add a new driver option `-extract-api` and associate it with a dummy
(for now) frontend action to set up the initial structure for
incremental works.

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

2 years ago[openmp] Disable build of old runtimes by default
Jon Chesterfield [Wed, 26 Jan 2022 19:17:30 +0000 (19:17 +0000)]
[openmp] Disable build of old runtimes by default

The old runtime is not tested by CI. Disable the build prior to the llvm-14 branch.

Reviewed By: jdoerfert

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

2 years ago[RISCV] Remove references to 'B' extension from AssemblerPredicate and SubtargetFeatu...
Craig Topper [Wed, 26 Jan 2022 18:35:53 +0000 (10:35 -0800)]
[RISCV] Remove references to 'B' extension from AssemblerPredicate and SubtargetFeature strings.

For Zba/Zbb/Zbc/Zbs I've removed the 'B' completely and used the
extension names as presented at the start of Chapter 1 of the
1.0.0 Bitmanipulation spec.

For the unratified extensions, I've replaced 'B' with 'Zb' and
otherwise left them unchanged.

Reviewed By: asb

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

2 years agoInitialize terminfo.bzl linkopts to None
jonmeow [Wed, 26 Jan 2022 19:02:20 +0000 (11:02 -0800)]
Initialize terminfo.bzl linkopts to None

The underlying issue here is that line 125 checks if linkopts was assigned (by line 120) but it's not initialized, so that becomes a crash. This was noticed by someone trying to use Docker, so no terminfo library installed.

Reviewed By: GMNGeoffrey

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

2 years agoFix UB in DwarfExpression::emitLegacyZExt()
Adrian Prantl [Tue, 25 Jan 2022 21:29:22 +0000 (13:29 -0800)]
Fix UB in DwarfExpression::emitLegacyZExt()

A shift-left > 63 triggers a UBSAN failure. This patch kicks the can
down the road (to the consumer) by emitting a more compact
representation of the shift computation in DWARF expressions.

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

2 years agoAMDGPU: Emit user sgpr count directives in text asm
Matt Arsenault [Fri, 21 Jan 2022 21:23:09 +0000 (16:23 -0500)]
AMDGPU: Emit user sgpr count directives in text asm

We were emitting these in the object file but not printing them.

2 years ago[NFC] Store Address's alignment into PointerIntPairs
Arthur Eubanks [Fri, 14 Jan 2022 00:30:29 +0000 (16:30 -0800)]
[NFC] Store Address's alignment into PointerIntPairs

This mitigates the extra memory caused by D115725.

On 32-bit arches where we only have 2 bits per PointerIntPair we fall
back to simply storing alignment separately.

Reviewed By: rnk, nikic

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

2 years ago[test][ASan][Win] Print more info when LoadLibrary fails
Arthur Eubanks [Wed, 26 Jan 2022 01:46:29 +0000 (17:46 -0800)]
[test][ASan][Win] Print more info when LoadLibrary fails

Reviewed By: hans

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

2 years ago[gn build] Make HAVE_MALLINFO2 a gn arg, default to false
Arthur Eubanks [Wed, 26 Jan 2022 17:43:44 +0000 (09:43 -0800)]
[gn build] Make HAVE_MALLINFO2 a gn arg, default to false

D117916 broke some people because some distros are still using a glibc
older than 2.33. Add gn arg llvm_have_mallinfo2 and default to false for
now.

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

2 years ago[ELF] Simplify writing the Elf_Chdr header. NFC
Fangrui Song [Wed, 26 Jan 2022 18:23:56 +0000 (10:23 -0800)]
[ELF] Simplify writing the Elf_Chdr header. NFC

And avoiding changing `size` in `writeTo`.

2 years ago[gn build] Manually port D118110
Arthur Eubanks [Wed, 26 Jan 2022 17:49:21 +0000 (09:49 -0800)]
[gn build] Manually port D118110

2 years ago[AMDGPU] SILoadStoreOptimizer: Precommit tests for merging across a swizzled access
Jay Foad [Wed, 26 Jan 2022 17:09:29 +0000 (17:09 +0000)]
[AMDGPU] SILoadStoreOptimizer: Precommit tests for merging across a swizzled access

2 years ago[Bazel] Update config.h to add the new define.
Adrian Kuegel [Wed, 26 Jan 2022 17:28:14 +0000 (18:28 +0100)]
[Bazel] Update config.h to add the new define.

2 years ago[clang][dataflow] Allow clients to disable built-in transfer functions.
Yitzhak Mandelbaum [Tue, 25 Jan 2022 20:36:14 +0000 (20:36 +0000)]
[clang][dataflow] Allow clients to disable built-in transfer functions.

These built-in functions build the (sophisticated) model of the code's
memory. This model isn't used by all analyses, so we provide for disabling it to
avoid incurring the costs associated with its construction.

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

2 years ago[clang] NFC: Use flush() idiomatically
Kirill Bobyrev [Wed, 26 Jan 2022 17:24:37 +0000 (18:24 +0100)]
[clang] NFC: Use flush() idiomatically

Using both `raw_ostream::flush()` and `raw_ostream::str()` consecutively is
redundant. The alternatives are:

- Use `raw_ostream::str()` without `raw_ostream::flush()`
- Use `raw_ostream::flush()` and then use the destination for `raw_ostream`
  writer

The latter is more idiomatic, so the fix resolves this particular case in its
favor.

Reviewed By: kadircet

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

2 years ago[lldb] Remove ConstString::StaticMemorySize
Jonas Devlieghere [Wed, 26 Jan 2022 17:10:50 +0000 (09:10 -0800)]
[lldb] Remove ConstString::StaticMemorySize

Remove ConstString::StaticMemorySize as it is unused and superseded by
GetMemoryStats. It is referenced in a bunch of doc comments but I don't
really understand why. My best guess it that the comments were
copy-pasted from ConstString::MemorySize() even though it didn't make
sense there either. The implementation of StaticMemorySize was being
called on the MemoryPool, not on the ConstString itself.

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

2 years ago[DebugInfo] Add stringLocationExp field to DIStringType
Chih-Ping Chen [Tue, 18 Jan 2022 19:54:01 +0000 (14:54 -0500)]
[DebugInfo] Add stringLocationExp field to DIStringType

DIStringType is used to encode the debug info of a character object
in Fortran. A Fortran deferred-length character object is typically
implemented as a pair of the following two pieces of info: An address
of the raw storage of the characters, and the length of the object.
The stringLocationExp field contains the DIExpression to get to the
raw storage.

This patch also enables the emission of DW_AT_data_location attribute
in a DW_TAG_string_type debug info entry based on stringLocationExp
in DIStringType.

A test is also added to ensure that the bitcode reader is backward
compatible with the old DIStringType format.

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