Commit Graph

514693 Commits

Author SHA1 Message Date
Augusto Noronha
f02252e1fd Revert "[lldb] SetErrorStringWithFormatv -> FromErrorStringWithFormatv (NFC)"
This reverts commit b77fdf5799.
2024-10-10 15:05:58 -07:00
William Junda Huang
48545a955c [ThinLTO] Do not duplicate import a function that is actually defined in the current module (#110064)
Doing so could cause a bug where the linker tries to remap a function
"reimported" from the current module when materializing it, causing a
lookup assert in the type mappings.
2024-10-10 17:59:44 -04:00
Vitaly Buka
af7fa2710c [sanitizer] VReport thread status for failed PTRACE_ATTACH (#111901)
Such threads can cause false leak reports,
but often it's hard to diagnose the reason of
failed PTRACE_ATTACH. Maybe we can find
a clue from `/proc/*/task/*/status`
2024-10-10 14:53:16 -07:00
Vitaly Buka
5deadc6eae [NFC][sanitizer] Extract LoadStatus (#111909)
For #111901
2024-10-10 14:52:50 -07:00
Jason Molenda
c99b365547 Revert "[lldb] Add include for SBLanguages in lldb-enumerations (#111907)"
Temporarily Revert until Chelsea can look at this.  With a clean build,
SBLanguages.h won't be generated in the build directory at the point
when it is included by lldb-enumerations when compiling e.g.
Broadcaster.cpp.  On a clean build (no pre-existing build directory),
the dependency ordering is not explicitly stated so the build will fail.
An incremental build will succeed.

This reverts commit b3554265f2.
2024-10-10 14:50:34 -07:00
Wael Yehia
16ef893e9f [test] env -u is not supported on AIX, use unset instead 2024-10-10 21:35:10 +00:00
Alexey Bataev
4b5018d231 [SLP]Track repeated reduced value as it might be vectorized
Need to track changes with the repeated reduced value, since it might be
vectorized in the next attempt for reduction vectorization, to correctly
generate the code and avoid compiler crash.

Fixes #111887
2024-10-10 13:41:56 -07:00
Vitaly Buka
195486950f [NFC][sanitizer] Fix at_scope_exit name. 2024-10-10 13:28:45 -07:00
vporpo
69c0067927 [SandboxVec][DAG] Refactoring: Outline code that looks for mem nodes (#111750) 2024-10-10 13:25:03 -07:00
Jonas Devlieghere
b77fdf5799 [lldb] SetErrorStringWithFormatv -> FromErrorStringWithFormatv (NFC) 2024-10-10 13:23:06 -07:00
Alexis Perry-Holby
86f78c0093 [flang] Add a link to the ICS file for the Biweekly Flang Community Call 2024-10-10 14:21:21 -06:00
Vitaly Buka
36bd9aebc4 [sanitizer] VReport BeforeFork/AfterFork (#111900)
Forks are common suspects for unusual sanitizer behavior.
It can be handy to see them without rebuild.
2024-10-10 13:12:36 -07:00
Chelsea Cassanova
b3554265f2 [lldb] Add include for SBLanguages in lldb-enumerations (#111907)
This adds an include for SBLanguages.h in lldb-enumerations.h so that
files that need this enum do not have to explicitly include SBLanguages.
2024-10-10 13:11:46 -07:00
Jonas Devlieghere
69b0b7e7ac [lldb] Return an llvm::Error from GetFrameBaseValue (#111882)
This fixes the following assertion: "Cannot create Expected<T> from
Error success value." The problem was that GetFrameBaseValue return
false without updating the Status argument. This patch eliminates the 
opportunity for mistakes by returning an llvm:Error.
2024-10-10 13:11:08 -07:00
Vitaly Buka
942fefe741 [NFC][sanitizer] Reopen '/proc/%d/task' instead of seek
NFC because I am not aware of any particular
issue from seek, but reopen looks less error prone.

Pull Request: https://github.com/llvm/llvm-project/pull/111899
2024-10-10 13:09:01 -07:00
Youngsuk Kim
f0ed31ce4b [llvm][PGOCtxProfLowering] Avoid Type::getPointerTo() (NFC) (#111857)
`Type::getPointerTo()` is to be deprecated & removed soon.
2024-10-10 16:02:13 -04:00
Robert O'Callahan
d5e1de6da9 [lldb] Implement basic support for reverse-continue (#99736)
This commit only adds support for the
`SBProcess::ReverseContinue()` API. A user-accessible command for this
will follow in a later commit.

This feature depends on a gdbserver implementation (e.g. `rr`) providing
support for the `bc` and `bs` packets. `lldb-server` does not support
those packets, and there is no plan to change that. So, for testing
purposes, `lldbreverse.py` wraps `lldb-server` with a Python
implementation of *very limited* record-and-replay functionality for use
by *tests only*.

The majority of this PR is test infrastructure (about 700 of the 950
lines added).
2024-10-10 13:01:47 -07:00
Tyler Nowicki
29e192a0bf [Coroutines] Documentation for custom ABIs (#111781)
Update the llvm/docs/Coroutines.rst docs to include a full description
of Custom ABI objects. This documentation describes the how ABI objects
allow users (plugin libraries) to create custom ABI objects for their
needs.
2024-10-10 15:59:24 -04:00
Justin Fargnoli
d832a1c744 [NVPTX] Only run LowerUnreachable when necessary (#109868)
Before CUDA 12.3 `ptxas` did not recognize that the trap instruction
terminates a basic block. Instead, it would assume that control flow
continued to the next instruction. The next instruction could be in the
block that's lexically below it. This would lead to phantom CFG edges
being created within ptxas.

[NVPTX: Lower unreachable to exit to allow ptxas to accurately
reconstruct the
CFG.](1ee4d880e8)
added the LowerUnreachable pass to NVPTX to work around this. Several
other WAR patches followed.

This bug in `ptxas` was fixed in CUDA 12.3 and is thus impossible to
encounter when targeting PTX ISA v8.3+

This commit reverts the WARs for the `ptxas` bug when targeting PTX ISA
v8.3+

CC @maleadt
2024-10-10 12:57:43 -07:00
vporpo
a4916d2005 [SandboxVec][DAG] Refactoring: Move MemPreds from DGNode to MemDGNode (#111897) 2024-10-10 12:42:28 -07:00
Vitaly Buka
07892aaf04 [NFC][sanitizer] Clang format sanitizer_thread_registry.cpp 2024-10-10 12:36:26 -07:00
Arthur Eubanks
e34d614e7d [Passes] Remove -enable-infer-alignment-pass flag (#111873)
This flag has been on for a while without any complaints.
2024-10-10 12:28:46 -07:00
Changpeng Fang
f6e93b8147 AMDGPU: Minor improvement and cleanup for waterfall loop generation (#111886)
First, ReadlanePieces should be in the scope of each MachineOperand. It
is not correct if we declare in a outer scope without clearing after the
use for a MachineOperand.
Additionally, we do not need the OrigBB argyment for
emitLoadScalarOpsFromVGPRLoop, since MachineFunction (the only use) can
be obtained from LoopBB (or BodyBB).
2024-10-10 12:13:36 -07:00
Tyler Nowicki
125262312f [Coroutines] Improve use of unique_ptr (#111870)
* Replace usage of unique_ptr<>(new ...) -> make_unique<>();
2024-10-10 15:11:27 -04:00
Florian Hahn
bb937e276d [LV] Compute value of escaped induction based on the computed end value. (#110576)
Update fixupIVUsers to compute the value for escaped inductions using
the already computed end value of the induction (EndValue), but
subtracting the step.

This results in slightly simpler codegen, as we avoid computing the full
transformed index at VectorTripCount - 1.

PR: https://github.com/llvm/llvm-project/pull/110576
2024-10-10 20:04:46 +01:00
vporpo
747d8f3fc9 [SandboxVec][DAG] Implement PredIterator (#111604)
This patch implements an iterator for iterating over both use-def and
mem dependencies of MemDGNodes.
2024-10-10 12:01:56 -07:00
Greg Roth
c2063de159 Switch DirectX Target to use the Itanium ABI (#111632)
To consolidate behavior of function mangling and limit the number of
places that ABI changes will need to be made, this switches the DirectX
target used for HLSL to use the Itanium ABI from the Microsoft ABI. The
Itanium ABI has greater flexibility in decisions regarding mangling of
new types of which we have more than a few yet to add.

One effect of this will be that linking library shaders compiled with
DXC will not be possible with shaders compiled with clang. That isn't
considered a terribly interesting use case and one that would likely
have been onerous to maintain anyway.

This involved adding a function to call all global destructors as the
Microsoft ABI had done.

This requires a few changes to tests. Most notably the mangling style
has changed which accounts for most of the changes. In making those
changes, I took the opportunity to harmonize some very similar tests for
greater consistency. I also shaved off some unneeded run flags that had
probably been copied over from one test to another.

Other changes effected by using the new ABI include using different
types when manipulating smaller bitfields, eliminating an unnecessary
alloca in one instance in this-assignment.hlsl, changing the way static
local initialization is guarded, and changing the order of inout
parameters getting copied in and out. That last is a subtle change in
functionality, but one where there was sufficient inconsistency in the
past that standardizing is important, but the particular direction of
the standardization is less important for the sake of existing shaders.

fixes #110736
2024-10-10 12:58:28 -06:00
Donough Liu
b800ff67da [lldb][debugserver][NFC] Simplify macOS thread name fetching. (#111684)
Remove unnecessary `proc_pidinfo` calling.
2024-10-10 11:46:19 -07:00
Finn Plummer
d36cef0b17 [HLSL][DXIL] Implement WaveGetLaneIndex Intrinsic (#111576)
- add additional lowering for directx backend in CGBuiltin.cpp
    - add directx intrinsic to IntrinsicsDirectX.td
    - add semantic check of arguments in SemaHLSL.cpp
    - add mapping to DXIL op in DXIL.td

    - add testing of semantics in WaveGetLaneIndex-errors.hlsl
    - add testing of dxil lowering in WaveGetLaneIndex.ll
  
Resolves #70105
2024-10-10 11:44:44 -07:00
Keith Smiley
ba530e6b64 [bazel] Add initial clang-doc config (#111779) 2024-10-10 11:42:23 -07:00
Jay Foad
62b3a4bc70 [AMDGPU] Improve codegen for s_barrier_init (#111866) 2024-10-10 19:40:02 +01:00
Vitaly Buka
453d373e80 [lsan] Add a few "\n" missing from VReport 2024-10-10 11:24:36 -07:00
Renato Golin
99c8557c17 Fix GCC build problem with 03483737a7 2024-10-10 18:52:27 +01:00
Valentin Clement (バレンタイン クレメン)
7026960ecf [flang][runtime][NFC] Fix header guard typo (#111741)
Header guard was in sync with the filename.
2024-10-10 10:31:03 -07:00
Adrian Vogelsgesang
7e16571eb0 [lldb][libc++] Hide all libc++ implementation details from stacktraces (#108870)
This commit changes the libc++ frame recognizer to hide implementation
details of libc++ more aggressively. The applied heuristic is rather
straightforward: We consider every function name starting with `__` as
an implementation detail.

This works pretty neatly for `std::invoke`, `std::function`,
`std::sort`, `std::map::emplace` and many others. Also, this should
align quite nicely with libc++'s general coding convention of using the
`__` for their implementation details, thereby keeping the future
maintenance effort low.

However, this heuristic by itself does not work in 100% of the cases:
E.g., `std::ranges::sort` is not a function, but an object with an
overloaded `operator()`, which means that there is no actual call
`std::ranges::sort` in the call stack. Instead, there is a
`std::ranges::__sort::operator()` call. To make sure that we don't hide
this stack frame, we never hide the frame which represents the entry
point from user code into libc++ code
2024-10-10 19:27:27 +02:00
Peter Klausler
2f22656db5 [flang] Minor cleanup (move function into /tools.cpp) (#111587)
The semantics utility GetAllNames has declarations in two header files
and a definition that really should be in the common utilities source
file. Remove the redudant declaration from resolve-names-utils.h and
move code from resolve-names-utils.cpp into Semantics/tools.cpp.
2024-10-10 10:25:42 -07:00
Peter Klausler
4f2b65fb80 [flang] Fix references to destroyed objects (#111582)
ProgramTree instances are created as the value of a local variable in
the Pre(const parser::ProgramUnit &) member function in name resolution.
But references to these ProgramTree instances can persist in
SubprogramNameDetails symbol table entries that might survive that
function call's lifetime, and lead to trouble later when (e.g.)
expression semantics needs to deal with a possible forward reference in
a function reference in an expression being processed later in
expression checking.

So put those ProgramTree instances into a longer-lived linked list
within the SemanticsContext.

Might fix some weird crashes reported on big-endian targets (AIX &
Solaris).
2024-10-10 10:25:19 -07:00
Peter Klausler
c893e3d02d [flang][runtime] Fix runtime crash after bad recoverable OPEN (#111454)
When an OPEN statement with a unit number fails in a recoverable manner,
the runtime needs to delete the ExternalFileUnit instance that was
created in the unit map. And we do this too soon -- that instance still
holds some of the I/O statement state that will be used by a later call
into the runtime for EndIoStatement.

Move the code that deletes the unit after a failed but recoverable OPEN
into ExternalIoStatementBase::EndIoStatement, and don't do things
afterwards that would need the I/O statement state that has been
destroyed.

Fixes https://github.com/llvm/llvm-project/issues/111404.
2024-10-10 10:24:59 -07:00
Justin Fargnoli
3f9998af4f [NVPTX] Prefer prmt.b32 over bfi.b32 (#110766)
In [[NVPTX] Improve lowering of
v4i8](cbafb6f2f5)
@Artem-B add the ability to lower ISD::BUILD_VECTOR with bfi PTX
instructions. @Artem-B did this because:
([source](https://github.com/llvm/llvm-project/pull/67866#discussion_r1343066911))

> Under the hood byte extraction/insertion ends up as BFI/BFE
instructions, so we may as well do that in PTX, too.
https://godbolt.org/z/Tb3zWbj9b

However, the example that @Artem-B linked was targeting sm_52. On modern
architectures, ptxas uses prmt.b32.
[Example](https://godbolt.org/z/Ye4W1n84o).

Thus, remove uses of NVPTXISD::BFI in favor of NVPTXISD::PRMT.
2024-10-10 10:24:02 -07:00
Louis Dionne
43ba97e707 [runtimes][NFC] Reindent CMake files (#111821)
This is a purely mechanical commit for fixing the indentation of the
runtimes' CMakeLists files after #80007. That PR didn't update the
indentation in order to make the diff easier to review and for merge
conflicts to be easier to resolve (for downstream changes).

This doesn't change any code, it only reindents it.
2024-10-10 13:13:17 -04:00
Abid Qadeer
36c34ec967 [mlir][debug] Support DICommonBlock. (#111706)
A COMMON block is a named area of memory that holds a collection of
variables. Fortran subprograms may map the COMMON block memory area to a
list of variables. A common block is represented in LLVM debug by
DICommonBlock.

This PR adds support for this in MLIR. The changes are mostly mechanical
apart from small change to access the DICompileUnit when the scope of
the variable is DICommonBlock.

---------

Co-authored-by: Tobias Gysi <tobias.gysi@nextsilicon.com>
2024-10-10 18:07:06 +01:00
Ryosuke Niwa
39a91413c3 isUncountedPtr should take QualType as an argument. (#110213)
Make isUncountedPtr take QualType as an argument instead of Type*. This
simplifies some code.
2024-10-10 10:02:07 -07:00
Ryosuke Niwa
820bab8fb5 [alpha.webkit.UncountedCallArgsChecker] Add the support for trivial CXXInheritedCtorInitExpr. (#111198) 2024-10-10 10:01:35 -07:00
Ryosuke Niwa
0fc3e4093c [alpha.webkit.UncountedCallArgsChecker] Skip std::forward in tryToFindPtrOrigin. (#111222)
Ignore std::forward when it appears while looking for the pointer
origin.
2024-10-10 10:00:42 -07:00
Jonas Devlieghere
f2c5aa9200 [lldb] Fix a variety of LLDB_LOG format strings
LLVM now triggers an assertion when the format string and arguments
don't match. Fix a variety of incorrect format strings I discovered when
enabling logging with a debug build.
2024-10-10 09:56:31 -07:00
TatWai Chong
cc9e7cb99b [mlir][tosa] Change the type of profile option to ListOption (#111214)
In tosa valiation pass, change the type of profile option to ListOption.
Now TOSA profiles is turned from hierarchical to composable. Each
profile is an independent set, i.e. an target can implement multiple
profiles.

Set the profile option to none by default, and limit to profiles if
requested.
The profiles can be specified via command line, e.g.
$ mlir-opt ... --tosa-validate="profile=bi,mi" which tells the valiation
pass that BI and MI are enabled.

Change-Id: I1fb8d0c1b27eccd768349b6eb4234093313efb57
2024-10-10 09:54:34 -07:00
Joseph Huber
c04b640a91 [libc] Add missing config include 2024-10-10 11:22:14 -05:00
Eric Astor
73e74e496e [clang][frontend] Support applying the annotate attribute to statements (#111841)
By allowing AnnotateAttr to be applied to statements, users can place arbitrary information in the AST for later use.

For example, this can be used for HW-targeted language extensions that involve specialized loop annotations.
2024-10-10 12:21:34 -04:00
Joseph Huber
2190ffa0f7 [libc] Fix missing namespace declarations 2024-10-10 11:07:33 -05:00
yronglin
25d9688c43 [Clang] Extend lifetime of temporaries in mem-default-init for P2718R0 (#86960)
Depends on [CWG1815](https://github.com/llvm/llvm-project/pull/108039).
Fixes https://github.com/llvm/llvm-project/issues/85613.

In [[Clang] Implement P2718R0 "Lifetime extension in range-based for
loops"](https://github.com/llvm/llvm-project/pull/76361), we've not
implement the lifetime extensions for the temporaries which in
`CXXDefaultInitExpr`. As the confirmation in
https://github.com/llvm/llvm-project/issues/85613, we should extend
lifetime for that.

To avoid modifying current CodeGen rules, in a lifetime extension
context, the cleanup of `CXXDefaultInitExpr` was ignored.

---------

Signed-off-by: yronglin <yronglin777@gmail.com>
2024-10-11 00:04:02 +08:00