Commit graph

383732 commits

Author SHA1 Message Date
Martin Storsjö 675401e04c [libcxx] Avoid pulling in xlocinfo.h in public headers
Including xlocinfo.h is a bit of a layering violation; locale.h is
the C library header we should use, while xlocinfo.h is essentially
part of the MS C++ library. Including xlocinfo.h brings in yvals.h,
which brings in yvals_core.h, which defines the MS STL's version
support macros, overriding what libc++'s <version> had defined.

Instead just include locale.h, and provide the few defines we need
for locale categories manually.

Differential Revision: https://reviews.llvm.org/D99213
2021-03-24 23:29:59 +02:00
Petr Hosek 39f3e9a9e0 [CMake][Fuchsia] Include llvm-lipo
We want to use llvm-lipo for building universal libraries.

Differential Revision: https://reviews.llvm.org/D99243
2021-03-24 14:21:40 -07:00
Roman Lebedev 2070fe7144
[NFCI][SimplifyCFG] Don't form DTU updates if we aren't going to apply them
I think we may want to have a thin wrapper over a vector to deduplicate
those `if(DTU)` predicates, and instead do them in the `insert()` itself.
2021-03-25 00:02:37 +03:00
Jessica Paquette 56e6eb7975 [AArch64][GlobalISel] Make G_UBFX/G_SBFX legalization check for constants
The original rule just checked the type, but this is actually only legal if
it has a constant.

Differential Revision: https://reviews.llvm.org/D99298
2021-03-24 13:58:27 -07:00
Vy Nguyen d988ffc34f [lld-macho][nfc] Fixed test so it output to %t/ rather than current directory.
The a.out broke our build.

Differential Revision: https://reviews.llvm.org/D99271
2021-03-24 16:55:37 -04:00
Nikita Popov a7efed5a20 [SCEV] Improve handling of not expressions in isImpliedCond()
SCEV currently tries to prove implications of x pred y by also
trying to imply ~y pred ~x. This is expensive in terms of
compile-time (in fact, the majority of isImpliedCond compile-time
is spent here) and generally not fruitful. The issue is that this
also swaps the operands and thus breaks canonical ordering. If
originally we were trying to prove an implication like
X > C1 -> Y > C2, then we'll now try to prove X > C1 -> C3 > ~Y,
which will not work.

The only real case where we can get some use out of this transform
is if the original conditions were in the form X > C1 -> Y < C2, were
then swapped to X > C1 -> C2 > Y and are then swapped again here to
X > C1 -> ~Y > C3.

As such, handle this at a higher level, where we are doing the
swapping in the first place. There's four different ways that we
can line up a predicate and a swapped predicate, so we use some
heuristics to pick some profitable way.

Because we now try this transform at a higher level
(isImpliedCondOperands rather than isImpliedCondOperandsHelper),
we can also prove additional facts. Of the added tests, one was
proven previously while the other wasn't.

Differential Revision: https://reviews.llvm.org/D90926
2021-03-24 21:53:02 +01:00
Louis Dionne 6427c53940 [libc++] Use add_lit_testsuite to register the libc++ test suite
The Runtimes build uses variables set by add_lit_testsuite to discover
tests suites to run.

Differential Revision: https://reviews.llvm.org/D97913
2021-03-24 16:47:34 -04:00
Stella Stamenova f6e0fc2ddd [mlir] Fix tile-and-distribute.mlir
A recent filecheck change resulted in better reporting of invalid variables and this test had a couple. This is the second occurence that the first fix missed.
2021-03-24 13:42:34 -07:00
Thomas Preud'homme bc888a0fd6 [MLIR, test] Fix variable def in Dialect/Linalg/tile-and-distribute.mlir 2021-03-24 20:37:28 +00:00
Med Ismail Bennani fad34da7fd Revert "[lldb/Plugins] Add ScriptedProcess Process Plugin"
Reverting commit b09d44b6ae, since it breaks
the windows bots: https://lab.llvm.org/buildbot/#/builders/83/builds/4993

