465378 Commits

Author SHA1 Message Date
Craig Topper
017a24eb1b [RISCV] Minor refactoring of some code in copyPhysReg. NFC
Move some of the vmv.v.i handling into the vmv.v.v if. This
reduces the scope of one variable.
2023-06-21 18:02:58 -07:00
Craig Topper
d846ce7bc4 [TableGen][Target] Rename Attribute field in SubtargetFeature class to FieldName.
The word "attribute" has a specific meaning in LLVM. Avoid using it
here to mean something different.

This addresses feedback from D153180.

Reviewed By: arsenm

Differential Revision: https://reviews.llvm.org/D153444
2023-06-21 17:53:50 -07:00
Brad Richardson
0867d41573 [flang] don't require -flang-experimental-exec flag anymore
Reviewed By: awarzynski, PeteSteinfeld

Differential Revision: https://reviews.llvm.org/D153379
2023-06-21 16:47:52 -07:00
Vitaly Buka
116b5e1eb4 [test][sanitizer] Pre-commit huge malloc test 2023-06-21 16:20:02 -07:00
Vitaly Buka
bda0a93a91 Revert "[test][sanitizer] Precommit huge malloc test"
Wrong accidental commit.

This reverts commit 1f18c9624b44e763a76742634f0f95432ea7cb23.
2023-06-21 16:17:23 -07:00
Shoaib Meenai
b1dadab3d9 [MachO] Remove redundant .section directive
See https://reviews.llvm.org/D153382#inline-1483291
2023-06-21 16:16:46 -07:00
Vitaly Buka
1f18c9624b [test][sanitizer] Precommit huge malloc test 2023-06-21 16:14:07 -07:00
Vitaly Buka
758935061c [test] Add llvm-xray into XRAY_TEST_DEPS 2023-06-21 16:13:47 -07:00
Vitaly Buka
2cb547a719 [test] Add lli into ORC_TEST_DEPS 2023-06-21 16:13:47 -07:00
Mitch Phillips
3c3ebebca2 Revert "[mlir][RunnerUtils] Make symbols private + implement loading mechanism."
This reverts commit bba2b656110209a3d9863b92c060082479b06ab1.

Reason: Broke the HWASan buildbot. See https://reviews.llvm.org/D153250
for more information.
2023-06-22 01:01:19 +02:00
Rashmi Mudduluru
db3dcedb9c [-Wunsafe-buffer-usage] Handle pointer initializations for grouping related variables
Differential Revision: https://reviews.llvm.org/D150489
2023-06-21 15:54:09 -07:00
Shoaib Meenai
1df10f1580 [Frontend] Remove ShowIncludesPretendHeader
It hasn't been written to since https://reviews.llvm.org/D46652, so it
was always empty. I don't have enough context on that diff to know if
the removal of the write to ShowIncludesPretendHeader in that diff was
intentional, but no one's complained about it for five years, so I
assume we're okay to just get rid of it entirely.

Reviewed By: hans

Differential Revision: https://reviews.llvm.org/D153176
2023-06-21 15:48:28 -07:00
Shoaib Meenai
67a11290df [Frontend] Don't output skipped includes from predefines
`-H` displays a tree of included header files, but that tree is supposed
to omit two categories of header files:
1. Any header files pulled in via `-include`, which the code refers to
   as the "predefines".
2. Any header files whose inclusion was skipped because they'd already
   been included (assuming header guards or `#pragma once`).

`-fshow-skipped-includes` was intended to make `-H` display the second
category of files. It wasn't checking for the first category, however,
so you could end up with only the middle of the `-include` hierarchy
displayed, e.g. the added test would previously output:

```
... /data/users/smeenai/llvm-project/clang/test/Frontend/Inputs/test2.h
. /data/users/smeenai/llvm-project/clang/test/Frontend/Inputs/test.h
```

This diff adds a check to prevent that and correctly omit headers from
`-include` even when `-fshow-skipped-includes` is passed. While I'm
here, add tests for the interaction between `-fshow-skipped-includes`
and `-sys-header-deps` as well.

Reviewed By: hans

Differential Revision: https://reviews.llvm.org/D153175
2023-06-21 15:48:27 -07:00
Valentin Clement
2bcbcbefcd
[flang] Enhance getTypeAsString to support more FIR types
Add support for couple of FIR types such as fir.ptr, fir.heap,
fir.box, fir.class

Reviewed By: razvanlupusoru

