Commit Graph

427881 Commits

Author SHA1 Message Date
Valentin Clement d45d707434
[flang] Explicitly map host associated symbols
Explicitly map host associated symbols in DoConcurrent with shared
locality-spec, clauses in OpenMP/OpenACC. The mapping of host-assoc
symbols is set to their parent SymbolBox. This is achieved through
a new interface function in the AbstractConverter.

This was already upstream for OpenMP.

This patch is part of the upstreaming effort from fir-dev branch.

Reviewed By: PeteSteinfeld

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

Co-authored-by: Kiran Chandramohan <kiran.chandramohan@arm.com>
2022-06-24 21:03:49 +02:00
Thomas Raoux 7eba5cdf9c [mlir][vector] Relax transfer_write vector distribution pattern
Small change to relax the pattern to support any vector containing a
single element.

Differential Revision: https://reviews.llvm.org/D128545
2022-06-24 19:03:14 +00:00
Valentin Clement 4489ef8e34
[flang] Fix LBOUND with assumed size array and non constant DIM
LBOUND with a non constant DIM argument use the runtime to allow runtime
verification of DIM <= RANK. The interface uses a descriptor. This caused
undefined behavior because the runtime believed it was seeing an explicit
shape arrays with zero extent and returned `1` (the runtime descriptor
does not allow making a difference between an explicit shape and an
assumed size. Assumed size are not meant to be described by runtime
descriptors).

Fix the issue by setting the last extent of assumed size to `1` when
creating the descriptor to inquire about the LBOUND with the runtime.

This patch is part of the upstreaming effort from fir-dev branch.

Reviewed By: PeteSteinfeld

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

Co-authored-by: Jean Perier <jperier@nvidia.com>
2022-06-24 21:02:07 +02:00
Philip Reames ae8fac6f98 [LV][RISCV] Add coverage showing scalable codegen when etype != ELEN
We currently have a costing bug around the etype == ELEN case, so add otherwise duplicate tests to show test diffs as I work on other parts of costing.
2022-06-24 11:38:54 -07:00
Venkata Ramanaiah Nalamothu a57b62deef [lldb] Fix thread step until to not set breakpoint(s) on incorrect line numbers
The requirements for "thread until <line number>" are:

a) If any code contributed by <line number> or the nearest subsequent of <line number> is executed before leaving the function, stop
b) If you end up leaving the function w/o triggering (a), then stop

In case of (a), since the <line number> may have multiple entries in the line table and the compiler might have scheduled/moved the relevant code across, and the lldb does not know the control flow, set breakpoints on all the line table entries of best match of <line number> i.e. exact or the nearest subsequent line.

Along with the above, currently, CommandObjectThreadUntil is also setting the breakpoints on all the subsequent line numbers after the best match and this latter part is wrong.

This issue is discussed at http://lists.llvm.org/pipermail/lldb-dev/2018-August/013979.html.

In fact, currently `TestStepUntil.py` is not actually testing step until scenarios and `test_missing_one` test fails without this patch if tests are made to run. Fixed the test as well.

Reviewed By: jingham

Differential Revision: https://reviews.llvm.org/D50304
2022-06-25 00:01:04 +05:30
Fangrui Song 4817b7729a [Driver][test] Replace ^//$ with empty string
The convention does not add //\n. Having all RUN/CHECK lines separated by //\n
makes editor movement difficult (e.g. { } in Vim).
2022-06-24 11:25:03 -07:00
Jonas Devlieghere 87a3293961
[lldb] Move Host::SystemLog out of !defined(_WIN32)
The definition of Host::SystemLog was (unintentionally) guarded by
!defined(_WIN32).
2022-06-24 11:18:31 -07:00
Aart Bik 9a3d60e0d3 [mlir][bufferization][sparse] put restriction on sparse tensor allocation
Putting some direct use restrictions on tensor allocations in the
sparse case enables the use of simplifying assumptions in the
bufferization analysis.

Reviewed By: springerm

Differential Revision: https://reviews.llvm.org/D128463
2022-06-24 10:58:43 -07:00
Jonas Devlieghere 5a08280659
[lldb] Fix flakiness in shell tests that mixed stderr and stdout
Because the diagnostic events are processed by the default event handler
in its own thread, tests cannot rely on output ordering. Split stdout
and stderr to make the test reliable again.
2022-06-24 10:53:15 -07:00
Jonas Devlieghere 1e5d5261e2
[lldb] Add SystemLogHandler for emitting log messages to the system log
Add a system log handler that emits log messages to the operating system
log. In addition to the log handler itself, this patch also introduces a
new Host::SystemLog helper function to abstract over writing to the
system log.