It seems to crash the `TestIRMemoryMapWindows.test` test.
2021-03-24 21:31:16 +01:00
Louis Dionne c504c68fac [libc++] Add a CI configuration with static libc++/libc++abi
Differential Revision: https://reviews.llvm.org/D99268
2021-03-24 16:30:48 -04:00
Janusz Nykiel e030ce3ec7 [Tooling] Handle compilation databases containing commands with double dashes
As of CMake commit https://gitlab.kitware.com/cmake/cmake/-/commit/d993ebd4,
which first appeared in CMake 3.19.x series, in the compile commands for
clang-cl, CMake puts `--` before the input file. When operating on such a
database, the `InterpolatingCompilationDatabase` - specifically, the
`TransferableCommand` constructor - does not recognize that pattern and so, does
not strip the input, or the double dash when 'transferring' the compile command.
This results in a incorrect compile command - with the double dash and old input
file left in, and the language options and new input file appended after them,
where they're all treated as inputs, including the language version option.

Test files for some tests have names similar enough to be matched to commands
from the database, e.g.:

`.../path-mappings.test.tmp/server/bar.cpp`

can be matched to:

`.../Driver/ToolChains/BareMetal.cpp`

etc. When that happens, the tool being tested tries to use the matched, and
incorrectly 'transferred' compile command, and fails, reporting errors similar
to:

`error: no such file or directory: '/std:c++14'; did you mean '/std:c++14'? [clang-diagnostic-error]`

This happens in at least 4 tests:

  Clang Tools :: clang-tidy/checkers/performance-trivially-destructible.cpp
  Clangd :: check-fail.test
  Clangd :: check.test
  Clangd :: path-mappings.test

The fix for `TransferableCommand` removes the `--` and everything after it when
determining the arguments that apply to the new file. `--` is inserted in the
'transferred' command if the new file name starts with `-` and when operating in
clang-cl mode, also `/`. Additionally, other places in the code known to do
argument adjustment without accounting for the `--` and causing the tests to
fail are fixed as well.

Differential Revision: https://reviews.llvm.org/D98824
2021-03-24 16:01:47 -04:00
Albion Fung e29bb074c6 [PowerPC] Exploit xxsplti32dx (constant materialization) for scalars
This patch exploits the xxsplti32dx instruction available on Power10
in place of constant pool loads where xxspltidp would not be able to,
usually because the immediate cannot fit into 32 bits.

Differential Revision: https://reviews.llvm.org/D95458
2021-03-24 15:59:59 -04:00
Greg Clayton e122877f10 Add a progress class that can track long running operations in LLDB.
LLDB can often appear deadlocked to users that use IDEs when it is indexing DWARF, or parsing symbol tables. These long running operations can make a debug session appear to be doing nothing even though a lot of work is going on inside LLDB. This patch adds a public API to allow clients to listen to debugger events that report progress and will allow UI to create an activity window or display that can show users what is going on and keep them informed of expensive operations that are going on inside LLDB.

Differential Revision: https://reviews.llvm.org/D97739
2021-03-24 12:58:13 -07:00
Alexey Bataev 9e9f6eba84 [OPENMP]Fix PR49468: Declare target should allow empty sequences and namespaces.
The emty declare target/end declare target region should not cause an
error emission.

Differential Revision: https://reviews.llvm.org/D99288
2021-03-24 12:53:33 -07:00
Congzhe Cao 829c1b6443 [LoopInterchange] fix tightlyNested() in LoopInterchange legality
This is yet another attempt to fix tightlyNested().

Add checks in tightlyNested() for the inner loop exit block,
such that 1) if there is control-flow divergence in between the inner
loop exit block and the outer loop latch, or 2) if the inner loop exit
block contains unsafe instructions, tightlyNested() returns false.

The reasoning behind is that after interchange, the original inner loop
exit block, which was part of the outer loop, would be put into the new
inner loop, and will be executed different number of times before and
after interchange. Thus it should be dealt with appropriately.

Reviewed By: Whitney

Differential Revision: https://reviews.llvm.org/D98263
2021-03-24 15:49:25 -04:00
Julian Lettner 26e0fb88a3 [TSan] Support initialize/finalize hooks in dynamic libraries
Make TSan runtime initialization and finalization hooks work
even if these hooks are not built in the main executable.  When these
hooks are defined in another library that is not directly linked against
the TSan runtime (e.g., Swift runtime) we cannot rely on the "strong-def
overriding weak-def" mechanics and have to look them up via `dlsym()`.

Let's also define hooks that are easier to use from C-only code:
```
extern "C" void __tsan_on_initialize();
extern "C" int __tsan_on_finalize(int failed);
```
For now, these will call through to the old hooks.  Eventually, we want
to adopt the new hooks downstream and remove the old ones.

This is part of the effort to support Swift Tasks (async/await and
actors) in TSan.

rdar://74256720

