Commit Graph

480189 Commits

Author SHA1 Message Date
Graham Hunter
34f83e86b4 [InstSimplify] Precommit extra tests for PR71528 2023-11-08 17:02:10 +00:00
Anna Thomas
29f03bf48d [GuardWidening] Require analyses only if necessary
We need to request analyses needed for guard widening only if there are
guards/widenable conditions.
2023-11-08 11:54:10 -05:00
Mark de Wever
3d131f960e
[libc++][CI] Adds a new CMake version in Docker. (#71582)
This allows testing the upcoming CMake 3.28 release in the CI. CMake
3.28 will have non-experimental support for C++20 modules. So this would
be a better CMake version for the modular builds.

The goal is to remove CMake 3.27 from the CI when the builder work
properly with 3.28.
2023-11-08 17:51:27 +01:00
Mark de Wever
7cc72a0a2e Implement syncstream (p0053)
This patch implements `std::basic_syncbuf` and `std::basic_osyncstream` as specified in paper p0053r7. ~~For ease of reviewing I am submitting this patch before submitting a patch for `std::basic_osyncstream`. ~~

~~Please note, this patch is not 100% complete. I plan on adding more tests (see comments), specifically I plan on adding tests for multithreading and synchronization.~~

Edit: I decided that it would be far easier for me to keep track of this and make changes that affect both `std::basic_syncbuf` and `std::basic_osyncstream` if both were in one patch.

The patch was originally written by @zoecarver

Implements
- P0053R7 - C++ Synchronized Buffered Ostream
- LWG-3127 basic_osyncstream::rdbuf needs a const_cast
- LWG-3334 basic_osyncstream move assignment and destruction calls basic_syncbuf::emit() twice
- LWG-3570 basic_osyncstream::emit should be an unformatted output function
- LWG-3867 Should std::basic_osyncstream's move assignment operator be noexcept?

Reviewed By: ldionne, #libc

Differential Revision: https://reviews.llvm.org/D67086
2023-11-08 17:45:06 +01:00
Jeremy Morse
f1b0a54451 Reapply 7d77bbef4a, adding new debug-info classes
This reverts commit 957efa4ce4.

Original commit message below -- in this follow up, I've shifted
un-necessary inclusions of DebugProgramInstruction.h into being forward
declarations (fixes clang-compile time I hope), and a memory leak in the
DebugInfoTest.cpp IR unittests.

I also tracked a compile-time regression in D154080, more explanation
there, but the result of which is hiding some of the changes behind the
EXPERIMENTAL_DEBUGINFO_ITERATORS compile-time flag. This is tested by the
"new-debug-iterators" buildbot.

[DebugInfo][RemoveDIs] Add prototype storage classes for "new" debug-info

This patch adds a variety of classes needed to record variable location
debug-info without using the existing intrinsic approach, see the rationale
at [0].

The two added files and corresponding unit tests are the majority of the
plumbing required for this, but at this point isn't accessible from the
rest of LLVM as we need to stage it into the repo gently. An overview is
that classes are added for recording variable information attached to Real
(TM) instructions, in the form of DPValues and DPMarker objects. The
metadata-uses of DPValues is plumbed into the metadata hierachy, and a
field added to class Instruction, which are all stimulated in the unit
tests. The next few patches in this series add utilities to convert to/from
this new debug-info format and add instruction/block utilities to have
debug-info automatically updated in the background when various operations
occur.

This patch was reviewed in Phab in D153990 and D154080, I've squashed them
together into this commit as there are dependencies between the two
patches, and there's little profit in landing them separately.

[0] https://discourse.llvm.org/t/rfc-instruction-api-changes-needed-to-eliminate-debug-intrinsics-from-ir/68939
2023-11-08 16:42:35 +00:00
Simon Pilgrim
671d10ad39 [X86] Add fabs test coverage for Issue #70947 2023-11-08 16:20:34 +00:00
Simon Pilgrim
45f1db4855 [X86] vec_fabs.ll - add AVX2 test coverage 2023-11-08 16:20:34 +00:00
Jonathan Peyton
5cc603cb22
[OpenMP] Add skewed iteration distribution on hybrid systems (#69946)
This commit adds skewed distribution of iterations in
nonmonotonic:dynamic schedule (static steal) for hybrid systems when
thread affinity is assigned. Currently, it distributes the iterations at
60:40 ratio. Consider this loop with dynamic schedule type,
for (int i = 0; i < 100; ++i). In a hybrid system with 20 hardware
threads (16 CORE and 4 ATOM core), 88 iterations will be assigned to
performance cores and 12 iterations will be assigned to efficient cores.
Each thread with CORE core will process 5 iterations + extras and with
ATOM core will process 3 iterations.

Differential Revision: https://reviews.llvm.org/D152955
2023-11-08 10:19:37 -06:00
Nikita Popov
3dff285679 [OCaml] Fix tests after const_uitofp removal (NFC) 2023-11-08 17:15:07 +01:00
Nikita Popov
2c61f9cab5 [CVP] Fix use after scope
Store the result of ConstantRange::sdiv() in a variable, as
getSingleElement() will return a pointer to the APInt it contains.
2023-11-08 16:53:47 +01:00
David Green
3ccbd68480
[InstCombine] Handle scalable geps in EmitGEPOffset (#71565)
This adds scalable handling for scalable vectors in emitGEPOffset. This
was noticed in some tests that Biplob was creating, so might be unlikely
to come up much in practice. I've attempted to add test coverage for
various places EmitGEPOffset is called. The vscale intrinsics will
currently emit multiple copies, relying on later CSE to combine them.
2023-11-08 15:50:32 +00:00
annamthomas
98d8b688bd
[InstSimplify] Check call for FMF instead of CtxI (#71585)
This code was incorrectly checking that the CtxI has required FMF, but
the context instruction need not always be the instrinsic call.

Check that the intrinsic call has the required FMF.

Fixes PR71548.
2023-11-08 10:25:11 -05:00
David Spickett
ea82853499 [lldb][test] Skip ScriptedProcess missing methods test on Windows
No dylib on Windows, so the test fails to build.
2023-11-08 15:23:03 +00:00
David Spickett
b663d6a310 [llvm][AArch64][NFC] Correct 70ea64de8b
Accidentally dropped a * around the language name.
2023-11-08 15:01:16 +00:00
David Spickett
70ea64de8b [llvm][AArch64][NFC] Correct AArch64Combine.td filename in license comment 2023-11-08 14:59:50 +00:00
Ilya Leoshkevich
a933e1417b
[SystemZ] Do not run mbackchain-4.c test without SystemZ target (#71678)
mbackchain-4.c requires running the backend and causes CI failures when
this target is not configured.
2023-11-08 15:53:10 +01:00
Jie Fu
5259fae710 [AArch64] Remove unused variable 'MaskSize' in GenerateFixedLengthSVETBL (NFC)
/llvm-project/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp:26139:12: error: unused variable 'MaskSize' [-Werror,-Wunused-variable]
  unsigned MaskSize = ShuffleMask.size();
           ^
1 error generated.
2023-11-08 22:42:20 +08:00
Dinar Temirbulatov
3f9d385e58
[AArch64][SME] Shuffle lowering, assume that the minimal SVE register is 128-bit, when NOEN is not available. (#71647)
We can assume that the minimal SVE register is 128-bit, when NEON is not
available. And we can lower the shuffle shuffle operation with one
operand to TBL1 SVE instruction.
2023-11-08 14:37:49 +00:00
Krzysztof Parzyszek
9cdaeefc45 [flang] Fix typo in ExpressionAnalyzer::CheckIntrinsicKind, NFC 2023-11-08 08:31:58 -06:00
Florian Hahn
26ab444e88
[ConstraintElim] Make sure add-rec is for the current loop.
Update addInfoForInductions to also check if the add-rec is for the
current loop. Otherwise we might add incorrect facts or crash.

Fixes a miscompile & crash introduced by 00396e6a1a.
2023-11-08 14:07:28 +00:00
alexfh
067632e141
Revert "[DAGCombiner] Transform (icmp eq/ne (and X,C0),(shift X,C1)) to use rotate or to getter constants." due to a miscompile (#71598)
- Revert "[DAGCombiner] Transform `(icmp eq/ne (and X,C0),(shift X,C1))`
to use rotate or to getter constants." - causes a miscompile, see
112e49b381 (commitcomment-131943923)
- Revert "[X86] Fix gcc warning about mix of enumeral and non-enumeral
types. NFC", which fixes a compiler warning in the commit above
2023-11-08 15:07:12 +01:00
Ilya Leoshkevich
d79fff0abb
[SystemZ] Add backchain target-feature (#71668)
GCC supports building individual functions with backchain using the
__attribute__((target("backchain"))) syntax, and Clang should too.

Clang translates this into the "target-features"="+backchain" attribute,
and the -mbackchain command-line option into the "backchain" attribute.
The backend currently checks only the latter; furthermore, the backchain
target feature is not defined.

Handle backchain like soft-float. Define a target feature, convert
function attribute into it in getSubtargetImpl(), and check for target
feature instead of function attribute everywhere. Add an end-to-end test
to the Clang testsuite.
2023-11-08 15:05:47 +01:00
Florian Hahn
0d48a4645d
[ConstraintElim] Add test for mis-compile with adjacent loops.
In the added test case, the AddRec from the first loop is used
incorrectly in the second loop.
2023-11-08 14:01:25 +00:00
Nikita Popov
d687057de8 [CVP] Try to fold sdiv to constant
If we know that the sdiv result is a single constant, directly
use that instead of performing narrowing.

Fixes https://github.com/llvm/llvm-project/issues/71659.
2023-11-08 14:49:24 +01:00
Nikita Popov
dc2cfd0407 [CVP] Add additional sdiv tests (NFC) 2023-11-08 14:49:24 +01:00
Nicolas Vasilache
5967375fcf [mlir][python] Add support for arg_attrs and other attrs to NamedSequenceOp 2023-11-08 13:42:16 +00:00
Björn Pettersson
d5cfdcaacb [clangd] Allow hover over 128-bit variable without crashing (#71415)
When hovering over variables larger than 64 bits, with more than 64
active bits, there were assertion failures since Hover is trying to
print the value as a 64-bit hex value.

There is already protection avoiding to call printHex if there is more
than 64 significant bits. And we already truncate and print negative
values using only 32 bits, when possible. So we can simply truncate
values with more than 64 bits to avoid the assert when using
getZExtValue. The result will be that for example a negative 128 bit
variable is printed using 64 bits, when possible.

There is still no support for printing more than 64 bits. That would
involve more changes since for example llvm::FormatterNumber is limited
to 64 bits.

This is a second attempt at landing this patch. Now with protection
to ensure we use a triple that supports __int128_t.
2023-11-08 14:13:11 +01:00
Jie Fu
fdf99b21f3 [AMDGPU] Fix -Wunused-variable in SIFrameLowering.cpp (NFC)
/llvm-project/llvm/lib/Target/AMDGPU/SIFrameLowering.cpp:1829:8: error: unused variable 'IsChainFunction' [-Werror,-Wunused-variable]
  bool IsChainFunction = MF.getInfo<SIMachineFunctionInfo>()->isChainFunction();
       ^
1 error generated.
2023-11-08 20:48:44 +08:00
Vlad Serebrennikov
5e09c4e6a8 [clang][NFC] Partially annotate IdentifierInfo with preferred_type
This patch leaves `ObjCOrBuiltinID` alone, because of performance concerns with potential refactoring that would enable correct types in debug info.
2023-11-08 15:44:46 +03:00
Jie Fu
b44399296a [mlir] Fix -Wsign-compare in NVGPUDialect.cpp (NFC)
/llvm-project/mlir/lib/Dialect/NVGPU/IR/NVGPUDialect.cpp:396:31: error: comparison of integers of different signs: 'size_t' (aka 'unsigned long') and 'int64_t' (aka 'long long') [-Werror,-Wsign-compare]
  if (getCoordinates().size() !=
      ~~~~~~~~~~~~~~~~~~~~~~~ ^
1 error generated.
2023-11-08 20:26:33 +08:00
Graham Hunter
e397a465a8 [InstSimplify] Precommit test for PR71528 2023-11-08 12:17:09 +00:00
LLVM GN Syncbot
135d6f3281 [gn build] Port e28157e778 2023-11-08 11:58:42 +00:00
Bjorn Pettersson
ee03dc1836 Revert "[clangd] Allow hover over 128-bit variable without crashing (#71415)"
This reverts commit 2626916c45.

It failed on buildbots not supporting __int128_t.
2023-11-08 12:56:26 +01:00
Mitch Phillips
d1fb930795 Revert "[AMDGPU] const-fold imm operands of amdgcn_update_dpp intrinsic (#71139)"
This reverts commit 32a3f2afe6.

Reason: Broke the sanitizer buildbots. More details at
32a3f2afe6
2023-11-08 12:50:53 +01:00
Markos Horro
9d2903c8e5
[IndVars] Add check of loop invariant for trunc instructions (#71072)
The same idea as in 34d380e1f6, but considering
truncation instructions.
Improvement for #59633.
2023-11-08 11:16:23 +00:00
Guray Ozen
6eb97f0380
[MLIR][NVGPU] Improve and Cleanup verifier of TMA OPs (#70923)
This PR improves and cleans-up verifiers of TmaCreateDescriptor and
TmaAsyncLoad Ops and unifies them.

The PR verifiers followings that didn't before:
- address space
- rank match between descriptor and memref
- element type match between descriptor and memref
- shape type match between descriptor and memref
2023-11-08 12:03:16 +01:00
Job Noorman
96b5e092dc
[BOLT] Support instrumentation hook via DT_FINI_ARRAY (#67348)
BOLT currently hooks its its instrumentation finalization function via
`DT_FINI`. However, this method of calling finalization routines is not
supported anymore on newer ABIs like RISC-V. `DT_FINI_ARRAY` is
preferred there.

This patch adds support for hooking into `DT_FINI_ARRAY` instead if the
binary does not have a `DT_FINI` entry. If it does, `DT_FINI` takes
precedence so this patch should not change how the currently supported
instrumentation targets behave.

`DT_FINI_ARRAY` points to an array in memory of `DT_FINI_ARRAYSZ` bytes.
It consists of pointer-length entries that contain the addresses of
finalization functions. However, the addresses are only filled-in by the
dynamic linker at load time using relative relocations. This makes
hooking via `DT_FINI_ARRAY` a bit more complicated than via `DT_FINI`.

The implementation works as follows:
- While scanning the binary: find the section where `DT_FINI_ARRAY`
points to, read its first dynamic relocation and use its addend to find
the address of the fini function we will use to hook;
- While writing the output file: overwrite the addend of the dynamic
relocation with the address of the runtime library's fini function.

Updating the dynamic relocation required a bit of boiler plate: since
dynamic relocations are stored in a `std::multiset` which doesn't
support getting mutable references to its items, functions were added to
`BinarySection` to take an existing relocation and insert a new one.
2023-11-08 11:01:10 +00:00
Simon Pilgrim
8d72079077 Fix MSVC "not all control paths return a value" warning. NFC. 2023-11-08 10:45:20 +00:00
Simon Pilgrim
f416f6c46d [X86] LowerABD - remove freeze from abd*(lhs, rhs) -> trunc(abs(sub(*ext(lhs), *ext(rhs))))
Single use each of lhs/rhs so we shouldn't need them.
2023-11-08 10:33:18 +00:00
Simon Pilgrim
33ecd93596 [X86] Add test coverage for ABDS/ABDU patterns with mismatching extension types 2023-11-08 10:33:18 +00:00
Björn Pettersson
2626916c45
[clangd] Allow hover over 128-bit variable without crashing (#71415)
When hovering over variables larger than 64 bits, with more than 64
active bits, there were assertion failures since Hover is trying to
print the value as a 64-bit hex value.

There is already protection avoiding to call printHex if there is more
than 64 significant bits. And we already truncate and print negative
values using only 32 bits, when possible. So we can simply truncate
values with more than 64 bits to avoid the assert when using
getZExtValue. The result will be that for example a negative 128 bit
variable is printed using 64 bits, when possible.

There is still no support for printing more than 64 bits. That would
involve more changes since for example llvm::FormatterNumber is limited
to 64 bits.
2023-11-08 11:30:03 +01:00
Björn Pettersson
8fc0aca5d1
[SCEV] Support larger than 64-bit types in ashr(add(shl(x, n), c), m) (#71600)
In commit 5a9a02f67b scalar evolution got support for
computing SCEV:s for (ashr(add(shl(x, n), c), m)) constructs. The code
however used APInt::getZExtValue without first checking that the APInt
would fit inside an uint64_t. When for example using 128-bit types we
ended up in assertion failures (or maybe miscompiles in non-assert
builds).
This patch simply avoid converting from APInt to uint64_t when creating
the truncated constant. We can just truncate the APInt instead.
2023-11-08 11:29:12 +01:00
Piotr Zegar
3716b5b4ba
[clang-tidy] Improve performance-enum-size to exclude empty enums (#71640)
Enums without enumerators (empty) are now excluded from analysis as it's
not possible to peroperly determinate new narrowed type, and such enums
can be used in diffrent way, like as strong-types.

Closes #71544
2023-11-08 11:22:31 +01:00
Mitch Phillips
a141a9fa97 Revert "[OpenMP] atomic compare fail : Parser & AST support"
This reverts commit 086b65340c.

Reason: Broke under -Werror. More details in
https://reviews.llvm.org/D123235
2023-11-08 11:20:17 +01:00
David Spickett
e28157e778
[lldb][AArch64][Linux] Add field information for the CPSR register (#70300)
The contents of which are mostly SPSR_EL1 as shown in the Arm manual,
with a few adjustments for things Linux says userspace shouldn't concern
itself with.

```
(lldb) register read cpsr
    cpsr = 0x80001000
         = (N = 1, Z = 0, C = 0, V = 0, SS = 0, IL = 0, ...
```

Some fields are always present, some depend on extensions. I've checked
for those extensions using HWCAP and HWCAP2.

To provide this for core files and live processes I've added a new class
LinuxArm64RegisterFlags. This is a container for all the registers we'll
want to have fields and handles detecting fields and updating register
info.

This is used by the native process as follows:
* There is a global LinuxArm64RegisterFlags object.
* The first thread takes a mutex on it, and updates the fields.
* Subsequent threads see that detection is already done, and skip it.
* All threads then update their own copy of the register information
with pointers to the field information contained in the global object.

This means that even though every thread will have the same fields, we
only detect them once and have one copy of the information.

Core files instead have a LinuxArm64RegisterFlags as a member, because
each core file could have different saved capabilities. The logic from
there is the same but we get HWACP values from the corefile note.

This handler class is Linux specific right now, but it can easily be
made more generic if needed. For example by using LLVM's FeatureBitset
instead of HWCAPs.

Updating register info is done with string comparison, which isn't
ideal. For CPSR, we do know the register number ahead of time but we do
not for other registers in dynamic register sets. So in the interest of
consistency, I'm going to use string comparison for all registers
including cpsr.

I've added tests with a core file and live process. Only checking for
fields that are always present to account for CPU variance.
2023-11-08 10:17:38 +00:00
Nikita Popov
567c02a80e [InstCombine] Remove inttoptr/ptrtoint handling from indexed compare fold
Looking through inttoptr / ptrtoint intermixed with GEPs is very
questionable from a provenance perspective. We also don't seem to
have any test coverage that shows this is useful (apart from one
test I added to guard against a crash).
2023-11-08 11:13:57 +01:00
Jay Foad
d5f3b3b3b1
[RegScavenger] Simplify state tracking for backwards scavenging (#71202)
Track the live register state immediately before, instead of after,
MBBI. This makes it simple to track the state at the start or end of a
basic block without a separate (and poorly named) Tracking flag.

This changes the API of the backward(MachineBasicBlock::iterator I)
method, which now recedes to the state just before, instead of just
after, *I. Some clients are simplified by this change.

There is one small functional change shown in the lit tests where
multiple spilled registers all need to be reloaded before the same
instruction. The reloads will now be inserted in the opposite order.
This should not affect correctness.
2023-11-08 09:49:07 +00:00
Timm Baeder
e6a94dca38
[clang][Interp] Fix creating APSInt from IntegralAP (#71410)
The boolean argument in the APSInt constructor is IsUnsigned, not
IsSigned.
2023-11-08 10:48:07 +01:00
Pravin Jagtap
32a3f2afe6
[AMDGPU] const-fold imm operands of amdgcn_update_dpp intrinsic (#71139)
Operands of `__builtin_amdgcn_update_dpp` need to evaluate to constant
to match the intrinsic requirements.

Fixes: SWDEV-426822, SWDEV-431138
---------

Authored-by: Pravin Jagtap <Pravin.Jagtap@amd.com>
2023-11-08 15:09:10 +05:30
Nicolas Vasilache
af3d856944 [mlir][python] Reland - Add sugared builder for transform.named_sequence
Address issues with #71597 post-revert and and reland
2023-11-08 09:34:29 +00:00