Itay Bookstein [Tue, 9 Nov 2021 07:06:30 +0000 (09:06 +0200)]
[InstCombine][NFC] Refactor llvm.stackrestore handling
Hoist the instruction classification logic outside the loop
in preparation for reuse in a future commit.
Signed-off-by: Itay Bookstein <itay.bookstein@nextsilicon.com>
Reviewed By: lebedev.ri
Differential Revision: https://reviews.llvm.org/D113464
Michał Górny [Tue, 9 Nov 2021 22:55:52 +0000 (23:55 +0100)]
[lldb] [gdb-server] Fix fill_clamp to handle signed src types
Fix the fill_clamp() function to handle signed source types. Make sure
that the source value is always non-negative, and cast it to unsigned
when verifying the upper bound. This fixes compiler warnings about
comparing unsigned and signed types.
Differential Revision: https://reviews.llvm.org/D113519
Michał Górny [Sat, 14 Aug 2021 21:22:29 +0000 (23:22 +0200)]
[lldb] Support gdbserver signals
GDB and LLDB use different signal models. GDB uses a predefined set
of signal codes, and maps platform's signos to them. On the other hand,
LLDB has historically simply passed native signos.
In order to improve compatibility between LLDB and gdbserver, the GDB
signal model should be used. However, GDB does not provide a mapping
for all existing signals on Linux and unsupported signals are passed
as 'unknown'. Limiting LLDB to this behavior could be considered
a regression.
To get the best of both worlds, use the LLDB signal model when talking
to lldb-server, and the GDB signal model otherwise. For this purpose,
new versions of lldb-server indicate "native-signals+" via qSupported.
At the same time, we also detect older versions of lldb-server
via QThreadSuffixSupported for backwards compatibility. If neither test
succeeds, we assume gdbserver or another implementation using GDB model.
Differential Revision: https://reviews.llvm.org/D108078
Dmitry Makogon [Wed, 10 Nov 2021 08:15:04 +0000 (15:15 +0700)]
[Test] Remove incorrect test in GVN
Removed it because it runs indvars after GVN and
it's obvious it's an indvars test, not GVN.
Also the removed test file includes a 'target triple' with aarch64 specified,
which is needed for indvars to eliminate the Phis produced by GVN,
and the test directory doesn't have a lit config to exclude lit from
running the test if aarch64 is not supported by a build.
Martin Storsjö [Wed, 10 Nov 2021 07:39:47 +0000 (09:39 +0200)]
[llvm-objdump] Remove a trailing semicolon, fixing GCC warnings. NFC.
Esme-Yi [Wed, 10 Nov 2021 07:23:56 +0000 (07:23 +0000)]
Reland [XCOFF][yaml2obj] support for the auxiliary file header.
Summary: Fix the build failure on MSVC by making the `T` and `U` of the function
'T llvm::Optional<T>::getValueOr<llvm::yaml::Hex32>(U &&) const &' the same.
Differential Revision: https://reviews.llvm.org/D111487
Sam McCall [Wed, 10 Nov 2021 07:22:28 +0000 (08:22 +0100)]
[clangd] Trace per-token time in clangd --check
Christian Kandeler [Tue, 9 Nov 2021 17:12:01 +0000 (18:12 +0100)]
[CodeCompletion] Generally consider header files without extension
Real-world use case: The Qt framework's headers have the same name
as the respective class defined in them, and Qt's traditional qmake
build tool uses -I (rather than -isystem) to pull them in.
Reviewed By: sammccall
Differential Revision: https://reviews.llvm.org/D112996
Kazu Hirata [Wed, 10 Nov 2021 07:05:15 +0000 (23:05 -0800)]
[llvm] Use MachineBasicBlock::{successors,predecessors} (NFC)
Salman Javed [Wed, 10 Nov 2021 05:34:41 +0000 (18:34 +1300)]
[clang-tidy] Fix llvm-header-guard so that it works with Windows paths
Fixes pr40372 (https://bugs.llvm.org/show_bug.cgi?id=40372).
The llvm-header-guard check does not take into account that the path
separator on Windows is `\`, not `/`.
This means that instead of suggesting a header guard in the form of:
LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_FOO_H
it incorrectly suggests:
C:\LLVM_PROJECT\CLANG_TOOLS_EXTRA\CLANG_TIDY\FOO_H
Differential Revision: https://reviews.llvm.org/D113450
Danil Stefaniuc [Wed, 10 Nov 2021 05:22:14 +0000 (21:22 -0800)]
[formatters] Add a libstdcpp formatter for forward_list and refactor list formatter
This diff adds a data formatter for libstdcpp's forward_list. Besides, it refactors the existing code by extracting the common functionality between libstdcpp forward_list and list formatters into the AbstractListSynthProvider class.
Reviewed By: wallace
Differential Revision: https://reviews.llvm.org/D113362
Amara Emerson [Wed, 10 Nov 2021 04:41:26 +0000 (20:41 -0800)]
[AArch64][GlobalISel] Fix atomic truncating stores from generating invalid copies.
If the source reg is a 64b vreg, then we need to emit a subreg copy to a 32b
gpr before we select sub-64b variants like STLRW.
Fangrui Song [Wed, 10 Nov 2021 04:41:05 +0000 (20:41 -0800)]
[ELF] Inline isPPC64SmallCodeModelTocReloc which is only called once. NFC
Fangrui Song [Wed, 10 Nov 2021 04:24:40 +0000 (20:24 -0800)]
[ELF] Move isStaticLinkTimeConstant closer to the only caller processRelocAux. NFC
Jorge Gorbe Moya [Wed, 10 Nov 2021 03:48:42 +0000 (19:48 -0800)]
Fix unused variable warning in release build
hsmahesha [Wed, 10 Nov 2021 03:14:58 +0000 (08:44 +0530)]
[CFE][Codegen] Make sure to maintain the contiguity of all the static allocas
at the start of the entry block, which in turn would aid better code transformation/optimization.
Reviewed By: rnk
Differential Revision: https://reviews.llvm.org/D110257
Igor Kudrin [Wed, 10 Nov 2021 03:07:20 +0000 (10:07 +0700)]
[clang-tblgen] Fix non-determinism in generating AttributeReference.rst
As for now, the categories are printed in an arbitrary order which
depends on the addresses of dynamically allocated objects. The patch
sorts them in an alphabetical order thus making the output stable.
Differential Revision: https://reviews.llvm.org/D113477
Igor Kudrin [Wed, 10 Nov 2021 03:06:30 +0000 (10:06 +0700)]
[clang-tblgen] Fix non-determinism in generating AttrSubMatchRulesParserStringSwitches.inc
llvm::MapVector, compared to std::map, guarantees the same iteration
order in different runs.
Differential Revision: https://reviews.llvm.org/D113168
Vitaly Buka [Tue, 9 Nov 2021 03:22:24 +0000 (19:22 -0800)]
[dfsan] Dfsan version of D113328
Depends on D113328.
Differential Revision: https://reviews.llvm.org/D113454
Vitaly Buka [Sat, 6 Nov 2021 02:57:19 +0000 (19:57 -0700)]
[msan] Block signals in MsanThread::Init
If async signal handler called when we MsanThread::Init
signal handler may trigger false reports.
I failed to reproduce this locally for a test.
Differential Revision: https://reviews.llvm.org/D113328
Vitaly Buka [Tue, 9 Nov 2021 02:45:22 +0000 (18:45 -0800)]
[NFC][sanitizer] Extract ScopedBlockSignals
Differential Revision: https://reviews.llvm.org/D113452
Jacques Pienaar [Wed, 10 Nov 2021 01:52:56 +0000 (17:52 -0800)]
[mlir-c] Add Region iterators matching Block & Operation ones
Enables using the same iterator interface to these even though underlying storage is different.
Differential Revision: https://reviews.llvm.org/D113512
Mehdi Amini [Wed, 10 Nov 2021 01:25:36 +0000 (01:25 +0000)]
Fix flang following MLIR API change in
f30a8a6f674
The printer for Attribute/Type does not need to include the mnemonic
anymore.
Mehdi Amini [Wed, 10 Nov 2021 01:05:34 +0000 (01:05 +0000)]
Fix ODS Attribute/Type declarative assembly generator after API change for Attribute/Type print
The change in
f30a8a6f674 conflicted with the recently landed feature on
ODS assembly format for Attribute/Type.
David Blaikie [Wed, 10 Nov 2021 00:47:30 +0000 (16:47 -0800)]
llvm-dwarfdump: Lookup type units when prettyprinting types
This handles DWARFv4 and DWARFv5 type units, but not Split DWARF type
units. That'll come in a follow-up patch.
Mehdi Amini [Wed, 10 Nov 2021 00:38:01 +0000 (00:38 +0000)]
Change the contract with the type/attribute parsing to let the dispatch handle the mnemonic
This breaking change requires to remove printing the mnemonic in the print()
method on Type/Attribute classes.
This makes it consistent with the parsing code which alread handles the
mnemonic outside of the parsing method.
This likely won't break the build for anyone, but tests will start
failing for dialects downstream. The fix is trivial and look like
going from:
void emitc::OpaqueType::print(DialectAsmPrinter &printer) const {
printer << "opaque<\"";
to:
void emitc::OpaqueAttr::print(DialectAsmPrinter &printer) const {
printer << "<\"";
Reviewed By: rriddle, aartbik
Differential Revision: https://reviews.llvm.org/D113334
Mehdi Amini [Sat, 6 Nov 2021 07:14:32 +0000 (07:14 +0000)]
Emit the boilerplate for Type printer/parser dialect dispatching from ODS
Add a new `useDefaultTypePrinterParser` boolean settings on the dialect
(default to false for now) that emits the boilerplate to dispatch type
parsing/printing to the auto-generated method.
We will likely turn this on by default in the future.
Differential Revision: https://reviews.llvm.org/D113332
Mehdi Amini [Sat, 6 Nov 2021 07:14:17 +0000 (07:14 +0000)]
Emit the boilerplate for Attribute printer/parser dialect dispatching from ODS
Add a new `useDefaultAttributePrinterParser` boolean settings on the dialect
(default to false for now) that emits the boilerplate to dispatch attribute
parsing/printing to the auto-generated method.
We will likely turn this on by default in the future.
Differential Revision: https://reviews.llvm.org/D113329
Mehdi Amini [Sat, 6 Nov 2021 07:14:02 +0000 (07:14 +0000)]
Restructure the Test dialect ODS to include the AttrDef in TestOps.td (NFC)
This structure is necessary to be able to use AttrDef as arguments on operations.
Differential Revision: https://reviews.llvm.org/D113327
Jessica Paquette [Mon, 8 Nov 2021 22:43:12 +0000 (14:43 -0800)]
[GlobalISel] Ensure that translateInvoke adds all successors for inlineasm
The existing code didn't add all necessary successors, which resulted in
disjoint basic blocks. These would end up not being legalized which, in the
best case, caused a fallback only in assert builds.
Here's an example:
https://godbolt.org/z/ndx15Enfj
We also end up getting weird codegen here as well.
Refactoring the code here allows us to correctly attach all successors. With
this patch, the above example gives correct codegen at -O0 with and without
asserts.
Also autogen the testcase to show that we add all the successors now.
Differential Revision: https://reviews.llvm.org/D113437
David Blaikie [Wed, 10 Nov 2021 00:08:14 +0000 (16:08 -0800)]
Fix memory leak in D demangler
Nathan Sidwell [Tue, 9 Nov 2021 23:41:22 +0000 (18:41 -0500)]
[clang] Fix restructured markup
Stanislav Mekhanoshin [Tue, 9 Nov 2021 23:38:24 +0000 (15:38 -0800)]
[InstCombine] Precommit updated and-xor-or.ll tests. NFC.
Tests for:
```
(c | ~(a & b)) & (b | ~(a & c)) --> ~(a & (b ^ c))
(b | ~(a & c)) & ~(a & b) --> ~((b | c) & a)
(b & ~(a | c)) | ~(a | b) --> ~((b & c) | a) (2 uses test)
```
Arthur Eubanks [Tue, 9 Nov 2021 23:19:43 +0000 (15:19 -0800)]
[llvm-reduce] Print extra newline when encountering unknown pass
Craig Topper [Tue, 9 Nov 2021 22:47:44 +0000 (14:47 -0800)]
[RISCV] Add test cases for roundeven intrinsics. NFC
These just fall back to libcalls.
Roman Lebedev [Tue, 9 Nov 2021 22:51:07 +0000 (01:51 +0300)]
[NFC][SROA] Precommit tests for promotion-with-spilling
Tests mainly stolen from https://reviews.llvm.org/D109749
Matt Arsenault [Thu, 28 Oct 2021 00:59:46 +0000 (20:59 -0400)]
AMDGPU: Account for implicit argument alignment for kernarg segment
If a kernel had no formal arguments but did have the implicit
arguments, we were reporting a required kernarg alignment of 4. For
some reason we require an 8-byte alignment for this, even though
there's no real advantage and I don't see where this is documented in
the ABI.
The code object header code also claims the minimum alignment is 16,
which is what I thought you always got at runtime anyway so I don't
know why this matters.
Joseph Huber [Fri, 8 Oct 2021 20:29:57 +0000 (16:29 -0400)]
[OpenMP] Remove doing assumption propagation in the front end.
This patch removes the assumption propagation that was added in D110655
primarily to get assumption informatino on opaque call sites for
optimizations. The analysis done in D111445 allows us to do this more
intelligently in the back-end.
Depends on D111445
Reviewed By: jdoerfert
Differential Revision: https://reviews.llvm.org/D111463
Joseph Huber [Mon, 4 Oct 2021 21:42:46 +0000 (17:42 -0400)]
[OpenMP] Use AAAssumptionInfo to get assumptions in OpenMPOpt
This patch uses the abstract attributor introduced in D111054 to get the
assumption values instead of the `hasAssumption` function. This also
calls it so assumption information should propagate throug the device
where applicabile.
Reviewed By: jdoerfert
Differential Revision: https://reviews.llvm.org/D111445
Joseph Huber [Mon, 4 Oct 2021 13:01:41 +0000 (09:01 -0400)]
[Attributor] Introduce AAAssumptionInfo to propagate assumptions
This patch introduces a new abstract attributor instance that propagates
assumption information from functions. Conceptually, if a function is
only called by functions that have certain assumptions, then we can
apply the same assumptions to that function. This problem is similar to
calculating the dominator set, but the assumptions are merged instead of
nodes.
Reviewed By: jdoerfert
Differential Revision: https://reviews.llvm.org/D111054
Kostya Serebryany [Tue, 9 Nov 2021 01:52:36 +0000 (17:52 -0800)]
[sancov] add tracing for loads and store
add tracing for loads and stores.
The primary goal is to have more options for data-flow-guided fuzzing,
i.e. use data flow insights to perform better mutations or more agressive corpus expansion.
But the feature is general puspose, could be used for other things too.
Pipe the flag though clang and clang driver, same as for the other SanitizerCoverage flags.
While at it, change some plain arrays into std::array.
Tests: clang flags test, LLVM IR test, compiler-rt executable test.
Reviewed By: morehouse
Differential Revision: https://reviews.llvm.org/D113447
Saleem Abdulrasool [Tue, 9 Nov 2021 22:28:12 +0000 (22:28 +0000)]
headers: optionalise some generated resource headers
This splits out the generated headers and conditonalises them upon the
target being enabled.
The motivation here is that the RISCV header alone added 10MB to the
resource directory, which was previously at 10MB, increasing the build
size and time. This header is contributing ~50% of the size of the
resource headers (~10MB).
The ARM generated headers are contributing about ~10% or 1MB.
This could be extended further adding only the static resource headers
for the targets that the LLVM build supports.
The changes to the tests for ARM mirror what the RISCV target already
did and rnk identified as a possible issue.
Testing:
cmake -G Ninja -D LLVM_TARGETS_TO_BUILD=X86 -D LLVM_ENABLE_PROJECTS="clang;lld" ../clang
ninja check-clang
Differential Revision: https://reviews.llvm.org/D112890
Reviewed By: craig.topper
Arthur Eubanks [Tue, 9 Nov 2021 22:23:04 +0000 (14:23 -0800)]
Revert "[DebugInfo] Enforce implicit constraints on `distinct` MDNodes"
This reverts commit
ee7652569854af567ba83e5255d70e80cc8619a1.
Causes crashes, see comments in D104827.
James Y Knight [Tue, 9 Nov 2021 16:18:36 +0000 (11:18 -0500)]
Fix test after
aee49255074fd4ef38d97e6e70cbfbf2f9fd0fa7.
(Apparently no buildbots enable both examples and plugins!)
Itay Bookstein [Sat, 6 Nov 2021 22:06:28 +0000 (00:06 +0200)]
[clang] Run LLVM Verifier in modes without CodeGen too
Previously, the Backend_Emit{Nothing,BC,LL} modes did
not run the LLVM verifier since it is usually added via
the TargetMachine::addPassesToEmitFile method according
to the DisableVerify parameter. This is called from
EmitAssemblyHelper::AddEmitPasses, which is only relevant
for BackendAction-s that require CodeGen.
Note:
* In these particular situations the verifier is added
to the optimization pipeline rather than the codegen
pipeline so that it runs prior to the BC/LL emission
pass.
* This change applies to both the old and the new PMs.
* Because the clang tests use -emit-llvm ubiquitously,
this change will enable the verifier for them.
* A small bug is fixed in emitIFuncDefinition so that
the clang/test/CodeGen/ifunc.c test would pass:
the emitIFuncDefinition incorrectly passed the
GlobalDecl of the IFunc itself to the call to
GetOrCreateLLVMFunction for creating the resolver.
Signed-off-by: Itay Bookstein <ibookstein@gmail.com>
Reviewed By: rjmccall
Differential Revision: https://reviews.llvm.org/D113352
Itay Bookstein [Sat, 30 Oct 2021 11:27:38 +0000 (14:27 +0300)]
[CodeGen] Diagnose and reject non-function ifunc resolvers
Signed-off-by: Itay Bookstein <ibookstein@gmail.com>
Reviewed By: MaskRay, erichkeane
Differential Revision: https://reviews.llvm.org/D112868
Itay Bookstein [Tue, 9 Nov 2021 20:01:56 +0000 (22:01 +0200)]
[clang][test][NFC] Move attr-ifunc.c test from Sema to CodeGen
Signed-off-by: Itay Bookstein <ibookstein@gmail.com>
Reviewed By: erichkeane
Differential Revision: https://reviews.llvm.org/D113431
Itay Bookstein [Tue, 9 Nov 2021 20:01:14 +0000 (22:01 +0200)]
[clang][test][NFC] clang-format attr-ifunc.c test
Signed-off-by: Itay Bookstein <ibookstein@gmail.com>
Reviewed By: erichkeane
Differential Revision: https://reviews.llvm.org/D113504
serge-sans-paille [Tue, 9 Nov 2021 21:38:56 +0000 (22:38 +0100)]
Revert "Misleading unicode identifier detection pass"
This reverts commit
7f92a1a84b96ff0b7568a35704c9483e9f24f057.
It triggers an assert, see http://45.33.8.238/linux/60293/step_9.txt
"AST/Decl.h:277: llvm::StringRef clang::NamedDecl::getName() const: Assertion `Name.isIdentifier() && "Name is not a simple identifier"' failed."
Alexander Shaposhnikov [Tue, 9 Nov 2021 21:27:16 +0000 (21:27 +0000)]
[CodeGen][Outliner] Clean up dead code
Clean up dead code in X86InstrInfo.cpp and AArch64InstrInfo.cpp
Test plan: make check-all
Differential revision: https://reviews.llvm.org/D111151
Aaron Puchert [Tue, 9 Nov 2021 21:24:44 +0000 (22:24 +0100)]
Comment AST: Add support for variable templates
We treat them as variables of course, though if they have function
pointer type we treat them as functions, i.e. allow parameter and return
value specifications. Just like VarDecls.
Reviewed By: gribozavr2
Differential Revision: https://reviews.llvm.org/D111266
Aaron Puchert [Tue, 9 Nov 2021 20:51:38 +0000 (21:51 +0100)]
Comment AST: Declare function pointer variables as functions
We were doing this already for type aliases, and it deduplicates the
code looking through aliases and pointers to find a function type. As
a side effect, this finds two warnings that we apparently missed before.
Reviewed By: gribozavr2
Differential Revision: https://reviews.llvm.org/D111264
Aaron Puchert [Tue, 9 Nov 2021 20:46:56 +0000 (21:46 +0100)]
Comment AST: Factor out function type extraction in DeclInfo::fill (NFC)
Reviewed By: gribozavr2
Differential Revision: https://reviews.llvm.org/D111262
David Blaikie [Tue, 9 Nov 2021 20:51:05 +0000 (12:51 -0800)]
DebugInfoDWARF: Refactor/simplify a couple of minor things
Haojian Wu [Tue, 9 Nov 2021 10:10:11 +0000 (11:10 +0100)]
[clang] Don't crash on an incomplete-type base specifier in template context.
Differential Revision: https://reviews.llvm.org/D113474
Nikita Popov [Tue, 9 Nov 2021 20:59:40 +0000 (21:59 +0100)]
[InstCombine] Add tests for and/or of range checks (NFC)
David Tenty [Tue, 9 Nov 2021 17:44:44 +0000 (12:44 -0500)]
[libcxx][CI][AIX] Switch to LLVM_ENABLE_RUNTIMES
and to the new `runtimes` top level CMakeLists.txt since the old path is now deprecated. This requires a slight adjustment of the libcxxabi CMake, since there are required macro definitions we previously got via the `llvm/CMakeList.txt` path.
Reviewed By: ldionne, #libc, #libc_abi
Differential Revision: https://reviews.llvm.org/D113403
C. Rayroud [Sun, 7 Nov 2021 19:56:35 +0000 (20:56 +0100)]
[clang-format] Refactor SpaceBeforeParens to add options
The coding style of some projects requires to have more control on space
before opening parentheses.
The goal is to add the support of clang-format to more projects.
For example adding a space only for function definitions or
declarations.
This revision adds SpaceBeforeParensOptions to configure each option
independently from one another.
Differentiel Revision: https://reviews.llvm.org/D110833
Björn Schäpers [Fri, 5 Nov 2021 21:20:52 +0000 (22:20 +0100)]
[clang-format] Address fixme
Differential Revision: https://reviews.llvm.org/D113320
serge-sans-paille [Fri, 15 Oct 2021 13:18:52 +0000 (15:18 +0200)]
Misleading unicode identifier detection pass
Detect when an identifier contains some Right-To-Left characters.
This pass relates to https://trojansource.codes/
This is a recommit of
299aa4dfa1d8c120648b1404b481d858b76c8173 with missing
option registration fixed.
Differential Revision: https://reviews.llvm.org/D112914
Ellis Hoag [Tue, 9 Nov 2021 20:45:54 +0000 (12:45 -0800)]
[DebugInfo] Fix broken MachO test
This test was introduced in https://reviews.llvm.org/D112337 and breaks on mac.
Reviewed By: dblaikie
Differential Revision: https://reviews.llvm.org/D113506
Luís Ferreira [Tue, 9 Nov 2021 20:40:45 +0000 (12:40 -0800)]
[Tools] Add a fuzzing tool to help fuzzing D demangler
This patch adds a fuzzing helper tool for D demangler by feeding the demangler API with
pseudo-random null terminated strings with the help of libfuzzer heuristics.
Reviewed By: dblaikie
Differential Revision: https://reviews.llvm.org/D111432
Ilya Yanok [Tue, 9 Nov 2021 20:35:43 +0000 (21:35 +0100)]
[RegAllocFast] Fix nondeterminism in debuginfo generation
Changes from commit
1db137b1859692ae33228c530d4df9f2431b2151
added iteration over hash map that can result in non-deterministic
order. Fix that by using a SmallMapVector to preserve the order.
Differential Revision: https://reviews.llvm.org/D113468
Gulfem Savrun Yeniceri [Tue, 9 Nov 2021 20:21:49 +0000 (20:21 +0000)]
[compiler-rt] Fix diagnostic in InstrProfError
This patch fixes some issues introduced in
https://reviews.llvm.org/D108942:
1) Remove the default label to fix the bots that use
-Werror,-Wcovered-switch-default
2) Modify the malformed test to fix the bots that are
built without zlib support
3) Modify some error messages in malformed profiles
David Green [Tue, 9 Nov 2021 20:29:42 +0000 (20:29 +0000)]
[AArch64] Extend and regenerate fcvt_combine.ll. NFC
This adds half and fptoi.sat variants of the tests in fcvt_combine.ll,
and regenerates the resulting check lines.
Matt Arsenault [Thu, 4 Nov 2021 23:31:56 +0000 (19:31 -0400)]
AMDGPU: Regenerate test checks
Update these to include -NEXT to avoid spurious changes in a future
commit.
Andrzej Warzynski [Wed, 3 Nov 2021 07:57:13 +0000 (07:57 +0000)]
[flang][CodeGen] Transform `fir.{store|load}` to `llvm.{store|load}`
This patch extends the `FIRToLLVMLowering` pass in Flang by adding a
hook to transform `fir.store`/`fir.load` to `llvm.store`/`fir.load`,
respectively.
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/D113090
Patch originally written by:
Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
Co-authored-by: Jean Perier <jperier@nvidia.com>
Nikita Popov [Tue, 9 Nov 2021 20:17:09 +0000 (21:17 +0100)]
[InstCombine] Combine code for and/or of icmps (NFC)
The implementation for and/or is the same, apart from the choice
of exactIntersectWith() vs exactUnionWith(). Extract a common
function to make future extension easier.
LLVM GN Syncbot [Tue, 9 Nov 2021 20:11:28 +0000 (20:11 +0000)]
[gn build] Port
737c4a2673da
Atmn Patel [Tue, 9 Nov 2021 04:16:54 +0000 (23:16 -0500)]
[clang][openmp][NFC] Remove arch-specific CGOpenMPRuntimeGPU files
The existing CGOpenMPRuntimeAMDGCN and CGOpenMPRuntimeNVPTX classes are
just code bloat. By removing them, the codebase gets a bit cleaner.
Reviewed By: jdoerfert, JonChesterfield, tianshilei1992
Differential Revision: https://reviews.llvm.org/D113421
Mogball [Tue, 9 Nov 2021 18:59:06 +0000 (18:59 +0000)]
[mlir][ods] Cleanup of handling Op vs OpAdaptor
In preparation for implementation subrange lookup on attributes.
Depends on D113039
Reviewed By: jpienaar, Chia-hungDuan
Differential Revision: https://reviews.llvm.org/D113128
Nikita Popov [Sat, 6 Nov 2021 21:15:26 +0000 (22:15 +0100)]
[InstCombine] Refactor and/or of icmp with constant (NFCI)
Rather than testing for many specific combinations of predicates
and values, compute the exact icmp regions for both comparisons
and check whether they union/intersect exactly. If they do,
construct the equivalent icmp for the new range. Assuming that the
existing code handled all possible cases, this should be NFC.
Differential Revision: https://reviews.llvm.org/D113367
Yonghong Song [Mon, 8 Nov 2021 04:36:52 +0000 (20:36 -0800)]
BPF: change btf_type_tag BTF output format
For the declaration like below:
int __tag1 * __tag1 __tag2 *g
Commit
41860e602aaa ("BPF: Support btf_type_tag attribute")
implemented the following encoding:
VAR(g) -> __tag1 --> __tag2 -> pointer -> __tag1 -> pointer -> int
Some further experiments with linux btf_type_tag support, esp.
with generating attributes in vmlinux.h, and also some internal
discussion showed the following format is more desirable:
VAR(g) -> pointer -> __tag2 -> __tag1 -> pointer -> __tag1 -> int
The format makes it similar to other modifier like 'const', e.g.,
const int *g
which has encoding VAR(g) -> PTR -> CONST -> int
Differential Revision: https://reviews.llvm.org/D113496
Stanislav Mekhanoshin [Wed, 3 Nov 2021 18:10:26 +0000 (11:10 -0700)]
[InstCombine] Fuse checks for LHS (~(A | B) & C) | ... NFC.
Differential Revision: https://reviews.llvm.org/D113132
Jorge Gorbe Moya [Tue, 9 Nov 2021 19:24:05 +0000 (11:24 -0800)]
Revert "[clang-tidy] Fix lint warning in ClangTidyDiagnosticConsumer.cpp (NFC)"
The change causes multiple clang-tidy tests to fail under ASan.
This reverts commit
00769572025f9b0d36dc832d3c1bc61500091ed5.
Sanjay Patel [Tue, 9 Nov 2021 18:26:04 +0000 (13:26 -0500)]
[InstCombine] fix code comment to match code; NFC
Mark de Wever [Sat, 6 Nov 2021 19:30:08 +0000 (20:30 +0100)]
[libc++] Adds missing forward_list merge tests.
During the review of D112660 it turned out the tests for
`std::forward_list::merge` are incomplete.
Adds tests for the rvalue reference overloads. The tests are extended to
better test the Effects [forward.list.ops]/25 and Remarks
[forward.list.ops]/27 of the function:
- x is empty after the merge.
- Pointers and references to the moved elements of x now refer to those
same elements but as members of *this.
- Iterators referring to the moved elements will continue to refer to
their elements, but they now behave as iterators into *this, not into x.
- The algorithm is stable.
Reviewed By: Quuxplusone, #libc, ldionne
Differential Revision: https://reviews.llvm.org/D113364
Yuanfang Chen [Tue, 9 Nov 2021 18:33:33 +0000 (10:33 -0800)]
[Sema] Mark virtual method declaration in union as invalid
Currently, this is only diagnosed but the decl is not marked invalid. This may hit assertions down the path.
This also reverts the fix for PR49534 since it is not needed anymore.
Reviewed By: hubert.reinterpretcast
Differential Revision: https://reviews.llvm.org/D113145
Ellis Hoag [Tue, 9 Nov 2021 18:52:10 +0000 (10:52 -0800)]
[DebugInfo] Only create concrete DIEs of concrete functions
At the begining of the module we can iterate through the functions to
see which SPs should have concrete DIEs. Then when we need to reference
a DIE for a SP we can decide if it's ok to create a concrete DIE or not.
Fixes
* https://bugs.llvm.org/show_bug.cgi?id=52159
* https://bugs.llvm.org/show_bug.cgi?id=30637
Reviewed By: dblaikie
Differential Revision: https://reviews.llvm.org/D112337
Pavel Labath [Tue, 9 Nov 2021 18:39:17 +0000 (19:39 +0100)]
[lldb] XFAIL TestPlatformKill on windows
-> PR52451
Adrian Prantl [Tue, 9 Nov 2021 18:46:09 +0000 (10:46 -0800)]
Use yaml2obj instead of relying on invoking the Darwin system assembler.
Dwight Guth [Tue, 9 Nov 2021 18:42:52 +0000 (10:42 -0800)]
[llvm-reduce] Fix invalid reduction in basic-blocks delta pass
Previously, if the basic-blocks delta pass tried to remove a basic block
that was the last basic block in a function that did not have external
or weak linkage, the resulting IR would become invalid. Since removing
the last basic block in a function is effectively identical to removing
the function body itself, we check explicitly for this case and if we
detect it, we run the same logic as in ReduceFunctionBodies.cpp
Reviewed By: aeubanks
Differential Revision: https://reviews.llvm.org/D113486
LLVM GN Syncbot [Tue, 9 Nov 2021 18:38:40 +0000 (18:38 +0000)]
[gn build] Port
533862933398
Arthur Eubanks [Mon, 1 Nov 2021 15:56:48 +0000 (08:56 -0700)]
[NFC] Rename GVN -> GVNPass and SROA -> SROAPass
To be more consistent with other pass struct names.
There are still more passes that don't end with "Pass", but these are the important ones.
Reviewed By: asbirlea
Differential Revision: https://reviews.llvm.org/D112935
Kazu Hirata [Tue, 9 Nov 2021 18:34:00 +0000 (10:34 -0800)]
[ProfileData] Fix a warning
This patch fixes:
llvm/lib/ProfileData/InstrProf.cpp:146:3: error: default label in
switch which covers all enumeration values
[-Werror,-Wcovered-switch-default]
Douglas Yung [Tue, 9 Nov 2021 18:28:41 +0000 (10:28 -0800)]
Revert "Reapply db28934 "[IndVars] Pass TTI to replaceCongruentIVs""
This reverts commit
5ec23863320ca12bfabb6dcff1d0425cb614b7a5.
This change is causing test failures on the PS4 linux build bot: https://lab.llvm.org/buildbot/#/builders/139/builds/12871
Simon Pilgrim [Tue, 9 Nov 2021 18:25:07 +0000 (18:25 +0000)]
Revert rG299aa4dfa1d8c120648b1404b481d858b76c8173 "Misleading unicode identifier detection pass"
This is failing on various buildbots: https://lab.llvm.org/buildbot/#/builders/109/builds/25932
Arthur Eubanks [Tue, 9 Nov 2021 18:20:43 +0000 (10:20 -0800)]
[gn build] Port
299aa4dfa1d8
Arthur Eubanks [Tue, 9 Nov 2021 18:20:42 +0000 (10:20 -0800)]
[gn build] Port
22a1aa5a43cb
Scott Linder [Thu, 4 Nov 2021 16:52:32 +0000 (16:52 +0000)]
[DebugInfo] Enforce implicit constraints on `distinct` MDNodes
Add UNIQUED and DISTINCT properties in Metadata.def and use them to
implement restrictions on the `distinct` property of MDNodes:
* DIExpression can currently be parsed from IR or read from bitcode
as `distinct`, but this property is silently dropped when printing
to IR. This causes accepted IR to fail to round-trip. As DIExpression
appears inline at each use in the canonical form of IR, it cannot
actually be `distinct` anyway, as there is no syntax to describe it.
* Similarly, DIArgList is conceptually always uniqued. It is currently
restricted to only appearing in contexts where there is no syntax for
`distinct`, but for consistency it is treated equivalently to
DIExpression in this patch.
* DICompileUnit is already restricted to always being `distinct`, but
along with adding general support for the inverse restriction I went
ahead and described this in Metadata.def and updated the parser to be
general. Future nodes which have this restriction can share this
support.
The new UNIQUED property applies to DIExpression and DIArgList, and
forbids them to be `distinct`. It also implies they are canonically
printed inline at each use, rather than via MDNode ID.
The new DISTINCT property applies to DICompileUnit, and requires it to
be `distinct`.
A potential alternative change is to forbid the non-inline syntax for
DIExpression entirely, as is done with DIArgList implicitly by requiring
it appear in the context of a function. For example, we would forbid:
!named = !{!0}
!0 = !DIExpression()
Instead we would only accept the equivalent inlined version:
!named = !{!DIExpression()}
This essentially removes the ability to create a `distinct` DIExpression
by construction, as there is no syntax for `distinct` inline. If this
patch is accepted as-is, the result would be that the non-canonical
version is accepted, but the following would be an error and produce a diagnostic:
!named = !{!0}
; error: 'distinct' not allowed for !DIExpression()
!0 = distinct !DIExpression()
Also update some documentation to consistently use the inline syntax for
DIExpression, and to describe the restrictions on `distinct` for nodes
where applicable.
Reviewed By: StephenTozer, t-tye
Differential Revision: https://reviews.llvm.org/D104827
Louis Dionne [Wed, 4 Nov 2020 13:56:04 +0000 (08:56 -0500)]
[libc++] Simplify selftest to avoid passing arguments to it
This makes the test pass on executors that don't support passing additional
arguments.
Differential Revision: https://reviews.llvm.org/D113483
Chih-Ping Chen [Wed, 3 Nov 2021 20:44:00 +0000 (16:44 -0400)]
[CodeView] Properly handle a DISubprogram in getScopeIndex.
Differential Revision: https://reviews.llvm.org/D113142
Louis Dionne [Fri, 29 Oct 2021 16:36:57 +0000 (12:36 -0400)]
[libc++] Enable -Wformat-nonliteral when building libc++
Using user-provided data as a format string is a well known source of
security vulnerabilities. For this reason, it is a good idea to compile
our code with -Wformat-nonliteral, which basically warns if a non-constant
string is used as a format specifier. This is the compiler’s best signal
that a format string call may be insecure.
I audited the code after adding the warning and made sure that the few
places where we used a non-literal string as a format string were not
potential security issues. I either disabled the warning locally for
those instances or fixed the warning by using a literal. The idea is
that after we add the warning to the build, any new use of a non-literal
string in a format string will trigger a diagnostic, and we can either
get rid of it or disable the warning locally, which is a way of
acknowledging that it has been audited.
I also looked into enabling it in the test suite, which would perhaps
allow finding additional instances of it in our headers, however that
is not possible at the moment because Clang doesn't support putting
__attribute__((__format__(...))) on variadic templates, which would
be needed.
rdar://
84571685
Differential Revision: https://reviews.llvm.org/D112927
Adrian Prantl [Tue, 9 Nov 2021 18:15:54 +0000 (10:15 -0800)]
Add a requires line to test.
Dwight Guth [Tue, 9 Nov 2021 18:13:33 +0000 (10:13 -0800)]
[llvm-reduce] Add flag to start at finer granularity
Sometimes if llvm-reduce is interrupted in the middle of a delta pass on
a large file, it can take quite some time for the tool to start actually
doing new work if it is restarted again on the partially-reduced file. A
lot of time ends up being spent testing large chunks when these large
chunks are very unlikely to actually pass the interestingness test. In
cases like this, the tool will complete faster if the starting
granularity is reduced to a finer amount. Thus, we introduce a command
line flag that automatically divides the chunks into smaller subsets a
fixed, user-specified number of times prior to beginning the core loop.
Reviewed By: aeubanks
Differential Revision: https://reviews.llvm.org/D112651
Mehdi Amini [Tue, 9 Nov 2021 18:11:59 +0000 (18:11 +0000)]
Revert "[mlir] Add nano precision clock to execution engine"
This reverts commit
48d1f099d492b0d796743d1528f09947e4d2d864.
Broke the MLIR buildbots
Michael Jones [Mon, 1 Nov 2021 17:32:19 +0000 (10:32 -0700)]
[libc] refactor atof string parsing
Split the code for parsing hexadecimal floating point numbers from the
code for parsing the decimal floating point numbers so that the parsing
can be faster for both of them.
This decreases the time for the benchmark in release mode by about 15%,
which noticeably beats GLibc.
Old version: 2.299s
New version: 1.893s
GLibc: 2.133s
Tests run by running the following command 10 times for each version:
time ~/llvm-project/build/bin/libc_str_to_float_comparison_test ~/parse-number-fxx-test-data/data/*
the parse-number-fxx-test-data-repository is here:
https://github.com/nigeltao/parse-number-fxx-test-data/tree/
fe94de252c691900982050c8e7c503d1efd1299a
It's important to build llvm-libc in Release mode for accurate
performance comparisons against glibc (set -DCMAKE_BUILD_TYPE=Release in
your cmake).
You also have to build the libc_str_to_float_comparison_test target.
Reviewed By: lntue
Differential Revision: https://reviews.llvm.org/D113036
Fangrui Song [Tue, 9 Nov 2021 18:08:41 +0000 (10:08 -0800)]
[llvm-objdump] -p: Dump PE header for PE/COFF
For a trivial DLL built with `clang --target=x86_64-windows -O2 -c a.c; lld-link -subsystem:console -dll a.o -out:a.dll`,
`objdump -p` vs `llvm-objdump -p`:
```
-a.dll: file format pei-x86-64
-
+a.dll: file format coff-x86-64
Characteristics 0x2022
executable
large address aware
@@ -57,4 +56,4 @@
Entry d
0000000000000000 00000000 Delay Import Directory
Entry e
0000000000000000 00000000 CLR Runtime Header
Entry f
0000000000000000 00000000 Reserved
-
+Export Table:
```
For a Linux image (`vmlinuz-5.10.76-gentoo-r1`) built with `CONFIG_EFI_STUB=y`
```
-vmlinuz-5.10.76-gentoo-r1: file format pei-x86-64
-
-Characteristics 0x20e
+vmlinuz-5.10.76-gentoo-r1: file format coff-x86-64
+Characteristics 0x206
executable
line numbers stripped
- symbols stripped
debugging information removed
Time/Date Wed Dec 31 16:00:00 1969
@@ -55,10 +53,4 @@
Entry d
0000000000000000 00000000 Delay Import Directory
Entry e
0000000000000000 00000000 CLR Runtime Header
Entry f
0000000000000000 00000000 Reserved
-
-
-PE File Base Relocations (interpreted .reloc section contents)
-
-Virtual Address:
000037ca Chunk size 10 (0xa) Number of fixups 1
- reloc 0 offset 0 [37ca] ABSOLUTE
-
+Export Table:
```
`symbols stripped` looks like a GNU objdump problem.
Reviewed By: jhenderson, alexander-shaposhnikov
Differential Revision: https://reviews.llvm.org/D113356
Gulfem Savrun Yeniceri [Mon, 30 Aug 2021 19:12:16 +0000 (19:12 +0000)]
[compiler-rt] Add more diagnostic to InstrProfError
If profile data is malformed for any kind of reason, we generate
an error that only reports "malformed instrumentation profile data"
without any further information. This patch extends InstrProfError
class to receive an optional error message argument, so that we can
do better error reporting.
Differential Revision: https://reviews.llvm.org/D108942
Mark de Wever [Wed, 3 Nov 2021 19:50:59 +0000 (20:50 +0100)]
[libc++] Fix lifetime issues of temporaries.
The ASAN build failed due to using pointers to a temporary whose
lifetime had expired.
Updating the libc++ Docker image to Ubuntu Focal caused some breakage.
This was temporary disabled in D112737. This re-enables two of these
tests.
Reviewed By: ldionne, #libc
Differential Revision: https://reviews.llvm.org/D113137