Reviewed By: vitalybuka, delcypher

Differential Revision: https://reviews.llvm.org/D98810
2021-03-24 12:38:39 -07:00
Nick Lewycky 80f6c99a78 Verify that MDNodes belong to the same context as the Module.
Differential Revision: https://reviews.llvm.org/D99289
2021-03-24 12:38:05 -07:00
Heejin Ahn a6aae5f7fc [WebAssembly] Don't inline -emscripten-cxx-exceptions-allowed functions
Functions specified in `-emscripten-cxx-exceptions-allowed`, which is
set by Emscripten's `EXCEPTION_CATCHING_ALLOWED` setting, can be inlined
in LLVM middle ends before we reach WebAssemblyLowerEmscriptenEHSjLj
pass in the wasm backend and thus don't get transformed for exception
catching.

This fixes the issue by adding `--force-attribute=FUNC_NAME:noinline`
for each function name in `-emscripten-cxx-exceptions-allowed`, which
adds `noinline` attribute to the specified function and thus excludes
the function from inlining candidates in optimization passes.

Fixes the remaining half of
https://github.com/emscripten-core/emscripten/issues/10721.

Reviewed By: sbc100

Differential Revision: https://reviews.llvm.org/D99259
2021-03-24 12:27:49 -07:00
Florian Hahn 9d45579279
[LV] Factor out phi type access to variable (NFC).
A slight simplification of the code to reduce future diffs.
2021-03-24 19:25:22 +00:00
Nathan James 279ea930fa
[clang] Add fixit for Wreorder-ctor
Create fix-it hints to fix the order of constructors.
To make this a lot simpler, I've grouped all the warnings for each out of order initializer into 1.
This is necessary as fixing one initializer would often interfere with other initializers.

Reviewed By: aaron.ballman

Differential Revision: https://reviews.llvm.org/D98745
2021-03-24 19:22:53 +00:00
Jim Ingham 3fd7d0d281 Disable the tests except on Darwin.
The commit passes the tests on Darwin.  The failure on linux shows
that this change was not sufficient to get this setting to work on linux,
but the behavior is the same as before the patch & test, and it caused
no new failures.

So marking the tests as Darwin only till someone can debug the Linux
issue.
2021-03-24 12:19:18 -07:00
Florian Hahn 8d1342f79d
[LV] Remove redundant access to Legal::getReductionVars() (NFC).
The reduction descriptor is retrieved earlier and stored in a variable
RdxDesc already.
2021-03-24 19:15:14 +00:00
LLVM GN Syncbot ac6572a5c8 [gn build] Port 5fbe1fdf17 2021-03-24 19:01:21 +00:00
Gulfem Savrun Yeniceri 5fbe1fdf17 Revert "[Passes] Add relative lookup table converter pass"
This reverts commit 5fd001a5ff
because it broke clang-with-thin-lto-ubuntu bot.
2021-03-24 18:59:33 +00:00
Thomas Preud'homme 058455ffbe [FileCheck] Fix PR49531: invalid use of string var
FileCheck string substitution block parsing code only report an invalid
variable name in a string variable use if it starts with a forbidden
character. It does not report anything if there are unparsed characters
after the variable name, i.e. [[X-Y]] is parsed as [[X]] and no error is
returned. This commit fixes that.

Reviewed By: jdenny, jhenderson

Differential Revision: https://reviews.llvm.org/D98691
2021-03-24 18:49:58 +00:00
Matt Morehouse 63f73c3eb9 [HWASan] Use page aliasing on x86_64.
Userspace page aliasing allows us to use middle pointer bits for tags
without untagging them before syscalls or accesses.  This should enable
easier experimentation with HWASan on x86_64 platforms.

Currently stack, global, and secondary heap tagging are unsupported.
Only primary heap allocations get tagged.

Note that aliasing mode will not work properly in the presence of
fork(), since heap memory will be shared between the parent and child
processes.  This mode is non-ideal; we expect Intel LAM to enable full
HWASan support on x86_64 in the future.

Reviewed By: vitalybuka, eugenis

Differential Revision: https://reviews.llvm.org/D98875
2021-03-24 11:43:41 -07:00
peter klausler 5da55bfc18 [flang] Fix output buffering bug (positionability assumption)
The I/O runtime library code was failing to retain data in a buffer
from the current output record when flushing the buffer; this is
fatally wrong when the corresponding file cannot be repositioned,
as in the case of standard output to the console. So refine the
Flush() member function to retain a specified number of bytes,
rearrange the data as necessary (using existing code for read frame
management after moving it into a new member function), and add
a big comment to the head of the file to clarify the roles of the
various data members in the management of contiguous frames in
circular buffers.