Differential Revision: https://reviews.llvm.org/D153461
2023-06-21 15:33:27 -07:00
Owen Pan
8e85739a5f [clang-format] Don't finalize #if, #else, #endif, etc.
Don't finalize a preprocessor branch directive if it's the first
token of an annotated line. See the rationale at
https://reviews.llvm.org/D150057#inline-1449546.

Fixes #63379

Differential Revision: https://reviews.llvm.org/D153243
2023-06-21 15:15:57 -07:00
Christopher Ferris
a27c416b89 [scudo] Change overloaded function name append.
The ScopedString class has two functions named append. One takes
a va_list, but on some platforms va_list is typedef'd to char*.
That means that this call:

  std::string value;
  Str.append("print this string %s", value.c_str());

The compiler can incorrectly think this is the va_list function,
leading to crashes when calling this. To fix this, change the name
of the va_list function to be vappend to avoid this.

Fix https://github.com/llvm/llvm-project/issues/62893

Reviewed By: Chia-hungDuan

Differential Revision: https://reviews.llvm.org/D153389
2023-06-21 15:11:47 -07:00
Louis Dionne
b356928058 [libc++] Fix the check-format job
Previously, it wouldn't take into account files in ignore_format.txt
(at least not on OSX) because the `find` command would return file names
like `libcxx/src//new_handler.cpp`, which never matched the file names
in `ignore_format.txt`.

Differential Revision: https://reviews.llvm.org/D153416
2023-06-21 17:59:32 -04:00
Jason Molenda
3858e9d6c5 Add two new entitlements when debugserver is built by Apple
Two new entitlements, com.apple.private.thread-set-state and
com.apple.private.set-exception-port should be included in the
debugserver entitlement plist when built internally at Apple.
The desktop builds of debugserver don't need these entitlements;
don't add them to debugserver-macosx-entitlements.plist.

rdar://108912676
rdar://103032208
2023-06-21 14:56:11 -07:00
Louis Dionne
bcca95da5e [libc++] Refactor the selection of string's ABI in __config
This doesn't change the selection, but it expands the conditions to
add comments and make it clearer what's happening. It also removes a
-Wundef instance when we checked __ARM_ARCH_7K__ >= 2 without checking
that it is defined in the first place.

Differential Revision: https://reviews.llvm.org/D153413
2023-06-21 17:53:57 -04:00
David Green
400b3c47c2 [ARM] Repair check lines in sub-cmp-peephole.ll test. NFC
Commit ec77747fbdca901e0fded58f940dae62e0f6b726 regenerated the check lines
without being very careful about which lines were updated. This attempts to fix
them to make sure the V7 and V8 lines are emitted as needed.
2023-06-21 22:47:30 +01:00
Amilendra Kodithuwakku
9246df7049 Revert "Revert "[LLD][ELF] Cortex-M Security Extensions (CMSE) Support""
This reverts commit a685ddf1d104b3ce9d53cf420521f5aaff429630.

This relands Arm CMSE support (D139092) and fixes the GCC build bot errors.
2023-06-21 22:27:13 +01:00
Razvan Lupusoru
20ba5c61ea [mlir][openacc] Update host_data data operands list name
For all other compute and data constructs, the data operands list
is named `dataClauseOperands`. Update `acc.host_data` to be
consistent with this naming.

Reviewed By: clementval

Differential Revision: https://reviews.llvm.org/D153425
2023-06-21 14:25:31 -07:00
Peiming Liu
e7df82816b [mlir][sparse] rewrite arith::SelectOp to semiring operations to sparsify it.
Reviewed By: aartbik, K-Wu

Differential Revision: https://reviews.llvm.org/D153397
2023-06-21 21:22:18 +00:00
Tomasz Kuchta
d9b3691166 [DFSAN] Add support for strncat
This patch adds a support for the libc strncat() function in DFSAN

Reviewed by: browneee

Differential Revision: https://reviews.llvm.org/D152196
2023-06-21 21:21:13 +00:00
Valentin Clement
7c9b9d316d
[flang][openacc] Use acc.private and acc.firstprivate when lowering clauses
Lower private and firstprivate operands through their corresponding
data entry operation to support array section.

Depends on D152972

Reviewed By: razvanlupusoru

Differential Revision: https://reviews.llvm.org/D152974
2023-06-21 14:19:55 -07:00
Valentin Clement
8fb247e2de
[mlir][openacc] Add acc.firstprivate operation as data entry operation
acc.firstprivate operation will be used as data entry operation
for the firstprivate operands.

