491307 Commits

Author SHA1 Message Date
Fangrui Song
ebaf26dabe [lldb] Fix -Wformat after #83602 2024-03-01 12:09:32 -08:00
Fangrui Song
214f897279 [unittest] Fix -Wsign-compare warnings in KnownBits.cpp after #82354 2024-03-01 12:06:12 -08:00
Fangrui Song
7b0b64a701 [DWARF] Use std::tie after #83047. NFC
The code suggestion was neglected when the patch landed.
2024-03-01 12:02:10 -08:00
Fabian Schiebel
1685e7fdab
[Support] Fix crash in install_bad_alloc_error_handler (#83160)
Previously, the function `install_bad_alloc_error_handler` was asserting that a bad_alloc error handler was not already installed. However, it was actually checking for the fatal-error handler, not for the bad_alloc error handler, causing an assertion failure if a fatal-error handler was already installed.

Fixes #83040
2024-03-01 14:53:54 -05:00
Hui
1a0c988ebd [libc++][NFC] rename variable in atomic_sync
As discussed in https://github.com/llvm/llvm-project/pull/81427/files#r1509266817
rename the variable as a separate commit
2024-03-01 19:52:14 +00:00
Michael Liao
a490bbf539 [M68k] Fix compilation pipeline check
- Add 'Init Undef Pass', which is target-independent now.
2024-03-01 14:49:27 -05:00
Florian Hahn
6fe60bd89f
[SLP] Exit early if MaxVF < MinVF (NFCI). (#83283)
Exit early if MaxVF < MinVF. In that case, the loop body below will
never get entered. Note that this adjusts the condition from MaxVF <=
MinVF. If MaxVF == MinVF, vectorization may still be feasible (and the
loop below gets entered).

PR: https://github.com/llvm/llvm-project/pull/83283
2024-03-01 19:43:06 +00:00
yelleyee
09ffd33908
[llvm][vfs] Remove blank comment after \endverbatim doxygen command (#83240)
Blank comment line afer \endverbatim malfunctions the doxygen parser.
  Check the "Detailed Description" section on
https://llvm.org/doxygen/classllvm_1_1vfs_1_1RedirectingFileSystem.html


Screenshot is attached below


![image](https://github.com/llvm/llvm-project/assets/22870466/35fc2444-d2f4-4638-990e-241cc14d0986)
2024-03-01 11:30:36 -08:00
Simon Pilgrim
fcdf818a77
[KnownBits] Add KnownBits::absdiff to compute the absolute difference of 2 unsigned values (#82354)
Equivalent to "umax(A, B) - umin(A, B)"

This is just an initial correctness implementation, hopefully we can make this optimal in the future.
2024-03-01 19:24:27 +00:00
Simon Pilgrim
1e8d3c357e [X86] cmp-shiftX-maskX.ll - add additional tests for #83596
Shows cases where logical shifts of allsignbits values can be profitably converted to masks
2024-03-01 19:20:14 +00:00
Simon Pilgrim
582718fe61 [X86] cmp-shiftX-maskX.ll - add AVX1 test coverage 2024-03-01 19:20:14 +00:00
Fangrui Song
4a3f7e798a
[ELF] Internalize enum
g++ -flto has a diagnostic `-Wodr` about mismatched redeclarations,
which even apply to `enum`.

Fix #83529

Reviewers: thesamesam

Reviewed By: thesamesam

Pull Request: https://github.com/llvm/llvm-project/pull/83604
2024-03-01 11:17:22 -08:00
Jonas Devlieghere
af009451ec
[lldb] Fix thread backtrace --count (#83602)
The help output for `thread backtrace` specifies that you can pass -1 to
`--count` to display all the frames.

```
-c <count> ( --count <count> )
            How many frames to display (-1 for all)
```

However, that doesn't work:

```
(lldb) thread backtrace --count -1
error: invalid integer value for option 'c'
```

The problem is that we store the option value as an unsigned and the
code to parse the string correctly rejects it. There's two ways to fix
this:

1. Make `m_count` a signed value so that it accepts negative values and
appease the parser. The function that prints the frames takes an
unsigned so a negative value will just become a really large positive
value, which is what the current implementation relies on.
2. Keep `m_count` unsigned and instead use 0 the magic value to show all
frames. I don't really see a point in not showing any frames at all,
plus that's already broken (`error: error displaying backtrace for
thread: "0x0001"`).

This patch implements (2) and at the same time improve the error
reporting so that we print the invalid value when we cannot parse it.

rdar://123881767
2024-03-01 11:06:58 -08:00
Joseph Huber
00570c36a3
[libc] Fix incorrectly enabled GPU math functions (#83594)
Summary:
These functions were implemented via builtins that aren't acually
supported. See https://godbolt.org/z/Wq6q6T1za. This caused the build to
crash if they were included. Remove these and replace with correct
implementations.
2024-03-01 13:02:27 -06:00
Alexey Bataev
2ab6d1e18e [SLP][NFC]Move some check to the outer if to simplify inner checks. 2024-03-01 10:58:41 -08:00
Chelsea Cassanova
137ed17016
[lldb][progress] Hook up new broadcast bit and progress manager (#83069)
This commit adds the functionality to broadcast events using the
`Debugger::eBroadcastProgressCategory`
bit (https://github.com/llvm/llvm-project/pull/81169) by keeping track
of these reports with the `ProgressManager`
class (https://github.com/llvm/llvm-project/pull/81319). The new bit is
used in such a way that it will only broadcast the initial and final
progress reports for specific progress categories that are managed by
the progress manager.

This commit also adds a new test to the progress report unit test that
checks that only the initial/final reports are broadcasted when using
the new bit.
2024-03-01 10:56:45 -08:00
Alexey Bataev
3a30d8e9e5
[SLP]Check if masked gather can be emitted as a serie of loads/insert subvector.
Masked gather is very expensive operation and sometimes better to
represent it as a serie of consecutive/strided loads + insertsubvectors
sequences. Patch adds some basic estimation and if loads+insertsubvector
is cheaper, decides to represent it in this way rather than masked
gather.

Reviewers: RKSimon

Reviewed By: RKSimon

Pull Request: https://github.com/llvm/llvm-project/pull/83481
2024-03-01 13:49:29 -05:00
sylvain-audi
dd426fa5f9
[Asan] Pre-commit test for asan support of funclet token (#82631)
This is in preparation for PR
https://github.com/llvm/llvm-project/pull/82533.

Here we Introduce a test for asan instrumentation where invalid code is
output (see bug https://github.com/llvm/llvm-project/issues/64990)
The `CHECK` lines are generated using `update_test_checks.py` script.
The actual fix PR will udpate this test to highlight the changes in the
generated code.
2024-03-01 13:34:57 -05:00
Changpeng Fang
84927a6728
AMDGPU: Simplify instruction definitions for global_load_tr_b64(b128) (#83601)
WaveSizePredicate is copied from pseudo to real
2024-03-01 10:03:54 -08:00
Farzon Lotfi
e741d889f4
[DXIL] Add frac unary lowering (#83465)
This change adds lowering for HLSL's frac intrinsic to DXIL.

This change should complete #70099
2024-03-01 12:53:05 -05:00
Alexey Bataev
df0fd3a80e
[SLP]Try to vectorize small graph with extractelements, used in buildvector.
If the graph incudes only single "gather" node with only
extractelements/undefs, which used only in insertelement-based
buildvector sequences, it still might be profitable to vectorize it.
Need to rely on the cost model, not throw this graph away immediately.

Reviewers: RKSimon

Reviewed By: RKSimon

Pull Request: https://github.com/llvm/llvm-project/pull/83581
2024-03-01 12:48:45 -05:00
Mircea Trofin
ce95a56db5
[pgo][nfc] Model Count as a std::optional in PGOUseEdge (#83505)
Similar to PR #83364.
2024-03-01 09:44:22 -08:00
Francesco Petrogalli
3337d69373
[llvm][Intrinsics] Add llvm_v3i8_ty. [NFCI] (#83576) 2024-03-01 18:41:54 +01:00
Slava Zakharin
ae58b676f1
[flang] Fixed ieee_logb to behave for denormals. (#83518)
For denormals we have to account for the exponent coming
from the significand.
2024-03-01 09:41:07 -08:00
Farzon Lotfi
b542501ad7
[HLSL][DXIL] Implementation of round intrinsic (#83570)
hlsl_intrinsics.h - add the round  api
DXIL.td add the llvm intrinsic to DXIL lowering mapping 
This change reuses llvm's existing intrinsic
`__builtin_elementwise_round`\ `int_round`
This change implements: #70077
2024-03-01 12:27:25 -05:00
Jay Foad
53f89a0bb7
[AMDGPU] Remove AtomicNoRet class and getAtomicNoRetOp table (#83593) 2024-03-01 17:18:55 +00:00
Kirill Stoimenov
f6f79d46e5 Revert "[HWASAN] Implement selective instrumentation based on profiling information (#83503)"
Broke a build bot: https://lab.llvm.org/buildbot/#/builders/124/builds/9846

This reverts commit e7c3cd245665042bbae163f7280aceed35f0fee5.
2024-03-01 17:17:37 +00:00
Craig Topper
0813b90ff5
[TypePromotion] Support positive addition amounts in isSafeWrap. (#81690)
We can support these by changing the sext promotion to -zext(-C) and
replacing a sgt check with ugt. Reframing the logic in terms of how the
unsigned range are affected. More comments in the patch.

The new cases check isLegalAddImmediate to avoid some
regressions in lit tests.
2024-03-01 09:17:14 -08:00
Timm Bäder
68516bfd2f [clang][Interp] Lambda This captures can be non-pointers
If they are captured by value.
2024-03-01 18:06:18 +01:00
Fangrui Song
64216ba1e4
[Sema] -Wpointer-bool-conversion: suppress lambda function pointer conversion diagnostic during instantiation (#83497)
I have seen two internal pieces of code that uses a template type
parameter to accept any callable type (function pointer, std::function,
closure type, etc). The diagnostic added in #83152 would require
adaptation to the template, which is difficult and also seems
unnecessary. Example:

```cpp
template <typename... Ts>
static bool IsFalse(const Ts&...) { return false; }

template <typename T, typename... Ts,
          typename = typename std::enable_if<std::is_constructible<bool, const T&>::value>::type>
static bool IsFalse(const T& p, const Ts&...) {
  return p ? false : true;
}

template <typename... Args>
void Init(Args&&... args) {
  if (IsFalse(absl::implicit_cast<const typename std::decay<Args>::type&>(
              args)...)) {
    // A callable object convertible to false is either a null pointer or a
    // null functor (e.g., a default-constructed std::function).
    empty_ = true;
  } else {
    empty_ = false;
    new (&factory_) Factory(std::forward<Args>(args)...);
  }
}
```
2024-03-01 08:57:54 -08:00
Joseph Huber
18d0d9b9b2
[libc] Update install directory for offloading versions of libraries (#83592)
Summary:
These currently go to `lib/`, but if the user has `lib/<triple>` they
should go there because it's always searched first.
2024-03-01 10:48:32 -06:00
Daniil Kovalev
8f65e7b917
[Dwarf] Support __ptrauth qualifier in metadata nodes (#82363)
Emit `__ptrauth`-qualified types as `DIDerivedType` metadata nodes in IR
with tag `DW_TAG_LLVM_ptrauth_type`, baseType referring to the type
which has the qualifier applied, and the following parameters
representing the signing schema:

- `ptrAuthKey` (integer)
- `ptrAuthIsAddressDiscriminated` (boolean)
- `ptrAuthExtraDiscriminator` (integer)
- `ptrAuthIsaPointer` (boolean)
- `ptrAuthAuthenticatesNullValues` (boolean)

Co-authored-by: Ahmed Bougacha <ahmed@bougacha.org>
2024-03-01 19:48:08 +03:00
Jonas Devlieghere
8fa33013de
[lldb] Add support for sorting by size to target module dump symtab (#83527)
This patch adds support to sort the symbol table by size. The command
already supports sorting and it already reports sizes. Sorting by size
helps diagnosing size issues.

rdar://123788375
2024-03-01 08:34:36 -08:00
Martin Wehking
92fe6c61f9
Silence illegal address computation warning (#83244)
Add an assertion before an access of ValMappings to ensure that it is
within the array bounds.
Silence a static analyzer warning through this.
2024-03-01 21:41:12 +05:30
Joseph Huber
b92c3fe027
[OpenMP] Fix test after updating library search paths (#83573)
Summary:
We still use this bitcode library in one case, the NVPTX non-LTO build.
The patch updated the search paths to treat it the same as other
libraries, which unintentionally prioritized system paths over
LIBRARY_PATH which is generally not correct. Also we had a test that
relied on system state so remove that.
2024-03-01 09:48:14 -06:00
Vinayak Dev
2b4d67bf59
[Clang][Sema]: Allow copy constructor side effects (#81127)
Copy constructors can have initialization with side effects, and thus
clang should not emit a warning when -Wunused-variable is used in this
context. Currently however, a warning is emitted.

Now, compilation happens without warnings.

Fixes #79518
2024-03-01 10:40:46 -05:00
Mats Petersson
601a9587a1
[Flang] Add support for assume_aligned directive (#81747)
This adds the parsing (and unparse) of the compiler drective assume_aligned.

The compiler will issue a warning that the directive is ignored.
2024-03-01 15:28:20 +00:00
Erich Keane
06bd74ba4a
Fix implementation of [temp.param]p14's first sentence. (#83487)
The first sentence says:

If a template-parameter of a class template, variable template, or alias
template has a default template-argument, each subsequent
template-parameter shall either have a default template-argument
supplied or be a template parameter pack.

However, we were only testing for "not a function function template",
and referring to an older version of the standard. As far as I can tell,
CWG2032 added the variable-template, and the alias-template pre-dates
the standard on github.

This patch started as a bug fix for #83461 , but ended up fixing a
number of similar cases, so those are validated as well.
2024-03-01 07:27:06 -08:00
Timm Bäder
a038f9758e [clang][Interp] Fix virtual calls with reference instance pointers
getCXXRecordType() on those types does not return the type we need.
Use getPointeeCXXRecordType() instead in those cases.
2024-03-01 16:19:45 +01:00
Erich Keane
b0181be36c
[OpenACC] Implement Duffs-Device restriction for Compute Constructs (#83460)
Like the last few patches, branching in/out of a compute construct is
not valid. This patch implements checking to ensure that a 'case' or
'default' statement cannot jump into a Compute Construct (in the style
of a duff's device!).
2024-03-01 07:11:17 -08:00
Timm Bäder
f15d799f16 [clang][Interp] Fix variadic operator calls
Operator calls pass their instance member explicitly, so remove
it from NumParams when calling a variadic function
2024-03-01 15:46:00 +01:00
Timm Bäder
f651f134bb [clang][Interp][NFC] Add precondition assertions
All three of these need to be non-null.
2024-03-01 15:41:49 +01:00
Timm Bäder
e59681d963 [clang][Interp] Allow inc/dec on boolean values
The warnings or errors are emitted in Sema, but we still need to
do the operation and provide a reasonable result.
2024-03-01 15:40:45 +01:00
Benjamin Kramer
3fc277f665
[SLPVectorizer] Make the insert/extractvector PHICompare a strict-weak ordering (#83571)
This was tripping off STL implementations that check for it (like libc++
with debug checking). The goal of this sort is to cluster operations on
the same values so preserve that property but sort everything else based
on the existing numbering.
2024-03-01 15:37:54 +01:00
Alexey Bataev
5bafb8d952 [SLP][NFC]Add/use single UsesLimit constant, NFC. 2024-03-01 06:37:08 -08:00
Florian Hahn
6ecd26132b
[SLP] Use ScopeExit to update Operands/PrevDist on all paths. (NFC) (#83490)
Use ScopeExit to make sure Operands/PrevDist are updated on all paths in
the loop. This makes it easier to ensure they are updated correctly if
new early continues are added.

Split off from https://github.com/llvm/llvm-project/pull/83283

PR: https://github.com/llvm/llvm-project/pull/83490
2024-03-01 14:30:01 +00:00
Simon Pilgrim
765a5d62bc
[X86] Pre-SSE42 v2i64 sgt lowering - check if representable as v2i32 (#83560)
Without PCMPGTQ, if the i64 elements are sign-extended enough to be representable as i32 then we can compare the lower i32 bits with PCMPGTD and splat the results into the upper elements.

Value tracking has meant we already get pretty close with this, but this allows us to remove a lot of unnecessary bit flipping.
2024-03-01 14:29:12 +00:00
Timm Bäder
dbf3d779bd [clang][Interp][NFC] Remove unused paramter
We manage the Result through EvaluationResult now.
2024-03-01 15:28:15 +01:00
Timm Bäder
18d2ff4be7 [clang][Interp] Allow recursive intepretation
This shouldn't be a problem in general, but we used to have some
sanity checks that prevented it from working. Remove those and
only do them on the non-recursive calls instead.
2024-03-01 15:28:14 +01:00
zhijian lin
3034632a27
[llvm-readobj] enable demangle option for the xcoff object file (#78455)
enable `--demangle` option for the xcoff object file for llvm-readobj
2024-03-01 09:21:11 -05:00