Update: added a unit test.

Differential Revision: https://reviews.llvm.org/D99198
2021-03-24 11:39:18 -07:00
Roland McGrath 3cb2346982 [AArch64] Support .arch_extension pan
This makes the behavior consistent with the GNU assembler.

Reviewed By: phosek

Differential Revision: https://reviews.llvm.org/D99209
2021-03-24 11:29:22 -07:00
Tim Keith 5d3249e9af [flang] Save binding labels as strings
Binding labels start as expressions but they have to evaluate to
constant character of default kind, so they can be represented as an
std::string. Leading and trailing blanks have to be removed, so the
folded expression isn't exactly right anyway.

So all BIND(C) symbols now have a string binding label, either the
default or user-supplied one. This is recorded in the .mod file.

Add WithBindName mix-in for details classes that can have a binding
label so that they are all consistent. Add GetBindName() and
SetBindName() member functions to Symbol.

Add tests that verifies that leading and trailing blanks are ignored
in binding labels and that the default label is folded to lower case.

Differential Revision: https://reviews.llvm.org/D99208
2021-03-24 11:25:23 -07:00
Jessica Paquette eca7b31864 Add missing -march to runline in llvm/test/MachineVerifier/test_g_ubfx_sbfx.mir
This can cause failures if built without a default target triple.
2021-03-24 11:23:08 -07:00
Jianzhou Zhao 4950695eba [dfsan] Add Origin ABI Wrappers
Supported ctime_r, fgets, getcwd, get_current_dir_name, gethostname,
getrlimit, getrusage, strcpy, time, inet_pton, localtime_r,
getpwuid_r, epoll_wait, poll, select, sched_getaffinity

Most of them work as calling their non-origin verision directly.

This is a part of https://reviews.llvm.org/D95835.

Reviewed By: morehouse

Differential Revision: https://reviews.llvm.org/D98966
2021-03-24 18:22:03 +00:00
Jessica Paquette a141c7d06b [AArch64][GlobalISel] Select G_SBFX and G_UBFX
Add selection support for G_SBFX and G_UBFX and add a test.

These must always have a constant LSB and width.

Differential Revision: https://reviews.llvm.org/D99224
2021-03-24 11:15:57 -07:00
Jim Ingham c8faa8c266 Make the stop-on-sharedlibrary-events setting work.
The StopInfoBreakpoint::PerformAction was overriding the synchronous
breakpoint's ShouldStop report.  Fix that and add a test.

This fixes two bugs in the original submission:
1) Actually generate both dylibs by including the second one in the Makefile
2) Don't ask synchronous callbacks for their opinion on whether to stop
   in the async context, that info is taken care of by recording the m_should_stop
   on entry to PerformAction.

Differential Revision: https://reviews.llvm.org/D98914
2021-03-24 11:15:11 -07:00
Craig Topper 512bae81cc [RISCV] Add basic cost modelling for fixed vector gather/scatter.
Reviewed By: frasercrmck

Differential Revision: https://reviews.llvm.org/D99142
2021-03-24 11:14:14 -07:00
Shafik Yaghmour 13bb39aad3 [NFC][LLDB] Removing extra semicolons to silence -Wc++98-compat-extra-semi diagnostics 2021-03-24 19:10:58 +01:00
Med Ismail Bennani b09d44b6ae [lldb/Plugins] Add ScriptedProcess Process Plugin
This patch introduces Scripted Processes to lldb.

The goal, here, is to be able to attach in the debugger to fake processes
that are backed by script files (in Python, Lua, Swift, etc ...) and
inspect them statically.

Scripted Processes can be used in cooperative multithreading environments
like the XNU Kernel or other real-time operating systems, but it can
also help us improve the debugger testing infrastructure by writting
synthetic tests that simulates hard-to-reproduce process/thread states.

Although ScriptedProcess is not feature-complete at the moment, it has
basic execution capabilities and will improve in the following patches.

rdar://65508855

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

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
2021-03-24 19:10:58 +01:00
Jessica Paquette 1818dc394f [AArch64][GlobalISel] Mark G_SBFX/G_UBFX as legal for s32 and s64
This isn't perfect, since we should also verify that these only use constants.

