Commit Graph

501471 Commits

Author SHA1 Message Date
Maksim Panchenko
540893e43f [BOLT] Add auto parsing for Linux kernel .altinstructions (#95068)
.altinstructions section contains a list of structures where fields can
have different sizes while other fields could be present or not
depending on the kernel version. Add automatic detection of such
variations and use it by default. The user can still overwrite the
automatic detection with `--alt-inst-has-padlen` and
`--alt-inst-feature-size` options.
2024-06-11 10:52:51 -07:00
Pavel Labath
56f668c12b [lldb/DWARF] Remove some dead code (#95127)
`GetDeclContextDIEs` and `DIEDeclContextsMatch` are unused (possibly
since we added support for simplified template names, but I haven't
checked). `GetDeclContextDIEs` is also very similar (but subtly
different) from `GetDeclContext` and `GetTypeLookupContext`.

I am keeping `GetParentDeclContextDIE` as that one still has some
callers, but I want to look into the possibility of merging it with at
least one of the functions mentioned above.
2024-06-11 19:49:10 +02:00
Sayhaan Siddiqui
727ecbeee3 [BOLT][DWARF][NFC] Remove old GDB Index functions (#95019)
Remove old usages of GDB Index functions after replacing them with new
ones.
2024-06-11 10:36:49 -07:00
geza-herman
1c59362e44 [clangd] Make it possible to enable misc-const-correctness clang-tidy check (#94920)
Before this PR, clangd forcefully disabled misc-const-correctness in
disableUnusableChecks().

Now we have a FastCheckFilter configuration whose default value
(Strict) also disables it. This patch removes misc-const-correctness
from disableUnusableChecks() so it's possible to enable by setting
FastCheckFilter to None.

Fixes https://github.com/llvm/llvm-project/issues/89758
2024-06-11 13:32:12 -04:00
Valentin Clement (バレンタイン クレメン)
27f3ac5929 [flang] Fix character scalar result for REDUCE intrinsic call (#95076)
The character reduce runtime functions expect a pointer to a scalar
character of the correct length for the result of character reduce. A
descriptor was passed so far. Fix the lowering so a proper temporary is
created and passed to the runtime.
2024-06-11 10:10:42 -07:00
Tomas Matheson
41f81ad735 [Tablegen][NFC] Add a check for duplicate features (#94223)
We hit this downstream and the only evidence of the mistake was that the
results of `Find` on `SubtargetFeatureKV` were corrupted.
2024-06-11 17:51:25 +01:00
Arthur Eubanks
71497cc7a4 [CGSCC] Fix compile time blowup with large RefSCCs (#94815)
In some modules, e.g. Kotlin-generated IR, we end up with a huge RefSCC
and the call graph updates done as a result of the inliner take a long
time. This is due to RefSCC::removeInternalRefEdges() getting called
many times, each time removing one function from the RefSCC, but each
call to removeInternalRefEdges() is proportional to the size of the
RefSCC.

There are two places that call removeInternalRefEdges(), in
updateCGAndAnalysisManagerForPass() and
LazyCallGraph::removeDeadFunction().

1) Since LazyCallGraph can deal with spurious (edges that exist in the
graph but not in the IR) ref edges, we can simply not call
removeInternalRefEdges() in updateCGAndAnalysisManagerForPass().

2) LazyCallGraph::removeDeadFunction() still ends up taking the brunt of
compile time with the above change for the original reason. So instead
we batch all the dead function removals so we can call
removeInternalRefEdges() just once. This requires some changes to
callers of removeDeadFunction() to not actually erase the function from
the module, but defer it to when we batch delete dead functions at the
end of the CGSCC run, leaving the function body as "unreachable" in the
meantime. We still need to ensure that call edges are accurate. I had
also tried deleting dead functions after visiting a RefSCC, but deleting
them all at once at the end was simpler.

Many test changes are due to not performing unnecessary revisits of an
SCC (the CGSCC infrastructure deems ref edge refinements as unimportant
when it comes to revisiting SCCs, although that seems to not be
consistently true given these changes) because we don't remove some ref
edges. Specifically for devirt-invalidated.ll this seems to expose an
inlining order issue with the inliner. Probably unimportant for this
type of intentionally weird call graph.

Compile time:
https://llvm-compile-time-tracker.com/compare.php?from=6f2c61071c274a1b5e212e6ad4114641ec7c7fc3&to=b08c90d05e290dd065755ea776ceaf1420680224&stat=instructions:u
2024-06-11 09:50:13 -07:00
David Parks
a03e93e1b2 [flang] Add runtime support for Fortran intrinsic ERFC_SCALED (#95040)
Co-authored-by: David Parks <dparks@nvidia.com>
2024-06-11 09:40:00 -07:00
Jay Foad
5ccdce95b4 [test] Skip some tests on Windows only (#95095)
These tests pass on Linux using lit's internal shell.
2024-06-11 17:34:15 +01:00
Felipe de Azevedo Piovezan
2e007b89c6 [lldb] Skip TestAttachDenied under asan
Like many other tests, this one times out when run under the address sanitizer.
To reduce noise, this commit skips it in those builds.
2024-06-11 09:28:10 -07:00
Fangrui Song
de19f7b6d4 [MC] Replace fragment ilist with singly-linked lists
Fragments are allocated with `operator new` and stored in an ilist with
Prev/Next/Parent pointers. A more efficient representation would be an
array of fragments without the overhead of Prev/Next pointers.

As the first step, replace ilist with singly-linked lists.

* `getPrevNode` uses have been eliminated by previous changes.
* The last use of the `Prev` pointer remains: for each subsection, there is an insertion point and
  the current insertion point is stored at `CurInsertionPoint`.
* `HexagonAsmBackend::finishLayout` needs a backward iterator. Save all
  fragments within `Frags`. Hexagon programs are usually small, and the
  performance does not matter that much.

To eliminate `Prev`, change the subsection representation to
singly-linked lists for subsections and a pointer to the active
singly-linked list. The fragments from all subsections will be chained
together at layout time.

Since fragment lists are disconnected before layout time, we can remove
`MCFragment::SubsectionNumber` (https://reviews.llvm.org/D69411). The
current implementation of `AttemptToFoldSymbolOffsetDifference` requires
future improvement for robustness.

Pull Request: https://github.com/llvm/llvm-project/pull/95077
2024-06-11 09:18:31 -07:00
Timm Bäder
4cf607fa15 [clang][Interp] Fix visiting non-FieldDecl MemberExprs
Ignore the base and visit the Member decl like a regular DeclRefExpr.
2024-06-11 18:13:28 +02:00
Florian Mayer
00c5474918 [HWASan] make get_info.local_time.pass.cpp UNSUPPORTED 2024-06-11 09:06:07 -07:00
Simon Pilgrim
3f3e85cd23 [X86] ICMP EQ/NE MIN_SIGNED_INT - avoid immediate argument by using NEG + SETO/SETNO (#94948)
For i64 this avoids loading a 64-bit value into register, for smaller registers this just avoids an immediate operand.

For i8+i16, limit to one use case as we save fewer bytes and these can be wasted entirely on extra register moves.

Fixes #67709
2024-06-11 16:38:53 +01:00
OverMighty
f5dcfb9968 [libc][math][c23] Add {totalorder,totalordermag}f16 C23 math functions (#95014)
Part of #93566.
2024-06-11 11:04:48 -04:00
Hans Wennborg
b746babb22 Restore 'REQUIRES: shell' for another test after 878deae
Otherwise this would fail when using gnuwin32.
2024-06-11 16:51:33 +02:00
Jacques Pienaar
18cf1cd92b [mlir] Add PDL C & Python usage (#94714)
Following a rather direct approach to expose PDL usage from C and then
Python. This doesn't yes plumb through adding support for custom
matchers through this interface, so constrained to basics initially.

This also exposes greedy rewrite driver. Only way currently to define
patterns is via PDL (just to keep small). The creation of the PDL
pattern module could be improved to avoid folks potentially accessing
the module used to construct it post construction. No ergonomic work
done yet.

---------

Signed-off-by: Jacques Pienaar <jpienaar@google.com>
2024-06-11 07:45:12 -07:00
Farzon Lotfi
38ccee0034 [WASM] Fix for wasi libc build break add tan to RuntimeLibcallSignatureTable (#95082)
The wasm backend fetches the tan runtime lib call in
`llvm/include/llvm/IR/RuntimeLibcalls.def` via `StaticLibcallNameMap()`,
but ignores the runtime function because a function sinature mapping is
not specified in RuntimeLibcallSignatureTable(). The fix is to specify
the function signatures for float32-128.

This is a fix for a build break reported on PR
https://github.com/llvm/llvm-project/pull/94559#issuecomment-2159923215.
2024-06-11 10:43:51 -04:00
Max191
d586372194 [mlir] Add bufferization option for parallel region check (#94645)
Handling parallel region RaW conflicts should usually be the
responsibility of the source program, rather than bufferization
analysis. However, to preserve current functionality, checks on parallel
regions is put behind a bufferization in this PR, which is on by
default. Default functionality will not change, but this PR enables the
option to leave parallelism checks out of the bufferization analysis.
2024-06-11 10:31:06 -04:00
Dmitry Chernenkov
be6248a42a [Bazel] Layering fix for 65310f34d7 2024-06-11 14:26:18 +00:00
Simon Pilgrim
464eb648fa [X86] SimplifyDemandedBitsForTargetNode - add basic X86ISD::CMOV handling
Add basic pass through handling - we could extend this to truncate CMOVQ to CMOVL in a future patch
2024-06-11 15:17:53 +01:00
Simon Pilgrim
1df37980c2 [X86] early-ifcvt-remarks.ll - use i64 arithmetic to ensure ifcvt doesn't drop below threshold
Upcoming SimplifyDemandedBits support for CMOV will simplify the code and reduce the critical path below the threshold if we stick with i32 multiplies
2024-06-11 15:17:53 +01:00
Pavel Labath
c0e1ad779f [lldb] Skip declaration DIEs in the debug_names index (#94744)
This makes sure we try to process declaration DIEs that are erroneously
present in the index. Until bd5c6367bd, clang was emitting index
entries for declaration DIEs with DW_AT_signature attributes. This makes
sure to avoid returning those DIEs as the definitions of a type, but
also makes sure to pass through DIEs referring to static constexpr
member variables, which is a (probably nonconforming) extension used by
dsymutil.

It adds test cases for both of the scenarios. It is essentially a
recommit of #91808.
2024-06-11 16:17:25 +02:00
Stephen Tozer
d83f37f039 Revert#2 "[MLIR][Flang][DebugInfo] Set debug info format in MLIR->IR translation (#95098)"
Also reverts "[MLIR][Flang][DebugInfo] Convert debug format in MLIR translators"

The patch above introduces behaviour controlled by an LLVM flag into the
Flang driver, which is incorrect behaviour.

This reverts commits:
  3cc2710e0d.
  460408f78b.
2024-06-11 15:14:31 +01:00
Johannes Doerfert
2eb60e2de8 [Offload][NFCI] Initialize the KernelArgsTy to default values (#95117)
Co-authored-by: Joseph Huber <huberjn@outlook.com>
2024-06-11 17:05:04 +03:00
Benjamin Kramer
37e9bf9d15 [bazel] Add missing dependency for 3cc2710e0d 2024-06-11 15:48:41 +02:00
Sergei Lebedev
bc5ced54cc Updated the annotations of Python bindings (#92733) 2024-06-11 08:46:43 -05:00
Simon Pilgrim
a7d28f5a4d [X86] early-ifcvt-remarks.ll - add codegen checks 2024-06-11 14:35:32 +01:00
paperchalice
837dc542b1 [CodeGen][NewPM] Split MachineDominatorTree into a concrete analysis result (#94571)
Prepare for new pass manager version of `MachineDominatorTreeAnalysis`.
We may need a machine dominator tree version of `DomTreeUpdater` to
handle `SplitCriticalEdge` in some CodeGen passes.
2024-06-11 21:27:14 +08:00
Nikita Popov
2b15fb16ce [gold] Don't pass StringRef to message() (#95083)
This is a printf style variadic function. If using a "%s" format, we
should pass "const char *" rather than "StringRef".

The use of data() here is safe because we know that the StringRef was
originally derived from a null-terminated string.
2024-06-11 15:26:53 +02:00
Stephen Tozer
400d4fd7b6 [RemoveDIs] Update all docs to use debug records (#91768)
As we approach the state where support for debug intrinsics is dropping and
we print and use debug records by default, the documentation should be updated
to refer to debug records as the primary debug info representation, with
debug intrinsics being relegated to an optional alternative.

This patch performs a few updates:
- Replace references to intrinsics with references to records across all
the documentation.
- Replace intrinsics with records in code examples.
- Move debug records prior to debug intrinsics in the
SourceLevelDebugging document, and change text to refer to them as the
primary representation.
- Add release notes describing the change.
2024-06-11 14:16:32 +01:00
Timm Bäder
e805b77107 [clang][Interp] Support ObjCEncodeExprs 2024-06-11 15:07:28 +02:00
Paul T Robinson
32add2435f Fix test to have correct requirements (#95106) 2024-06-11 06:04:09 -07:00
Nikita Popov
da5f45f593 [ConstantFolding] Preserve nowrap flags in gep of gep fold
A caveat here is that we can only preserve nusw if the offset
additions did not overflow.

Proofs: https://alive2.llvm.org/ce/z/u56z_u
2024-06-11 15:03:10 +02:00
Congcong Cai
1bae10879d [clang-tidy] fix false positives for the functions with the same name as standard library functions in misc-include-cleaner (#94923)
Fixes: #93335
For decl with body, we should provide physical locations also. Because
it may be the function which have the same name as std library.
2024-06-11 21:01:52 +08:00
Andrzej Warzyński
d4c6478cf2 [mlir][vector] Update tests for collapse 1/n (nfc) (#94490)
The main goal of this PR (and subsequent PRs), is to add more tests with
scalable vectors to:
  * vector-transfer-collapse-inner-most-dims.mlir

There's quite a few cases to consider, hence this is split into multiple
PRs. In this PR, the very first test is complemented with all the
possible combinations:
  * scalable (rather than fixed) unit trailing dim,
  * dynamic (rather than static) trailing dim in the source memref.

Also,
  * `@leading_scalable_dimension_transfer_read` and
    `@trailing_scalable_one_dim_transfer_read`,

are replaced with:
  * `@contiguous_inner_most_scalable_inner_dim` and
    `@negative_scalable_unit_dim`,

respectively, and added to the list above (i.e. alongside other
variations for the very first test).

In addition:
  * "_view" is removed from function names (it's not clear to me what it
    was meant to signify)
  * extra comments are added to separate tests for vector.transfer_read
    and vector.transfer_write

NOTE: This PR is limited to tests for `vector.transfer_read`.
2024-06-11 13:56:45 +01:00
Stephen Tozer
3cc2710e0d [MLIR][Flang][DebugInfo] Convert debug format in MLIR translators
Following from the previous commit, this patch converts to the
appropriate debug info format before printing LLVM IR.

See: https://github.com/llvm/llvm-project/pull/95098
2024-06-11 13:48:41 +01:00
Stephen Tozer
460408f78b Reapply "[MLIR][Flang][DebugInfo] Set debug info format in MLIR->IR translation (#95098)"
Reapplies the original patch with some additional conversion layers added
to the MLIR translator, to ensure that we don't write the new debug info
format unless WriteNewDbgInfoFormat is set.

This reverts commit 8c5d9c79b9.
2024-06-11 13:46:09 +01:00
Matt Arsenault
a2bc50aa8b AMDGPU: Add more tests for vector typed atomicrmw fadd
Some cases should be legal for gfx940.
2024-06-11 14:44:28 +02:00
Pierre van Houtryve
a45080f091 [AMDGPU] Document amdgpu-as in AMDGPUUsage (#94335)
Add a section about fence & address spaces that covers amdgpu-as.
2024-06-11 14:31:26 +02:00
Stephen Tozer
8c5d9c79b9 Revert "[MLIR][Flang][DebugInfo] Set debug info format in MLIR->IR translation (#95098)"
Reverted due to failure on buildbot due to missing use of the
WriteNewDbgInfoFormat flag in MLIR.

This reverts commit ca920bb628.
2024-06-11 13:29:38 +01:00
Zibi Sarbinowski
ffc3a6b286 [libc++] Fix endianness for algorithm mismatch (#93082)
This PR is required to fix
`std/algorithms/alg.nonmodifying/mismatch/mismatch.pass.cpp` test for
big endian platrofrms such as z/OS.
2024-06-11 08:29:12 -04:00
Pierre van Houtryve
d4b8b7217f [CodeGen][MachineLICM] Use RegUnits in HoistRegionPostRA (#94608)
Those BitVectors get expensive on targets like AMDGPU with thousands of
registers, and RegAliasIterator is also expensive.

We can move all liveness calculations to use RegUnits instead to speed
it up for targets where RegAliasIterator is expensive, like AMDGPU.
On targets where RegAliasIterator is cheap, this alternative can be a little more expensive, but I believe the tradeoff is worth it.
2024-06-11 14:27:35 +02:00
Donát Nagy
546c816a52 [clang-tidy] Improve sizeof(pointer) handling in bugprone-sizeof-expression (#94356)
This commit reimplements the functionality of the Clang Static Analyzer
checker `alpha.core.SizeofPointer` within clang-tidy by adding a new
(off-by-default) option to bugprone-sizeof-expression which activates
reporting all the `sizeof(ptr)` expressions (where ptr is an expression
that produces a pointer).

The main motivation for this change is that `alpha.core.SizeofPointer`
was an AST-based checker, which did not rely on the path sensitive
capabilities of the Static Analyzer, so there was no reason to keep it
in the Static Analyzer instead of the more lightweight clang-tidy.

After this commit I'm planning to create a separate commit that deletes
`alpha.core.SizeofPointer` from Clang Static Analyzer.

It was natural to place this moved logic in bugprone-sizeof-expression,
because that check already provided several heuristics that reported
various especially suspicious classes of `sizeof(ptr)` expressions.

The new mode `WarnOnSizeOfPointer` is off-by-default, so it won't
surprise the existing users; but it can provide a more through coverage
for the vulnerability CWE-467 ("Use of sizeof() on a Pointer Type") than
the existing partial heuristics.

Previously this checker had an exception that the RHS of a
`sizeof(array) / sizeof(array[0])` expression is not reported; I
generalized this to an exception that the check doesn't report
`sizeof(expr[0])` and `sizeof(*expr)`. This idea is taken from the
Static Analyzer checker `alpha.core.SizeofPointer` (which had an
exception for `*expr`), but analysis of open source projects confirmed
that this indeed eliminates lots of unwanted results.

Note that the suppression of `sizeof(expr[0])` and `sizeof(*expr)`
reports also affects the "old" mode `WarnOnSizeOfPointerToAggregate`
which is enabled by default.

This commit also replaces the old message "suspicious usage of
'sizeof(A*)'; pointer to aggregate" with two more concrete messages; but
I feel that this tidy check would deserve a through cleanup of all the
diagnostic messages that it can produce. (I added a FIXME to mark one
outright misleading message.)
2024-06-11 14:16:42 +02:00
Stephen Tozer
ca920bb628 [MLIR][Flang][DebugInfo] Set debug info format in MLIR->IR translation (#95098)
MLIR's LLVM dialect does not internally support debug records, only
converting to/from debug intrinsics. To smooth the transition from
intrinsics to records, there is a step prior to IR->MLIR translation
that switches the IR module to intrinsic-form; this patch adds the
equivalent conversion to record-form at MLIR->IR translation, and also
modifies the flang front end to use the WriteNewDbgInfoFormat flag when
it is emitting LLVM IR.
2024-06-11 13:11:41 +01:00
Nathan Gauër
a141a28c0c [SPIR-V] Fix flakiness during switch generation. (#95001)
The case-list of the switches generated by this pass were not
"deterministic" (based on allocation patterns).
This is because the CaseList order relied on an unordered_set order.
Using the sorted exit target list for those should solve the problem.

Fixes #94961

Signed-off-by: Nathan Gauër <brioche@google.com>
2024-06-11 13:57:31 +02:00
Paul T Robinson
3f88311124 [Driver] Rearrange some Apple version testing (#94514)
There were four tests in Driver that actually tested bits of Driver and
bits of CodeGen, and therefore had target restrictions. Rework those
four tests into one Driver test (with no target restrictions) and two
target-specific CodeGen tests.
2024-06-11 07:51:21 -04:00
Timm Bäder
fa9745e8d3 [clang][Interp][NFC] Remove unneeded opcode initializers 2024-06-11 13:45:48 +02:00
Johannes Reifferscheid
9b225d01f8 Fix complex abs with nnan/ninf. (#95080)
The current logic tests for inf/inf and 0/0 inputs using a NaN check.
This doesn't work with all fastmath flags. With nnan and ninf, we can
just check for a 0 maximum. With only nnan, we have to check for both
cases separately.
2024-06-11 13:44:29 +02:00
donald chen
efbd64cbd9 [mlir][arith] Delete unnecessary error logs (#94970)
Function `getNeutralElement` already indicates "cannot find neutral
element" by returning nullptr through the return value, and no
additional error log needs to be output.
2024-06-11 19:41:01 +08:00