Fangrui Song [Wed, 16 Mar 2022 02:24:41 +0000 (19:24 -0700)]
[ELF] Move section assignment from initializeSymbols to postParse
https://discourse.llvm.org/t/parallel-input-file-parsing/60164
initializeSymbols currently sets Defined::section and handles non-prevailing
COMDAT groups. Move the code to the parallel postParse to reduce work from the
single-threading code path and make parallel section initialization infeasible.
Postpone reporting duplicate symbol errors so that the messages have the
section information. (`Defined::section` is assigned in postParse and another
thread may not have the information).
* duplicated-synthetic-sym.s: BinaryFile duplicate definition (very rare) now
has no section information
* comdat-binding: `%t/w.o %t/g.o` leads to an undesired undefined symbol. This
is not ideal but we report a diagnostic to inform that this is unsupported.
(See release note)
* comdat-discarded-lazy.s: %tdef.o is unextracted. The new behavior (discarded
section error) makes more sense
* i386-comdat.s: switched to a better approach working around
.gnu.linkonce.t.__x86.get_pc_thunk.bx in glibc<2.32 for x86-32.
Drop the ancient no-longer-relevant workaround for __i686.get_pc_thunk.bx
Depends on D120640
Differential Revision: https://reviews.llvm.org/D120626
Haocong.Lu [Wed, 16 Mar 2022 02:07:21 +0000 (02:07 +0000)]
[RISCV] Select SRLI+SLLI for AND with leading ones mask
Select SRLI+SLLI for and i64 %x, imm if the imm is a leading ones mask.
It's useful in RV64 when the mask exceeds simm32 (cannot be generated by LUI).
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D121598
Sam McCall [Wed, 16 Mar 2022 02:01:40 +0000 (03:01 +0100)]
[lit] Remove clang_libs_dir
Seems to have been added accidentally in
58db03a116a197719 and then
copied into clangd by me (but not actually needed).
Fangrui Song [Wed, 16 Mar 2022 02:00:54 +0000 (19:00 -0700)]
Revert D120626 "[ELF] Move section assignment from initializeSymbols to postParse"
This reverts commit
c30e6447c0225f675773d07f2b6d4e3c2b962155.
It exposed brittle support for __x86.get_pc_thunk.bx.
Need to think a bit how to support __x86.get_pc_thunk.bx.
Fangrui Song [Wed, 16 Mar 2022 01:47:52 +0000 (18:47 -0700)]
[ELF][test] Improve i386-linkonce.s
Make it behave like the glibc<2.32 .gnu.linkonce usage that we want to work around.
Shafik Yaghmour [Wed, 16 Mar 2022 01:10:30 +0000 (18:10 -0700)]
[LLDB][NFC] Remove dead code from Section.cpp
Removing comment out code, looks like debugging code left over from a while ago.
Vitaly Buka [Wed, 16 Mar 2022 01:01:07 +0000 (18:01 -0700)]
[lsan] Attempt to fix s390x after
a63932a8
Sam Clegg [Mon, 7 Mar 2022 23:50:30 +0000 (15:50 -0800)]
[lld][WebAssembly] Take advantage of extended const expressions when available
In particular we use these in two places:
1. When building PIC code we no longer need to combine output segments
into a single segment that can be initialized at `__memory_base`.
Instead each segment can encode its offset from `__memory_base` in
its initializer. e.g.
```
(i32.add (global.get __memory_base) (i32.const offset)
```
2. When building PIC code we no longer need to relocation internalized
global addresses. We can just initialize them with their correct
offsets.
Differential Revision: https://reviews.llvm.org/D121420
Zequan Wu [Wed, 16 Mar 2022 00:49:24 +0000 (17:49 -0700)]
[LLDB][NativePDB] Remove REQUIRES: system-windows for local-variables-regsiters.s
Nico Weber [Wed, 16 Mar 2022 00:44:59 +0000 (20:44 -0400)]
[gn build] (manually) port
89cd86bbc58a (clang-pseudo move)
Aart Bik [Tue, 15 Mar 2022 21:30:08 +0000 (14:30 -0700)]
[mlir][sparse] add one extra index test on f32 matrix
Reviewed By: bixia
Differential Revision: https://reviews.llvm.org/D121743
River Riddle [Tue, 15 Mar 2022 23:40:36 +0000 (16:40 -0700)]
[mlir:PDLInterp][NFC] Switch to using prefixed accessors
PDLInterp is effectively an internal dialect, so there isn't a need to
stage the switch.
River Riddle [Tue, 15 Mar 2022 23:09:19 +0000 (16:09 -0700)]
[mlir:Toy][NFC] Switch toy to use prefixed accessors
Jez Ng [Wed, 16 Mar 2022 00:25:06 +0000 (20:25 -0400)]
[lld-macho] Set FinalDefinitionInLinkageUnit on most LTO externs
Since Mach-O has a two-level namespace (unlike ELF), we can usually set
this property to true.
(I believe this setting is only available in the new LTO backend, so I
can't really use ld64 / libLTO's behavior as a reference here... I'm
just doing what I think is correct.)
See {D119294} for the work done to calculate the `interposable` used in
this diff.
Reviewed By: MaskRay
Differential Revision: https://reviews.llvm.org/D119506
Fangrui Song [Wed, 16 Mar 2022 00:20:29 +0000 (17:20 -0700)]
[ELF] Suppress duplicate symbol error for __x86.get_pc_thunk.bx
Tobias Nießen [Wed, 16 Mar 2022 00:13:08 +0000 (17:13 -0700)]
[libfuzzer] improve introductory sentence
This merely adds a missing "an" in the introductory sentence.
Reviewed By: vitalybuka
Differential Revision: https://reviews.llvm.org/D121760
Sam McCall [Wed, 16 Mar 2022 00:08:02 +0000 (01:08 +0100)]
Reapply [pseudo] Move pseudoparser from clang to clang-tools-extra"
This reverts commit
049f4e4eab19c6e468e029232e94ca71245b0f56.
The problem was a stray dependency in CLANG_TEST_DEPS which caused cmake
to fail if clang-pseudo wasn't built. This is now removed.
Sam McCall [Wed, 16 Mar 2022 00:06:01 +0000 (01:06 +0100)]
Revert "[pseudo] Move pseudoparser from clang to clang-tools-extra"
This reverts commit
b97856c4cfe7efb13887d5691002a7aa38440924.
Breaks a bunch of bots:
https://lab.llvm.org/buildbot/#/builders/193/builds/8513
Michael Jones [Wed, 9 Mar 2022 19:00:44 +0000 (11:00 -0800)]
[libc][bazel] split support_standalone_cpp target
previously the support_standalone_cpp target contained all of the files
in the __support/cpp folder. This change splits these out so that only
what is needed is included. In addition, this change adds the new
support files that previously didn't have targets.
Reviewed By: lntue, gchatelet
Differential Revision: https://reviews.llvm.org/D121314
Philip Reames [Tue, 15 Mar 2022 23:19:55 +0000 (16:19 -0700)]
[SLP] Optionally preserve MemorySSA
This initial patch adds code to preserve MemorySSA through a run of SLP vectorizer. The eventual plan is to use MemorySSA to accelerate SLP's memory dependence checking, but we're a ways from that. In particular, this patch is correct, but really slow. It's being landed so that we can work incrementally in tree, not because it's expected to be useful to anyone just yet.
The broader effort is being tracked in https://github.com/llvm/llvm-project/issues/54256. Its worth noting expicitly that this may not work out, and if not, we will be reverting all of the MSSA support in SLP at some point in the next few weeks.
Differential Revision: https://reviews.llvm.org/D117926
Sam McCall [Tue, 8 Mar 2022 18:31:32 +0000 (19:31 +0100)]
[pseudo] Move pseudoparser from clang to clang-tools-extra
This should make clearer that:
- it's not part of clang proper
- there's no expectation to update it along with clang (beyond green tests)
- clang should not depend on it
This is intended to be expose a library, so unlike other tools has a split
between include/ and lib/.
The main renames are:
clang/lib/Tooling/Syntax/Pseudo/* => clang-tools-extra/pseudo/lib/*
clang/include/clang/Tooling/Syntax/Pseudo/* => clang-tools-extra/pseudo/include/clang-pseudo/*
clang/tools/clang/pseudo/* => clang-tools-extra/pseudo/tool/*
clang/test/Syntax/* => clang-tools-extra/pseudo/test/*
clang/unittests/Tooling/Syntax/Pseudo/* => clang-tools-extra/pseudo/unittests/*
#include "clang/Tooling/Syntax/Pseudo/*" => #include "clang-pseudo/*"
namespace clang::syntax::pseudo => namespace clang::pseudo
check-clang => check-clang-pseudo
clangToolingSyntaxPseudo => clangPseudo
The clang-pseudo and ClangPseudoTests binaries are not renamed.
See discussion around:
https://discourse.llvm.org/t/rfc-a-c-pseudo-parser-for-tooling/59217/50
Differential Revision: https://reviews.llvm.org/D121233
Nico Weber [Tue, 15 Mar 2022 23:05:46 +0000 (19:05 -0400)]
[gn build] (manually) port
2b69eb4a7d1d
Bixia Zheng [Mon, 14 Mar 2022 23:41:41 +0000 (16:41 -0700)]
[mlir][sparse][taco] Support the use of index values in tensor expressions.
PyTACO DSL doesn't support the use of index values as in A[i] = B[i]+ i.
We extend the DSL to support such a use in MLIR-PyTACO.
Remove an obsolete unit test. Add unit tests and PyTACO tests.
Reviewed By: aartbik
Differential Revision: https://reviews.llvm.org/D121716
Sam Clegg [Mon, 16 Nov 2020 18:11:37 +0000 (10:11 -0800)]
[lld][WebAssembly] Add --unresolved-symbols=import-dynamic
This is a new mode for handling unresolved symbols that allows all
symbols to be imported in the same that they would be in the case of
`-fpie` or `-shared`, but generting an otherwise fixed/non-relocatable
binary.
Code linked in this way should still be compiled with `-fPIC` so that
data symbols can be resolved via imports.
This essentially allows the building of static binaries that have
dynamic imports. See:
https://github.com/emscripten-core/emscripten/issues/12682
As with other uses of the experimental dynamic linking ABI, this
behaviour will produce a warning unless run with `--experimental-pic`.
Differential Revision: https://reviews.llvm.org/D91577
Valentin Clement [Tue, 15 Mar 2022 21:52:36 +0000 (22:52 +0100)]
[flang] Move null entry at the correct place
This is a fix for failing buildbot
https://lab.llvm.org/buildbot/#/builders/172/builds/9652
River Riddle [Wed, 9 Mar 2022 00:21:07 +0000 (16:21 -0800)]
[mlir][toy] Define a FuncOp operation in toy and drop the dependence on FuncOp
FuncOp is being moved out of the builtin dialect, and defining a custom
toy operation showcases various aspects of defining function-like operation
(e.g. inlining, passes, etc.).
Differential Revision: https://reviews.llvm.org/D121264
River Riddle [Tue, 8 Mar 2022 22:20:08 +0000 (14:20 -0800)]
[mlir][PDL] Define a new PDLInterp::FuncOp operation and drop uses of FuncOp
Defining our own function operation allows for the PDL interpreter
to be more self contained, and also removes any dependency on FuncOp;
which is moving out of the Builtin dialect.
Differential Revision: https://reviews.llvm.org/D121253
Siva Chandra Reddy [Tue, 15 Mar 2022 21:34:51 +0000 (21:34 +0000)]
[libc][NFC] Fix typos and reduntent code triggering compiler warinings.
Ian Bearman [Tue, 15 Mar 2022 20:31:25 +0000 (13:31 -0700)]
[MLIR] UnknownLoc on Inlinable Calls in LLVMIR Translation
During MLIR translation to LLVMIR if an inlineable call has an UnkownLoc we get this error message:
```
inlinable function call in a function with debug info must have a !dbg location
call void @callee()
```
There is code that checks for this case and strips debug information to avoid this situation. I'm expanding this code to handle the case where an debug location points at a UnknownLoc. For example, a NamedLoc whose child location is an UnknownLoc.
Reviewed By: ftynse
Differential Revision: https://reviews.llvm.org/D121633
Fangrui Song [Tue, 15 Mar 2022 21:48:29 +0000 (14:48 -0700)]
[ELF] Work around not-fully-supported .gnu.linkonce.t.__x86.get_pc_thunk.bx
Jonas Devlieghere [Tue, 15 Mar 2022 21:21:10 +0000 (14:21 -0700)]
[lldb] Fix AppleObjCRuntime log channels
The log channel was changed from Types to Commands in
a007a6d84471bb956abe10974cac3066799f583f:
- Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS | LIBLLDB_LOG_TYPES));
+ Log *log = GetLog(LLDBLog::Process | LLDBLog::Commands);
Valentin Clement [Tue, 15 Mar 2022 21:40:11 +0000 (22:40 +0100)]
[flang] Fix intrinsic entry
Valentin Clement [Tue, 15 Mar 2022 21:29:06 +0000 (22:29 +0100)]
[flang] Lower random_[init|number|seed] intrinsics
Thsi patch add the infrastructure to lower the random related
intrinsics:
- `random_init`
- `random_number`
- `random_seed`
This patch is part of the upstreaming effort from fir-dev branch.
Reviewed By: PeteSteinfeld, schweitz
Differential Revision: https://reviews.llvm.org/D121704
Co-authored-by: V Donaldson <vdonaldson@nvidia.com>
Co-authored-by: Jean Perier <jperier@nvidia.com>
Tavian Barnes [Tue, 15 Mar 2022 21:23:02 +0000 (14:23 -0700)]
[sanitizer] Always initialize the regex in the regcomp() interceptor
When regcomp() fails, the same regex_t* should be passed to regerror()
for potentially better error messages. But doing that with msan would
report a use-of-uninitialized-value.
Fixes https://github.com/google/sanitizers/issues/1496
Reviewed By: vitalybuka
Differential Revision: https://reviews.llvm.org/D120591
Valentin Clement [Tue, 15 Mar 2022 21:18:45 +0000 (22:18 +0100)]
[flang] Lower min|max intrinsics
This patch adds lowering for the following intrinsics:
- `max`
- `maxloc`
- `maxval`
- `minloc`
- `minval`
This patch is part of the upstreaming effort from fir-dev branch.
Reviewed By: PeteSteinfeld
Differential Revision: https://reviews.llvm.org/D121701
Co-authored-by: Jean Perier <jperier@nvidia.com>
Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
Co-authored-by: mleair <leairmark@gmail.com>
Matthias Braun [Wed, 9 Mar 2022 23:50:20 +0000 (15:50 -0800)]
X86ISelDAGToDAG: Transform TEST + MOV64ri to SHR + TEST
Optimize a pattern where a sequence of 8/16 or 32 bits is tested for
zero: LLVM normalizes this towards and `AND` with mask which is usually
good, but does not work well on X86 when the mask does not fit into a
64bit register. This DagToDAG peephole transforms sequences like:
```
movabsq $
562941363486720, %rax # imm = 0x1FFFE00000000
testq %rax, %rdi
```
to
```
shrq $33, %rdi
testw %di, %di
```
The result has a shorter encoding and saves a register if the tested
value isn't used otherwise.
Differential Revision: https://reviews.llvm.org/D121320
Matthias Braun [Wed, 9 Mar 2022 19:10:06 +0000 (11:10 -0800)]
Add tests for D121320
Differential Revision: https://reviews.llvm.org/D121319
Louis Dionne [Thu, 3 Mar 2022 18:39:12 +0000 (13:39 -0500)]
[libc++] Define _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER whenever we enable warnings in the test suite
This should make CI consistent on all the compilers we support. Most of
this patch is working around various warnings emitted by GCC in our code
base, which are now being shown when we compile the tests.
After this patch, the whole test suite should be warning free on all
compilers we support and test, except for a few warnings on GCC that
we silence explicitly until we figure out the proper fix for them.
Differential Revision: https://reviews.llvm.org/D120684
Valentin Clement [Tue, 15 Mar 2022 21:13:24 +0000 (22:13 +0100)]
[flang] Lower character related intrinsic
This patch adds lowering for the following character related intrinsics:
- `len`
- `len_trim`
- `lge`, `lgt`, `lle` and `llt`
This patch is part of the upstreaming effort from fir-dev branch.
Reviewed By: PeteSteinfeld
Differential Revision: https://reviews.llvm.org/D121703
Co-authored-by: V Donaldson <vdonaldson@nvidia.com>
Co-authored-by: Jean Perier <jperier@nvidia.com>
Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
Sam McCall [Thu, 10 Mar 2022 23:29:10 +0000 (00:29 +0100)]
[clang-tools-extra] Reuse llvm_config.use_clang() to set up test environment
This replaces a bunch of duplicate logic to set up environment variables
and a few substitutions.
It does a little more than we were doing previously:
- searching for clang and setting up substitutions for it
- setting up some substitutions for target triples, which are
potentially useful but not actually used
clangd has been happily using this for its tests for a while.
Differential Revision: https://reviews.llvm.org/D121422
Valentin Clement [Tue, 15 Mar 2022 21:06:04 +0000 (22:06 +0100)]
[flang] Lower allocated intrinsic
This patch adds lowering for the `allocated`
intrinsic.
This patch is part of the upstreaming effort from fir-dev branch.
Reviewed By: jeanPerier, PeteSteinfeld
Differential Revision: https://reviews.llvm.org/D121702
Co-authored-by: Jean Perier <jperier@nvidia.com>
Aleksandr Platonov [Tue, 15 Mar 2022 21:08:54 +0000 (00:08 +0300)]
Fix sphinx build because of indentation
Sam McCall [Thu, 10 Mar 2022 23:58:03 +0000 (00:58 +0100)]
[lit] add lit_config.substitute to interpolate lit_config.params
A version of this logic appears in ~every lit.site.cfg.in (28 copies total).
This patch just removes two, but I'll update the rest of llvm-project next.
Differential Revision: https://reviews.llvm.org/D121427
Zequan Wu [Mon, 14 Mar 2022 20:53:19 +0000 (13:53 -0700)]
[LLDB][NativePDB] Don't complete static members' types when completing a record type.
`UdtRecordCompleter` shouldn't complete static members' types. static members' types are going to be completed when the types are called in `SymbolFile::CompleteType`.
Reviewed By: labath
Differential Revision: https://reviews.llvm.org/D121030
Valentin Clement [Tue, 15 Mar 2022 21:03:14 +0000 (22:03 +0100)]
[flang] Lower alternate return
This patch adds the lowering infrastructure for the lowering of
alternat returns.
This patch is part of the upstreaming effort from fir-dev branch.
Depends on D121698
Reviewed By: PeteSteinfeld
Differential Revision: https://reviews.llvm.org/D121699
Co-authored-by: V Donaldson <vdonaldson@nvidia.com>
Co-authored-by: Jean Perier <jperier@nvidia.com>
Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
Valentin Clement [Tue, 15 Mar 2022 21:01:34 +0000 (22:01 +0100)]
[flang] Lower entry statement
This patch add the lowering for the entry statement.
This patch is part of the upstreaming effort from fir-dev branch.
Depends on D121697
Reviewed By: PeteSteinfeld
Differential Revision: https://reviews.llvm.org/D121698
Co-authored-by: V Donaldson <vdonaldson@nvidia.com>
Co-authored-by: Jean Perier <jperier@nvidia.com>
Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
Valentin Clement [Tue, 15 Mar 2022 20:57:30 +0000 (21:57 +0100)]
[flang] Lower more pointer assignments/disassociation cases
This patch lowers more cases of pointer assignments and
disassociations.
This patch is part of the upstreaming effort from fir-dev branch.
Reviewed By: PeteSteinfeld, schweitz
Differential Revision: https://reviews.llvm.org/D121697
Co-authored-by: V Donaldson <vdonaldson@nvidia.com>
Co-authored-by: Jean Perier <jperier@nvidia.com>
Co-authored-by: mleair <leairmark@gmail.com>
Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
Keith Smiley [Tue, 15 Mar 2022 03:35:44 +0000 (20:35 -0700)]
reland: [clang] Don't append the working directory to absolute paths
This fixes a bug that happens when using -fdebug-prefix-map to remap an
absolute path to a relative path. Since the path was absolute before
remapping, it is safe to assume that concatenating the remapped working
directory would be wrong.
This was originally submitted as https://reviews.llvm.org/D113718, but
reverted because when testing with dwarf 5 enabled, the tests were too
strict.
Differential Revision: https://reviews.llvm.org/D121663
Björn Schäpers [Mon, 14 Mar 2022 12:19:08 +0000 (13:19 +0100)]
[clang-format] Fix crash with ObjC Blocks
Fixes https://github.com/llvm/llvm-project/issues/54367
Fixes https://github.com/llvm/llvm-project/issues/54368
Differential Revision: https://reviews.llvm.org/D121596
Louis Dionne [Mon, 14 Mar 2022 15:50:02 +0000 (11:50 -0400)]
[libc++] Add workaround to avoid breaking users of <span> when <ranges> are disabled
Back in
3a208c68942e, we implemented the range-based constructor for <span>.
However, in doing so, we removed a previous non-standard constructor that
we provided before shipping <ranges>. Unfortunately, that breaks code that
was relying on a range-based constructor until we ship all of <ranges>.
This patch reintroduces the old non-conforming constructors and tests
that were removed in
3a208c68942e and uses them whenever <ranges> is
not provided (e.g. in LLVM 14). This is only a temporary workaround
until we enable <ranges> by default in C++20, which should hopefully
happen by LLVM 15.
The goal is to cherry-pick this workaround back to the LLVM 14 release
branch, since I suspect the constructor removal may otherwise cause
breakage out there, like the breakage I saw internally.
We could have avoided this situation by waiting for C++20 to be finalized
before shipping std::span. For example, we could have guarded it with
something like _LIBCPP_HAS_NO_INCOMPLETE_RANGES to prevent users from
accidentally starting to depend on it before it is stable. We did not
have these mechanisms when std::span was first implemented, though.
Differential Revision: https://reviews.llvm.org/D121626
Vitaly Buka [Tue, 15 Mar 2022 07:30:14 +0000 (00:30 -0700)]
[lsan] Allow suppression of "unknown module"
If sanitizer cannot determine name of the module it
will use "<unknown module>". Then it can be suppressed
if needed.
Reviewed By: kda
Differential Revision: https://reviews.llvm.org/D121674
Louis Dionne [Tue, 15 Mar 2022 20:18:45 +0000 (16:18 -0400)]
[libc++] Update URL to old libc++ dylibs
Roy Jacobson [Tue, 15 Mar 2022 19:54:18 +0000 (12:54 -0700)]
[Concepts] Fix an assertion failure while diagnosing constrained
function candidates
See: https://github.com/llvm/llvm-project/issues/54379
I tried to see if I can reuse ResolveAddressOfOverloadedFunction for
explicit function instantiation and so I managed to hit this ICE.
Bug was the diagnostic required an argument (%0) and specific code path
didn't pass an argument.
Differential Revision: https://reviews.llvm.org/D121646
Sterling Augustine [Tue, 15 Mar 2022 19:48:31 +0000 (12:48 -0700)]
Avoid using a variable-sized array for a tiny allocation.
Differential Revision: https://reviews.llvm.org/D121732
Jonas Devlieghere [Tue, 15 Mar 2022 18:11:04 +0000 (11:11 -0700)]
Re-land "[lldb] Synchronize output through the IOHandler"
Add synchronization to the IOHandler to prevent multiple threads from
writing concurrently to the output or error stream.
A scenario where this could happen is when a thread (the default event
thread for example) is using the debugger's asynchronous stream. We
would delegate this operation to the IOHandler which might be running on
another thread. Until this patch there was nothing to synchronize the
two at the IOHandler level.
Differential revision: https://reviews.llvm.org/D121500
Maksim Panchenko [Tue, 15 Mar 2022 19:33:55 +0000 (12:33 -0700)]
[BOLT][NFC] Remove unused function
Reviewed By: yota9
Differential Revision: https://reviews.llvm.org/D121729
Florian Hahn [Tue, 15 Mar 2022 19:35:54 +0000 (19:35 +0000)]
[FunctionAttrs] Replace MemoryAccessKind with FMRB.
Update FunctionAttrs to use FunctionModRefBehavior instead
MemoryAccessKind.
This allows for adding support for inferring argmemonly and others,
see D121415.
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D121460
Aleksandr Platonov [Tue, 15 Mar 2022 18:46:54 +0000 (21:46 +0300)]
[clang][parser] Allow GNU attributes before namespace identifier
GCC supports:
- `namespace <gnu attributes> identifier`
- `namespace identifier <gnu attributes>`
But clang supports only `namespace identifier <gnu attributes>` and diagnostics for `namespace <gnu attributes> identifier` case looks unclear:
Code:
```
namespace __attribute__((visibility("hidden"))) A
{
}
```
Diags:
```
test.cpp:1:49: error: expected identifier or '{'
namespace __attribute__((visibility("hidden"))) A
^
test.cpp:1:49: error: C++ requires a type specifier for all declarations
test.cpp:3:2: error: expected ';' after top level declarator
}
```
This patch adds support for `namespace <gnu attributes> identifier` and also forbids gnu attributes for nested namespaces (this already done for C++ attributes).
Reviewed By: aaron.ballman
Differential Revision: https://reviews.llvm.org/D121245
Jake Egan [Tue, 15 Mar 2022 19:15:58 +0000 (15:15 -0400)]
[NFC][AIX] Disable precompiled module file test on AIX
This patch follows the same reasoning as D114481. The PCH reader looks for `__clangast` section in the precompiled module file, which is not present in the file on AIX and not supported in XCOFF yet.
Reviewed By: daltenty
Differential Revision: https://reviews.llvm.org/D121709
Vladislav Khmelevsky [Thu, 10 Mar 2022 18:38:55 +0000 (21:38 +0300)]
[BOLT] Set cold sections alignment explicitly
The cold text section alignment is set using the maximum alignment value
passed to the emitCodeAlignment. In order to calculate tentetive layout
right we will set the minimum alignment of such sections to the maximum
possible function alignment explicitly.
Differential Revision: https://reviews.llvm.org/D121392
Stefan Pintilie [Fri, 11 Mar 2022 16:06:17 +0000 (10:06 -0600)]
[PowerPC][P10] Add Vector pair calling convention
Add the calling convention for the vector pair registers.
These registers overlap with the vector registers.
Part of an original patch by: Lei Huang
Reviewed By: nemanjai, #powerpc
Differential Revision: https://reviews.llvm.org/D117225
Eli Friedman [Thu, 10 Mar 2022 21:50:44 +0000 (13:50 -0800)]
Complete the list of single-underscore keywords for MSVC compat.
List derived from https://docs.microsoft.com/en-us/cpp/cpp/keywords-cpp
. Not that this is something we really want to encourage, but some of
these show up in practice, so I figured I should just complete the list.
Differential Revision: https://reviews.llvm.org/D121412
Nirvedh [Mon, 7 Mar 2022 00:49:19 +0000 (00:49 +0000)]
[MLIR][Linalg] Canonicalization patterns for linalg.generic.
Fold linalg.fill into linalg.generic.
Remove dead arguments used in linalg.generic.
Reviewed By: ThomasRaoux
Differential Revision: https://reviews.llvm.org/D121535
LLVM GN Syncbot [Tue, 15 Mar 2022 18:43:11 +0000 (18:43 +0000)]
[gn build] Port
d46409fc8ea4
Shubham Sandeep Rastogi [Tue, 15 Mar 2022 18:36:06 +0000 (11:36 -0700)]
Move DWARFRecordSectionSplitter code to its own file
With
229d576b31f4071ab68c85ac4fabb78cfa502b04 the class EHFrameSplitter was renamed to DWARFRecordSectionSplitter. This change merely moves it to it's own .cpp/.h file
Differential Revision: https://reviews.llvm.org/D121721
Sam Clegg [Tue, 15 Mar 2022 18:36:56 +0000 (11:36 -0700)]
[WebAssembly] Fix asan issue from https://reviews.llvm.org/D121349
Dimitry Andric [Mon, 14 Mar 2022 21:05:35 +0000 (22:05 +0100)]
[libc++] Make __dir_stream visibility declaration consistent
The class `__dir_stream` is currently declared in two places: as a
top-level forward declaration in `directory_iterator.h`, and as a friend
declaration in class `directory_entry`, in `directory_entry.h`.
The former has a `_LIBCPP_HIDDEN` attribute, but the latter does not,
causing the Firefox build to complain about the visibility not matching
the previous declaration. This is because Firefox plays games with
pushing and popping visibility.
Work around this by making both `__dir_stream` declarations consistently
use `_LIBCPP_HIDDEN`.
Reviewed By: ldionne, philnik, #libc
Differential Revision: https://reviews.llvm.org/D121639
Danny Mösch [Tue, 15 Mar 2022 18:29:33 +0000 (14:29 -0400)]
Allow newline characters as separators for checks in Clang-Tidy configurations
This is a fix for #53737. In addition to commas, newline characters are
considered as separators of checks.
Daniel Thornburgh [Mon, 14 Mar 2022 23:23:08 +0000 (23:23 +0000)]
[Debuginfod] Check libcurl via CMake library.
If libcurl was built with CMake, CMake's FindCURL module defers
completely to the included config file. This config file doesn't set any
of the variables that the current check script depends on; it just sets
up an imported CMake target. Accordingly, the smoke test fails, since it
can't find the libcurl (or its static dependencies).
This changes the compile smoke test to refer to the imported library
instead; this should in turn bring in the necessary include and library
directories via the interface properties set up by CMake. This better
mirrors the way libcurl is referred to elsewhere in the CMakeLists.
Reviewed By: MaskRay
Differential Revision: https://reviews.llvm.org/D121718
Joe Nash [Tue, 15 Mar 2022 17:42:33 +0000 (13:42 -0400)]
[AMDGPU] Regen checks again no-remat-indirect-mov
NFC. Update script does not behave right since the run lines have
identical output. Delete the duplicated check prefix added in
22cfbf7ecacdf7db47c2f65fe896bdf62ebcc0f3
Joe Nash [Tue, 15 Mar 2022 17:35:43 +0000 (13:35 -0400)]
[AMDGPU] Regen checks for schedule-barrier
NFC. Hasn't been updated since script added check-next
Joe Nash [Tue, 15 Mar 2022 17:10:37 +0000 (13:10 -0400)]
[AMDGPU] Regen checks for no-remat-indirect-mov
NFC. Hasn't been updated since the update script started adding
check-next.
Reviewed By: arsenm
Differential Revision: https://reviews.llvm.org/D121719
Aart Bik [Tue, 15 Mar 2022 02:31:23 +0000 (19:31 -0700)]
[mlir][sparse] more test cases for linalg.index
Reviewed By: bixia
Differential Revision: https://reviews.llvm.org/D121660
Roman Lebedev [Tue, 15 Mar 2022 15:36:39 +0000 (18:36 +0300)]
[X86] Fix AMD Znver3 model checks
While `-march=` is correctly detected as `znver3` for the cpu,
apparently the model check is incorrect:
```
$ lscpu
Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit
Address sizes: 48 bits physical, 48 bits virtual
Byte Order: Little Endian
CPU(s): 32
On-line CPU(s) list: 0-31
Vendor ID: AuthenticAMD
Model name: AMD Ryzen 9 5950X 16-Core Processor
CPU family: 25
Model: 33
Thread(s) per core: 2
Core(s) per socket: 16
Socket(s): 1
Stepping: 0
Frequency boost: disabled
CPU max MHz: 6017.8462
CPU min MHz: 2200.0000
BogoMIPS: 8050.07
Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm constant_tsc rep_good nopl nonstop_tsc cpuid extd_apicid aperfmperf rapl pni pclmulqdq monitor ssse
3 fma cx16 sse4_1 sse4_2 movbe popcnt aes xsave avx f16c rdrand lahf_lm cmp_legacy svm extapic cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw ibs skinit wdt tce topoext perfctr_core perfctr_nb bpext perfctr_llc mwaitx cpb cat_l3 cdp_l3 hw_p
state ssbd mba ibrs ibpb stibp vmmcall fsgsbase bmi1 avx2 smep bmi2 erms invpcid cqm rdt_a rdseed adx smap clflushopt clwb sha_ni xsaveopt xsavec xgetbv1 xsaves cqm_llc cqm_occup_llc cqm_mbm_total cqm_mbm_local clzero irperf xsaveerptr rdpru wbn
oinvd arat npt lbrv svm_lock nrip_save tsc_scale vmcb_clean flushbyasid decodeassists pausefilter pfthreshold avic v_vmsave_vmload vgif v_spec_ctrl umip pku ospke vaes vpclmulqdq rdpid overflow_recov succor smca fsrm
Virtualization features:
Virtualization: AMD-V
Caches (sum of all):
L1d: 512 KiB (16 instances)
L1i: 512 KiB (16 instances)
L2: 8 MiB (16 instances)
L3: 64 MiB (2 instances)
NUMA:
NUMA node(s): 1
NUMA node0 CPU(s): 0-31
Vulnerabilities:
Itlb multihit: Not affected
L1tf: Not affected
Mds: Not affected
Meltdown: Not affected
Spec store bypass: Mitigation; Speculative Store Bypass disabled via prctl
Spectre v1: Mitigation; usercopy/swapgs barriers and __user pointer sanitization
Spectre v2: Mitigation; Retpolines, IBPB conditional, IBRS_FW, STIBP always-on, RSB filling
Srbds: Not affected
Tsx async abort: Not affected
```
Model is 33 (0x21), while the code was expecting it to be `0x00 .. 0x1F`.
https://github.com/torvalds/linux/blob/v5.17-rc8/drivers/hwmon/k10temp.c#L432-L453 agrees.
I'm not sure if other ranges listed here should also be accepted.
I noticed this while implementing CPU model detection
for halide (https://github.com/halide/Halide/pull/6648)
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D121708
Yi Kong [Tue, 15 Mar 2022 17:17:17 +0000 (01:17 +0800)]
Revert "[clang][driver] Emit a warning if -xc/-xc++ is after the last input file"
This reverts commit
1c1a4b9556db8579f7428605ac2c351bddde9ad5.
Some builders failed.
Yi Kong [Tue, 15 Mar 2022 10:50:06 +0000 (18:50 +0800)]
[clang][driver] Emit a warning if -xc/-xc++ is after the last input file
This follows the same warning GCC produces.
Differential Revision: https://reviews.llvm.org/D121683
Joe Nash [Tue, 15 Mar 2022 16:36:51 +0000 (12:36 -0400)]
[AMDGPU] Fix typo consecutive in GCNNSAReassign
Jonas Devlieghere [Tue, 15 Mar 2022 16:44:33 +0000 (09:44 -0700)]
Revert "[lldb] Synchronize output through the IOHandler"
This reverts commit
242c574dc03e4b90e992cc8d07436efc3954727f because it
breaks the following tests on the bots:
- TestGuiExpandThreadsTree.py
- TestBreakpointCallbackCommandSource.py
Igor Kudrin [Tue, 15 Mar 2022 16:46:22 +0000 (20:46 +0400)]
[llvm-cov gcov] Fix calculating coverage of template functions
Template functions share the same lines in source files, so the common
container of lines' properties cannot be used to calculate the coverage
statistics of individual functions.
> cat tmpl.cpp
template <int N> int test() { return N; }
int main() { return test<1>() + test<2>(); }
> clang++ --coverage tmpl.cpp -o tmpl
> ./tmpl
> llvm-cov gcov tmpl.cpp -f
...
Function '_Z4testILi1EEiv'
Lines executed:100.00% of 1
Function '_Z4testILi2EEiv'
Lines executed:-nan% of 0
...
> llvm-cov-patched gcov tmpl.cpp -f
...
Function '_Z4testILi1EEiv'
Lines executed:100.00% of 1
Function '_Z4testILi2EEiv'
Lines executed:100.00% of 1
...
Differential Revision: https://reviews.llvm.org/D121390
Shafik Yaghmour [Tue, 15 Mar 2022 16:34:12 +0000 (09:34 -0700)]
[LLDB] Fixing DWARFExpression handling of ValueType::FileAddress case for DW_OP_deref_size
Currently DW_OP_deref_size just drops the ValueType::FileAddress case and does
not attempt to handle it. This adds support for this case and a test that
verifies this support.
I did a little refactoring since DW_OP_deref and DW_OP_deref_size have some
overlap in code.
Also see: rdar://
66870821
Differential Revision: https://reviews.llvm.org/D121408
Andrzej Warzynski [Tue, 15 Mar 2022 13:16:47 +0000 (13:16 +0000)]
[flang][lowering] Add support for lowering of the `ibits` intrinsic
This patch adds support for lowering of the `ibits` intrinsic from Fortran
to the FIR dialect of MLIR.
This is part of the upstreaming effort from the `fir-dev` branch in [1].
[1] https://github.com/flang-compiler/f18-llvm-project
Differential Revision: https://reviews.llvm.org/D121693
Co-authored-by: Jean Perier <jperier@nvidia.com>
Co-authored-by: Valentin Clement <clementval@gmail.com>
Co-authored-by: V Donaldson <vdonaldson@nvidia.com>
Jonas Devlieghere [Tue, 15 Mar 2022 16:29:39 +0000 (09:29 -0700)]
[lldb] Make the PlatformMacOSX unit test Apple specific
I thought that x86GetSupportedArchitectures would always return
x86_64-apple-macosx as a compatible architecture, regardless of the host
achitecture, but the Debian bot disagrees with that.
Jonas Devlieghere [Tue, 15 Mar 2022 16:13:57 +0000 (09:13 -0700)]
[lldb] Synchronize output through the IOHandler
Add synchronization to the IOHandler to prevent multiple threads from
writing concurrently to the output or error stream.
A scenario where this could happen is when a thread (the default event
thread for example) is using the debugger's asynchronous stream. We
would delegate this operation to the IOHandler which might be running on
another thread. Until this patch there was nothing to synchronize the
two at the IOHandler level.
Differential revision: https://reviews.llvm.org/D121500
Andrzej Warzynski [Tue, 15 Mar 2022 12:31:20 +0000 (12:31 +0000)]
[flang][lowering] Add support for lowering the `dim` intrinsic
This patch adds support for lowering of the `dim` intrinsic from Fortran
to the FIR dialect of MLIR.
This is part of the upstreaming effort from the `fir-dev` branch in [1].
[1] https://github.com/flang-compiler/f18-llvm-project
Differential Revision: https://reviews.llvm.org/D121689
Co-authored-by: Jean Perier <jperier@nvidia.com>
Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
Co-authored-by: Valentin Clement <clementval@gmail.com>
Co-authored-by: V Donaldson <vdonaldson@nvidia.com>
Siva Chandra Reddy [Tue, 15 Mar 2022 08:26:41 +0000 (08:26 +0000)]
[libc] Add implementation of POSIX lseek function.
Reviewed By: lntue
Differential Revision: https://reviews.llvm.org/D121676
Jonas Devlieghere [Tue, 15 Mar 2022 15:50:33 +0000 (08:50 -0700)]
[lldb] Fix platform selection on Apple Silicon (again)
This patch is another attempt to fix platform selection on Apple
Silicon. It partially undoes D117340 which tried to fix the issue by
always instantiating a remote-ios platform for "iPhone and iPad Apps on
Apple Silicon Macs".
While the previous patch worked for attaching, it broke launching and
everything else that expects the remote platform to be connected. I made
an attempt to work around that, but quickly found out that there were
just too may places that had this assumption baked in.
This patch takes a different approach and reverts back to marking the
host platform compatible with iOS triples. This brings us back to the
original situation where platform selection was broken for remote iOS
debugging on Apple Silicon. To fix that, we now look at the process'
host architecture to differentiate between iOS binaries running remotely
and iOS binaries running locally.
I tested the following scenarios, which now all uses the desired
platform:
- Launching an iOS binary on macOS: uses the host platform
- Attaching to an iOS binary on macOS: uses the host platform
- Attaching to a remote iOS binary: uses the remote-ios platform
rdar://
89840215
Differential revision: https://reviews.llvm.org/D121444
Andrzej Warzynski [Tue, 15 Mar 2022 10:58:50 +0000 (10:58 +0000)]
[flang][lowering] Add support for lowering the `dot_product` intrinsic
This patch adds support for lowering the `dot_product` intrinsic from
Fortran to the FIR dialect of MLIR.
This is part of the upstreaming effort from the `fir-dev` branch in [1].
[1] https://github.com/flang-compiler/f18-llvm-project
Differential Revision: https://reviews.llvm.org/D121684
Co-authored-by: Jean Perier <jperier@nvidia.com>
Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
Co-authored-by: Valentin Clement <clementval@gmail.com>
Co-authored-by: Mark Leair <leairmark@gmail.com>
Bixia Zheng [Mon, 14 Mar 2022 22:43:12 +0000 (15:43 -0700)]
[mlir][sparse][taco] Reorder a class.
Define IndexExpr before IndexVar. This is to prepare for the next change
to support the use of index values in tensor expressions.
Reviewed By: aartbik
Differential Revision: https://reviews.llvm.org/D121649
Craig Topper [Tue, 15 Mar 2022 15:27:38 +0000 (08:27 -0700)]
[LegalizeTypes][RISCV][WebAssembly] Expand ABS in PromoteIntRes_ABS if it will expand to sra+xor+sub later.
If we promote the ABS and then Expand in LegalizeDAG, then both the
sra and the xor will have their inputs sign extended. This generates
extra code on RISCV which lacks an i8 or i16 sign extend instructon.
If we expand during type legalization, then only the sra will get its
input sign extended. RISCV is able to combine this with the sra by
doing a shift left followed by an sra.
Reviewed By: RKSimon
Differential Revision: https://reviews.llvm.org/D121664
Craig Topper [Tue, 15 Mar 2022 15:23:55 +0000 (08:23 -0700)]
[DAGCombiner][RISCV] Adjust (aext (and (trunc x), cst)) -> (and x, cst) to sext cst based on target preference
RISCV strong prefers i32 values be sign extended to i64. This combine
was always zero extending the constant using APInt methods.
This adjusts the code so that it calls getNode using ISD::ANY_EXTEND instead.
getNode will call TLI.isSExtCheaperThanZExt to decide how to handle
the constant.
Tests were copied from D121598 where I noticed that we were creating
constants that were hard to materialize.
Reviewed By: RKSimon
Differential Revision: https://reviews.llvm.org/D121650
Pavel Labath [Tue, 15 Mar 2022 15:23:43 +0000 (16:23 +0100)]
Revert "[lldb/test] Make category-skipping logic "platform"-independent"
This reverts commit
dddf4ce034a8e06cc1351492dceece3fa2344c14. It breaks
a couple of tests on macos.
Craig Topper [Tue, 15 Mar 2022 15:17:21 +0000 (08:17 -0700)]
[RISCV] Remove lowerSPLAT_VECTOR
This code handles fixed vector SPLAT_VECTOR, but is never called in
any tests.
We only form fixed vector splat vectors for vXi64 on RV32 as part
of DAGCombine. This will be type legalized to SPLAT_VECTOR_PARTS.
So the Custom handling for SPLAT_VECTOR is never needed.
This patch makes SPLAT_VECTOR for vXi64 'Legal' on RV32 so that
DAGCombine will create it, but there's no need for Custom handler.
It will still be type legalized to SPLAT_VECTOR_PARTS.
Reviewed By: frasercrmck
Differential Revision: https://reviews.llvm.org/D121673
Alex Brachet [Tue, 15 Mar 2022 15:18:41 +0000 (15:18 +0000)]
[libc] Fix exit not calling new handlers registered from a call to atexit in atexit handler
Alex Brachet [Tue, 15 Mar 2022 15:11:57 +0000 (15:11 +0000)]
[libc][BlockStore] Add back, pop_back and empty methods
Reviewed By: sivachandra
Differential Revision: https://reviews.llvm.org/D121656
Yitzhak Mandelbaum [Tue, 15 Mar 2022 12:57:26 +0000 (12:57 +0000)]
[clang][dataflow] Allow disabling built-in transfer functions for CFG terminators
Terminators are handled specially in the transfer functions so we need an
additional check on whether the analysis has disabled built-in transfer
functions.
Differential Revision: https://reviews.llvm.org/D121694
Sanjay Patel [Tue, 15 Mar 2022 14:34:48 +0000 (10:34 -0400)]
[InstCombine] try harder to propagate 'nsz' through fneg-of-select
This can be viewed as swapping the select arms:
https://alive2.llvm.org/ce/z/jUvFMJ
...so we don't have the 'nsz' problem with the more general fold.
This unlocks other folds for the motivating fabs example.
This was discussed in issue #38828.
Sanjay Patel [Tue, 15 Mar 2022 12:50:06 +0000 (08:50 -0400)]
[InstCombine] add tests for fneg-of-select with FMF; NFC
Louis Dionne [Mon, 7 Mar 2022 21:58:16 +0000 (16:58 -0500)]
[libc++] Overhaul all tests for assertions and debug mode
Prior to this patch, there was no distinction between tests that check
basic assertions and tests that check full-fledged iterator debugging
assertions. Both were disabled when support for the debug mode is not
provided in the dylib, which is stronger than it needs to be.
Furthermore, all of the tests using "debug_macros.h" that contain more
than one assertion in them were broken -- any code after the first
assertion would never be executed.
This patch refactors all of our assertion-related tests to:
1. Be enabled whenever they can, i.e. basic assertions tests are run
even when the debug mode is disabled.
2. Use the superior `check_assertion.h` (previously `debug_mode_helper.h`)
instead of `debug_macros.h`, which allows multiple assertions in the
same program.
3. Coalesce some tests into the same file to make them more readable.
4. Use consistent naming for test files -- no more db{1,2,3,...,10} tests.
This is a large but mostly mechanical patch.
Differential Revision: https://reviews.llvm.org/D121462
Simon Moll [Tue, 15 Mar 2022 13:03:36 +0000 (14:03 +0100)]
[VE] strided v256.23 isel and tests
ISel for experimental.vp.strided.load|store for v256.32 types via
lowering to vvp_load|store SDNodes.
Reviewed By: kaz7
Differential Revision: https://reviews.llvm.org/D121616
Sam Carroll [Tue, 15 Mar 2022 14:22:31 +0000 (15:22 +0100)]
[mlir] Fix --convert-func-to-llvm=emit-c-wrappers argument and result attribute handling
When using `--convert-func-to-llvm=emit-c-wrappers` the attribute arguments of the wrapper would not be created correctly in some cases.
This patch fixes that and introduces a set of tests for (hopefully) all corner cases.
See https://github.com/llvm/llvm-project/issues/53503
Author: Sam Carroll <sam.carroll@lmns.com>
Co-Author: Laszlo Kindrat <laszlo.kindrat@lmns.com>
Reviewed By: ftynse
Differential Revision: https://reviews.llvm.org/D119895