493542 Commits

Author SHA1 Message Date
Arthur Eubanks
b19bf3e888
[clang][SPIRV] Don't warn on -mcmodel (#86039)
The code model doesn't affect the sub-compilation, so don't check it.

Followup to #70740.
2024-03-21 14:48:35 -07:00
Cooper Partin
cde54df39c
Add support for PSV EntryFunctionName (#84409)
This change introduces a version 3 of the PSV data that includes support
for the name of the entry function as an offset into StringTable data to
a null-terminated utf-8 string.

Additional tests were added to ensure that the new value was properly
serialized/deserialized from object data.

Fixes #80175

---------

Co-authored-by: Cooper Partin <coopp@ntdev.microsoft.com>
2024-03-21 14:43:15 -07:00
Amir Ayupov
6280681137
[BOLT] Output basic YAML profile in BAT mode
Relax assumptions that YAML output is not supported in BAT mode.
Set up basic infrastructure for emitting YAML for functions not covered
by BAT, such as from `.bolt.org.text` section (code identical to input binary
sans external refs), or non-rewritten functions in non-relocation mode (where
the function stays in the same section but BAT mapping is not emitted).

This diff only produces YAML profile for non-BAT functions (skipped,
non-simple). YAML profile for BAT functions is added in follow-up diffs:
- https://github.com/llvm/llvm-project/pull/76911 emits YAML profile with
  internal control flow information only (branch profile),
- https://github.com/llvm/llvm-project/pull/76896 adds cross-function profile
  (calls profile).

Test Plan: Added bolt/test/X86/bolt-address-translation-yaml.test

Reviewers: ayermolo, dcci, maksfb, rafaelauler

Reviewed By: rafaelauler

Pull Request: https://github.com/llvm/llvm-project/pull/76910
2024-03-21 14:32:13 -07:00
Guillaume Chatelet
70a9c527b8
[libc][bazel] Fix bazel build (#86190)
Follow up on #86140
2024-03-21 14:28:44 -07:00
Maksim Panchenko
6b1cf00400
[BOLT] Add support for Linux kernel static keys jump table (#86090)
Runtime code modification used by static keys is the most ubiquitous
self-modifying feature of the Linux kernel. The idea is to to eliminate
the condition check and associated conditional jump on a hot path if
that condition (based on a boolean value of a static key) does not
change often. Whenever they condition changes, the kernel runtime
modifies all code paths associated with that key flipping the code
between nop and (unconditional) jump.
2024-03-21 14:05:21 -07:00
Krzysztof Parzyszek
2ab106cbd4
[flang][OpenMP] Convert processTODO and remove unused objects (#81627)
Remove `ClauseIterator2` and `clauses2` from ClauseProcessor.

[Clause representation 5/6]
2024-03-21 15:12:43 -05:00
Kevin Frei
6d939a6ec6
DebugInfoD tests + fixing issues exposed by tests (#85693)
Finally getting back to Debuginfod tests:
I've migrated the tests in my [earlier
PR](https://github.com/llvm/llvm-project/pull/79181) from shell to API
(at @JDevlieghere's suggestion) and addressed a couple issues that came
about during testing.

The tests first test the "normal" situation (no DebugInfoD involvement,
just normal debug files sitting around), then the "no debug info"
situation (to make sure the test is seeing failure properly), then it
tests to validate that when Debuginfod returns the symbols, things work
properly. This is duplicated for DWP/split-dwarf scenarios.

---------

Co-authored-by: Kevin Frei <freik@meta.com>
2024-03-21 13:09:04 -07:00
Florian Mayer
85ccfb5ed5
[HWASan] [NFC] pull logic to get sanitizer ptr out of hwasan (#86024)
Also some drive by cleanup removing an unnnecessary argument and a
redundant condition.
2024-03-21 12:42:55 -07:00
Michele Scandale
536cb1fad3
[InstCombine] Fix for folding select-like shufflevector into floating point binary operators. (#85452)
Folding a select-like `shufflevector` into a floating point binary
operators can only be done if the result is preserved for both case. In
particular, if the common operand of the `shufflevector` and the
floating point binary operator can be a NaN, then the transformation
won't preserve the result value.
2024-03-21 12:40:18 -07:00
Guillaume Chatelet
3eb58d15b3
Revert "[libc] Add reverse_iterator comparisons" (#86186)
Reverts llvm/llvm-project#86147
2024-03-21 20:37:04 +01:00
Guillaume Chatelet
c96b61adc3
[libc] Add reverse_iterator comparisons (#86147)
https://en.cppreference.com/w/cpp/iterator/reverse_iterator/operator_cmp
2024-03-21 20:33:05 +01:00
lorenzo chelini
22e7e68a40 [mlir][Affine] Fix unused variable warning (NFC) 2024-03-21 19:40:55 +01:00
dmaclach
3fefeafa49
[OBJC] Allow __attribute__((NSObject)) types be used as lightweight generic specifiers (#84593)
As per
https://clang.llvm.org/docs/AutomaticReferenceCounting.html#retainable-object-pointers,
types with `__attribute__((NSObject))` are retainable, and thus should
be eligible to be used as lightweight generic specifiers.

Fix for #84592 84592
2024-03-21 14:22:35 -04:00
Aaron Ballman
999d4f8407
Split -Wcast-function-type into a separate group (#86131)
We want to add -Wcast-function-type to -Wextra (as done in
1de7e6c8cba27296f3fc16d107822ea0ee856759), but we do not want to add
-Wcast-function-type-strict in at the same time
(https://lab.llvm.org/buildbot/#/builders/57/builds/33601/steps/5/logs/stdio).

This moves the existing warning to a new group
(-Wcast-function-type-mismatch), puts the new group under the existing
-Wcast-function-type warning group, and adds
-Wcast-function-type-mismatch to -Wextra.
2024-03-21 14:18:43 -04:00
Kazu Hirata
f5ef9bd26d
[memprof] Call SmallVector::reserve (#86055)
With one raw memprof file I have, NumPCs averages about 41.  Given the
default number of inline elements being 8 for SmallVector<uint64_t>,
we should reserve the storage in advance.
2024-03-21 11:17:52 -07:00
Craig Topper
796efa8cd5
[Float2Int] Fix pessimization in the MinBW calculation. (#86051)
The MinBW was being calculated using the significant bits of the upper
and lower bounds. The upper bound is 1 past the last value in the range
so I don't think it should be included. Instead use ConstantRange::getMinSignedBits.

I'm still not sure if the +1 is needed after the getMinSignedBits call.
2024-03-21 11:09:40 -07:00
Noah Goldstein
b3ee127e7d [InstCombine] integrate N{U,S}WAddLike into existing folds
Just went a quick replacement of `N{U,S}WAdd` with the `Like` variant
that old matches `or disjoint`

Closes #86082
2024-03-21 13:03:38 -05:00
Noah Goldstein
ac13e5c0f6 [InstCombine] Add tests for integrating N{U,S}WAddLike; NFC 2024-03-21 13:03:38 -05:00
Noah Goldstein
aa7f8200ac [IR] Add helpers for NUWAddLike and NSWAddLike to also match or disjoint; NFC
`or disjoint` implies `add nuw nsw`: https://alive2.llvm.org/ce/z/VABhDA
2024-03-21 13:03:38 -05:00
Simon Pilgrim
3218570620 [X86] Add shuffle test case for Issue #86068 2024-03-21 17:56:58 +00:00
Daniel Chen
e84a985cbf
[Flang] Support for NULL() and procedure in structure constructor for procedure pointer component. (#85991)
This PR fixes a subset of procedure pointer component initialization in
structure constructor.
It covers
  1. NULL()
  2. procedure
  
 For example:
 ```
   MODULE M
    TYPE :: DT
      !PROCEDURE(Fun), POINTER, NOPASS :: pp1
      PROCEDURE(Fun), POINTER :: pp1
    END TYPE

    CONTAINS

    INTEGER FUNCTION Fun(Arg)
     class(dt) :: arg
    END FUNCTION

  END MODULE

  PROGRAM MAIN
  USE M
  IMPLICIT NONE
  TYPE (DT), PARAMETER :: v1 = DT(NULL())
  TYPE (DT) :: v2
  v2 = DT(fun)
  END
  ```
  
Passing a procedure pointer itself or reference to a function that
returns a procedure pointer is TODO.
2024-03-21 13:50:40 -04:00
LLVM GN Syncbot
aa571a1e8f [gn build] Port 797336b1278c 2024-03-21 17:34:43 +00:00
T-Gruber
86d479fd7c
Adapted MemRegion::getDescriptiveName to handle ElementRegions (#85104)
Fixes https://github.com/llvm/llvm-project/issues/84463

Changes:
- Adapted MemRegion::getDescriptiveName
- Added unittest to check name for a given clang::ento::ElementRegion
- Some format changes due to clang-format

---------

Co-authored-by: Andreas Steinhausen <andreas.steinhausen@concenrio.io>
Co-authored-by: Balazs Benics <benicsbalazs@gmail.com>
2024-03-21 18:27:53 +01:00
Balazs Benics
c8772940ee
[analyzer] Wrap SymbolicRegions by ElementRegions before getting a FieldRegion (#85211)
Inside the ExprEngine when we process the initializers, we create a
PostInitializer program-point, which will refer to the field being
initialized, see `FieldLoc` inside `ExprEngine::ProcessInitializer`.

When a constructor (of which we evaluate the initializer-list) is
analyzed in top-level context, then the `this` pointer will be
represented by a `SymbolicRegion`, (as it should be).

This means that we will form a `FieldRegion{SymbolicRegion{.}}` as the
initialized region.

```c++
class Bear {
public:
  void brum() const;
};
class Door {
public:
  // PostInitializer would refer to "FieldRegion{SymRegion{this}}"
  // whereas in the store and everywhere else it would be:
  // "FieldRegion{ELementRegion{SymRegion{Ty*, this}, 0, Ty}".
  Door() : ptr(nullptr) {
    ptr->brum(); // Bug
  }
private:
  Bear* ptr;
};
```

We (as CSA folks) decided to avoid the creation of FieldRegions directly
of symbolic regions in the past:

f8643a9b31

---

In this patch, I propose to also canonicalize it as in the mentioned
patch, into this: `FieldRegion{ElementRegion{SymbolicRegion{Ty*, .}, 0,
Ty}`

This would mean that FieldRegions will/should never simply wrap a
SymbolicRegion directly, but rather an ElementRegion that is sitting in
between.

This patch should have practically no observable effects, as the store
(due to the mentioned patch) was made resilient to this issue, but we
use `PostInitializer::getLocationValue()` for an alternative reporting,
where we faced this issue.

Note that in really rare cases it suppresses now dereference bugs, as
demonstrated in the test. It is because in the past we failed to follow
the region of the PostInitializer inside the StoreSiteFinder visitor -
because it was using this code:
```c++
// If this is a post initializer expression, initializing the region, we
// should track the initializer expression.
if (std::optional<PostInitializer> PIP =
        Pred->getLocationAs<PostInitializer>()) {
  const MemRegion *FieldReg = (const MemRegion *)PIP->getLocationValue();
  if (FieldReg == R) {
    StoreSite = Pred;
    InitE = PIP->getInitializer()->getInit();
  }
}
```
Notice that the equality check didn't pass for the regions I'm
canonicalizing in this patch.

Given the nature of this change, we would rather upstream this patch.

CPP-4954
2024-03-21 18:22:22 +01:00
Janek van Oirschot
797336b127
Revert "[AMDGPU] MCExpr-ify MC layer kernel descriptor" (#86151)
Reverts llvm/llvm-project#80855
2024-03-21 10:19:54 -07:00
Ilya Biryukov
4bf8dc1a0f
[libc++] Remove macros for keeping std::allocator members and void specialization after C++20 (#85806)
Fixes #75975.

Remove `_LIBCPP_ENABLE_CXX20_REMOVED_ALLOCATOR_MEMBERS` for the LLVM 19
release, it was previously marked as deprecated in LLVM 18.

I believe that
`_LIBCPP_ENABLE_CXX20_REMOVED_ALLOCATOR_VOID_SPECIALIZATION` was only
used by Google in conjunction with
`_LIBCPP_ENABLE_CXX20_REMOVED_ALLOCATOR_MEMBERS`.

Removing both macros together should not cause any issues in practice,
even though we did not announce the removal of
`_LIBCPP_ENABLE_CXX20_REMOVED_ALLOCATOR_VOID_SPECIALIZATION` before.
2024-03-21 17:48:13 +01:00
Simon Pilgrim
6942927609 [DAG] combineConcatVectorOfScalars - stop always creating UNDEF nodes. NFC.
Noticed in debug logs - most calls to visitVECTOR_SHUFFLE resulted into wasteful UNDEF node creations, despite almost never being used.
2024-03-21 16:37:48 +00:00
Nick Desaulniers
6eff53b4f0
[libc][stdio] implement rename via SYS_renameat2 (#86140)
SYS_rename may be unavailable on architectures such as aarch64 and
riscv.
rename can be implemented in terms of SYS_rename, SYS_renameat, or
SYS_renameat2. I don't have a full picture of the history here, but it
seems
that SYS_renameat might also be unavailable on some platforms.

`man 2 rename` mentions that SYS_renameat2 was added in Linux 3.15. We
don't
need to support such ancient kernel versions prior.

Link: #84980
Link: #85068
2024-03-21 09:35:18 -07:00
OverMighty
c1c2551a28
[clang] Implement __builtin_{clzg,ctzg} (#83431)
Fixes #83075, fixes #83076.
2024-03-21 09:33:16 -07:00
Guillaume Chatelet
9a87d4d546
[libc] Add is_constant_evaluated type_traits (#86139)
This will replace `__builtin_is_constant_evaluated` in math_extras.h.
2024-03-21 17:25:37 +01:00
Craig Topper
12836467b7
[ConstantRange] Fix off by 1 bugs in UIToFP and SIToFP handling. (#86041)
We were passing the min and max values of the range to the ConstantRange
constructor, but the constructor expects the upper bound to 1 more than
the max value so we need to add 1.

We also need to use getNonEmpty so that passing 0, 0 to the constructor
creates a full range rather than an empty range. And passing smin,
smax+1 doesn't cause an assertion.

I believe this fixes at least some of the reason #79158 was reverted.
2024-03-21 09:25:13 -07:00
Tarun Prabhu
d9f0d9a145
[flang][NFC] Fix header guards
Some header guards conflicted with clang. Fix a few others to follow the
convention in the rest of the headers in flang.
2024-03-21 10:22:33 -06:00
Matt Arsenault
d8b0d8d671
AMDGPU: Use defset to cleanup marking MFMA intrinsics as divergent (#85915) 2024-03-21 21:49:57 +05:30
Jonas Devlieghere
81bd799819
[lldb] Add missing initialization in LineEntry ctor 2024-03-21 09:06:06 -07:00
Craig Topper
f5c90f3000
[RISCV] Use BuildPairF64 and SplitF64 for bitcast i64<->f64 on rv32 regardless of Zfa. (#85982)
Previously we used BuildPairF64 and SplitF64 only if Zfa was supported
since they will select register file moves that are only available with
Zfa.

We recently changed the handling of BuildPairF64/SplitF64 for Zdinx to
not go through memory so we should use that for bitcast.

That leaves the D without Zfa case that does need to go through memory.
Previously we let type legalization expand to loads and stores using a
new stack temporary created for each bitcast. After this patch we will
create the loads ands stores in the custom inserter and share the same
stack slot for all. This also allows DAGCombiner to optimize when
bitcast is mixed with BuildPairF64/SplitF64.
2024-03-21 08:52:51 -07:00
Chelsea Cassanova
6317c780d8
[lldb][progress][NFC] Clarify Doxygen comments for details field (#86002)
The Doxygen comments for the `details` field of a progress report
currently does not specify that this field will act as the initial set
of details for a progress report that gets updated with
`Progress::Increment()`. This commit clarifies this.
2024-03-21 08:49:43 -07:00
Finn Plummer
38f8a3cf0d
[mlir][spirv] Improve folding of MemRef to SPIRV Lowering (#85433)
Investigate the lowering of MemRef Load/Store ops and implement
additional folding of created ops

Aims to improve readability of generated lowered SPIR-V code.

Part of work llvm#70704
2024-03-21 08:49:27 -07:00
Craig Topper
6295e67722 [Float2Int] Pre-commit test for SIToFP/UIToFP ConstantRange bug. NFC
The range for these operations is being constructed without the
maximum value for the range due to an incorrect usage of the
ConstantRange constructor.

This causes Float2Int to think the range for 'uitofp i1' only
contains 0 instead of 0 and 1.
2024-03-21 08:41:02 -07:00
Jonas Devlieghere
556fe5f290
[lldb] Reland: Store SupportFile in FileEntry (NFC) (#85892)
This is another step towards supporting DWARF5 checksums and inline
source code in LLDB. This is a reland of #85468 but without the
functional change of storing the support file from the line table (yet).
2024-03-21 08:40:08 -07:00
Nick Desaulniers
0c8dfc85c3
[libc][stdio][test] fixup rename test (#86136)
Link: #84980
Link: #85068
2024-03-21 08:36:47 -07:00
timoh-ba
7650a01927
[DWARF5][COFF] Emit section-relative .debug_line_str relocations (#83773)
Dwarf 5 allows separating filenames from .debug_line into a separate
.debug_line_str section. The strings are referenced relative to the
start of the .debug_line_str section. Previously, on COFF, the
relocation information instead caused offsets to be relocated to the
base address of the COFF-File. This lead  to wrong offsets in linked
COFF (PE) files which caused the debugger to be unable to find the
correct source files.

This patch fixes this problem by making the offsets relative to the
start of the .debug_line_str section instead. There should be no
changes for ELF-Files as everything seems to be working there.

A test is also added to ensure that the correct relocation entries are
emitted.
2024-03-21 17:30:10 +02:00
Martin Storsjö
50801f1095
Reapply [libcxx] [modules] Fix relative paths with absolute LIBCXX_INSTALL_MODULES_DIR (#86020)
This reapplies 272d1b44efdedb68c194970a610f0ca1b7b769c5 (from #85756),
which was reverted in
407937036fa7640f61f225474b1ea6623a40dbdd.

In the previous attempt, empty CMAKE_INSTALL_PREFIX was handled by
quoting them, in d209d1340b99d4fbd325dffb5e13b757ab8264ea. That made the
calls to cmake_path(ABSOLUTE_PATH) succeed, but the output paths of that
weren't actually absolute, which was required by file(RELATIVE_PATH).

Avoid this issue by constructing a non-empty base directory variable
to use for calculating the relative path.
2024-03-21 17:29:15 +02:00
aniplcc
c04807c84e
[libc][c11] Add stdio.h's rename() function (#85068)
Adds stdio.h's rename() function as defined in n3096. Fixes  #84980.
2024-03-21 08:21:06 -07:00
Craig Topper
7678e6e562
[RISCV] Lower the alignment requirement for a GPR pair spill for Zdinx on RV32. (#85871)
I believe we can use XLen alignment as long as eliminateFrameIndex
limits the maximum folded offset to 2043. This way when we split
the load/store into two 2 instructions we'll be able to add 4
without overflowing simm12.
2024-03-21 08:14:48 -07:00
Simon Pilgrim
e4fa2e3562
[DAG] isGuaranteedNotToBeUndefOrPoisonForTargetNode - add fallback implementation (#86125)
Allow targets to rely on TargetLowering::isGuaranteedNotToBeUndefOrPoisonForTargetNode to test nodes for canCreateUndefOrPoisonForTargetNode + all arguments are isGuaranteedNotToBeUndefOrPoison.

Targets can still perform this themselves for specific special case nodes (e.g. target shuffles).

Matches the fallback in SelectionDAG::isGuaranteedNotToBeUndefOrPoison
2024-03-21 15:11:59 +00:00
Alexey Bataev
8d7a6e2fd8 [SLP]Fix a crash for gather node with instructions from different bbs,
if cost threshold is very low.
2024-03-21 08:03:06 -07:00
Nikita Popov
6898147b9f
[InstCombine] Add contributor guide (#79007)
Document expectations for contributions to InstCombine, especially
regarding test coverage and alive2 proofs.
2024-03-21 16:00:53 +01:00
Jonas Paulsson
b4b5e8277a
Check for all frame instructions in finalize isel. (#85945)
Check for all frame instructions in finalize isel, not just for the
frame setup opcode. This was proven necessary, see #78001 
for discussion.
2024-03-21 11:00:08 -04:00
Joe Nash
44278f2326 [AMDGPU][MC] Fix GFX12 check line typo and move test
NFC.
Fix CHECK lines that seem to have a copy paste error.
Move the test that was formerly in gfx12_dasm_vinterp.txt (see #85949).
2024-03-21 10:46:07 -04:00
Joe Nash
d1f182c895
[AMDGPU][MC][True16] Rename and combine VINTERP MC tests (#85949)
NFC.
gfx11_asm_vinterp.s already contained GFX12 run lines. Rename the
assembler and disassembler tests to be sorted based on real16 or fake16
instead of gfxip. Note, both GFX11 and GFX12 currently only have fake16
(fake16 in encoding, but not by name) upstream, so that is why the test
files have a -fake16 suffix.

One test input is changed, and that is the disassembler test for
unsupported bits in the instruction. It is now an input that is valid on
both GFX11 and GFX12. This was necessary because the size of the opcode
field changed.
2024-03-21 10:42:39 -04:00