Depends on D152970

Reviewed By: razvanlupusoru

Differential Revision: https://reviews.llvm.org/D152972
2023-06-21 14:18:48 -07:00
Valentin Clement
cfba521dbd
[mlir][openacc] Add acc.private operation as data entry operation
acc.private operation will be used as data entry operation
for the private operands.

Reviewed By: razvanlupusoru

Differential Revision: https://reviews.llvm.org/D152970
2023-06-21 14:17:32 -07:00
Med Ismail Bennani
d10a61c8d2 [lldb/test] Disable TestStackCoreScriptedProcess.py
This patch disables TestStackCoreScriptedProcess.py since it times out
non deterministicly.

Signed-off-by: Med Ismail Bennani <ismail@bennani.ma>
2023-06-21 14:05:55 -07:00
Arthur Eubanks
ff4fcbb5f4 [test] Add test for null_pointer_is_valid and Inliner instsimplify interaction
As requested in D151254

Reviewed By: arsenm

Differential Revision: https://reviews.llvm.org/D153435
2023-06-21 14:00:53 -07:00
Vitaly Buka
96928abb4d [NFC][sanitizer] Pass user region into OnMapSecondary 2023-06-21 13:50:42 -07:00
Vitaly Buka
38dfcf96df [NFC][sanitizer] Add OnMapSecondary callback
Now it implemented as OnMap everywhere, but in follow up patches
we can optimize Asan handler.
2023-06-21 13:33:41 -07:00
Florian Hahn
04a7c672ab
[PhaseOrdering] Add test showing mis-compile caused by 17fdaccccf.
The test shows a mis-compile where @test gets incorrectly simplified to
unreachable. The test case is reduced from a ThinLTO build of Clang,
with only the relevant pass sequence included.
2023-06-21 21:15:14 +01:00
Vitaly Buka
42adbb1b2d [NFC][sanitizer] Remove MapUnmapCallback from sanitizer_flat_map.h
It's used by test only to test "test-only" code.
2023-06-21 13:14:30 -07:00
Shubham Sandeep Rastogi
e734a12b60 Emit DW_LLE_base_address + DW_LLE_offset_pair for DWARF v5
This patch tries to reduce the size of the debug_loclist section by
replacing the DW_LLE_start_length opcodes currently emitted by dsymutil
in favor of using DW_LLE_base_address + DW_LLE_offset_pair instead.

The DW_LLE_start_length is one AddressSize followed by a ULEB per entry,
whereas, the DW_LLE_base_address + DW_LLE_offset_pair will use one
AddressSize for the base address, and then the DW_LLE_offset_pair is a
pair of ULEBs. This will be more efficient where a loclist fragment has
many entries.

Differential Revision: https://reviews.llvm.org/D153080
2023-06-21 12:43:29 -07:00
Guozhi Wei
1bcb6a3da2 [MBP] Enable duplicating return block to remove jump to return
Sometimes LLVM generates branch to return instruction, like PR63227.

It is because in function MachineBlockPlacement::canTailDuplicateUnplacedPreds
we avoid duplicating a BB into another already placed BB to prevent destroying
computed layout. But if the successor BB is a return block, duplicating it will
only reduce taken branches without hurt to any other branches.

Differential Revision: https://reviews.llvm.org/D153093
2023-06-21 18:54:31 +00:00
Vitaly Buka
c172210492 [NFC][asan] Move AsanStats update
Deallocate is a more appropiate place to update free count.
2023-06-21 11:50:45 -07:00
LLVM GN Syncbot
d036bf0711 [gn build] Port 1ee4d880e876 2023-06-21 18:41:47 +00:00
Tim Besard
1ee4d880e8 NVPTX: Lower unreachable to exit to allow ptxas to accurately reconstruct the CFG.
PTX does not have a notion of `unreachable`, which results in emitted basic
blocks having an edge to the next block:

```
block1:
  call @does_not_return();
  // unreachable
block2:
  // ptxas will create a CFG edge from block1 to block2
```

This may result in significant changes to the control flow graph, e.g., when
LLVM moves unreachable blocks to the end of the function. That's a problem
in the context of divergent control flow, as `ptxas` uses the CFG to determine
divergent regions, while some intructions may not be executed divergently.

For example, `bar.sync` is not allowed to be executed divergently on Pascal
or earlier. If we start with the following:

