Markus Böck [Fri, 21 Jul 2023 05:40:10 +0000 (07:40 +0200)]
[mlir] Add opt-in default property bytecode read and write implementation
Using properties currently requires at the very least implementing four methods/code snippets:
* `convertToAttribute`
* `convertFromAttribute`
* `writeToMlirBytecode`
* `readFromMlirBytecode`
This makes replacing attributes with properties harder than it has to be: Attributes by default do not require immediately defining custom bytecode encoding.
This patch therefore adds opt-in implementations of `writeToMlirBytecode` and `readFromMlirBytecode` that work with the default implementations of `convertToAttribute` and `convertFromAttribute`. They are provided by `defvar`s in `OpBase.td` and can be used by adding:
```
let writeToMlirBytecode = writeMlirBytecodeWithConvertToAttribute;
let readFromMlirBytecode = readMlirBytecodeUsingConvertFromAttribute;
```
to ones TableGen definition.
While this bytecode encoding is almost certainly not ideal for a given property, it allows more incremental use of properties and getting something sane working before optimizing the bytecode format.
Differential Revision: https://reviews.llvm.org/D155286
LLVM GN Syncbot [Fri, 21 Jul 2023 05:54:11 +0000 (05:54 +0000)]
[gn build] Port
c3648f37d0ed
varconst [Fri, 21 Jul 2023 05:50:37 +0000 (22:50 -0700)]
[libc++][hardening] Don't trigger uncategorized assertions in the hardened mode.
The hardened mode is intended to only include security-critical,
relatively low-overhead checks that are intended to be usable in
production. By default, assertions are excluded from this mode.
Differential Revision: https://reviews.llvm.org/D155866
varconst [Sat, 15 Jul 2023 03:54:38 +0000 (20:54 -0700)]
[libc++][ranges] Implement `ranges::to`.
Differential Revision: https://reviews.llvm.org/D142335
Fangrui Song [Fri, 21 Jul 2023 05:44:23 +0000 (22:44 -0700)]
[modularize] Stabilize iteration order when processing module maps
Many diagnostics (e.g., ProblemsDuplicate.modularize,
ProblemsDisplayLists.modularize) are dependent on the iteration order of
StringMap, which is not guaranteed to be deterministic
(https://llvm.org/docs/ProgrammersManual.html#llvm-adt-stringmap-h).
clang::ModuleMap::Modules is a StringMap. For now, sort by name in
modularize.
Fangrui Song [Fri, 21 Jul 2023 04:37:50 +0000 (21:37 -0700)]
Sarif: stabilize artifacts order
StringMap iteration order is not guaranteed to be deterministic
(https://llvm.org/docs/ProgrammersManual.html#llvm-adt-stringmap-h).
Fangrui Song [Fri, 21 Jul 2023 04:17:04 +0000 (21:17 -0700)]
[Driver] -fopenmp-targets=: stabilize OrderedOffloadingToolchains value order
to make actions deterministic.
StringSet iteration order is not guaranteed to be deterministic
(https://llvm.org/docs/ProgrammersManual.html#llvm-adt-stringmap-h).
Jie Fu [Fri, 21 Jul 2023 03:41:28 +0000 (11:41 +0800)]
[lldb] Fix -Wreturn-type in RegisterInfos_x86_64_with_base_shared.cpp (NFC)
/data/llvm-project/lldb/source/Plugins/Process/Utility/RegisterInfos_x86_64_with_base_shared.cpp:319:1: error: non-void function does
not return a value in all control paths [-Werror,-Wreturn-type]
}
^
1 error generated.
Piyou Chen [Fri, 21 Jul 2023 03:19:02 +0000 (20:19 -0700)]
[RISCV] precommit for removing useless copy from undef subreg
testcase from https://github.com/llvm/llvm-project/issues/63554
Reviewed By: kito-cheng
Differential Revision: https://reviews.llvm.org/D155039
Nick Desaulniers [Fri, 21 Jul 2023 03:30:37 +0000 (20:30 -0700)]
[clang] fix for D155342
Nick Desaulniers [Fri, 21 Jul 2023 02:58:17 +0000 (19:58 -0700)]
[clang][JumpDiagnostics] ignore non-asm goto target scopes
The current behavior of JumpScopeChecker::VerifyIndirectOrAsmJumps was
to cross validate the scope of every jumping statement (goto, asm goto)
against the scope of every label (even if the label was not even a
possible target of the asm goto).
When we have multiple asm goto's with unique targets, we could trigger
false positive build errors complaining that labels that weren't even in
the asm goto's label list could not be jumped to. Example:
error: cannot jump from this asm goto statement to one of its possible targets
asm goto(""::::foo);
note: possible target of asm goto statement
bar:
^
Fixes: https://github.com/ClangBuiltLinux/linux/issues/1886
Reviewed By: void, jyu2, rjmccall
Differential Revision: https://reviews.llvm.org/D155342
Dave Lee [Tue, 11 Jul 2023 18:24:31 +0000 (11:24 -0700)]
[llvm][utils] Use literal type name for non-template data formatters (NFC)
These don't need to be regex.
Dave Lee [Fri, 14 Jul 2023 17:25:24 +0000 (10:25 -0700)]
[lldb] Delete unused LibcxxOptionalSummaryProvider (NFC)
No longer needed following refactoring in D115178.
Dave Lee [Tue, 11 Jul 2023 20:20:49 +0000 (13:20 -0700)]
[lldb] Identify Swift-implemented ObjC classes
Classes implemented in Swift can be exposed to ObjC. For those classes, the ObjC
metadata is incomplete. Specifically, the encoded types of the ivars are incomplete. As
one might expect, the Swift metadata _is_ complete. In such cases, the Swift runtime
should be consulted when determining the dynamic type of a value.
Differential Revision: https://reviews.llvm.org/D152837
Maksim Panchenko [Wed, 19 Jul 2023 23:55:32 +0000 (16:55 -0700)]
[BOLT] Improve Linux Kernel ORC reader
* Sort ORC entries in the internal table. Older Linux kernels did not
sort them in the file (only during boot time).
* Add an option to dump sorted ORC tables (--dump-orc).
* Associate entries in the internal ORC table with a BinaryFunction
even when we are not changing the function.
* If the function doesn't have ORC entry at the start, propagate ORC
state from a previous entry.
Reviewed By: Amir
Differential Revision: https://reviews.llvm.org/D155767
Fangrui Song [Fri, 21 Jul 2023 01:31:41 +0000 (18:31 -0700)]
[llvm-profdata] Stabilize iteration order for InstrProfWriter
If two functions are inserted to the same bucket, their order in the
serialized profile is dependent on StringMap iteration order, which is
not guaranteed to be deterministic.
(https://llvm.org/docs/ProgrammersManual.html#llvm-adt-stringmap-h).
Use a sort like we do in writeText.
Konstantin Varlamov [Fri, 21 Jul 2023 00:41:37 +0000 (17:41 -0700)]
[libc++][hardening][NFC] Rename `HardenedMode.rst` to `Hardening.rst`.
This addresses a comment from https://reviews.llvm.org/D154997.
Philip Reames [Thu, 20 Jul 2023 23:46:45 +0000 (16:46 -0700)]
[RISCV] Expand memset.inline test coverage [nfc]
Add coverage for unaligned overlap cases, and for vector stores.
Note that the vector memset here is coming from store combining, not memset lowering.
Jie Fu [Thu, 20 Jul 2023 23:59:30 +0000 (07:59 +0800)]
[clang][test] Remove unused variable 'SM' (NFC)
/data/llvm-project/clang/unittests/AST/DeclTest.cpp:153:18: error: unused variable 'SM' [-Werror,-Wunused-variable]
SourceManager &SM = Ctx.getSourceManager();
^
1 error generated.
Matt Arsenault [Wed, 19 Jul 2023 12:39:05 +0000 (08:39 -0400)]
AMDGPU: Add flag to disable fdiv processing in IR pass
We kind of have to have multiple implementations of fdiv split between
the two selectors with some pre-processing. Add yet another test to
check for consistency of interpretation of flag combinations. We have
quite a bit of test redundancy here already, but there are so many
possible interesting permutations it's unwieldy to cover every detail
in any one of them. We have a number of overlapping fdiv tests but
it's hard to follow everything going on as it is.
Matt Arsenault [Mon, 17 Jul 2023 15:11:25 +0000 (11:11 -0400)]
AMDGPU: Expand rsq testing to cover contract flag
The 1.0/sqrt(x) -> rsq(x) fold increases precision and probably needs
a contract flag.
LLVM GN Syncbot [Thu, 20 Jul 2023 23:36:14 +0000 (23:36 +0000)]
[gn build] Port
49b3c3355f9c
Christopher Di Bella [Thu, 20 Jul 2023 22:31:48 +0000 (22:31 +0000)]
[clang] adds `conceptDecl` as an ASTMatcher
Closes #63934
Differential Revision: https://reviews.llvm.org/D155549
Jeffrey Tan [Mon, 17 Jul 2023 23:15:06 +0000 (16:15 -0700)]
[lldb][x86_64] Support fs_base/gs_base register in Linux
Summary:
[lldb][x86_64] This patch adds fs_base/gs_base support for Linux x86_64.
Originally, I plan to split the diff into two parts, one to refactoring lldb_xxx_x86_64 => x86_64::lldb_xxx across code base and the other one for adding fs_base/gs_base, but it turns out to be a non-trivial effort to split and very error prone so I decided to keep a single diff to get feedback.
GDB supports fs_base/gs_base registers while LLDB does not. Since both linux coredump note section and ptrace
supports them it is a missing feature.
For context, this is a required feature to support getting pthread pointer on linux from both live and dump debugging.
See thread below for details:
https://discourse.llvm.org/t/how-to-get-pthread-pointer-from-lldb/70542/2?u=jeffreytan81
Implementation wise, we have initially tried `#ifdef` approach to reuse the code but it is introducing very tricky bugs and proves
hard to maintain. Instead the diff completely separates the registers between x86_64 and x86_64_with_base so that non-linux related
implementations can use x86_64 registers while linux uses x86_64_with_base.
Here are the list of changes done in the patch:
* Registers in lldb-x86-register-enums.h are separated into two: x86_64 and x86_64_with_base
* fs_base/gs_base are added into x86_64_with_base
* All linux files are change to use x86_64::lldb_xxx => x86_64_with_base::lldb_xxx
* Support linux elf-core:
* A new RegisterContextLinuxCore_x86_64 class is added for ThreadElfCore
* RegisterContextLinuxCore_x86_64 overrides and uses its own register set supports fs_base/gs_base
* RegisterInfos_x86_64_with_base/RegisterInfos_x86_64_with_base_shared ared added to provide g_contained_XXX/g_invalidate_XXX and RegInfo related code sharing.
* `RegisterContextPOSIX_x86 ::m_gpr_x86_64` seems to be unused so I removed it.
* `NativeRegisterContextDBReg_x86::GetDR()` is overridden in `NativeRegisterContextLinux_x86_64` to make watchpoint work.
Reviewers:clayborg,labath,jingham,jdoerfert,JDevlieghere,kusmour,GeorgeHuyubo
Subscribers:
Tasks:
Tags:
Differential Revision: https://reviews.llvm.org/D155256
Matt Arsenault [Tue, 18 Jul 2023 21:46:31 +0000 (17:46 -0400)]
AMDGPU: Fold fsub [+-0] into fneg when folding source modifiers
This isn't always folded to fneg for a freestanding fsub depending on
the denormal mode. When matching source modifiers, we're implicitly
canonicalizing the input so we can fold it here.
Doesn't bother handling the VOP3P case since it's only relevant with
DAZ, which nobody really uses with f16.
For f64, tests show an existing bug where DAGCombiner tries to respect
the denormal mode for fsub -0, x, but not after it's lowered to fadd
-0, (fneg x). Either the fold is wrong or we shouldn't restrict the
fsub case based on the denormal mode.
https://reviews.llvm.org/D155652
Matt Arsenault [Thu, 20 Jul 2023 23:11:23 +0000 (19:11 -0400)]
AMDGPU: Regenerate test checks
Mostly a workaround for recent reverts in update_test_checks
wren romano [Wed, 19 Jul 2023 23:55:22 +0000 (16:55 -0700)]
[mlir][sparse] Improve `DimLvlMapParser`'s handling of variable bindings
This commit comprises a number of related changes:
(1) Reintroduces the semantic distinction between `parseVarUsage` vs `parseVarBinding`, adds documentation explaining the distinction, and adds commentary to the one place that violates the desired/intended semantics.
(2) Improves documentation/commentary about the forward-declaration of level-vars, and about the meaning of the `bool` parameter to `parseLvlSpec`.
(2) Removes the `VarEnv::addVars` method, and instead has `DimLvlMapParser` handle the conversion issues directly. In particular, the parser now stores and maintains the `{dims,lvls}AndSymbols` arrays, thereby avoiding the O(n^2) behavior of scanning through the entire `VarEnv` for each `parse{Dim,Lvl}Spec` call. Unfortunately there still remains another source of O(n^2) behavior, namely: the `AsmParser::parseAffineExpr` method will copy the `DimLvlMapParser::{dims,lvls}AndSymbols` arrays into `AffineParser::dimsAndSymbols` on each `parse{Dim,Lvl}Spec` call; but fixing that would require extensive changes to `AffineParser` itself.
Depends On D155532
Reviewed By: Peiming
Differential Revision: https://reviews.llvm.org/D155533
Jon Chesterfield [Thu, 20 Jul 2023 22:44:32 +0000 (23:44 +0100)]
[libc] Fix line reporting in assertion failure
Was passing zeros to the string print function.
Reviewed By: jhuber6
Differential Revision: https://reviews.llvm.org/D155899
Matt Arsenault [Tue, 18 Jul 2023 21:52:35 +0000 (17:52 -0400)]
AMDGPU: Add baseline test for folding fsub into fneg modifiers
Jason Molenda [Thu, 20 Jul 2023 22:14:07 +0000 (15:14 -0700)]
Remove IncrementFalseAlarmsAndReviseHitCount, unused ivars
Reading through the Watchpoint class, I found this method
that wasn't being used properly, and a couple of ivars that
weren't used at all. Cleanup.
Differential Revision: https://reviews.llvm.org/D155768
Matt Arsenault [Thu, 13 Jul 2023 12:45:46 +0000 (08:45 -0400)]
clang/HIP: Directly use f32 exp and log builtins
These are now lowered correctly by the backend, and you get proper
fast math flags when directly handled.
Matt Arsenault [Thu, 20 Jul 2023 21:43:27 +0000 (17:43 -0400)]
AMDGPU: Filter out contract flags when lowering exp
It is unsafe to contract the fsub into the fmul. It also increases
code size by duplicating a constant.
Matt Arsenault [Thu, 20 Jul 2023 21:38:25 +0000 (17:38 -0400)]
AMDGPU: Add some new baseline tests for exp lowering
Mircea Trofin [Thu, 20 Jul 2023 21:37:22 +0000 (14:37 -0700)]
[nfc] Renamed ICallPromotionFunc to InidrectCallPromoter
For (subjectively) more clarity; also updated the comment describing it.
Differential Revision: https://reviews.llvm.org/D155888
Philip Reames [Thu, 20 Jul 2023 21:59:59 +0000 (14:59 -0700)]
[RISCV] Add memset.inline test coverage with and without V [nfc]
LLVM GN Syncbot [Thu, 20 Jul 2023 21:50:59 +0000 (21:50 +0000)]
[gn build] Port
37e5baf318b1
Michael Jones [Thu, 20 Jul 2023 21:47:02 +0000 (14:47 -0700)]
[libc][NFC] mark vprintf functions as inline
The functions are in a header, and so must be marked inline to avoid
symbol conflicts.
Differential Revision: https://reviews.llvm.org/D155892
Nikolas Klauser [Thu, 20 Jul 2023 21:45:19 +0000 (14:45 -0700)]
[libc++][PSTL] Implement std::sort
Reviewed By: #libc, ldionne
Spies: ldionne, libcxx-commits, mgrang
Differential Revision: https://reviews.llvm.org/D152860
Fangrui Song [Thu, 20 Jul 2023 21:37:54 +0000 (14:37 -0700)]
[unittest] Improve OpenMPIRBuilderTest after D149162
Make it less sensitive to omp_offload.info operands order and improve
the failure diagnostic.
Caught by D155789
Mircea Trofin [Thu, 13 Jul 2023 15:59:41 +0000 (08:59 -0700)]
[nfc] small maintainability IndirectCallPromotion changes
- we can remove the `Module` field, it's obtainable from `F` and used in
only one place
- a few fields can be `const`-ed, thus enforcing compile-time
initialization checking (and we don't need to support `operator=`)
Differential Revision: https://reviews.llvm.org/D155212
Fazlay Rabbi [Tue, 18 Jul 2023 19:51:53 +0000 (12:51 -0700)]
[OpenMP][Reduction] Allow PLUS (+) operator on reduction clauses in OMP > 52
Currently, clang gives an incorrect reduction identifier error for the PLUS
operator for OpenMP version > 52. But, PLUS operator is allowed in OpenMP
version > 52. This revision fixes this issue and also modified the error
messages to show the correct expected operators in the message based on the OpenMP
version used (prior to OMP 6.0 and since OMP 6.0).
Test Src:
void foo() {
int a = 0 ;
#pragma omp parallel reduction(+:a)
;
#pragma omp parallel reduction(-:a)
;
}
Before this revision:
$ clang -fopenmp -fopenmp-version=60 test.c -c
test.c:3:34: error: incorrect reduction identifier, expected one of '+', '-', '*', '&', '|', '^', '&&', '||', 'min' or 'max' or declare reduction for type 'int'
3 | #pragma omp parallel reduction(+:a)
| ^
test.c:5:34: error: incorrect reduction identifier, expected one of '+', '-', '*', '&', '|', '^', '&&', '||', 'min' or 'max' or declare reduction for type 'int'
5 | #pragma omp parallel reduction(-:a)
| ^
2 errors generated.
Wit this revision:
$ clang -fopenmp -fopenmp-version=60 test.c -c
test.c:5:34: error: incorrect reduction identifier, expected one of '+', '*', '&', '|', '^', '&&', '||', 'min' or 'max' or declare reduction for type 'int'
5 | #pragma omp parallel reduction(-:a)
|
1 error generated.
Differential Revision: https://reviews.llvm.org/D155635
varconst [Thu, 20 Jul 2023 21:11:31 +0000 (17:11 -0400)]
[mlir][spirv] Extract more ops from the main implementation file. NFC.
Continue to work outlined in D155747 and split the main SPIR-V ops
implementation file into a few smaller and quicker to compile files.
Move control flow and memory ops to their own implementation files.
Create new `.cpp` files for tablegened code.
After this change, the `SPIRVOps.cpp` is 2k LoC-long and takes a
reasonable amount of time to compile.
Reviewed By: antiagainst
Differential Revision: https://reviews.llvm.org/D155883
Christopher Ferris [Wed, 19 Jul 2023 20:26:38 +0000 (13:26 -0700)]
[scudo] Clean up tests.
Modify the tests so that all clang warnings can be turned up to high.
Fix all places flagged by -Wconversion.
Fix a few unused variables not marked with UNUSED.
For the memtag testing, only compile some tests for 64 bit since
compiling them on 32 bit leads to warnings/errors. All of the tests
are already skipped on 32 bit OSes, so this will not affect any
real tests.
Reviewed By: Chia-hungDuan
Differential Revision: https://reviews.llvm.org/D155749
Paul Kirth [Thu, 20 Jul 2023 20:53:08 +0000 (20:53 +0000)]
Revert "[gold] Add preliminary FatLTO support to the Gold plugin"
This reverts commit
421e4026111315d002879b1e7a0cf3aacd00f488.
One of the test needs a requires line, but we've also seen some issues
for downstream projects that may need coordination, so I'm reverting
this for until we can address those issues. see
https://reviews.llvm.org/D152973#4520240 for context.
Philip Reames [Thu, 20 Jul 2023 20:34:22 +0000 (13:34 -0700)]
[RISCV] Revise check names for unaligned memory op tests [nfc]
This has come up a few times in review; the current ones seem to be universally confusing. Even I as the original author of most of these get confused. Switch to using the SLOW/FAST naming used by x86, hopefully that's a bit clearer.
Mariusz Borsa [Thu, 20 Jul 2023 19:54:49 +0000 (12:54 -0700)]
[Sanitizers][Darwin][Test] XFAIL symbolize_pc test on Darwin/TSan+UBSan
Louis Dionne [Tue, 18 Jul 2023 22:02:09 +0000 (18:02 -0400)]
[libc++] Make sure we use the libdispatch backend on Apple platforms
The Apple.cmake cache wasn't set up properly, so we wouldn't enable
the libdispatch backend by default on Apple platforms. This patch
fixes the issue and adds a test.
We also need to make various drive-by fixes:
- Drop the usage of std::vector in libdispatch.h to avoid changing
the transitive includes only on Apple platforms.
- Fix includes
- Use __construct at since construct_at is unavailable in C++17
- Get rid of the (unused) __get_memory_resource function since that
adds a back-deployment requirement and we don't use it right now.
- Fix bugs in the chunking logic around boundary conditions.
Differential Revision: https://reviews.llvm.org/D155649
Ian Anderson [Wed, 12 Jul 2023 21:23:26 +0000 (14:23 -0700)]
[libc++][Modules] Make top level modules for all C++ headers with OS/clang versions
The headers that include_next compiler and OS headers need to be in different top level modules in order to avoid module cycles. e.g. libc++'s stdlib.h will #include_next stdlib.h from the compiler and then the C library. Either of those are likely to include stddef.h, which will come back up to the libc++ module map and create a module cycle. Putting stdlib.h and stddef.h (and the rest of the C standard library headers) in top level modules resolves this by letting the order go cxx_stdlib_h -> os_stdlib_h -> cxx_stddef_h -> os_stddef_h.
All of those headers' dependencies then need to be moved into top level modules themselves to avoid module cycles between the new top level level cstd modules. This starts to get complicated, as the libc++ C headers, by standard, have to include many of the C++ headers, which include the private detail headers, which are intertwined. e.g. some `__algorithm` headers include `__memory` headers and vice versa.
Make top level modules for all of the libc++ headers to easily guarantee that the modules aren't cyclic.
Add enough module exports to fix `check-cxx` and `run-buildbot generic-modules`.
`__stop_token/intrusive_shared_ptr.h` uses `__atomic/atomic.h` but has no include path to it. Add that include.
`math.h` absorbs `bits/atomic_wide_counter.h` on some platforms that don't have modules, work around that by including `math.h` in `__threading_support`.
<mutex> doesn't actually require threads, there are a few pieces like once_flag that work without threads. Remove the requirement from its module.
AIX is no longer able to support modular builds.
Reviewed By: ldionne, #libc
Differential Revision: https://reviews.llvm.org/D144322
Antonio Frighetto [Wed, 5 Jul 2023 14:34:09 +0000 (16:34 +0200)]
[InstCombine] Fold binop of `select` and cast of `select` condition
Simplify binary operations, whose operands involve a `select`
instruction and a cast of the `select` condition. Specifically,
the binop is canonicalized into a `select` with folded arguments
as follows:
(Binop (zext C), (select C, T, F))
-> (select C, (binop 1, T), (binop 0, F))
(Binop (sext C), (select C, T, F))
-> (select C, (binop -1, T), (binop 0, F))
Proofs: https://alive2.llvm.org/ce/z/c_JwwM
Differential Revision: https://reviews.llvm.org/D153963
Antonio Frighetto [Thu, 20 Jul 2023 19:31:28 +0000 (19:31 +0000)]
[InstCombine] Introduce tests for D153963
Introduce test cases for folding binops of
`select` and cast of the `select` condition.
Differential Revision: https://reviews.llvm.org/D155510
Amanda Tang [Thu, 13 Jul 2023 22:54:30 +0000 (22:54 +0000)]
[ODS] Use Adaptor Trait for Shaped Type Inference
Author inferReturnTypeComponents methods with the Op Adaptor by using the InferShapedTypeOpAdaptor.
Reviewed By: jpienaar
Differential Revision: https://reviews.llvm.org/D155243
Aaron Ballman [Thu, 20 Jul 2023 19:10:02 +0000 (15:10 -0400)]
Speculatively fix Clang build bots
This is intended to address the issues found in:
https://lab.llvm.org/buildbot/#/builders/192/builds/3337
https://lab.llvm.org/buildbot/#/builders/124/builds/7968
Andrzej Warzynski [Thu, 20 Jul 2023 18:57:01 +0000 (18:57 +0000)]
[mlir][test] Add emulator to the mlir-cpu-runner invocation
In https://reviews.llvm.org/D146917, MLIR's LIT configuration was
updated to allow us to use `mlir-cpu-runner` to run Arm SVE integration
tests. That update broke the following buildbot that doesn't support
SVE:
https://lab.llvm.org/buildbot/#/builders/179/builds/6704
While that bot doesn't support SVE, it can run SVE tests under
emulation. This patch makes sure that whenever an Arm emulator is set
(via `RM_EMULATOR_EXECUTABLE` CMake variable), it is used to run both
`lli` _and_ `mlir-cpu-runner`.
I am sending this without a review as it's a rather trivial change and I
want to quickly fix the spurious bot failure.
CaprYang [Thu, 20 Jul 2023 18:53:56 +0000 (14:53 -0400)]
[clang][NFC] Use a more accurate size type in the new operation
This prevents issues when PointerWidth and the SizeType width are not same.
Differential Revision: https://reviews.llvm.org/D152160
Alexander Yermolovich [Thu, 20 Jul 2023 18:51:06 +0000 (11:51 -0700)]
[BOLT][DWARF] Replace MD5 with hash_combine
Slight performance improvement, based on perf.
Collected on clang-17 built with DWARF4 + split dwarf.
MD5
8:46.50 real, 713.38 user, 64.19 sys, 0 amem,
41933136 mmem
8:27.44 real, 708.55 user, 63.83 sys, 0 amem,
41906576 mmem
8:40.37 real, 724.63 user, 62.56 sys, 0 amem,
42319572 mmem
hash_combine
8:03.99 real, 681.92 user, 60.04 sys, 0 amem,
42459204 mmem
8:02.92 real, 685.20 user, 62.56 sys, 0 amem,
41879164 mmem
7:57.85 real, 690.27 user, 60.12 sys, 0 amem,
41806240 mmem
Reviewed By: maksfb
Differential Revision: https://reviews.llvm.org/D155764
Alexander Yermolovich [Thu, 20 Jul 2023 18:47:36 +0000 (11:47 -0700)]
[BOLT][DWARF] Fix performance regression running BOLT on binaries build with DWARF4
In one of the previous diffs LocBuffer was changed to pass by value. This lead to
performance regression running BOLT on binaries with DWARF4 split dwarf.
Reviewed By: maksfb
Differential Revision: https://reviews.llvm.org/D155763
Giuseppe Rossini [Thu, 20 Jul 2023 18:24:03 +0000 (18:24 +0000)]
[mlir][AMDGPU] Define wrappers for WMMA matrix ops
Wave Matrix Multiply Accumulate (WMMA) is the instruction to accelerate
matrix multiplication on RDNA3 architectures. LLVM already provides a
set of intrinsics to generate wmma instructions. This change uses those
intrinsics to enable the feature in MLIR.
Reviewed By: krzysz00
Differential Revision: https://reviews.llvm.org/D152451
Louis Dionne [Thu, 20 Jul 2023 18:13:12 +0000 (14:13 -0400)]
[libc++][NFC] Fix synopsis comments in cout tests
Michael Jones [Tue, 27 Jun 2023 20:12:15 +0000 (13:12 -0700)]
[libc] Move printf writer to new design
The new printf writer design focuses on optimizing the fast path. It
inlines any write to a buffer or string, and by handling buffering
itself can more effectively work with both internal and external file
implementations. The overflow hook should allow for expansion to
asprintf with minimal extra code.
Reviewed By: sivachandra
Differential Revision: https://reviews.llvm.org/D153999
Fangrui Song [Thu, 20 Jul 2023 17:47:47 +0000 (10:47 -0700)]
[wasm-ld] Switch to xxh3_64bits
Similar to recent changes to ELF (e.g., D154813), Mach-O, and COFF to
improve hashing performance.
Reviewed By: dschuff
Differential Revision: https://reviews.llvm.org/D155752
Aaron Ballman [Thu, 20 Jul 2023 17:27:39 +0000 (13:27 -0400)]
Change a test case to be more generic; NFC
This amends
4a100690461022625dc5d2a21e2e028a926149d9 to address the
issue found by:
https://lab.llvm.org/buildbot/#/builders/188/builds/32658
Jonas Devlieghere [Sat, 15 Jul 2023 00:06:12 +0000 (17:06 -0700)]
[lldb] Skip unsupported CTF types
This ensures we we don't crash when parsing a type that references an
unsupported type.
Slava Zakharin [Thu, 20 Jul 2023 16:31:38 +0000 (09:31 -0700)]
[flang][hlfir] Avoid expr buffer reuse when end_associate may cycle.
If end_associate may execute more times than the expr value producer,
then it cannot take ownership of the expr buffer. Otherwise, it may
result in double-free errors.
Note that the LIT test exposes a different issue with fir.alloca
inside the do-loop produced for hlfir.elemental. This may cause
out-of-stack conditions in valid Fortran programs that are not expected
to run out of stack. I will create an issue for this.
Reviewed By: tblah
Differential Revision: https://reviews.llvm.org/D155778
varconst [Thu, 20 Jul 2023 17:13:54 +0000 (10:13 -0700)]
[libc++][hardening] Categorize most assertions inside the container classes.
This introduces:
- `_LIBCPP_ASSERT_VALID_INPUT_RANGE`;
- `_LIBCPP_ASSERT_VALID_CONTAINER_ACCESS`;
- `_LIBCPP_ASSERT_VALID_ITERATOR_ACCESS`;
- `_LIBCPP_ASSERT_VALID_ALLOCATOR`;
- `_LIBCPP_ASSERT_INTERNAL`.
Differential Revision: https://reviews.llvm.org/D155349
Arthur Eubanks [Thu, 20 Jul 2023 17:06:24 +0000 (10:06 -0700)]
[test][llvm-reduce] Remove implicit-check-not in reduce-linkage.ll
Or else if the test path contains "internal" the test will fail.
The test is already testing that "internal" gets removed in the CHECK lines.
Rashmi Mudduluru [Wed, 12 Jul 2023 22:04:45 +0000 (15:04 -0700)]
[WIP][-Wunsafe-buffer-usage] Handle lambda expressions within a method.
Differential Revision: https://reviews.llvm.org/D150386
Aaron Ballman [Thu, 20 Jul 2023 15:04:04 +0000 (11:04 -0400)]
Fix a failing assertion when emitting a note diagnostic
When noting the previous declaration for a builtin, the diagnostic
expects two arguments, but none were being passed. We now pass
arguments for the note (and the arguments are unused for several of the
possible notes we emit, but that is something the diagnostic engine is
fine with).
Fixes https://github.com/llvm/llvm-project/issues/63967
Piotr Zegar [Thu, 20 Jul 2023 16:31:34 +0000 (16:31 +0000)]
[clang-tidy][NFC] Fix link in release notes
Correct link to modernize-loop-convert check in
release notes entry.
Joseph Huber [Wed, 19 Jul 2023 16:00:34 +0000 (11:00 -0500)]
[libc] Warn on use of global constructors in `libc`
Clang supports the `-Wglobal-constructors` flag which will indicate if a
global constructor is being used. The current goal in `libc` is to make
the constructors `constexpr` to prevent this from happening with
straight construction. However, there are many other cases where we can
emit a constructor that this won't catch. This should give warning if
someone accidentally introduces a global constructor.
Reviewed By: michaelrj
Differential Revision: https://reviews.llvm.org/D155721
Mark de Wever [Thu, 20 Jul 2023 16:26:25 +0000 (18:26 +0200)]
[libc++][print] Disables tests with (hw)asan.
Next to sanitizer-aarch64-linux-bootstrap-msan it appears asan and
hwasan are broken on aarch64. To unbreak the CI disable these two
sanitizer checks too.
The breakage was introduced by D150044.
Jingu Kang [Thu, 20 Jul 2023 16:12:25 +0000 (17:12 +0100)]
Revert "[MachineLICM] Handle Subloops"
This reverts commit
50dd383d08670960540fecb4b48c0f0429fbfba3.
Nikita Popov [Thu, 20 Jul 2023 16:07:41 +0000 (18:07 +0200)]
Revert "[IR] Mark add constant expressions as undesirable"
This reverts commit
f8a36d8c3e264c4fccf8058e699201a452ea7bb7.
I believe this is causing an assertion failure on the
sanitizer-x86_64-linux buildbot:
clang++: /b/sanitizer-x86_64-linux/build/llvm-project/llvm/include/llvm/Support/Casting.h:578: decltype(auto) llvm::cast(From *) [To = llvm::BinaryOperator, From = llvm::Value]: Assertion `isa<To>(Val) && "cast<Ty>() argument of incompatible type!"' failed.
#10 0x000055bdd7e82408 canonicalizeLogicFirst(llvm::BinaryOperator&, llvm::IRBuilder<llvm::TargetFolder, llvm::IRBuilderCallbackInserter>&) /b/sanitizer-x86_64-linux/build/llvm-project/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp:2131:5
#11 0x000055bdd7e80183 llvm::InstCombinerImpl::visitAnd(llvm::BinaryOperator&) /b/sanitizer-x86_64-linux/build/llvm-project/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp:2661:20
Likely the code is encountering a constant expression in a case it
didn't before.
Yaxun (Sam) Liu [Thu, 20 Jul 2023 14:53:34 +0000 (10:53 -0400)]
Reland "[CUDA][HIP] Use the same default language std as C++""
Reland after fixing regression in lldb.
Differential Revision: https://reviews.llvm.org/D155539
Corentin Jabot [Thu, 20 Jul 2023 15:53:52 +0000 (17:53 +0200)]
[Clang] Fix failing test caused by non-portable diag message
Jingu Kang [Wed, 19 Jul 2023 11:07:18 +0000 (12:07 +0100)]
[MachineLICM] Handle Subloops
Following discussion on https://reviews.llvm.org/D154205, make MachineLICM pass
handle subloops with only visiting outmost loop's blocks once.
Differential Revision: https://reviews.llvm.org/D154205
Yingwei Zheng [Thu, 20 Jul 2023 15:21:36 +0000 (23:21 +0800)]
[ConstraintElim] Store the triple Pred + LHS + RHS in ReproducerEntry instead of CmpInst + Not
This patch represents a condition with `Pred + LHS + RHS` in ReproducerEntry instead of `CmpInst + Not`.
It avoids creating temporary ICmpInsts in D155412.
Reviewed By: nikic, fhahn
Differential Revision: https://reviews.llvm.org/D155782
Craig Topper [Thu, 20 Jul 2023 15:14:50 +0000 (08:14 -0700)]
[RISCV] Remove Opcode field from RVInst. Assign Inst{6-0} directly. NFC
Most places assign Opcode right after assigning every other bit in
Inst. I don't think treating Opcode separately adds much value. It
doesn't hide what bits belong to the opcode since every other bits is
listed.
This makes RVInst consistent with RVInst16 subclasss which already
assign Inst{1-0} directly.
Reviewed By: asb, wangpc
Differential Revision: https://reviews.llvm.org/D155797
Craig Topper [Thu, 20 Jul 2023 15:14:41 +0000 (08:14 -0700)]
[RISCV] Remove unused Opcode field from RVInst16. NFC
Unlike RVInst which also has an Opcode field, all of the subclasseso
of RVInst16 assign Inst{1-0} directly.
Reviewed By: asb, wangpc
Differential Revision: https://reviews.llvm.org/D155791
Jakub Kuderski [Thu, 20 Jul 2023 15:13:51 +0000 (11:13 -0400)]
[mlir][spirv] Extract Atomic/Cast/Group op implementation. NFC.
Continue to work outlined in D155747 and split the main SPIR-V ops
implementation file into a few smaller and quicker to compile files.
This organization matches the op definition organizaion in `.td` files.
In this patch, extract atomic, cast/conversion, and group op
implementation into separate files.
Reviewed By: antiagainst
Differential Revision: https://reviews.llvm.org/D155777
Craig Topper [Thu, 20 Jul 2023 15:03:59 +0000 (08:03 -0700)]
[RISCV] Order the RISCVInstrInfo*.td includes for standard extensions into logical groups. NFC
There are some ordering dependency between these files.
-F must be included before D, Zfh, and Zfa. I recently suggested Zfbfmin
should be after Zfh.
-V must be before Zvk.
-Zc must be after Zb since Zbb instructions can be compressed.
So I've grouped all the scalar FP together. The vector together.
And put the compressed instructions at the end.
Reviewed By: asb, wangpc
Differential Revision: https://reviews.llvm.org/D155780
Benjamin Kramer [Thu, 20 Jul 2023 15:05:28 +0000 (17:05 +0200)]
[bazel] Fix dependency path
Benjamin Kramer [Thu, 20 Jul 2023 15:02:50 +0000 (17:02 +0200)]
[bazel][clang] Add missing dependency for
8b5d3ba829c162fd4890fd65a4629ce0715825ee
Jingu Kang [Tue, 18 Jul 2023 12:52:20 +0000 (13:52 +0100)]
[AArch64] Reuse larger DUPLANE if available
As combining DUP, try to reuse larger DUPLANELANE.
Differential Revision: https://reviews.llvm.org/D155592
Timm Bäder [Thu, 20 Jul 2023 14:38:32 +0000 (16:38 +0200)]
[clang][Interp] Provide required c++14 warnings
This doesn't show up in standards after c++14.
Sergio Afonso [Thu, 20 Jul 2023 14:38:32 +0000 (15:38 +0100)]
[Flang][OpenMP] Fix unit test using AMDGPU triple without requiring it
Ingo Müller [Mon, 17 Jul 2023 10:26:33 +0000 (10:26 +0000)]
[mlir][transform][python] Add extended ApplyPatternsOp.
This patch adds a mixin for ApplyPatternsOp to _transform_ops_ext.py
with syntactic sugar for construction such ops. Curiously, the op did
not have any constructors yet, probably because its tablegen definition
said to skip the default builders. The new constructor is thus quite
straightforward. The commit also adds a refined `region` property which
returns the first block of the single region.
Reviewed By: ftynse
Differential Revision: https://reviews.llvm.org/D155435
Ingo Müller [Thu, 20 Jul 2023 10:13:55 +0000 (10:13 +0000)]
[mlir][linalg][transform] Rename ApplyPatternsOp.{region => patterns}.
This gives the region a more meaningful name. The topic came up in a
discussion on https://reviews.llvm.org/D155435, where the name `region`
would have led to a situation where a convenience accessor called
`region` (after the ODS name) would have returned a Block.
Reviewed By: ftynse
Differential Revision: https://reviews.llvm.org/D155810
Ingo Müller [Wed, 19 Jul 2023 15:31:23 +0000 (15:31 +0000)]
[mlir][transform][gpu][python] Add MapForallToBlocks mix-in.
This patch adds a mix-in class for MapForallToBlocks with overloaded
constructors. This makes it optional to provide the return type of the
op, which is defaulte to `AnyOpType`.
Reviewed By: ftynse
Differential Revision: https://reviews.llvm.org/D155717
Timm Bäder [Thu, 20 Jul 2023 14:18:45 +0000 (16:18 +0200)]
[clang][Interp] Add missing static_assert messages
Kevin P. Neal [Thu, 20 Jul 2023 13:51:50 +0000 (09:51 -0400)]
[FPEnv][RISCV] Correct strictfp tests.
Correct RISC-V strictfp tests to follow the rules documented in the LangRef:
https://llvm.org/docs/LangRef.html#constrained-floating-point-intrinsics
Mostly these tests just needed the strictfp attribute on function definitions.
I've also removed the strictfp attribute from uses of the constrained
intrinsics because it comes by default since D154991, but I only did this
in tests I was changing anyway.
Test changes verified with D146845.
Sergio Afonso [Thu, 1 Jun 2023 16:38:33 +0000 (17:38 +0100)]
[MLIR][OpenMP][OMPIRBuilder] Use target triple to initialize `IsGPU` flag
This patch modifies the construction of the `OpenMPIRBuilder` in MLIR to
initialize the `IsGPU` flag using target triple information passed down from
the Flang frontend. If not present, it will default to `false`.
This replicates the behavior currently implemented in Clang, where the
`CodeGenModule::createOpenMPRuntime()` method creates a different
`CGOpenMPRuntime` instance depending on the target triple, which in turn has an
effect on the `IsGPU` flag of the `OpenMPIRBuilderConfig` object.
Differential Revision: https://reviews.llvm.org/D151903
Timm Bäder [Sun, 30 Apr 2023 14:20:20 +0000 (16:20 +0200)]
[clang][Interp] Fix compound assign operator evaluation order
We need to evaluated the RHS before the LHS.
Differential Revision: https://reviews.llvm.org/D149550
Florian Hahn [Thu, 20 Jul 2023 13:56:18 +0000 (14:56 +0100)]
[IVUsers] Check getExpr result in findAddRecForLoop.
This fixes a crash if the SCEV for the use isn't invertible and nullptr
is returned.
Fixes https://github.com/llvm/llvm-project/issues/63840
Aaron Ballman [Thu, 20 Jul 2023 13:53:02 +0000 (09:53 -0400)]
Update NATVIS visualizers for Clang
This fixes issues with TemplateTypeParmType and TemplateTypeParmDecl.
Timm Bäder [Thu, 4 May 2023 05:29:57 +0000 (07:29 +0200)]
[clang][Interp] Implement __builtin_strcmp
Make our Function class keep a list of parameter offsets so we can
simply get a parameter by index when evaluating builtin functions.
Differential Revision: https://reviews.llvm.org/D149816
Jake Egan [Thu, 20 Jul 2023 13:44:14 +0000 (09:44 -0400)]
Implement -frecord-command-line for XCOFF integrated assembler path
The patch D153600 implemented `-frecord-command-line` for the XCOFF direct assembly path. This patch adds support for the XCOFF integrated assembly path.
Reviewed By: scott.linder
Differential Revision: https://reviews.llvm.org/D154921
Joseph Huber [Thu, 20 Jul 2023 13:31:37 +0000 (08:31 -0500)]
[libc] Add an override option for specifying the loader implementation
There are some cases when testing we want to override the logic for not
building tests if the loader is not present. This allows users to
specify an external binary that fulfils the same duties which will force
the tests to be built even without meeting the dependencies.
Reviewed By: JonChesterfield
Differential Revision: https://reviews.llvm.org/D155837
Alex Bradbury [Thu, 20 Jul 2023 13:35:55 +0000 (14:35 +0100)]
[RISCV][NFC] Get rid of additional unneeded static_cast around RISCVSubtarget
Some similar cases to
60152f1983336e709.
Timm Bäder [Tue, 9 May 2023 17:38:37 +0000 (19:38 +0200)]
[clang][Interp] Add more shift error checking
Differential Revision: https://reviews.llvm.org/D150209
Timm Bäder [Tue, 11 Jul 2023 07:47:03 +0000 (09:47 +0200)]
[clang][Interp] Call dtor of Floating values
The APFloat might heap-allocate some memory, so we need to call its
destructor.
Differential Revision: https://reviews.llvm.org/D154928