2311 Commits

Author SHA1 Message Date
Fangrui Song
f999b11e68
[CMake] Remove some unneeded HAVE_*_H
Pull Request: https://github.com/llvm/llvm-project/pull/123282
2025-01-16 21:37:24 -08:00
Akshat Oke
f07b10b7c4
[Support] Recycler: Match dealloc size and enforce min size (#121889)
Address sanitizer found mismatching deallocation size in Recycler.
2025-01-09 14:22:27 +05:30
Akshat Oke
bc51a2e394
[Support] Recycler: Implement move constructor (#120555)
Discovered missing while running RAGreedy through the NPM which relies on moving analyses to the cache.
2025-01-07 15:46:58 +05:30
Akshat Oke
b51a082e1a
Revert "[Support] Recycler: Enforce minimum allocation size" (#121735)
Reverts llvm/llvm-project#121425
2025-01-06 13:50:31 +05:30
Akshat Oke
34e8aff480
[Support] Recycler: Enforce minimum allocation size (#121425)
Recycler uses reinterpret_cast to an internal structure of size 8.
Invalid write occurs if Recycler is used for objects with sizes less
than 8.
2025-01-06 11:53:56 +05:30
Jinsong Ji
5de7af4b9f
[llvm][Support][Windows] Fix slash in path for remove_directories (#121448)
Before 925471ed903dad871042d7ed0bab89ab6566a564 remove_directories
supports path with slash (instead of backslash).
The ILCreateFromPathW in new implementation requires backslash path,
so the call to remove_directories will fail if the path contains slash.

This is to normalize the path to make sure remove_directories still
support path with slash as well.
2025-01-02 12:32:42 -05:00
Tyler Nowicki
8e66344448
[Support] Use macro var args to allow templates within DEBUG_WITH_TYPE (#117614)
Use variadic args with DEBUG_WITH_TYPE("name", ...) macros to resolve a
compilation failure that occurs when using a comma within the last macro
argument. Commas come up when instantiating templates such as
SmallMapVector that require multiple template args.
2024-12-05 08:48:42 -05:00
NAKAMURA Takumi
39209724e6
[YAML] Fix incorrect dash output in nested sequences (#116488)
Nested sequences could be defined but the YAML output was incorrect.
`Output::newLineCheck()` was not able to emit multiple dashes `- ` and
YAML parser sometimes didn't accept its output as the result.

This fixes for emitting corresponding dashes for consecutive
`inSeqFirstElement`, but suppresses emission to the top
`inSeqFirstElement`.

This also fixes for emitting flow elements onto nested sequences.
2024-11-30 22:10:31 +09:00
NAKAMURA Takumi
980316ec85 [YAML] Recommit "Make std::array available (#116059)" with a fix.
`std::array` will be handled like `MutableArrayRef`;

- Extending elements is not acceptable.
- For applying fewer sequence, trailing elements will be initialized by
default.

Not like;

- `std::array` is not the reference but holds values. Supposing to hold
small count of elements.

Changes since llvmorg-20-init-12117-g941f704f0892:
- Use `size_t` for `N`, instead of `unsigned`.
- include <array>
2024-11-14 20:15:46 +09:00
NAKAMURA Takumi
e9aee4fd80 Revert "[YAML] Make std::array available (#116059)"
Compilation failed on gcc hosts.

This reverts commit 941f704f0892317701fd263603a729e0ef86dda6.
(llvmorg-20-init-12117-g941f704f0892)
2024-11-14 11:38:51 +09:00
NAKAMURA Takumi
941f704f08
[YAML] Make std::array available (#116059)
`std::array` will be handled like `MutableArrayRef`;

- Extending elements is not acceptable.
- For applying fewer sequence, trailing elements will be initialized by
default.

Not like;

- `std::array` is not the reference but holds values. Supposing to hold
small count of elements.
2024-11-14 11:21:27 +09:00
NAKAMURA Takumi
287a34311e Reformat 2024-11-14 11:16:56 +09:00
goldsteinn
877cb9a2ed
[KnownBits] Make {s,u}{add,sub}_sat optimal (#113096)
Changes are:
    1) Make signed-overflow detection optimal
    2) For signed-overflow, try to rule out direction even if we can't
       totally rule out overflow.
    3) Intersect add/sub assuming no overflow with possible overflow
       clamping values as opposed to add/sub without the assumption.
2024-11-05 09:03:37 -06:00
Lang Hames
633a6c91a3
[Support] Extend ExtensibleRTTI utility to support basic multiple inheritance. (#112643)
Clients can now pass multiple parent classes to RTTIExtends. Each parent
class will be inherited from publicly (and non-virtually). The isa,
cast, and dyn_cast methods will now work as expected for types with
multiple inheritance.
2024-10-24 15:53:42 -07:00
Jay Foad
40c3e583b7
[KnownBits] Check that mul is optimal for low order bits (#113316) 2024-10-22 16:36:06 +01:00
Luke Drummond
b55c52c047 Revert "Renormalize line endings whitespace only after dccebddb3b80"
This reverts commit 9d98acb196a40fee5229afeb08f95fd36d41c10a.
2024-10-18 21:16:50 +01:00
Luke Drummond
9d98acb196 Renormalize line endings whitespace only after dccebddb3b80
Line ending policies were changed in the parent, dccebddb3b80. To make
it easier to resolve downstream merge conflicts after line-ending
policies are adjusted this is a separate whitespace-only commit. If you
have merge conflicts as a result, you can simply `git add --renormalize
-u && git merge --continue` or `git add --renormalize -u && git rebase
--continue` - depending on your workflow.
2024-10-17 14:49:26 +01:00
David Blaikie
f796a0c7c9
[formatv] Leave format parameters unstripped (#112625)
This is consistent with std::formatv and allows formatters to support a
wider variety of use cases (like having a bare string in their formatter
if that's useful, etc).

Came up in the context of some Carbon diagnostic work here:
https://github.com/carbon-language/carbon-lang/pull/4411#discussion_r1803688859
2024-10-16 15:53:52 -07:00
ivanaivanovska
871f69f0b6
[TimeProfiler] Added instant events to llvm TimeProfiler. (#103039)
This adds support for adding instant events to the TimeProfiler. Later we plan to use it to record deferring of template instantiations.
2024-10-08 13:04:39 +02:00
Jay Foad
5cabf1505d
[KnownBits] Make avg{Ceil,Floor}S optimal (#110688)
Rewrite the signed functions in terms of the unsigned ones which are
already optimal.
2024-10-01 19:34:50 +01:00
Noah Goldstein
bbdca53bad [KnownBitsTest] Add optimality tests to some optimal impls; NFC
Adding optimality test to `add`, `sub`, `avgCeilU` and `avgFloorU`
2024-09-30 13:10:16 -05:00
Abhina Sree
1e67e4bbba
[SystemZ][z/OS] z/OS does not support nanosleep, use usleep instead (#109823)
Use usleep instead of nanosleep to resolve a build error on z/OS because
there is no support for nanosleep.
2024-09-25 08:21:29 -04:00
Rahul Joshi
c92137e474
[NFC][TableGen] Adopt scaled indent in PredicateExpander (#109801)
Adopt scaled indent in PredicateExpander.
Added pre/post inc/dec operators to `indent` and related unit tests.
Verified by comparing *.inc files generated by LLVM build with/without
the change.
2024-09-24 22:05:51 -07:00
Rahul Joshi
6bed79b3f0
[Support] Add scaling support in indent (#109478)
Scaled indent is useful when indentation is always in steps of a fixed
number (the Scale) and still allow using the +/- operators to adjust
indentation.
2024-09-23 18:41:40 -07:00
Jay Foad
eb6e7e8f89
[unittests] Use {} instead of std::nullopt to initialize empty ArrayRef (#109388)
Follow up to #109133.
2024-09-21 10:59:50 +01:00
Fangrui Song
b84d773fd0 [Parallel] Revert sequential task changes
https://reviews.llvm.org/D148728 introduced `bool Sequential` to unify
`execute` and the old `spawn` without argument. However, sequential
tasks might be executed by any worker thread (non-deterministic),
leading to non-determinism output for ld.lld -z nocombreloc (see
https://reviews.llvm.org/D133003).

In addition, the extra member variables have overhead.
This sequential task has only been used for lld parallel relocation
scanning.

This patch restores the behavior before https://reviews.llvm.org/D148728 .

Fix #105958

Pull Request: https://github.com/llvm/llvm-project/pull/109084
2024-09-20 21:15:42 -07:00
Abhina Sreeskantharajan
efdb3ae232 Revert "[SystemZ][z/OS] Propagate IsText parameter to open text files as text (#107906)"
This reverts commit edf3b277a5f2ebe144827ed47463c22743cac5f9.
2024-09-20 08:18:16 -04:00
Nikita Popov
37e5319a12 [UnitTests] Fix APInt signed flags (NFC)
This makes unit tests compatible with the assertion added in
https://github.com/llvm/llvm-project/pull/106524, by setting the
isSigned flag to the correct value or changing how the value is
constructed.
2024-09-20 12:13:33 +02:00
Abhina Sree
edf3b277a5
[SystemZ][z/OS] Propagate IsText parameter to open text files as text (#107906)
This patch adds an IsText parameter to the following functions
openFileForRead, getBufferForFile, getBufferForFileImpl and determines
whether a file is text by querying the file tag on z/OS. The default is
set to OF_Text instead of OF_None, this change in value does not affect
any other platforms other than z/OS.
2024-09-19 14:30:10 -04:00
Rahul Joshi
2731be7ac5
[Support] Add helper struct indent for adding indentation (#108966)
Add helper struct indent() for adding indentation to raw_ostream.
2024-09-18 08:54:11 -07:00
Rahul Joshi
2f7ffbaad3
[Support] Fix bugs in formatv automatic index assignment (#108384)
Fix bugs found when actually trying to use formatv() automatic index
assignment in IntrinsicEmitter.cpp:
- Assign automatic index only for `ReplacementType::Format`.
- Make the check for all replacement indices being either automatic orexplicit more accurate.
  The existing check fails for formatv("{}{0}{}", 0, 1) (added as a unit test). Explicitly track if we
  have seen any explicit and any automatic index instead.
2024-09-16 21:48:05 -07:00
Jake Egan
53d60398ef
[CMake] Use old DynamicLibrary symbol behavior on AIX for now (#108692)
New behavior broke the AIX bot, so fall back to the old behavior on AIX
for now to give time to investigate
2024-09-16 10:57:06 -04:00
JOE1994
459a82e689 [llvm][unittests] Don't call raw_string_ostream::flush() (NFC)
raw_string_ostream::flush() is essentially a no-op (also specified in docs).
Don't call it in tests that aren't meant to test 'raw_string_ostream' itself.

p.s. remove a few redundant calls to raw_string_ostream::str()
2024-09-13 19:55:44 -04:00
JOE1994
77bab2a6f3 [llvm][unittests] Strip unneeded use of raw_string_ostream::str() (NFC)
Avoid unneeded layer of indirection.
2024-09-13 18:33:41 -04:00
Rahul Joshi
d5d6b44784
[Support] Add automatic index assignment in formatv (#107459)
Make index in replacement field optional. It will be automatically
assigned in incremental order by formatv.

Make mixed use of automatic and explicit indices an error that will fail
validation.
Adopt uses of formatv() within FormatVariadic to use automatic index.
2024-09-12 04:38:36 -07:00
Lang Hames
2e18f636fd Fix some unit tests for LLVM_ENABLE_EXPORTED_SYMBOLS_IN_EXECUTABLES=Off.
Building with -DLLVM_ENABLE_EXPORTED_SYMBOLS_IN_EXECUTABLES=Off should not
prevent the PluginsTests and DynamicLibraryTests unit tests from working.

This fix uses the approach implemented in
https://github.com/llvm/llvm-project/pull/101741.

rdar://135849875
2024-09-12 15:18:53 +10:00
Jan Svoboda
70fcdb3d52
[llvm][support] Implement tracing virtual file system (#88326)
LLVM-based tools often use the `llvm::vfs::FileSystem` instrastructure
to access the file system. This patch adds new kind of a VFS that
performs lightweight tracing of file system operations on an underlying
VFS. This is supposed to aid in investigating file system traffic
without resorting to instrumentation on the operating system level.
There will be follow-up patches that integrate this into Clang and its
dependency scanner.
2024-09-06 14:14:44 -07:00
Rahul Joshi
c2018fa40f
[NFC][Support] Refactor FormatVariadic code. (#106610)
- Rename `Align` field in ReplacementItem/FmtAlign to `Width` to 
  accurately reflect its use.
- Change both `Width` and `Index` in ReplacementItem to 32-bit int 
  instead of size_t (as 64-bits seems excessive in this context).
- Eliminate the use of `Empty` ReplacementType, and use the
  existing std::optional<> instead to indicate that.
- Eliminate some boilerplate type code in formatv().
- Eliminate the loop in `splitLiteralAndReplacement`. The existing
  code will never loop back.
- Directly use constructor instead of std::make_pair.
2024-09-05 09:01:19 -07:00
Rahul Joshi
ad30a050ca
[NFC][Support] Add FormatVariadic sub-test for validation (#106578)
- Add validation subtest that tests assert failures in assert enabled
  builds, and that validation is disabled in assert disabled builds.
2024-09-02 06:27:12 -07:00
Daniil Fukalov
89e6a28867
[NFC] Add explicit #include llvm-config.h where its macros are used. (#106621)
Without these explicit includes, removing other headers, who implicitly
include llvm-config.h, may have non-trivial side effects.
2024-08-30 09:35:06 +02:00
Rahul Joshi
9ce4af5cad
Revert "Revert "[Support] Validate number of arguments passed to formatv()"" (#106592)
Reverts llvm/llvm-project#106589
The fix for bot failures caused by the reverted commit was committed
already, so this revert is not needed.
2024-08-29 10:39:40 -07:00
Mehdi Amini
ed37b5f6c3
Revert "[Support] Validate number of arguments passed to formatv()" (#106589)
Reverts llvm/llvm-project#105745

Some bots are broken apparently.
2024-08-29 10:30:11 -07:00
Rahul Joshi
115b87636b
[NFC][Support] Eliminate ',' at end of MemoryEffects print (#106545)
- Eliminate comma at end of a MemoryEffects print.
- Added basic unit test to validate that.
2024-08-29 09:28:45 -07:00
Rahul Joshi
5048fabb05
[Support] Delete FormatVariadicTest Validate sub-test (#106570)
- The subtest, if enabled correctly, will fail with assert in Debug
  builds and validation is disabled in Release builds.
- Hence deleting the test to fix test failures in CI.
2024-08-29 08:40:15 -07:00
Rahul Joshi
fc110202df
[Support] Validate number of arguments passed to formatv() (#105745)
Change formatv() to validate that the number of arguments passed matches
number of replacement fields in the format string, and that the replacement
indices do not contain holes.

To support cases where this cannot be guaranteed, introduce a formatv()
overload that allows disabling validation with a bool flag as its first argument.
2024-08-29 08:00:25 -07:00
Kazu Hirata
22e55ba329
[llvm] Prefer StringRef::substr to StringRef::slice (NFC) (#106330)
S.substr(N) is simpler than S.slice(N, StringRef::npos). Also, substr
is probably better recognizable than slice thanks to
std::string_view::substr.
2024-08-28 01:13:46 -07:00
Fangrui Song
7c06786479
[CMake] Remove HAVE_LINK_H
We can remove the variable from https://reviews.llvm.org/D5610 since
link.h is available on Linux (glibc/musl/Bionic), FreeBSD, and NetBSD.
Use `__has_include(<link.h>)` before including it.

Pull Request: https://github.com/llvm/llvm-project/pull/104893
2024-08-20 08:50:24 -07:00
Ramkumar Ramachandra
7dd6340bda
MathExtras: template'ize alignToPowerOf2 (#97814)
Follow up on 5627794 (MathExtras: avoid unnecessarily widening types) to
change the overflow behavior of alignToPowerOf2 to only overflow if the
result is not representable in the return type. This allows us to
template'ize it, and avoid unnecessarily widening the types of
arguments.
2024-08-19 16:03:42 +01:00
Steven Wu
2596464dcd [CMake] Re-land #102671 after the flaky test is disabled
Reland #102671 after the other attempted fixes are all flawed in some
build configurations. The previous try for the same commit was breaking
a flaky tests under ASAN which is not marked as unsupported. This fix
should be good to go now.

Fixes AIX bot for DynamicLibraryTests failure.
2024-08-13 15:18:09 -07:00
Steven Wu
29314b4b27 Revert "[CMake] Fix DynamicLibraryTests exports symbol when plugins are enabled (#102941)"
This reverts commit a9604cd3212beb6cdb41a79f248723140ab9939d.

The export list in unit-tests will break sanitizer build since that
requires more symbols than listed in the export file.
2024-08-13 13:59:12 -07:00