Paulo Matos [Thu, 23 Jun 2022 12:10:52 +0000 (14:10 +0200)]
[WebAssembly] Update test to run it in opaque pointers mode
When opaque pointers was enabled, -no-opaque-pointers were added to some tests in order not to change behaviour. We now revert this and fix the test.
Reviewed By: asb, tlively
Differential Revision: https://reviews.llvm.org/D128282
Sergey Kosukhin [Wed, 22 Jun 2022 13:10:33 +0000 (16:10 +0300)]
[compiler-rt] Fix false positive detection of a target in compile-only mode
When `compiler-rt` is configured as a runtime, the configure-time target
detection for builtins is done in compile-only mode, which is basically a
test of whether the newly-built `clang` can compile a simple program with
an additional flag (`-m32` and `-m64` in my case). The problem is that on
my Debian system `clang` can compile `int foo(int x, int y) { return x + y; }`
with `-m32` but fails to include `limits.h` (or any other target-specific
header) for the `i386` target:
```
$ /path/to/build/./bin/clang --target=x86_64-unknown-linux-gnu -DVISIBILITY_HIDDEN -O3 -DNDEBUG -m32 -std=c11 -fPIC -fno-builtin -fvisibility=hidden -fomit-frame-pointer -MD -MT CMakeFiles/clang_rt.builtins-i386.dir/absvdi2.c.o -MF CMakeFiles/clang_rt.builtins-i386.dir/absvdi2.c.o.d -o CMakeFiles/clang_rt.builtins-i386.dir/absvdi2.c.o -c /path/to/src/compiler-rt/lib/builtins/absvdi2.c
In file included from /path/to/src/compiler-rt/lib/builtins/absvdi2.c:13:
In file included from /path/to/src/compiler-rt/lib/builtins/int_lib.h:93:
In file included from /path/to/build/lib/clang/15.0.0/include/limits.h:21:
In file included from /usr/include/limits.h:25:
/usr/include/features.h:364:12: fatal error: 'sys/cdefs.h' file not found
^~~~~~~~~~~~~
1 error generated.
```
This is an attempt to make the target detection more robust: extend the test
program with `#include <limits.h>`.
Differential Revision: https://reviews.llvm.org/D127975
Tobias Hieta [Thu, 23 Jun 2022 12:04:23 +0000 (14:04 +0200)]
[NFC] remove trailing whitespace
LLVM GN Syncbot [Thu, 23 Jun 2022 11:53:18 +0000 (11:53 +0000)]
[gn build] Port
2c3bbac0c715
Nikolas Klauser [Thu, 23 Jun 2022 10:23:41 +0000 (12:23 +0200)]
[libc++] Implement ranges::move{, _backward}
This patch also adds a new optimization to `std::move`. It unwraps three `reverse_iterator`s if the wrapped iterator is a `contiguous_iterator` and the iterated type is trivially_movable. This allows us to simplify `ranges::move_backward` to a forward to `std::move` without any pessimization.
Reviewed By: var-const, #libc
Spies: libcxx-commits, mgorny
Differential Revision: https://reviews.llvm.org/D126616
Valentin Clement [Thu, 23 Jun 2022 11:43:38 +0000 (13:43 +0200)]
[flang] Lowering passing variables to OPTIONAL VALUE
The case where the dummy argument is OPTIONAL was missing in the
handling of VALUE numerical and logical dummies (passBy::BaseAddressValueAttribute).
This caused segfaults while unconditionally copying actual arguments that were legally
absent at runtime.
Takes this bug as an opportunity to share the code that lowers arguments
that must be passed by BaseAddress, BaseAddressValueAttribute, BoxChar,
and CharBoxValueAttribute.
It has to deal with the exact same issues (being able to make contiguous
copies of the actual argument, potentially conditionally at runtime,
and potentially requiring a copy-back).
The VALUE case is the same as the non value case, except there is never
a copy-back and there is always a copy-in for variables. This two
differences are easily controlled by a byValue flag.
This as the benefit of implementing CHARACTER, VALUE for free that was
previously a hard TODO.
This patch is part of the upstreaming effort from fir-dev branch.
Reviewed By: kiranchandramohan
Differential Revision: https://reviews.llvm.org/D128418
Co-authored-by: Jean Perier <jperier@nvidia.com>
Florian Hahn [Thu, 23 Jun 2022 11:44:41 +0000 (13:44 +0200)]
[VPlan] Update unit test after
569d84fe99e63.
Bruno De Fraine [Thu, 23 Jun 2022 11:25:05 +0000 (13:25 +0200)]
[tbaa] Handle base classes in struct tbaa
This is a fix for the miscompilation reported in https://github.com/llvm/llvm-project/issues/55384
Not adding a new test case since existing test cases already cover base classes (including new-struct-path tbaa).
Reviewed By: jeroen.dobbelaere
Differential Revision: https://reviews.llvm.org/D126956
Florian Hahn [Thu, 23 Jun 2022 11:36:02 +0000 (13:36 +0200)]
[VPlan] Remove dead recipes across whole plan.
This extends removeDeadRecipe to remove recipes across the whole plan.
Reviewed By: Ayal
Differential Revision: https://reviews.llvm.org/D127580
Kristof Beyls [Wed, 15 Jun 2022 13:09:03 +0000 (15:09 +0200)]
[docs] Document and publish LLVM community calendar
Let's introduce and publish an LLVM community calendar.
The idea is that organizers of events such as online sync-ups or office hours
invite calendar@llvm.org to the event they're creating. That way, the calendar
publicly visible at
https://calendar.google.com/calendar/u/0/embed?src=calendar@llvm.org will show
the event.
The hope is that having a single calendar showing all LLVM events makes it
easier for both new comers and experienced people to discover events they're
interested in.
This patch partially implements https://github.com/llvm/llvm-project/issues/55426
We could also give pointers to the calendar in a few other places, e.g. from
the main LLVM page, but let's introduce the incrementally.
Differential Revision: https://reviews.llvm.org/D127852
Aaron Ballman [Thu, 23 Jun 2022 11:22:00 +0000 (07:22 -0400)]
Fix sphinx build for clang-tools-extra
I think it doesn't like the non-ASCII characters in the block, so using
a text block to disable syntax highlighting.
This should fix:
https://lab.llvm.org/buildbot/#/builders/115/builds/29888
Kiran Chandramohan [Thu, 23 Jun 2022 10:55:30 +0000 (10:55 +0000)]
[Flang] Call the CSE pass in the pass pipeline
During the upstreaming process, it was decided to move contents
of the FIR CSE pass to the MLIR pass. Most of the FIR CSE changes
that are used are already moved to the MLIR pass. This patch calls
the MLIR CSE pass in places where the FIR CSE pass is called in the
pass pipeline.
Note: This is part of upstreaming from the fir-dev branch of
https://github.com/flang-compiler/f18-llvm-project.
Reviewed By: awarzynski, clementval
Differential Revision: https://reviews.llvm.org/D128365
Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
Co-authored-by: Valentin Clement <clementval@gmail.com>
Co-authored-by: Andrzej Warzynski <andrzej.warzynski@arm.com>
Nikita Popov [Thu, 23 Jun 2022 10:44:46 +0000 (12:44 +0200)]
[Clang] Don't test register allocation
This test was broken by
719658d078c4093d1ee716fb65ae94673df7b22b.
How did an assembly test get into clang/test?
David Spickett [Thu, 23 Jun 2022 10:33:05 +0000 (10:33 +0000)]
Revert "[LLDB] Handle DIE with DW_AT_low_pc and empty ranges"
This reverts commit
1beededc0e7d86d09cee972f0b9f0030a139cab4.
Due to failures on the Arm/AArch64 build bots:
https://lab.llvm.org/buildbot/#/builders/96/builds/25032
Nikita Popov [Thu, 23 Jun 2022 10:18:28 +0000 (12:18 +0200)]
[X86] Update some AMX tests to use opaque pointers (NFC)
This only touches IR tests (or tests without codegen changes).
Dmitry Preobrazhensky [Thu, 23 Jun 2022 10:07:45 +0000 (13:07 +0300)]
[AMDGPU][MC][GFX11] Correct disassembly of VOP3.DPP8 opcodes
Fix bug #56163.
Add W32/W64 tests for all VOP3.DPP opcodes.
Differential Revision: https://reviews.llvm.org/D128369
isuckatcs [Wed, 8 Jun 2022 21:23:07 +0000 (23:23 +0200)]
[analyzer] Structured binding to arrays
Introducing structured binding to data members and more.
To handle binding to arrays, ArrayInitLoopExpr is also
evaluated, which enables the analyzer to store information
in two more cases. These are:
- when a lambda-expression captures an array by value
- in the implicit copy/move constructor for a class
with an array member
Differential Revision: https://reviews.llvm.org/D126613
Nikita Popov [Mon, 20 Jun 2022 15:38:04 +0000 (17:38 +0200)]
[IR] Export ConstantFold.h header (NFC)
This is in preparation for https://discourse.llvm.org/t/rfc-remove-most-constant-expressions/63179.
As part of that change, we'll want to invoke some of these constant
folding APIs explicitly, as it won't happen as part of
ConstantExpr::getXYZ() anymore.
Ideally, we'd merge these with the DL-aware constant folding APIs
and only call those, but this is not easily possible for some
current usages (most important IRBuilder, which uses DL-independent
constant folding by default, and some major layering changes would
be needed to change that).
This is basically a reboot of D115035 with different motivation.
Differential Revision: https://reviews.llvm.org/D128213
Balázs Kéri [Thu, 23 Jun 2022 08:24:45 +0000 (10:24 +0200)]
[clang][analyzer] Fix StdLibraryFunctionsChecker 'mkdir' return value.
The functions 'mkdir', 'mknod', 'mkdirat', 'mknodat' return 0 on success
and -1 on failure. The checker modeled these functions with a >= 0
return value on success which is changed to 0 only. This fix makes
ErrnoChecker work better for these functions.
Reviewed By: steakhal
Differential Revision: https://reviews.llvm.org/D127277
Weining Lu [Thu, 23 Jun 2022 09:07:42 +0000 (17:07 +0800)]
[LoongArch] Combine ((x & shifted_mask) >> shamt) to bstrpick.{w/d}
This is an improvement to LoongArch codegen. In D127206 we combined
((x >> shamt) & shifted_mask) to bstrpick and here we do a similar
combination when certain conditions are met.
Thanks to @xen0n for reminding me.
Differential Revision: https://reviews.llvm.org/D128191
Florian Hahn [Thu, 23 Jun 2022 09:04:51 +0000 (11:04 +0200)]
[ConstraintElimination] Transfer info from SGT to unsigned system.
If A >s B then A >=u 0, if B >=s -1.
https://alive2.llvm.org/ce/z/cncGKi
Adrian Kuegel [Wed, 22 Jun 2022 11:50:30 +0000 (13:50 +0200)]
[mlir] Add an additional check to vectorizeStaticLinalgOpPrecondition.
We need to make sure that the types used in the body are valid element types
for VectorType.
Differential Revision: https://reviews.llvm.org/D128336
Luo, Yuanke [Thu, 23 Jun 2022 01:18:47 +0000 (09:18 +0800)]
[fastalloc] Support allocating specific register class in fastalloc
The base RA support infrastructure that only allow a specific register
class be allocated in RA pss. Since greedy RA, basic RA derived from
base RA, they all allow allocating specific register class. Fast RA
doesn't support allocating register for specific register class. This
patch is to enable ShouldAllocateClass in fast RA, so that it can
support allocating register for specific register class.
Differential Revision: https://reviews.llvm.org/D126771
Fangrui Song [Thu, 23 Jun 2022 06:16:31 +0000 (23:16 -0700)]
Revert D115462 "[SLP]Improve shuffles cost estimation where possible."
This reverts commit
cac60940b771a0685d058a5b471c84cea05fdc46.
Caused -Os -fsanitize=memory -march=haswell miscompile to pytorch/cpuinfo.
See my latest comment (may update) on D115462.
Fangrui Song [Thu, 23 Jun 2022 05:31:01 +0000 (22:31 -0700)]
Revert "[SLP]Fix a crash when insert subvector is out of range."
This reverts commit
f1ee2738b3d70fea803ac1f3401c2fc9f61e514a.
Revert due to the revert of a dependent commit `[SLP]Improve shuffles cost estimation where possible.`
Craig Topper [Thu, 23 Jun 2022 06:04:30 +0000 (23:04 -0700)]
[RISCV] Refactor code to remove some small wrapper methods and merge two functions together. NFC
chenglin.bi [Thu, 23 Jun 2022 05:21:51 +0000 (13:21 +0800)]
Revert "[SelectionDAG][DAGCombiner] Reuse exist node by reassociate"
This reverts commit
6c951c5ee6d0b848877cb8ac7a9cb2a9ef9ebbb5.
Serguei Katkov [Tue, 21 Jun 2022 08:57:44 +0000 (15:57 +0700)]
[RS4GC] Handle freeze case for vector
Finding BDV for vector value does not handle freeze instruction.
Adding its handling as it is done for scalar case.
Reviewed By: apilipenko
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D128254
Valentin Clement [Thu, 23 Jun 2022 04:54:03 +0000 (06:54 +0200)]
[flang] Fixes several bugs relating to initialization expressions. An (#1493)
Fixes several bugs relating to initialization expressions. An
initialization expression has no access to dynamic resources like the
stack or the heap. It must reduce to a relocatable expression that the
loader can complete at runtime.
Adds regression test.
This patch is part of the upstreaming effort from fir-dev branch.
Reviewed By: PeteSteinfeld
Differential Revision: https://reviews.llvm.org/D128380
Co-authored-by: Jean Perier <jperier@nvidia.com>
Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
Charlie Barto [Thu, 23 Jun 2022 04:34:19 +0000 (21:34 -0700)]
[GlobalISel][TableGen] Qualify calls to llvm::format that have ::std:: types as parameters
... to avoid ambiguity in overload resolution when ADL finds `std::format`.
Differential Revision: https://reviews.llvm.org/D119213
wangpc [Thu, 23 Jun 2022 03:11:09 +0000 (11:11 +0800)]
[TableGen] Add new operator !exists
We can cast a string to a record via !cast, but we have no mechanism
to check if it is valid and TableGen will raise an error if failed to
cast. Besides, we have no semantic null in TableGen (we have `?` but
different backends handle uninitialized value differently), so operator
like `dyn_cast<>` is hard to implement.
In this patch, we add a new operator `!exists<T>(s)` to check whether
a record with type `T` and name `s` exists. Self-references are allowed
just like `!cast`.
By doing these, we can write code like:
```
class dyn_cast_to_record<string name> {
R value = !if(!exists<R>(name), !cast<R>(name), default_value);
}
defvar v = dyn_cast_to_record<"R0">.value; // R0 or default_value.
```
Reviewed By: tra, nhaehnle
Differential Revision: https://reviews.llvm.org/D127948
LLVM GN Syncbot [Thu, 23 Jun 2022 02:41:57 +0000 (02:41 +0000)]
[gn build] Port
2962f9df7ca3
John Regehr [Tue, 21 Jun 2022 23:30:52 +0000 (17:30 -0600)]
stop llvm-reduce from introducing undefs
Differential Revision: https://reviews.llvm.org/D128317
Okwan Kwon [Wed, 22 Jun 2022 22:59:53 +0000 (15:59 -0700)]
[mlir][linalg] move isElementwise() to Linalg/Utils (NFC)
Differential Revision: https://reviews.llvm.org/D128398
Julian Lettner [Thu, 23 Jun 2022 01:19:31 +0000 (18:19 -0700)]
[ASan][Darwin] XFAIL test; atos does not show line numbers for globals
atos currently doesn't show source line numbers for global variables, so
global-location.cpp is failing after we switched from ASan-specific
metadata to normal symbolication.
See:
https://reviews.llvm.org/D127552
Matt Arsenault [Fri, 17 Jun 2022 22:24:28 +0000 (18:24 -0400)]
AMDGPU: Add missing implicit uses in tests
These tests were deleting the copy instruction, defeating
the purpose of having it.
Matt Arsenault [Fri, 10 Jun 2022 19:07:39 +0000 (15:07 -0400)]
AMDGPU: Fix invalid liveness after si-optimize-exec-masking-pre-ra
This was leaving behind a use at the deleted instruction which the
verifier would fail during allocation.
Matt Arsenault [Wed, 15 Jun 2022 21:04:05 +0000 (17:04 -0400)]
InlineSpiller: Don't fold spills into undef reads
This was producing a load into a dead register which was a verifier
error.
Fazlay Rabbi [Thu, 23 Jun 2022 00:10:31 +0000 (17:10 -0700)]
[OpenMP] Add handling cases when filter(tid) appears with default(none)
Differential Revision: https://reviews.llvm.org/D128397
Mingming Liu [Wed, 1 Jun 2022 22:21:59 +0000 (15:21 -0700)]
[SampleProfile][Inline] Annotate sample profile inline remarks with link phase (prelink/postlink) information.
Differential Revision: https://reviews.llvm.org/D126833
Paul Walker [Thu, 24 Feb 2022 18:40:23 +0000 (18:40 +0000)]
[SVE] Make ISD::SPLAT_VECTOR a legal operation.
The implication of this patch being AArch64ISD::DUP no longer
supports scalable vectors.
Differential Revision: https://reviews.llvm.org/D128265
jackalcooper [Tue, 21 Jun 2022 16:28:36 +0000 (12:28 -0400)]
[mlir][vulkan-runner] fix VK_ERROR_INCOMPATIBLE_DRIVER error
On macOS, Vulkan is emulated by MoltenVK. Some extra flags are
required for "building robust and portable Vulkan based
applications that are good citizens in the Vulkan ecosystem".
More information:
https://vulkan.lunarg.com/doc/sdk/1.3.216.0/mac/getting_started.html
Reviewed By: antiagainst
Differential Revision: https://reviews.llvm.org/D128173
Nikolas Klauser [Wed, 22 Jun 2022 19:10:57 +0000 (21:10 +0200)]
[libc++] Implement P0154R1 (Hardware inference size)
`__GCC_CONSTRUCTIVE_SIZE` and `__GCC_DESTRUCTIVE_SIZE` are available since GCC 12. I'm assuming clang will also implement these for compatability with libstdc++.
Reviewed By: ldionne, #libc
Spies: h-vetinari, libcxx-commits, arichardson
Differential Revision: https://reviews.llvm.org/D122276
Nikolas Klauser [Wed, 22 Jun 2022 09:14:04 +0000 (11:14 +0200)]
[libc++] Simplify the visibility attributes
Reviewed By: ldionne, #libc
Spies: libcxx-commits
Differential Revision: https://reviews.llvm.org/D128007
Fangrui Song [Wed, 22 Jun 2022 23:19:17 +0000 (16:19 -0700)]
[ELF][test] Clean up thinlto*
Florian Mayer [Wed, 15 Jun 2022 22:31:05 +0000 (15:31 -0700)]
[MTE] [HWASan] Use LoopInfo for reachability queries.
The reachability queries default to "reachable" after exploring too many
basic blocks. LoopInfo helps it skip over the whole loop.
Reviewed By: eugenis
Differential Revision: https://reviews.llvm.org/D127917
Chelsea Cassanova [Tue, 21 Jun 2022 18:11:27 +0000 (14:11 -0400)]
[lldb/Fuzzer] Add command interpreter fuzzer for LLDB
This adds a command interpreter fuzzer to LLDB's fuzzing library.
The input data from the fuzzer is used as input for the command
interpreter.
Input data for the fuzzer is guided by a dictionary of keywords used in
LLDB, such as "breakpoint", "target" and others.
Differential revision: https://reviews.llvm.org/D128292
Adrian Tong [Wed, 22 Jun 2022 21:22:45 +0000 (21:22 +0000)]
Fix a misspell. NFC
Brendon Cahoon [Wed, 6 Apr 2022 14:05:56 +0000 (09:05 -0500)]
[StructurizeCFG] Improve basic block ordering
StructurizeCFG linearizes the successors of branching basic block
by adding Flow blocks to record the true/false path for branches
and back edges. This patch reduces the number of Phi values needed
to capture the control flow path by improving the basic block
ordering.
Previously, StructurizeCFG adds loop exit blocks outside of the
loop. StructurizeCFG sets a boolean value to indicate the path
taken, and all exit block live values extend to after the loop.
For loops with a large number of exits blocks, this creates a
huge number of values that are maintained, which increases
compilation time and register pressure. This is problem
especially with ASAN, which adds early exits to blocks with
unreachable instructions for each instrumented check in the loop.
In specific cases, this patch reduces the number of values needed
after the loop by moving the exit block into the loop. This is
done for blocks that have a single predecessor and single successor
by moving the block to appear just after the predecessor.
Differential Revision: https://reviews.llvm.org/D123231
Jonas Devlieghere [Wed, 22 Jun 2022 20:46:00 +0000 (13:46 -0700)]
[lldb] Fix off-by-one error in the AppleObjCRuntimeV2 utility function
Fix an off-by-one error in the utility function used to extract the
dynamic class info. This resulted in a buffer overflow in the inferior
which interrupted our utility function.
Differential revision: https://reviews.llvm.org/D128377
Jonas Devlieghere [Wed, 22 Jun 2022 20:39:56 +0000 (13:39 -0700)]
[lldb] Return the correct utility function in AppleObjCRuntimeV2
A copy/paste error in GetClassInfoUtilityFunction resulted in the wrong
utility function being returned: copyRealizedClassList instead of
getRealizedClassList_trylock.
Differential revision: https://reviews.llvm.org/D128378
Brendon Cahoon [Wed, 6 Apr 2022 01:53:46 +0000 (20:53 -0500)]
[UnifyLoopExits] Reduce number of guard blocks
UnifyLoopExits creates a single exit, a control flow hub, for
loops with multiple exits. There is an input to the block for
each loop exiting block and an output from the block for each
loop exit block. Multiple checks, or guard blocks, are needed
to branch to the correct exit block.
For large loops with lots of exit blocks, all the extra guard
blocks cause problems for StructurizeCFG and subsequent passes.
This patch reduces the number of guard blocks needed when the
exit blocks branch to a common block (e.g., an unreachable
block). The guard blocks are reduced by changing the inputs
and outputs of the control flow hub. The inputs are the exit
blocks and the outputs are the common block.
Reducing the guard blocks enables StructurizeCFG to reorder the
basic blocks in the CFG to reduce the values that exit a loop
with multiple exits. This reduces the compile-time of
StructurizeCFG and also reduces register pressure.
Differential Revision: https://reviews.llvm.org/D123230
Evgenii Stepanov [Wed, 22 Jun 2022 18:19:56 +0000 (11:19 -0700)]
Revert "[Attributor] Ensure to use the proper liveness AA"
Reason: memory leaks
This reverts commit
083010312aa4a0ba0cd5299bd3b039af8fb6d58f.
Nathan James [Wed, 22 Jun 2022 20:37:16 +0000 (21:37 +0100)]
[clang-tidy][docs] Fix a couple of missed cases from
6e566bc5523
A few of the checks had documentation URLs that weren't updated in the aforementioned commit.
Valentin Clement [Wed, 22 Jun 2022 20:32:21 +0000 (22:32 +0200)]
[flang] Capture result interface of functions called in internal procedures
Character and array results are allocated on the caller side. This
require evaluating the result interface on the call site. When calling
such functions inside an internal procedure, it is possible that the
interface is defined in the host, in which case the lengths/bounds of
the function results must be captured so that they are available in
the internal function to emit the call.
To handle this case, extend the PFT symbol visit to visit the bounds and length
parameters of functions called in the internal procedure parse tree.
This patch is part of the upstreaming effort from fir-dev branch.
Reviewed By: klausler
Differential Revision: https://reviews.llvm.org/D128371
Co-authored-by: Jean Perier <jperier@nvidia.com>
Nathan James [Wed, 22 Jun 2022 20:21:24 +0000 (21:21 +0100)]
[clang-tidy][docs] Reorganise release notes
Jim Ingham [Wed, 22 Jun 2022 19:16:24 +0000 (12:16 -0700)]
Fix a bug with "process continue -b" when no breakpoints are
passed. I was passing the empty list of breakponts to the
VerifyBreakpointList routine, but that treats empty as "choose
the default breakpoint" which we don't want here.
Nicolas Vasilache [Tue, 21 Jun 2022 12:11:29 +0000 (05:11 -0700)]
[mlir][Linalg] SplitReduction implementation without tensor::ExpandShapeOp
This revision proposes a different implementation of the SplitReductoin transformation that does
not rely on tensor::ExpandShapeOp.
Previously, a dimension `[k]` would be split into `[k][kk]` via an ExpandShapeOp.
Instead, this revision proposes to rewrite `[k]` into `[factor * k + kk]`.
There are different tradeoffs involved but the proposed implementation is more general because
the affine rewrite is well-defined. In particular, it works naturally with `?` parallel dimensions and
non-trivial indexing maps.
A further rewrite of `[factor * k + kk]` + ExpandShapeOp is possible as a followup.
Differential Revision: https://reviews.llvm.org/D128266
Guillaume Gomez [Wed, 22 Jun 2022 18:48:31 +0000 (19:48 +0100)]
Rename GCCBuiltin into ClangBuiltin
This patch is needed because developers expect "GCCBuiltin" items to be the GCC intrinsics equivalent and not the Clang internals.
Reviewed By: #libc_abi, RKSimon, xbolva00
Differential Revision: https://reviews.llvm.org/D127460
Valentin Clement [Wed, 22 Jun 2022 18:47:48 +0000 (20:47 +0200)]
[flang] Remove some auto
This patch replaces some `auto` with proper type. This was done in fir-dev
but not upstreamed yet.
This patch is part of the upstreaming effort from fir-dev branch.
Reviewed By: klausler
Differential Revision: https://reviews.llvm.org/D128350
Valentin Clement [Wed, 22 Jun 2022 18:46:30 +0000 (20:46 +0200)]
[flang] Handle BINC(C) variables and add TODO for corner cases
- BIND(C) was ignored in lowering for objects (it can be used on
module and common blocks): use the bind name as the fir.global name.
- When an procedure is declared BIND(C) indirectly via an interface,
it should have a BIND(C) name. This was not the case because
GetBindName()/bindingName() return nothing in this case: detect this
case in mangler.cpp and use the symbol name.
Add TODOs for corner cases:
- BIND(C) module variables may be initialized on the C side. This does
not fit well with the current linkage strategy. Add a TODO until this
is revisited.
- BIND(C) internal procedures should not have a binding label (see
Fortran 2018 section 18.10.2 point 2), yet we currently lower them as
if they were BIND(C) external procedure.
I think this and the indirect interface case should really be
handled by symbol.GetBindName instead of adding more logic in
lowering to deal with this case: add a TODO.
This patch is part of the upstreaming effort from fir-dev branch.
Reviewed By: klausler
Differential Revision: https://reviews.llvm.org/D128340
Co-authored-by: Jean Perier <jperier@nvidia.com>
Joe Loser [Wed, 22 Jun 2022 17:25:43 +0000 (11:25 -0600)]
[libc++] Clarify std::function release note
Replace "This option it" with "This option" to make the sentence read a bit
clearer.
Differential Revision: https://reviews.llvm.org/D128362
Florian Mayer [Tue, 14 Jun 2022 22:41:27 +0000 (15:41 -0700)]
[MTE] [HWASan] Support diamond lifetimes.
We were overly conservative and required a ret statement to be dominated
completely be a single lifetime.end marker. This is quite restrictive
and leads to two problems:
* limits coverage of use-after-scope, as we degenerate to
use-after-return;
* increases stack usage in programs, as we have to remove all lifetime
markers if we degenerate to use-after-return, which prevents
reuse of stack slots by the stack coloring algorithm.
Reviewed By: eugenis
Differential Revision: https://reviews.llvm.org/D127905
Walter Erquinigo [Sat, 18 Jun 2022 22:44:37 +0000 (15:44 -0700)]
[trace] Add an option to dump instructions in json and to a file
In order to provide simple scripting support on top of instruction traces, a simple solution is to enhance the `dump instructions` command and allow printing in json and directly to a file. The format is verbose and not space efficient, but it's not supposed to be used for really large traces, in which case the TraceCursor API is the way to go.
- add a -j option for printing the dump in json
- add a -J option for pretty printing the json output
- add a -F option for specifying an output file
- add a -a option for dumping all the instructions available starting at the initial point configured with the other flags
- add tests for all cases
- refactored the instruction dumper and abstracted the actual "printing" logic. There are two writer implementations: CLI and JSON. This made the dumper itself much more readable and maintanable
sample output:
```
(lldb) thread trace dump instructions -t -a --id 100 -J
[
{
"id": 100,
"tsc": "
43591204528448966"
"loadAddress": "0x407a91",
"module": "a.out",
"symbol": "void std::deque<Foo, std::allocator<Foo>>::_M_push_back_aux<Foo>(Foo&&)",
"mnemonic": "movq",
"source": "/usr/include/c++/8/bits/deque.tcc",
"line": 492,
"column": 30
},
...
```
Differential Revision: https://reviews.llvm.org/D128316
Richard [Fri, 17 Jun 2022 01:02:47 +0000 (19:02 -0600)]
[clang-tidy] Organize test files into subdirectories by module (NFC)
Eliminate clutter by reorganizing the Lit test files for clang-tidy:
- Move checkers/<module>-* to checkers/<module>/*.
- Move module specific inputs from Inputs to <module>/Inputs. Remove
any module prefix from the file or subdirectory name as they are no
longer needed.
- Introduce a Lit substitution %clang_tidy_headers for the system
headers in checkers/Inputs/Headers and use this throughout. This
avoids referencing system headers through a relative path to the
parent directory and makes it clear that these fake system headers are
shared among all modules.
- Update add_new_check.py to follow the above conventions when creating
the boiler plate test files for a new check.
- Update Contributing.rst to describe per-module Inputs directory and
fix link to test source code.
Differential Revision: https://reviews.llvm.org/D128072
Alexander Yermolovich [Wed, 22 Jun 2022 17:52:19 +0000 (10:52 -0700)]
[LLDB] Handle DIE with DW_AT_low_pc and empty ranges
The case comes out of how BOLT handles transformation of
DW_AT_low_pc/DW_AT_high_pc into DW_AT_low_pc/DW_AT_high_pc
with latter being 0.
Reviewed By: clayborg
Differential Revision: https://reviews.llvm.org/D127889
Florian Mayer [Wed, 15 Jun 2022 22:54:12 +0000 (15:54 -0700)]
[NFC] [HWASan] Remove indirection for getting analyses.
This was necessary for code reuse between the old and new passmanager.
With the old pass-manager gone, this is no longer necessary.
Reviewed By: eugenis, myhsu
Differential Revision: https://reviews.llvm.org/D127913
Argyrios Kyrtzidis [Wed, 22 Jun 2022 17:49:31 +0000 (10:49 -0700)]
[Support/BLAKE3] Fix error in prior commit, apply `-mavx512vl` for `blake3_avx512_x86-64_unix.S` when including it
Alvin Wong [Wed, 22 Jun 2022 17:48:01 +0000 (20:48 +0300)]
[lldb] Second attempt at fixing command-target-create-resolve-exe.test on the buildbot
Mark de Wever [Tue, 14 Jun 2022 15:47:51 +0000 (17:47 +0200)]
[libc++][NFC] Merges unused functions in callers.
This is a follow up based on a request of @jloser in D127594.
As drive-by qualified the function calls in the <bit> header.
Reviewed By: #libc, EricWF
Differential Revision: https://reviews.llvm.org/D127760
Joseph Huber [Wed, 22 Jun 2022 15:17:14 +0000 (11:17 -0400)]
[LinkerWrapper][NFC] Change interface to use a StringRef to TempFiles
Summary:
Currently we use temporary files to write the intermediate results to.
However, these are stored as regular strings and we do a few unnecessary
copies and conversions of them. This patch simply replaces these strings
with a reference to the filename stored in the list of temporary files.
The temporary files will stay alive during the whole linking phase and
have stable pointers, so we should be able to cheaply pass references to
them rather than copying them every time.
Mingming Liu [Fri, 17 Jun 2022 15:49:04 +0000 (08:49 -0700)]
[Support] Change TrackingStatistic and NoopStatistic to use uint64_t instead of unsigned.
Binary size of `clang` is trivial; namely, numerical value doesn't
change when measured in MiB, and `.data` section increases from 139Ki to
173 Ki.
Differential Revision: https://reviews.llvm.org/D128070
lorenzo chelini [Wed, 22 Jun 2022 17:04:40 +0000 (19:04 +0200)]
[MLIR] Fix top-level comment (NFC)
Daniel Thornburgh [Fri, 29 Apr 2022 19:09:19 +0000 (19:09 +0000)]
[Symbolize] Parse multi-line markup elements.
This allows registering certain tags as possibly beginning multi-line
elements in the symbolizer markup parser. The parser is kept agnostic to
how lines are delimited; it reports the entire contents, including line
endings, once the end of element marker is reached.
Reviewed By: peter.smith
Differential Revision: https://reviews.llvm.org/D124798
Jim Ingham [Wed, 8 Jun 2022 01:03:23 +0000 (18:03 -0700)]
Add a "-b" option to "process continue" to run to a set of breakpoints,
temporarily ignoring the others.
Differential Revision: https://reviews.llvm.org/D126513
serge-sans-paille [Wed, 22 Jun 2022 14:20:21 +0000 (16:20 +0200)]
[iwyu] Handle regressions in libLLVM header include
Running iwyu-diff on LLVM codebase since
fb67d683db46dfd88da09d99 detected a few
regressions, fixing them.
The impact on preprocessed output is negligible: -4k lines.
Richard [Wed, 22 Jun 2022 16:46:27 +0000 (10:46 -0600)]
[clang-tidy] Fix documentation (NFC)
The documentation files were reorganized into subdirectories, but a new
check was added concurrently and wasn't rebased correctly before
submitting. Sort the new clang-tidy checks by check name and fix the
indentation of bugprone-unchecked-optional-access.
Mark de Wever [Mon, 20 Jun 2022 16:28:34 +0000 (18:28 +0200)]
[libc++] Reduces std::to_chars instantiations.
Instead of instantiating all functions called by std::to_chars for the
integral types only instantiate them for 32 and 64 bit integral types.
This results in a smaller binary when using different types.
In an example using the types: signed char, short, int, long, long long,
unsigned char, unsigned short, unsigned int, unsigned long, and
unsigned long long this saved 2792 bytes of code size. For libc++.so.1
is saves 688 bytes of code size (64-bit Linux).
This was discovered while investigating a solution for #52709.
Reviewed By: #libc, ldionne
Differential Revision: https://reviews.llvm.org/D128215
Aart Bik [Tue, 21 Jun 2022 23:03:25 +0000 (16:03 -0700)]
[mlir][sparse] fix typo in CHECK test
Thanks Peiming for reporting!
Reviewed By: Peiming
Differential Revision: https://reviews.llvm.org/D128308
Aart Bik [Tue, 21 Jun 2022 23:47:44 +0000 (16:47 -0700)]
[mlir][sparse] accept sparse reshape (expand/collapse)
This revision makes sure we accept sparse tensors as arguments
of the expand/collapse reshaping operations in the tensor dialect.
Note that the actual lowering to runnable IR is still TBD.
Reviewed By: springerm
Differential Revision: https://reviews.llvm.org/D128311
Arjun P [Wed, 22 Jun 2022 16:29:46 +0000 (18:29 +0200)]
[MLIR][Presburger] introduce SlowMPInt, an auto-resizing APInt for fully correct signed integer computations
The Presburger library currently uses int64_t throughout for its integers.
This runs the risk of silently producing incorrect results when overflows occur.
Fixing this issue requires some sort of multiprecision integer
that transparently supports aribtrary arithmetic computations.
The class SlowMPInt provides this functionality, and is intended to be used
as the slow path fallback for a more optimized upcoming class, MPInt, that optimizes
for the Presburger library's workloads.
Reviewed By: ftynse
Differential Revision: https://reviews.llvm.org/D123758
Max Kazantsev [Wed, 22 Jun 2022 13:48:47 +0000 (20:48 +0700)]
[LSR] Don't allow zero quotient as scale ref. PR56160
Scale reg should never be zero, so when the quotient is zero, we
cannot assign it there. Limit this transform to avoid this situation.
Differential Revision: https://reviews.llvm.org/D128339
Reviewed By: eopXD
Craig Topper [Wed, 22 Jun 2022 16:00:15 +0000 (09:00 -0700)]
[RISCV] Add RISCVISD opcodes for the rest of get*Addr.
This adds RISCVISD opccodes for LA, LA_TLS_IE, and LA_TLS_GD to
remove creation of MachineSDNodes form get*Addr. This makes the
code consistent with the previous patches that added RISCVISD::HI,
ADD_LO, LLA, and TPREL_ADD.
Reviewed By: asb
Differential Revision: https://reviews.llvm.org/D128325
Mark de Wever [Wed, 22 Jun 2022 16:11:19 +0000 (18:11 +0200)]
[libc++][CI] Use GCC 12 labels.
Xiang Li [Tue, 14 Jun 2022 00:15:56 +0000 (17:15 -0700)]
[DirectX] Support opaque ptr for ValueAsMetadata in DXILBitcodeWriter
When writeValueAsMetadata for GlobalVariable and Function, write TypedPointerType for ValueType and FunctionType.
Reviewed By: bogner
Differential Revision: https://reviews.llvm.org/D127705
Peixin Qiao [Wed, 22 Jun 2022 16:04:24 +0000 (00:04 +0800)]
[flang] Add semantic check for C1520
As Fortran 2018 C1520, if proc-language-binding-spec with NAME= is
specified, then proc-decl-list shall contain exactly one proc-decl,
which shall neither have the POINTER attribute nor be a dummy procedure.
Add this check.
Reviewed By: klausler
Differential Revision: https://reviews.llvm.org/D127725
Peixin Qiao [Wed, 22 Jun 2022 15:56:34 +0000 (23:56 +0800)]
[flang][Driver] Refine _when_ driver diagnostics are formatted
This patch refines //when// driver diagnostics are formatted so that
`flang-new` and `flang-new -fc1` behave consistently with `clang` and
`clang -cc1`, respectively. This change only applies to driver diagnostics.
Scanning, parsing and semantic diagnostics are separate and not covered here.
**NEW BEHAVIOUR**
To illustrate the new behaviour, consider the following input file:
```! file.f90
program m
integer :: i = k
end
```
In the following invocations, "error: Semantic errors in file.f90" _will be_
formatted:
```
$ flang-new file.f90
error: Semantic errors in file.f90
./file.f90:2:18: error: Must be a constant value
integer :: i = k
$ flang-new -fc1 -fcolor-diagnostics file.f90
error: Semantic errors in file.f90
./file.f90:2:18: error: Must be a constant value
integer :: i = k
```
However, in the following invocations, "error: Semantic errors in file.f90"
_will not be_ formatted:
```
$ flang-new -fno-color-diagnostics file.f90
error: Semantic errors in file.f90
./file.f90:2:18: error: Must be a constant value
integer :: i = k
$ flang-new -fc1 file.f90
error: Semantic errors in file.f90
./file.f90:2:18: error: Must be a constant value
integer :: i = k
```
Before this change, none of the above would be formatted. Note also that the
default behaviour in `flang-new` is different to `flang-new -fc1` (this is
consistent with Clang).
**NOTES ON IMPLEMENTATION**
Note that the diagnostic options are parsed in `createAndPopulateDiagOpt`s in
driver.cpp. That's where the driver's `DiagnosticEngine` options are set. Like
most command-line compiler driver options, these flags are "claimed" in
Flang.cpp (i.e. when creating a frontend driver invocation) by calling
`getLastArg` rather than in driver.cpp.
In Clang's Options.td, `defm color_diagnostics` is replaced with two separate
definitions: `def fcolor_diagnostics` and def fno_color_diagnostics`. That's
because originally `color_diagnostics` derived from `OptInCC1FFlag`, which is a
multiclass for opt-in options in CC1. In order to preserve the current
behaviour in `clang -cc1` (i.e. to keep `-fno-color-diagnostics` unavailable in
`clang -cc1`) and to implement similar behaviour in `flang-new -fc1`, we can't
re-use `OptInCC1FFlag`.
Formatting is only available in consoles that support it and will normally mean that
the message is printed in bold + color.
Co-authored-by: Andrzej Warzynski <andrzej.warzynski@arm.com>
Reviewed By: rovka
Differential Revision: https://reviews.llvm.org/D126164
Peixin Qiao [Wed, 22 Jun 2022 15:53:38 +0000 (23:53 +0800)]
[NFC][flang] Add the test case for D125371
This adds the test case with portability warning preparing for D125804,
which supports checking for portability warnings in test_errors.py.
Reviewed By: ekieri
Differential Revision: https://reviews.llvm.org/D127821
Martin Storsjö [Wed, 22 Jun 2022 15:48:04 +0000 (18:48 +0300)]
[lldb] Tentative attempt to fix command-target-create-resolve-exe.test on buildbot
This test does succeed in my local test environment though, but
fails on the buildbot.
Jonathan Peyton [Thu, 5 May 2022 14:15:41 +0000 (09:15 -0500)]
[OpenMP][libomp] Hold old __kmp_threads arrays until library shutdown
When many nested teams are formed, __kmp_threads may be reallocated
to accommodate new threads. This reallocation causes a data
race when another existing team's thread simultaneously references
__kmp_threads. This patch keeps the old thread arrays around until library
shutdown so these lingering references can complete without issue and
access to __kmp_threads remains a simple array reference.
Fixes: https://github.com/llvm/llvm-project/issues/54708
Differential Revision: https://reviews.llvm.org/D125013
Nikita Popov [Wed, 22 Jun 2022 15:25:35 +0000 (17:25 +0200)]
[X86PreAMXConfig] Use IRBuilder to insert instructions (NFC)
Use an IRBuilder to insert instructions in preWriteTileCfg().
While here, also remove some unnecessary bool return values.
There are some test changes because the IRBuilder folds
"trunc i16 8 to i8" to "i8 8", and that has knock-on effects on
instruction naming.
I ran into this when converting tests to opaque pointers and
noticed that this pass introduces unnecessary "bitcast ptr to ptr"
instructions.
Mark de Wever [Wed, 22 Jun 2022 15:26:17 +0000 (17:26 +0200)]
[libc++] Fixes GCC-12 build.
Nikita Popov [Wed, 22 Jun 2022 15:00:10 +0000 (17:00 +0200)]
[X86] Regenerate test checks (NFC)
This runs the test through -instnamer and generates test checks
using update_test_checks.py. (The previous comment indicated that
update_llc_test_checks.py was used, but I rather doubt that.)
This relies on the non-determinism fix from
fbb72530fe80a95678a7d643d7a3f5ee8d693c93,
the previous check lines have apparently been written to accomodate
that non-determinism.
Nikita Popov [Wed, 22 Jun 2022 14:56:43 +0000 (16:56 +0200)]
[X86PreAMXConfig] Use MapVector to fix non-determinism
We generate code by iterating over this map, so make sure that the
order is deterministic.
Guillaume Chatelet [Wed, 22 Jun 2022 14:55:47 +0000 (14:55 +0000)]
Revert "[NFC] Remove dead code"
This reverts commit
8ba2cbff70f2c49a8926451c59cc260d67b706cf.
Nikita Popov [Wed, 22 Jun 2022 14:43:21 +0000 (16:43 +0200)]
[X86] Name instructions in test (NFC)
Run the test through -instnamer, to make it easier to modify.
Nico Weber [Wed, 22 Jun 2022 14:44:07 +0000 (10:44 -0400)]
[gn build] Port
c3574ef739fb slightly better
The name of the host binary changed from make_confusable_table to
make-confusable-table, so match that.
Nico Weber [Fri, 3 Jun 2022 11:49:28 +0000 (07:49 -0400)]
Reland "[gn build] (manually) port
b94db7ed7eaf (Confusables.inc)"
b94db7ed7eaf relanded in
c3574ef739fb.
This relands commit
180bae08a04d4dc, rebased across the new version of
commit
c3574ef739fb, and rebased across
10f7255d32b690.
serge-sans-paille [Fri, 15 Oct 2021 13:20:22 +0000 (15:20 +0200)]
[clang-tidy] Confusable identifiers detection
Detect identifiers that are confusable using a variant of Unicode definition
http://www.unicode.org/reports/tr39/#Confusable_Detection
and have conflicting scopes.
This a recommit (with portability and feature fixes) of
b94db7ed7eaf4a3b21f600653a09c55cab77b79f
Differential Revision: https://reviews.llvm.org/D112916
Alvin Wong [Wed, 22 Jun 2022 13:16:04 +0000 (16:16 +0300)]
[lldb] Add setting to override PE/COFF ABI by module name
The setting `plugin.object-file.pe-coff.module-abi` is a string-to-enum
map that allows specifying an ABI to a module name. For example:
ucrtbase.dll=msvc
libstdc++-6.dll=gnu
This allows for debugging a process which mixes both modules built using
the MSVC ABI and modules built using the MinGW ABI.
Depends on D127048
Reviewed By: DavidSpickett
Differential Revision: https://reviews.llvm.org/D127234