516869 Commits

Author SHA1 Message Date
Congcong Cai
bd6c430dcb
[clang codegen] avoid to crash when emit init func for global variable with flexible array init (#113336)
Fixes: #113187
Avoid to create init function since clang does not support global
variable with flexible array init.
It will cause assertion failure later.
2024-10-23 09:21:27 +08:00
Konstantin Romanov
0fbf91ab8e
[clang-tidy] Fix cppcoreguidelines-pro-type-union-access if memLoc is invalid (#104540)
Fixes #102945.
2024-10-22 17:05:00 -07:00
Augusto Noronha
8234f8ae26
[DebugInfo] Emit linkage name into DWARF for types for Swift (#112802)
Store Swift mangled names in DW_AT_linkage_name. The Swift compiler
emits only the type mangled name in debug information, and LLDB uses
those mangled names as keys to look up size, alignment, fields, etc
from either reflection metadata or Swift modules.

Additionally, emit types linkage names for types into the accelerator
table if they exist and they're different from the display name.
2024-10-22 16:47:58 -07:00
Alex MacLean
4c1b1f6d21
[NVPTX] Add support for clamped funnel shift intrinsics (#113228)
Add support for ``llvm.nvvm.fshl.clamp`` and ``llvm.nvvm.fshr.clamp``
intrinsics. These intrinsics are similar to the generic llvm funnel
shift, except that the shift value is clamped to the integer width.
Currently only ``i32`` is supported and is implemented with the
`shf.[rl].clamp.b32` PTX instruction.
2024-10-22 16:39:44 -07:00
Helena Kotas
9b984554d7
[HLSL][NFC] Move IsIntangibleType from SemaHLSL to Type to make it accessible outside of Sema (#113206)
Moves `IsIntangibleType` from SemaHLSL to Type class and renames it to
`isHLSLIntangibleType`. The existing `isHLSLIntangibleType` is renamed
to `isHLSLBuiltinIntangibleType` and updated to return true only for the
builtin `__hlsl_resource_t` type.

This change makes `isHLSLIntangibleType` functionality accessible
outside of Sema, for example from clang CodeGen.
2024-10-22 16:32:09 -07:00
Florian Hahn
4334f317e7
[TBAA] Extend pointer TBAA to pointers of non-builtin types. (#110569)
Extend the logic added in 123c036bd361d
(https://github.com/llvm/llvm-project/pull/76612) to support pointers to
non-builtin types by using the mangled name of the canonical type.

PR: https://github.com/llvm/llvm-project/pull/110569
2024-10-22 16:23:34 -07:00
Michael O'Farrell
10f0c1aadd
[PGO] Ensure non-zero entry-count after populateCounters (#112029)
With sampled instrumentation (#69535), profile counts may appear corrupt
and `fixFuncEntryCount` may assert. In particular a function can have a
0 block count for its entry, while later blocks are non zero. This is
only likely to happen for colder functions, so it is reasonable to take
any action that does not crash. Here we simply bail from fixing the
entry count.
2024-10-22 16:05:40 -07:00
Justin Fargnoli
8a12e0131f
Revert "[LLVM] Add IRNormalizer Pass" (#113392)
Reverts llvm/llvm-project#68176

Introduced BuildBot failure:
https://github.com/llvm/llvm-project/pull/68176#issuecomment-2428243474
2024-10-22 16:01:32 -07:00
Michael O'Farrell
b4fcaa137f
[PGO][SampledInstr] Correct off by 1s and allow 100% sampling (#113350)
This corrects a couple off by ones related to the sampling of
**instrumented** counters, and enables setting 100% rates for burst
sampling (burst duration = period).

Off by ones:
Prior to this change it was impossible to set a period of 65535 because
this was converted to fast sampling which rollsover at USHRT_MAX + 1
(65536). Similarly the burst durations would collect burst duration + 1
counts as they used an ULE comparison.

100% sampling:
Although this is not useful for a productionized use case, it does allow
for more deterministic testing with the sampling checks in place. After
all the off by ones are fixed, allowing for 100% sampling is a matter of
letting burst duration = period.
2024-10-22 16:01:13 -07:00
Florian Mayer
2e0506f83b
[NFC] [MTE] Remove useless yaml2obj from test (#113374)
We already have the .o, there is no reason to go .o -> YAML -> .o
2024-10-22 15:23:13 -07:00
jofrn
fe480cf923
[ARM] Use proper types for these records. (#113370)
llvm#112904 will add typechecking to submulticlass arguments, and these
ones are currently mistyped.
2024-10-22 18:17:52 -04:00
Jan Svoboda
0ffa29fe81
[clang][modules] Timestamp PCM files when writing (#112452)
Clang uses timestamp files to track the last time an implicitly-built
PCM file was verified to be up-to-date with regard to its inputs. With
`-fbuild-session-{file,timestamp}=` and
`-fmodules-validate-once-per-build-session` this reduces the number of
times a PCM file is checked per "build session".

The behavior I'm seeing with the current scheme is that when lots of
Clang instances wait for the same PCM to be built, they race to validate
it as soon as the file lock gets released, causing lots of concurrent
IO.

This patch makes it so that the timestamp is written by the same Clang
instance responsible for building the PCM while still holding the lock.
This makes it so that whenever a PCM file gets compiled, it's never
re-validated in the same build session.

I believe this is as sound as the current scheme. One thing to be aware
of is that there might be a time interval between accessing input file N
and writing the timestamp file, where changes to input files 0..<N would
not result in a rebuild. Since this is the case current scheme too, I'm
not too concerned about that.

I've seen this speed up `clang-scan-deps` by ~27%.
2024-10-22 15:08:02 -07:00
Jinsong Ji
d985197156
[NFC][Fuzzer] Refactor to avoid a false warning from gcc (#112944)
This is one of the many PRs to fix errors with LLVM_ENABLE_WERROR=on.
Built by GCC 11.

Refactor the code to avoid the false warning

llvm-project/llvm/tools/llvm-isel-fuzzer/llvm-isel-fuzzer.cpp
llvm-project/llvm/tools/llvm-isel-fuzzer/llvm-isel-fuzzer.cpp: In
function ‘int LLVMFuzzerInitialize(int*, char***)’:
llvm-project/llvm/tools/llvm-isel-fuzzer/llvm-isel-fuzzer.cpp:141:43:
error: ISO C++ forbids zero-size array ‘argv’ [-Werror=pedantic]
  141 |   ExitOnError ExitOnErr(std::string(*argv[0]) + ": error:");
      |
2024-10-22 17:39:05 -04:00
Longsheng Mou
519eef3bdc
[mlir][tosa] Add a verifier for tosa.mul (#113320)
This PR adds a verifier check for tosa.mul, requiring that the shift be
0 for float types.
Fixes #112716.
2024-10-22 22:34:04 +01:00
Krzysztof Parzyszek
a8d506b320
[flang][OpenMP] Rename enum OmpxHold to Ompx_Hold in parser (#113366)
The convention is to use enum names that match the source spelling (up
to upper/lower case), including names with underscores.

Remove the special case from unparser, update tests.
2024-10-22 16:24:17 -05:00
Vitaly Buka
c77d8edf80
Revert "Revert "[msan] Switch to -msan-handle-icmp-exact my default"" (#113379)
Reverts llvm/llvm-project#113376

Fixed with #113378
2024-10-22 14:05:35 -07:00
Heejin Ahn
5c92f2331c
[WebAssembly] Fix MIR printing of reference types (#113028)
When printing a memory operand in MIR, this line

d37bc32a65/llvm/lib/CodeGen/MachineOperand.cpp (L1247)
calls this
d37bc32a65/llvm/include/llvm/Support/Alignment.h (L238)
which assumes `Rhs` (the size in this case) is positive.

But Wasm reference types' size is set to 0:
d37bc32a65/llvm/include/llvm/CodeGen/ValueTypes.td (L326-L328)

`getSize() > 0` condition was added with the Wasm reference types
support in
46667a1003,
and it looks it was removed in #84751. This revives the condition so
that Wasm reference types will not crash the MIR printer.
2024-10-22 13:48:00 -07:00
Vitaly Buka
71792dc570
[NFC][msan] Workaround arg evaluation order diff GCC vs Clang (#113378) 2024-10-22 13:31:46 -07:00
Vitaly Buka
c3aa8b7dd6
Revert "[msan] Switch to -msan-handle-icmp-exact my default" (#113376)
Reverts llvm/llvm-project#113200

Breaks bots, see llvm/llvm-project#113200
2024-10-22 13:05:59 -07:00
Artem Belevich
020fa86897
[NVPTX] mangle symbols in debug info to conform to PTX restrictions. (#113216)
Until now debug info was printing the symbols names as-is and that
resulted in invalid PTX when the symbols contained characters that are
invalid for PTX. E.g. `__PRETTY_FUNCTION.something`

Debug info is somewhat disconnected from the symbols themselves, so the
regular "NVPTXAssignValidGlobalNames" pass can't easily fix them.

As the "plan B" this patch catches printout of debug symbols and fixes
them, as needed. One gotcha is that the same code path is used to print
the names of debug info sections. Those section names do start with a
'.debug'. The dot in those names is nominally illegal in PTX, but the
debug section names with a dot are accepted as a special case. The
downside of this change is that if someone ever has a `.debug*` symbol
that needs to be referred to from the debug info, that label will be
passed through as-is, and will still produce broken PTX output. If/when
we run into a case where we need it to work, we could consider only
passing through specific debug section names, or add a mechanism
allowing us to tell section names apart from regular symbols.

Fixes #58491
2024-10-22 13:01:40 -07:00
Renaud Kauffmann
f1e59dcb45
Renaming Cuf passes to CUF (#113351)
For consistency with other dialects and other CUF passes and files, this
patch renames passes CufOpConversion to CUFOpConversion,
CufImplicitDeviceGlobal to CUFDeviceGlobal.
It also renames the file.
2024-10-22 12:50:31 -07:00
Vitaly Buka
395093ec15
[msan] Switch to -msan-handle-icmp-exact my default (#113200)
Fixes #111212.

This grows .text by 5.3% on CTMark, (or 2.6% large internal binary)
Perf regressed by 1.6%. We will try to improve in follow up patches.

It worth to pay some performance regression to fix
correctness to avoid stuff like #111212.
2024-10-22 12:35:18 -07:00
Vitaly Buka
54cf62d19d
[nfc][msan] Generate test with update_test_checks.py (#113199)
PR is to:
1. Simplify test update in #113200
2. Make tests more comprehensive, currently interesting cases looks very
basic:

```
; CHECK-LABEL: @ICmpSGTAllOnes
; CHECK: icmp slt
; CHECK-NOT: call void @__msan_warning
; CHECK: icmp sgt
; CHECK-NOT: call void @__msan_warning
; CHECK: ret i1
```
2024-10-22 12:33:58 -07:00
Stanislav Mekhanoshin
03fef62b84
[AMDGPU] Relax __builtin_amdgcn_update_dpp sema check (#113341)
Recent change applied too strict check for old and src operands match.
These shall be compatible, but not necessarily exactly the same.

Fixes: SWDEV-493072
2024-10-22 12:32:08 -07:00
Valentin Clement (バレンタイン クレメン)
cc4926a069
[flang][cuda] Fix module registration (#113358) 2024-10-22 12:26:10 -07:00
weiwei chen
7191ced3b6
[MLIR] Add folding constants canonicalization for mlir::index::AddOp. (#111084)
- [x] Add a simple canonicalization for `mlir::index::AddOp`.
2024-10-22 12:04:26 -07:00
Andreas Jonson
00b47b98d4 [NFC] Fix missplaced comment 2024-10-22 20:51:46 +02:00
Sam Elliott
78e026f845 [RISCV][NFC] Document F64 ISD Nodes 2024-10-22 11:45:12 -07:00
Lei Huang
06d192925d
[PowerPC] Expand global named register support (#112603)
Enable all valid registers for intrinsics that read from and write
to global named registers.
2024-10-22 14:34:24 -04:00
Lang Hames
e575483870 [ORC] Fix LLJITWithRemoteDebugging example after db21bd4fa9b. 2024-10-22 11:31:54 -07:00
Vlad Serebrennikov
1b0fcf1e42
[clang-tidy][NFC] Replace usages of DeclSpec::TQ with Qualifiers::TQ (#113295)
This patch improves, but doens't fully resolve the layering violation,
which stems from relying on Sema. There's one function that needs to
convert enumerator to a string (`buildQualifier` in
`FixItHintUtils.cpp`), but `Qualifiers::TQ` doesn't offer such function.
Even more, the set of enumerators is not complete compared to
`DeclSpec::TQ`, so I'm afraid that this would be a functional change.
2024-10-22 22:21:08 +04:00
Vlad Serebrennikov
8536c2e9a2
[clang][NFC] Move concepts::createSubstDiagAt from AST to Sema (#113294)
This fixes layering violation introduced in
2fd01d75a863184766ee0c82b5c0fc8be172448a. The declaration is moved to
`SemaTemplateInstantiate` section of `Sema.h`, after the file where it's
implemented.
2024-10-22 22:18:25 +04:00
muiez
9edb4f74a6
Define CLANG_ABI and LLVM_ABI for z/OS (#113333)
This patch fixes the build failure seen on z/OS:

```
llvm/clang/include/clang/ASTMatchers/ASTMatchers.h:7212:1: error: unknown type name 'CLANG_ABI'
```
2024-10-22 14:13:37 -04:00
Sam Elliott
9b9c2a082c [RISCV][NFC] Move RISCVISD::TAIL beside RISCVISD::CALL 2024-10-22 11:12:58 -07:00
Kristof Beyls
383bd05818 [docs] Add link to newest CoC transparency report 2024-10-22 11:01:06 -07:00
Sam Clegg
0764e55c91
[lld][WebAssembly] Improve -v/-V/--version flag compat (#113204)
Fixes: #112836
2024-10-22 10:47:57 -07:00
Arthur Eubanks
62cb1a3b0b [gn build] Port b8930cd13d48 2024-10-22 17:38:21 +00:00
Arthur Eubanks
50df49e02a [gn build] Port 6c4267fb1779 2024-10-22 17:38:11 +00:00
Arthur Eubanks
24293e6900 [gn build] Port 6512a8dd8c0a 2024-10-22 17:32:06 +00:00
Arthur Eubanks
c08a5c15e1 [gn build] Port 470a59919207 2024-10-22 17:32:05 +00:00
Arthur Eubanks
2cbe7c2b9e [gn build] Port 1295d2e6da2f 2024-10-22 17:32:05 +00:00
Kazu Hirata
6803062eb7 [BOLT] Fix a build failure
This patch fixes:

  bolt/lib/Core/DIEBuilder.cpp:285:40: error: too many arguments to
  function call, expected 2, have 3
2024-10-22 10:20:20 -07:00
Sergey Kozub
7b308b18c3
Fix bitcasting E8M0 APFloat to APInt (#113298)
Fixes a bug in APFloat handling of E8M0 type (zero mantissa).

Related PRs:
- https://github.com/llvm/llvm-project/pull/107127
- https://github.com/llvm/llvm-project/pull/111028
2024-10-22 19:15:29 +02:00
Daniel Paoliello
2fdf49db75
[llvm-rc] Handle Windows line endings in tag-html test (#113000)
The tag-html.test has been failing for me and [in
CI](https://buildkite.com/llvm-project/github-pull-requests/builds/111277#0192a122-c5c9-4e4e-bc5b-7532fec99ae4)
if Git happens to decide to check out the baseline file with Windows
line endings.

This fix for this is to call `tr` to strip Windows newlines when copying
the baselines files to the test output directory before embedding them.
2024-10-22 09:54:32 -07:00
Daniel Hoekwater
f66bc4d3f1
Revert "Reland [CFIFixup] Factor CFI remember/restore insertion into a helper (NFC)" (#113340)
Reverts llvm/llvm-project#113328

This change breaks a number of builds (e.g
https://lab.llvm.org/buildbot/#/builders/25/builds/3504), for some
reason. Reverting to do some troubleshooting.
2024-10-22 12:50:15 -04:00
Jonas Devlieghere
5886454669
[dsymutil] Provide an option to ignore object timestamp mismatches (#113238)
Provide a option (--no-object-timestamp) to ignore object file timestamp
mismatches. We already have a similar option for Swift modules
(--no-swiftmodule-timestamp).

rdar://123975869
2024-10-22 09:48:02 -07:00
Jonas Devlieghere
2ccbea1d73
[dsymutil] Share one BinaryHolder between debug map parsing & linking (#113234)
I (re)discovered that dsymutil was instantiating two BinaryHolders: one
for parsing the debug map and one for linking. That really defeats the
purpose of the BinaryHolder as it serves as a cache. Fix the issue and
remove an old FIXME.
2024-10-22 09:40:34 -07:00
Christudasan Devadasan
91fd1b4f32
[HIP] Always add -fnative-half-arguments-and-returns cmdline option. (#113335)
This command-line option is now required while building the HIP
applications (mainly for the host side) after we enabled __fp16
args and return values with patches D133885 & D145345.
2024-10-22 22:07:35 +05:30
Greg Clayton
dc5c044193
Add verification support for .debug_names with foreign type units. (#109011)
This commit enables 'llvm-dwarfdump --veriy' to verify the DWARF in
foreign type units when using split DWARF for the .debug_names section.
2024-10-22 09:35:10 -07:00
Lang Hames
470a599192 [ORC] Move MachO object format details into their own header (NFC). 2024-10-22 09:23:48 -07:00