```
entry:
  // start of divergent region
  @%p0 bra cont;
  @%p1 bra unlikely;
  ...
  bra.uni cont;
unlikely:
  ...
  // unreachable
cont:
  // end of divergent region
  bar.sync 0;
  bra.uni exit;
exit:
  ret;
```

it is transformed by the branch-folder and block-placement passes to:

```
entry:
  // start of divergent region
  @%p0 bra cont;
  @%p1 bra unlikely;
  ...
  bra.uni cont;
cont:
  bar.sync 0;
  bra.uni exit;
unlikely:
  ...
  // unreachable
exit:
  // end of divergent region
  ret;
```

After moving the `unlikely` block to the end of the function, it has an edge
to the `exit` block, which widens the divergent region and makes the `bar.sync`
instruction happen divergently. That causes wrong computations, as we've been
running into for years with Julia code (which emits a lot of `trap` +
`unreachable` code all over the place).

To work around this, add an `exit` instruction before every `unreachable`,
as `ptxas` understands that exit terminates the CFG. Note that `trap` is not
equivalent, and only future versions of `ptxas` will model it like `exit`.
Another alternative would be to emit a branch to the block itself, but emitting
`exit` seems like a cleaner solution to represent `unreachable` to me.

Also note that this may not be sufficient, as it's possible that the block
with unreachable control flow is branched to from different divergent regions,
e.g. after block merging, in which case it may still be the case that `ptxas`
could reconstruct a CFG where divergent regions are merged (I haven't confirmed
this, but also haven't encountered this pattern in the wild yet):

```
entry:
  // start of divergent region 1
  @%p0 bra cont1;
  @%p1 bra unlikely;
  bra.uni cont1;
cont1:
  // intended end of divergent region 1
  bar.sync 0;
  // start of divergent region 2
  @%p2 bra cont2;
  @%p3 bra unlikely;
  bra.uni cont2;
cont2:
  // intended end of divergent region 2
  bra.uni exit;
unlikely:
  ...
  exit;
exit:
  // possible end of merged divergent region?
```

I originally tried to avoid the above by cloning paths towards `unreachable` and
splitting the outgoing edges, but that quickly became too complicated. I propose
we go with the simple solution first, also because modern GPUs with more flexible
hardware thread schedulers don't even suffer from this issue.

Finally, although I expect this to fix most of
https://bugs.llvm.org/show_bug.cgi?id=27738, I do still encounter
miscompilations with Julia's unreachable-heavy code when targeting these
older GPUs using an older `ptxas` version (specifically, from CUDA 11.4 or
below). This is likely due to related bugs in `ptxas` which have been fixed
since, as I have filed several reproducers with NVIDIA over the past couple of
years. I'm not inclined to look into fixing those issues over here, and will
instead be recommending our users to upgrade CUDA to 11.5+ when using these GPUs.

Also see:
- https://github.com/JuliaGPU/CUDAnative.jl/issues/4
- https://github.com/JuliaGPU/CUDA.jl/issues/1746
- https://discourse.llvm.org/t/llvm-reordering-blocks-breaks-ptxas-divergence-analysis/71126

Reviewed By: jdoerfert, tra

Differential Revision: https://reviews.llvm.org/D152789
2023-06-21 11:40:31 -07:00
Med Ismail Bennani
0c5b632071 [lldb] Fix failure in TestStackCoreScriptedProcess on x86_64
This patch should address the failure of TestStackCoreScriptedProcess
that is happening specifically on x86_64.

It turns out that in 1370a1cb5b97, I changed the way we extract integers
from a `StructuredData::Dictionary` and in order to get a stop info from
the scripted process, we call a method that returns a `SBStructuredData`
containing the stop reason data.

TestStackCoreScriptedProcess` was failing specifically on x86_64 because
the stop info dictionary contains the signal number, that the `Scripted
Thread` was trying to extract as a signed integer where it was actually
parsed as an unsigned integer. That caused `GetValueForKeyAsInteger` to
return the default value parameter, `LLDB_INVALID_SIGNAL_NUMBER`.

This patch address the issue by extracting the signal number with the
appropriate type and re-enables the test.

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

Signed-off-by: Med Ismail Bennani <ismail@bennani.ma>
2023-06-21 10:57:13 -07:00
cynecx
63538a0879 [MC] Add .pushsection/.popsection support to COFFAsmParser
The COFFAsmParser (to my surprise) didn't support the .pushsection and
.popsection directives. These directives aren't directly useful, however for
frontends that have inline asm support this is really useful. Rust in
particular, has support for inline asm, which can be used together with these
directives to "emulate" features like static generics. This patch adds support
for the two mentioned directives.

Reviewed By: MaskRay

Differential Revision: https://reviews.llvm.org/D152085
2023-06-21 10:39:56 -07:00
Felipe de Azevedo Piovezan
1704c8d104 [lldb][MachO] Fix section type recognition for new DWARF 5 sections
When LLDB needs to access a debug section, it generally calls
SectionList::FindSectionByType with the corresponding type (we have one type for
each DWARF section). However, the missing entries made some sections be
classified as "eSectionTypeOther", which makes all calls to `FindSectionByType`
fail.

With this patch, a check-lldb build with
`-DLLDB_TEST_USER_ARGS=--dwarf-version=5` reports a much lower number of
failures:

  Unsupported      :  327
  Passed           : 2423
  Expectedly Failed:   16
  Unresolved       :    2
  Failed           :   52

This is down from previously 400~ failures.

Differential Revision: https://reviews.llvm.org/D153433
2023-06-21 13:25:10 -04:00
Stella Laurenzo
54db162429 Revert "Define/guard MLIR_STANDALONE_BUILD LLVM_LIBRARY_OUTPUT_INTDIR var."
This reverts commit f55fd19b6b565827af5fbf504952dcc35b8b7360.

As noted on the original thread, other uses of LLVM_LIBRARY_OUTPUT_INTDIR are optional. Will make a separate patch that makes this use optional as well.
2023-06-21 10:20:35 -07:00
Alex Langford
b4827a3c0a [lldb][NFCI] Remove ConstString from GDBRemoteCommunicationClient::ConfigureRemoteStructuredData
ConstString's benefits are not being utilized here, StringRef is
sufficient.

Differential Revision: https://reviews.llvm.org/D153177
2023-06-21 10:17:24 -07:00
Tom Eccles
74adc3e0eb [flang][hlfir] fix missing conversion in transpose simplification
It seems just replacing the operation was not replacing all of the uses
when the types of the expression before and after this pass differ (due
to differing shape information). Now the shape information is always
kept the same.

This fixes https://github.com/llvm/llvm-project/issues/63399

Differential Revision: https://reviews.llvm.org/D153333
2023-06-21 16:54:58 +00:00
Lorenzo Chelini
9d796d05a1 [MLIR][Linalg] Rename tile-to-foreach-thread.mlir (NFC)
`ForeachThreadOp` was renamed to `ForallOp`, update the filename to
avoid confusion.

See: https://reviews.llvm.org/D144242
2023-06-21 18:44:24 +02:00
Adam Paszke
9816cc916f Fix a memory leak in the Python implementation of bytecode writer
The bytecode writer config was heap-allocated, but was never freed, causing ASAN errors.

Reviewed By: jpienaar

Differential Revision: https://reviews.llvm.org/D153440
2023-06-21 09:40:51 -07:00
Joseph Huber
e0b487bfc0 [libc] Rename and install the RPC server interface
This patch prepares the RPC interface to be installed. We place this in
the existing `llvm-gpu-none` directory as it will also give us access to
the generated `libc` headers for the opcodes.

Reviewed By: JonChesterfield

Differential Revision: https://reviews.llvm.org/D153040
2023-06-21 11:26:24 -05:00
Luke Lau
485d25007a [RISCV] Custom lower fixed vector undef to scalable undef
This avoids undefs from being expanded to a build vector of zeroes.
As noted by @craig.topper in D153399

Reviewed By: craig.topper

Differential Revision: https://reviews.llvm.org/D153411
2023-06-21 17:14:57 +01:00
Joseph Huber
4272d09196 [libc][NFC] Cleanup the RPC server implementation prior to installing
This does some simple cleanup prior to landing the patch to install
these.

Differential Revision: https://reviews.llvm.org/D153439
2023-06-21 11:14:20 -05:00
Petr Hosek
037952f6d4 [libcxx] Include <sys/time.h> in posix_compat.h
posix_compat.h uses struct timeval which is defined in <sys/time.h>
but it doesn't include it. On most POSIX platforms like Linux or macOS,
that headers is transitively included by other headers like <sys/stat.h>,
but there are other platforms where this is not the case.

Differential Revision: https://reviews.llvm.org/D153384
2023-06-21 16:10:01 +00:00