Differential Revision: https://reviews.llvm.org/D99219
2021-03-24 11:08:41 -07:00
Craig Topper f24f09d256 [RISCV] Add TTI support for cpop with Zbb
This will tell loop idiom recognize that it can make popcount loops countable
using the ctpop intrinsic. I didn't bother checking for illegal types.
Type legalization knows how to split a ctpop into multiple ctops added together.
Assuming we only receive reasonable integer bit widths, a few cpop instructions
added together is probably better than the loop.

Reviewed By: frasercrmck

Differential Revision: https://reviews.llvm.org/D99203
2021-03-24 10:58:42 -07:00
Thomas Preud'homme c5d53efeff [test] Fix mix of variable use/def and regex match
LLVM test Transforms/GlobalSplit/basic.ll mixes variable definition and
variable use with regex matching of end of line. Mixing end of line
matching with variable definition will work but not record the end of
line in the string variable. Mixing end of line with variable use will
ignore end of line and cause an error once D98691 is landed.

This commit moves the end of line matching out of the string subtitution
blocks.

Reviewed By: tejohnson

Differential Revision: https://reviews.llvm.org/D98854
2021-03-24 17:58:16 +00:00
Konstantin Zhuravlyov 4f28303133 AMDGPU/LLD: Add target id and code object v4 support to linker
Differential Revision: https://reviews.llvm.org/D95811
2021-03-24 13:41:10 -04:00
LLVM GN Syncbot f6259efee7 [gn build] Port 5fd001a5ff 2021-03-24 17:33:50 +00:00
Gulfem Savrun Yeniceri 5fd001a5ff [Passes] Add relative lookup table converter pass
Lookup tables generate non PIC-friendly code, which requires dynamic relocation as described in:
https://bugs.llvm.org/show_bug.cgi?id=45244

This patch adds a new pass that converts lookup tables to relative lookup tables to make them PIC-friendly.

Differential Revision: https://reviews.llvm.org/D94355
2021-03-24 17:31:18 +00:00
Martin Storsjö feff05d135 [lit] Fix check-lit hanging on Windows due to a division by zero exception 2021-03-24 19:28:33 +02:00
Nikita Popov 8a168d2d70 [LICM] Fix NumSunk statistic (NFC)
LICM can sink instructions that have uses inside the loop, as
long as these uses are considered "free". However, if there were
only free uses inside the loop, and no uses outside the loop at
all, the instruction would still count towards the NumSunk
statistic. This resulted in a wild inflation of the NumSunk metric.
After this patch it drops down from 1141787 to 5852 on test-suite O3.
2021-03-24 18:28:19 +01:00
Abhina Sreeskantharajan 0bf833f670 [SystemZ][z/OS] JSON file should be text files
This patch sets the OF_Text flag correctly for the json file created in Clang::DumpCompilationDatabaseFragmentToDir.

Reviewed By: amccarth

Differential Revision: https://reviews.llvm.org/D99200
2021-03-24 13:28:08 -04:00
Thomas Preud'homme 3b52c04e82 Make FindAvailableLoadedValue TBAA aware
FindAvailableLoadedValue() relies on FindAvailablePtrLoadStore() to run
the alias analysis when searching for an equivalent value. However,
FindAvailablePtrLoadStore() calls the alias analysis framework with a
memory location for the load constructed from an address and a size,
which thus lacks TBAA metadata info. This commit modifies
FindAvailablePtrLoadStore() to accept an optional memory location as
parameter to allow FindAvailableLoadedValue() to create it based on the
load instruction, which would then have TBAA metadata info attached.

Reviewed By: nikic

Differential Revision: https://reviews.llvm.org/D99206
2021-03-24 17:20:26 +00:00
Alexey Bataev 7654bb6303 [OPENMP]Fix PR48571: critical/master in outlined contexts cause crash.
If emit inlined region for master/critical directives, no need to clear
lambda/block context data, otherwise the variables cannot be found and
it causes a crash at compile time.

Differential Revision: https://reviews.llvm.org/D99280
2021-03-24 10:15:24 -07:00
Thomas Preud'homme 60e12a2279 [NFC][Loads] Add a testcase for TBAA aware FindAvailableLoadedValue
(D99206)
2021-03-24 17:03:19 +00:00
Tim Keith a76d0207d5 Revert "[flang] Save binding labels as strings"
This reverts commit eb4ad0e3e3.

This was causing a crash compiling omp_lib.f90
2021-03-24 09:48:41 -07:00