Differential revision: https://reviews.llvm.org/D128321
2022-06-24 10:53:15 -07:00
David Blaikie 4821508d4d Revert "DebugInfo: Fully integrate ctor type homing into 'limited' debug info"
Reverting to simplify some Google-internal rollout issues. Will recommit
in a week or two.

This reverts commit 517bbc64db.
2022-06-24 17:07:47 +00:00
Mingming Liu e0d069598b [Inline] Annotate inline pass name with link phase information for analysis.
The annotation is flag gated; flag is turned off by default.

Differential Revision: https://reviews.llvm.org/D125495
2022-06-24 10:06:43 -07:00
Daniel Douglas d4a7b8de52 [OpenMP][libomp] avoid spin wait and yield on arm64 macOS
This patch changes the default behavior to avoid spin waiting and
yielding. (See “Don’t Keep Threads Active And Idle” section here:
https://developer.apple.com/documentation/apple-silicon/tuning-your-code-s-performance-for-apple-silicon)

We verified using instruments traces that the changes improve scheduling
behavior on macOS.

We also collected results using EPCC schedbench
(https://github.com/LangdalP/EPCC-OpenMP-micro-benchmarks) that are
attached here that show a reduction in standard deviation and max test
run time across all scheduling types. Static scheduling sees dramatic
improvements with these changes, we see a 2-4x average runtime
improvement in the benchmark.

Differential Revision: https://reviews.llvm.org/D126510
2022-06-24 12:02:16 -05:00
Fazlay Rabbi 42bb88e2aa [OpenMP] Initial parsing and sema support for 'masked taskloop' construct
This patch gives basic parsing and semantic support for "masked taskloop"
construct introduced in OpenMP 5.1 (section 2.16.7)

Differential Revision: https://reviews.llvm.org/D128478
2022-06-24 10:00:08 -07:00
Eli Friedman e11bf8de72 [clang codegen] Add dso_local/hidden/etc. markings to VTT declarations
We were marking definitions, but not declarations. Marking declarations
makes computing the address more efficient.

Fixes issue reported at https://discourse.llvm.org/t/63090

Differential Revision: https://reviews.llvm.org/D128482
2022-06-24 09:58:31 -07:00
Akira Hatanaka 5fa4629581 [Sema] Check whether `__auto_type` has been deduced before merging
This fixes a bug in clang where it emits the following diagnostic when
compiling the test case:

"argument to 'sizeof' in 'memset' call is the same pointer type 'S' as
the destination"

The code that merges __auto_type with other types was committed in
https://reviews.llvm.org/D122029.

Differential Revision: https://reviews.llvm.org/D128373
2022-06-24 09:49:07 -07:00
Richard 5e97788a3e [clang-tidy] Update release notes (NFC)
- Sort changes to existing checks by check name
- Correct check link
2022-06-24 10:48:47 -06:00
Jonas Devlieghere 6879391908
[lldb] Replace Host::SystemLog with Debugger::Report{Error,Warning}
As it exists today, Host::SystemLog is used exclusively for error
reporting. With the introduction of diagnostic events, we have a better
way of reporting those. Instead of printing directly to stderr, these
messages now get printed to the debugger's error stream (when using the
default event handler). Alternatively, if someone is listening for these
events, they can decide how to display them, for example in the context
of an IDE such as Xcode.

This change also means we no longer write these messages to the system
log on Darwin. As far as I know, nobody is relying on this, but I think
this is something we could add to the diagnostic event mechanism.

Differential revision: https://reviews.llvm.org/D128480
2022-06-24 09:46:26 -07:00
Alexey Bataev 2faacf61a5 [SLP]Improve shuffles cost estimation where possible.
Improved/fixed cost modeling for shuffles by providing masks, improved
cost model for non-identity insertelements.

Differential Revision: https://reviews.llvm.org/D115462
2022-06-24 09:28:01 -07:00
Joshua Root 146f486ba3 [ObjCopy] Fix type mismatch in writeCodeSignatureData()
The result of pointer subtraction is of type ptrdiff_t, which is not necessarily the same underlying type as ssize_t. This can lead to a compilation error since std::min requires both parameters to be the same type.

Fixes: https://github.com/llvm/llvm-project/issues/54846

Reviewed By: alexander-shaposhnikov, drodriguez, jhenderson

Differential Revision: https://reviews.llvm.org/D128117
2022-06-24 09:14:47 -07:00
Arthur Eubanks e422c0d3b2 [GlobalOpt] Perform store->dominated load forwarding for stored once globals
The initial land incorrectly optimized forwarding non-Constants in non-nosync/norecurse functions. Bail on non-Constants since norecurse should cause global -> alloca promotion anyway.

The initial land also incorrectly assumed that StoredOnceStore was the only store to the global, but it actually means that only one value other than the global initializer is stored. Add a check that there's only one store.

Compile time tracker:
https://llvm-compile-time-tracker.com/compare.php?from=c80b88ee29f34078d2149de94e27600093e6c7c0&to=ef2c2b7772424b6861a75e794f3c31b45167304a&stat=instructions

Reviewed By: nikic, asbirlea, jdoerfert

Differential Revision: https://reviews.llvm.org/D128128
2022-06-24 09:09:26 -07:00
Casey Carter d3cbcc4e89 [libcxx][test] barrier completion functions must be non-throwing
... per N4910 [thread.barrier.class]/5.
2022-06-24 09:06:47 -07:00
Siva Chandra Reddy 300f8da8e8 [libc] Add Uint128 type as a fallback when __uint128_t is not available.
Also, the unused specializations of __int128_t have been removed.

Differential Revision: https://reviews.llvm.org/D128304
2022-06-24 16:03:35 +00:00
Philip Reames 056d63938a [RISCV] Split a vectorizer test runline so that upcoming changes in defaults are visible 2022-06-24 08:48:11 -07:00
Philip Reames adbe718675 [RISCV] Modify a test line so it exercises the intended configuration once we turn on scalable vectorization 2022-06-24 08:48:11 -07:00
Peter Collingbourne b064bc18c3 ELF: Do not relax ADRP/LDR -> ADRP/ADD for absolute symbols in PIC.
GOT references to absolute symbols can't be relaxed to use ADRP/ADD in
position-independent code because these instructions produce a relative
address.

Differential Revision: https://reviews.llvm.org/D128492
2022-06-24 08:47:23 -07:00
Florian Hahn cb69ba4faa
[LV] Create RT checks once VF/IC are selected, track scalar cost.
This patch updates LV to generate runtime after the VF & IC are selected. It
allows deciding whether to vectorize with runtime checks or not based on
their cost compared to the vector loop.

It also updates VectorizationFactor to include the scalar cost.

Reviewed By: lebedev.ri, dmgreen

Differential Revision: https://reviews.llvm.org/D75981
2022-06-24 17:42:11 +02:00
Walter Erquinigo b8dcd0ba26 [NFC][lldb][trace] Rename trace session to trace bundle
As previously discussed with @jj10306, we didn't really have a name for
the post-mortem (or offline) trace session representation, which is in
fact a folder with a bunch of files. We decided to call this folder
"trace bundle", and the main JSON file in it "trace bundle description
file". This naming is pretty decent, so I'm refactoring all the existing
code to account for that.

Differential Revision: https://reviews.llvm.org/D128484
2022-06-24 08:41:33 -07:00
Joe Nash 07b7fada73 [AMDGPU] gfx11 VOPD instructions MC support
VOPD is a new encoding for dual-issue instructions for use in wave32.
This patch includes MC layer support only.

A VOPD instruction is constituted of an X component (for which there are
13 possible opcodes) and a Y component (for which there are the 13 X
opcodes plus 3 more). Most of the complexity in defining and parsing
a VOPD operation arises from the possible different total numbers of
operands and deferred parsing of certain operands depending on the
constituent X and Y opcodes.

Reviewed By: dp

Differential Revision: https://reviews.llvm.org/D128218
2022-06-24 11:08:39 -04:00
Craig Topper 78a31bb969 [RISCV] Change how we isel (add X, [-4096, -2049]) or (add X, [2048,4095]).
We currently split the immediate almost equally between two addis.
If the immediate is odd, it won't be split exactly equal.

This patch instead gives one addi an immediate of 2047 or -2048 and the
other getsthe remainder. If the original immediate is near -2049 or 2048,
this might allow the use of c.addi for the addi that receives the
smaller immediate.

Reviewed By: asb, luismarques

Differential Revision: https://reviews.llvm.org/D128500
2022-06-24 08:31:52 -07:00
Konstantin Zhuravlyov 7736ce1c56 AMDGPU: Clear kill flags when optimizing vcmp save exec sequence
It was causing bad machine code for several blender scenes:
  *** Bad machine code: Using an undefined physical register ***
  - function:    kernel_holdout_emission_blurring_pathtermination_ao
  - basic block: %bb.28 if.end40.i (0x7f84861a2320)
  - instruction: V_CMPX_EQ_U32_nosdst_e64 0, $vgpr3, implicit-def $exec, implicit $exec
  - operand 1:   $vgpr3

Differential Revision: https://reviews.llvm.org/D127768
2022-06-24 11:30:22 -04:00
Michał Górny c1829e0ec5 [lldb] [test] Move part of fork tests to common helper
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.llvm.org/D128361
2022-06-24 17:20:25 +02:00
Michał Górny 4b485fc0ea [lldb] [llgs] Introduce an AppendThreadIDToResponse() helper
Introduce a helper function to append GDB Remote Serial Protocol "thread
IDs", with optional PID in multiprocess mode.

Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.llvm.org/D128324
2022-06-24 17:20:24 +02:00
Michał Górny e827e5186f [lldb] [llgs] Implement the 'T' packet
Implement the 'T' packet that is used to verify whether the specified
thread belongs to the debugged processes.

Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.llvm.org/D128170
2022-06-24 17:20:24 +02:00
Michał Górny 630da0e309 [lldb] [llgs] Include PID in QC response in multiprocess mode
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.llvm.org/D128156
2022-06-24 17:20:24 +02:00
Michał Górny 14d6707335 [lldb] [llgs] Add a test for multiprocess register read/write
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.llvm.org/D128153
2022-06-24 17:20:24 +02:00
Michał Górny 75757c86c6 [lldb] [llgs] Support multiprocess in qfThreadInfo
Update the `qfThreadInfo` handler to report threads of all debugged
processes and include PIDs when in multiprocess mode.

Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.llvm.org/D128152
2022-06-24 17:20:24 +02:00
Michał Górny 0481d8efa9 [lldb] [llgs] Add a test for multiprocess memory read/write
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.llvm.org/D128150
2022-06-24 17:20:24 +02:00
Michał Górny a3422793e0 [lldb] [llgs] Support resuming one process with PID!=current via vCont
Extend vCont function to support resuming a process with an arbitrary
PID, that could be different than the one selected via Hc (or no process
at all may be selected).  Resuming more than one process simultaneously
is not supported yet.

Remove the ReadTid() method that was only used by Handle_vCont(),
and furthermore it was wrongly using m_current_process rather than
m_continue_process.

Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.llvm.org/D127862
2022-06-24 17:20:23 +02:00
Michał Górny 3266b11714 [lldb] [llgs] Add test for resuming via c in multiprocess scenarios
Add a test verifying that it is possible to resume a single process
via the `c` packet when multiple processes are being debugged.  This
includes a tiny change to the test program — when `fork()` is called,
the child process is no longer terminated immediately but continues
performing the same tasks as queued for the parent.

Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.llvm.org/D127755
2022-06-24 17:20:23 +02:00
Michał Górny c18784ba33 [lldb] [llgs] Implement the vKill packet
Implement the support for the vKill packet.  This is the modern packet
used by the GDB Remote Serial Protocol to kill one of the debugged
processes.  Unlike the `k` packet, it has well-defined semantics.

The `vKill` packet takes the PID of the process to kill, and always
replies with an `OK` reply (rather than the exit status, as LLGS does
for `k` packets at the moment).  Additionally, unlike the `k` packet
it does not cause the connection to be terminated once the last process
is killed — the client needs to close it explicitly.

Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.llvm.org/D127667
2022-06-24 17:20:23 +02:00
Michał Górny e8fe7e930a [lldb] [llgs] Make `k` kill all processes, and fix multiple exits
Modify the behavior of the `k` packet to kill all inferiors rather than
just the current one.  The specification leaves the exact behavior
of this packet up to the implementation but since vKill is specifically
meant to be used to kill a single process, it seems logical to use `k`
to provide the alternate function of killing all of them.

Move starting stdio forwarding from the "running" response
to the packet handlers that trigger the process to start.  This avoids
attempting to start it multiple times when multiple processes are killed
on Linux which implicitly causes LLGS to receive "started" events
for all of them.  This is probably also more correct as the ability
to send "O" packets is implied by the continue-like command being issued
(and therefore the client waiting for responses) rather than the start
notification.

Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.llvm.org/D127500
2022-06-24 17:20:23 +02:00
Yaxun (Sam) Liu 8ad4c6e4b1 [HIP] add -fhip-kernel-arg-name
Add option -fhip-kernel-arg-name to emit kernel argument
name metadata, which is needed for certain HIP applications.

Reviewed by: Artem Belevich, Fangrui Song, Brian Sumner

Differential Revision: https://reviews.llvm.org/D128022
2022-06-24 11:15:36 -04:00
chenglin.bi 8c74205642 [SelectionDAG][DAGCombiner] Reuse exist node by reassociate
When already have (op N0, N2), reassociate (op (op N0, N1), N2) to (op (op N0, N2), N1) to reuse the exist (op N0, N2)

Reviewed By: RKSimon

Differential Revision: https://reviews.llvm.org/D122539
2022-06-24 23:15:06 +08:00
Stephen Long 186bea3750 [MSVC] Add initial support for MSVC pragma optimize
MSVC's pragma optimize turns optimizations on or off based on the list
passed. At the moment, we only support an empty optimization list.

i.e. `#pragma optimize("", on | off)`

From MSVC's docs:

| Parameter | Type of optimization                             |
|-----------|--------------------------------------------------|
| g         | Enable global optimizations. Deprecated          |
| s or t    | Specify short or fast sequences of machine code  |
| y         | Generate frame pointers on the program stack     |

https://docs.microsoft.com/en-us/cpp/preprocessor/optimize?view=msvc-170

Reviewed By: aaron.ballman

Differential Revision: https://reviews.llvm.org/D125723
2022-06-24 08:03:42 -07:00
Tapasweni Pathak 946c45a4ed Implement soft reset of the diagnostics engine.
This patch implements soft reset and adds tests for soft reset success of the
diagnostics engine. This allows us to recover from errors in clang-repl without
resetting the pragma handlers' state.

Differential revision: https://reviews.llvm.org/D126183
2022-06-24 14:46:54 +00:00
Sam Estep 8c278a2781 [clang][dataflow] Allow MatchSwitch to return a value
Reland of D128467. This version replaces `return {};` with `return Result();`, since the former failed on GCC with `Result = void`.

Reviewed By: gribozavr2

Differential Revision: https://reviews.llvm.org/D128533
2022-06-24 14:38:00 +00:00
Nicolas Vasilache f6c79c6ae4 [mlir][Vector]Fix bug where vector::WarpExecuteOnLane0Op are created with 2 blocks in the region
Differential Revision: https://reviews.llvm.org/D128534
2022-06-24 07:33:58 -07:00
Dawid Jurczak b7e7f4e1b6 [InlineCost] Improve debugging experience by adding print about initial inlining cost
Differential Revision: https://reviews.llvm.org/D127597
2022-06-24 16:27:26 +02:00
serge-sans-paille 886715af96 [clang] Introduce -fstrict-flex-arrays=<n> for stricter handling of flexible arrays
Some code [0] consider that trailing arrays are flexible, whatever their size.
Support for these legacy code has been introduced in
f8f6324983 but it prevents evaluation of
__builtin_object_size and __builtin_dynamic_object_size in some legit cases.

Introduce -fstrict-flex-arrays=<n> to have stricter conformance when it is
desirable.

n = 0: current behavior, any trailing array member is a flexible array. The default.
n = 1: any trailing array member of undefined, 0 or 1 size is a flexible array member
n = 2: any trailing array member of undefined or 0 size is a flexible array member
n = 3: any trailing array member of undefined size is a flexible array member (strict c99 conformance)

Similar patch for gcc discuss here: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101836

[0] https://docs.freebsd.org/en/books/developers-handbook/sockets/#sockets-essential-functions
2022-06-24 16:13:29 +02:00