Med Ismail Bennani [Tue, 6 Jun 2023 23:05:26 +0000 (16:05 -0700)]
[lldb] Disable some tests on windows
This patch skips both `test_completion_target_create_from_root_dir`
introduced in `e896612` and `target-label.test` introduced in `1e82b20`
since I don't have a windows machine to try to accomodate the filesystem
path style differences for these tests to pass.
Signed-off-by: Med Ismail Bennani <ismail@bennani.ma>
Arthur Eubanks [Tue, 6 Jun 2023 22:59:26 +0000 (15:59 -0700)]
Revert "Reland [compiler-rt][CMake] Properly set COMPILER_RT_HAS_LLD"
This reverts commit
fffa05a2bcb548d5189e8c2e52d2ed2e7ebb2498.
This seems to cause hwasan tests to run in environments it didn't run in before.
Amir Ayupov [Tue, 6 Jun 2023 22:49:00 +0000 (15:49 -0700)]
[BOLT][NFC] Fix debug messages
Fix debug printing, making it easier to compare two debug logs side by side:
- `BinaryFunction::addRelocation`: print function name instead of `this` ptr,
- `DataAggregator::doTrace`: remove duplicated function name.
Reviewed By: #bolt, maksfb
Differential Revision: https://reviews.llvm.org/D152314
Jonas Devlieghere [Tue, 6 Jun 2023 22:18:14 +0000 (15:18 -0700)]
[lldb] Fix "NameError: name 'self' is not defined" when using crashlog -c
This fixes a regression introduced by
27f27d15f6c9 that results in a
NameError: (name 'self' is not defined) when using crashlog with the -c
option.
rdar://
110007391
Fangrui Song [Tue, 6 Jun 2023 22:12:45 +0000 (15:12 -0700)]
[Driver] Change some Separate CC1 options to use the Joined = form
Matt Arsenault [Tue, 22 Nov 2022 05:42:55 +0000 (00:42 -0500)]
clang/HIP: Inline frexp/frexpf implementations
Don't bother calling ocml. This stops setting the
appropriate fast math flags, and requires this junk
for passing to a private pointer.
Aaron Ballman [Tue, 6 Jun 2023 21:29:15 +0000 (17:29 -0400)]
Fix LLVM Sphinx build; NFC
Addresses the issue found by:
https://lab.llvm.org/buildbot/#/builders/30/builds/35968
Craig Topper [Tue, 6 Jun 2023 21:27:28 +0000 (14:27 -0700)]
[RISCV] Use const reference when looping over RISCVMatInt::InstSeq. NFC
Artem Belevich [Mon, 5 Jun 2023 20:45:47 +0000 (13:45 -0700)]
[NVPTX] Adapt tests to make them usable with CUDA-12.x
CUDA-12 no longer supports 32-bit compilation.
Tests agnostic to 32/64 compilation mode are switched to use nvptx64.
Tests that do care about it have 32-bit ptxas compilation disabled with cuda-12+.
Differential Revision: https://reviews.llvm.org/D152199
Matt Arsenault [Tue, 6 Jun 2023 21:18:31 +0000 (17:18 -0400)]
LangRef: Try to fix sphinx bot error
Matt Arsenault [Fri, 28 Apr 2023 17:50:20 +0000 (13:50 -0400)]
ValueTracking: Add baseline test for ldexp computeKnownFPClass
Fangrui Song [Tue, 6 Jun 2023 21:08:49 +0000 (14:08 -0700)]
[test] Restore x86-registered-target in Driver/as-warnings.c
64666d46c0bb0575e62525a5b867569b32850116 incorrectly removed REQUIRES.
2 RUN lines do need x86-registered-target.
Matt Arsenault [Sun, 30 Apr 2023 14:19:57 +0000 (10:19 -0400)]
clang: Start emitting intrinsic for __builtin_ldexp*
Also introduce __builtin_ldexpf16.
Matt Arsenault [Thu, 27 Apr 2023 02:02:42 +0000 (22:02 -0400)]
IR: Add llvm.ldexp and llvm.experimental.constrained.ldexp intrinsics
AMDGPU has native instructions and target intrinsics for this, but
these really should be subject to legalization and generic
optimizations. This will enable legalization of f16->f32 on targets
without f16 support.
Implement a somewhat horrible inline expansion for targets without
libcall support. This could be better if we could introduce control
flow (GlobalISel version not yet implemented). Support for strictfp
legalization is less complete but works for the simple cases.
Matt Arsenault [Tue, 6 Jun 2023 21:00:37 +0000 (17:00 -0400)]
AMDGPU/GlobalISel: Fix broken / copy paste error in sext_inreg test
Nikolas Klauser [Tue, 6 Jun 2023 20:57:45 +0000 (13:57 -0700)]
[libc++] Refactor __less
This simplifies the usage of `__less` by making the class not depend on the types compared, but instead the `operator()`. We can't remove the template completely because we explicitly instantiate `std::__sort` with `__less<T>`.
Reviewed By: ldionne, #libc
Spies: arichardson, EricWF, libcxx-commits, mgrang
Differential Revision: https://reviews.llvm.org/D145285
Fangrui Song [Tue, 6 Jun 2023 20:50:04 +0000 (13:50 -0700)]
[Driver] Change some Separate CC1 options to use the Joined = form
-f{constexpr,macro,template}-backtrace-limit=, -fspell-checking-limit=, -ftemplate-depth=
Amir Ayupov [Tue, 6 Jun 2023 20:41:43 +0000 (13:41 -0700)]
[profi][NFC] Get rid of afdo_detail::TypeMap
Parametrize SampleProfileInference and SampleProfileLoaderBaseImpl by function
type (Function/MachineFunction) instead of block type
(BasicBlock/MachineBasicBlock). Move out specializations to appropriate
locations.
This change makes it possible to use GraphTraits instead of a custom TypeMap and
make SampleProfileInference not dependent on LLVM types, paving the way for
generalizing SampleProfileInference interfaces to BOLT IR types
(BinaryFunction/BinaryBasicBlock) in stale profile matching (D144500).
Reviewed By: hoy
Differential Revision: https://reviews.llvm.org/D152187
Benjamin Kramer [Tue, 6 Jun 2023 20:47:30 +0000 (22:47 +0200)]
Benjamin Kramer [Tue, 6 Jun 2023 20:47:17 +0000 (22:47 +0200)]
Louis Dionne [Thu, 29 Sep 2022 21:44:39 +0000 (17:44 -0400)]
[libc++] Disable int128_t and ship filesystem on MSVC by default
Back in 2020 [1], we went very close to enabling Filesystem on MSVC
by disabling int128_t, but decided to wait because MSVC support
for int128_t was supposed to come shortly after. Since it's not
there yet, I propose turning off int128_t support by default on MSVC.
This will make <filesystem> available by default on MSVC, and most
importantly will open the possibility for changing
LIBCXX_ENABLE_FILESYSTEM to mean "the system doesn't have support
for a filesystem" instead of simply "don't build the std::filesystem
library", which is what I'm really after with this change.
In a way, this is a resurection of D91139.
[1]: https://reviews.llvm.org/D91139#2429595
Differential Revision: https://reviews.llvm.org/D134912
Craig Topper [Tue, 6 Jun 2023 20:30:33 +0000 (13:30 -0700)]
[RISCV] Use PACK in RISCVMatInt for constants that have the same lower and upper 32 bits.
This requires Zbkb.
Reviewed By: reames
Differential Revision: https://reviews.llvm.org/D152293
Louis Dionne [Wed, 31 May 2023 18:02:23 +0000 (11:02 -0700)]
[libc++] Use Lit annotations for all .gen.py tests
Instead of guarding header tests using #ifdefs inside the tests,
use Lit markup to mark all the tests as unsupported. This is simpler
but also provides better feedback about which tests are being run
when running the test suite.
Differential Revision: https://reviews.llvm.org/D151893
Craig Topper [Tue, 6 Jun 2023 20:23:17 +0000 (13:23 -0700)]
[RISCV] Add early out to generateInstSeq when the initial sequence is 1 or 2 instructions.
This avoids checking the size of the sequence repeatedly for each
special case. Especially on RV32 where none of the special cases
apply.
Reviewed By: reames
Differential Revision: https://reviews.llvm.org/D152300
Arthur Eubanks [Tue, 6 Jun 2023 18:11:52 +0000 (11:11 -0700)]
[NFC][lld][COFF] Rename findFile* methods
findFile returns null if we've already seen the file, make that clearer.
Reviewed By: mstorsjo
Differential Revision: https://reviews.llvm.org/D152292
Noah Goldstein [Tue, 6 Jun 2023 19:07:30 +0000 (14:07 -0500)]
[InstCombine] Remove deadcode in `(icmp SignTest(shl/shr X))`; NFC
This is dead as of: D145341
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D152181
Noah Goldstein [Tue, 6 Jun 2023 19:06:39 +0000 (14:06 -0500)]
[KnownBits] Factor out and improve the lowbit computation for {u,s}div
There are some new cases if the division is `exact`:
1: If `TZ(LHS) == TZ(RHS)` then the result is always Odd
2: If `TZ(LHS) > TZ(RHS)` then the `TZ(LHS)-TZ(RHS)` bits of the
result are zero.
Proofs: https://alive2.llvm.org/ce/z/3rAZqF
As well, return zero in known poison cases to be consistent rather
than just working about the bits we are changing.
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D150923
Noah Goldstein [Thu, 25 May 2023 17:10:31 +0000 (12:10 -0500)]
[KnownBits] Return `0` for poison {s,u}div inputs
It seems consistent to always return zero for known poison rather than
varying the value. We do the same elsewhere.
Differential Revision: https://reviews.llvm.org/D150922
Noah Goldstein [Sun, 28 May 2023 16:20:44 +0000 (11:20 -0500)]
[KnownBits] Cleanup some misspelling / logic in {u,s}div
Chronically misspelled 'denominator' as 'denuminator' and a few other
cases.
On the logic side, no longer require `RHS` to be strictly positive in
`sdiv`. This in turn means we need to handle a possible zero `denom`
in the APInt division.
Differential Revision: https://reviews.llvm.org/D150921
David Green [Tue, 6 Jun 2023 20:10:32 +0000 (21:10 +0100)]
[AArch64][SVE] Add one-use-check to EitherVSelectOrPassthruPatFrags
As pointed out in D149968 vselect predicate patterns could do with a one-use
check to prevent multiple operations being created. This updates the
EitherVSelectOrPassthruPatFrags pattern frags used in creating predicates
min/max.
Differential Revision: https://reviews.llvm.org/D151080
Fangrui Song [Tue, 6 Jun 2023 20:06:21 +0000 (13:06 -0700)]
[ELF] Add PT_RISCV_ATTRIBUTES program header
Close https://github.com/llvm/llvm-project/issues/63084
Unlike AArch32, RISC-V defines PT_RISCV_ATTRIBUTES to include the
SHT_RISCV_ATTRIBUTES section. There is no real-world use case yet.
We place PT_RISCV_ATTRIBUTES after PT_GNU_STACK, similar to PT_ARM_EXIDX. GNU ld
places PT_RISCV_ATTRIBUTES earlier, but the placement should not matter.
Link: https://github.com/riscv-non-isa/riscv-elf-psabi-doc/pull/71
Reviewed By: asb
Differential Revision: https://reviews.llvm.org/D152065
Jonas Devlieghere [Tue, 6 Jun 2023 19:25:41 +0000 (12:25 -0700)]
[lldb] Remove __FUNCTION__ from log messages in lldbHost (NFC)
LLDB's logging infrastructure supports prepending log messages with the
name of the file and function that generates the log (see help log
enable). Therefore it's unnecessary to include the current __FUNCTION__
in the log message itself. This patch removes __FUNCTION__ from log
messages in the Host library.
Differential revision: https://reviews.llvm.org/D151762
Stanislav Mekhanoshin [Tue, 6 Jun 2023 19:20:39 +0000 (12:20 -0700)]
[AMDGPU] Replace std::pair with VOPDCombineInfo in VOPD combine. NFC.
The future patch will carry additional info there.
Differential Revision: https://reviews.llvm.org/D152302
Guozhi Wei [Tue, 6 Jun 2023 19:45:34 +0000 (19:45 +0000)]
[GVN] Improve PRE on load instructions
This patch implements the enhancement proposed by
https://github.com/llvm/llvm-project/issues/59312.
Suppose we have following code
v0 = load %addr
br %LoadBB
LoadBB:
v1 = load %addr
...
PredBB:
...
br %cond, label %LoadBB, label %SuccBB
SuccBB:
v2 = load %addr
...
Instruction v1 in LoadBB is partially redundant, edge (PredBB, LoadBB) is a
critical edge. SuccBB is another successor of PredBB, it contains another load
v2 which is identical to v1. Current GVN splits the critical edge
(PredBB, LoadBB) and inserts a new load in it. A better method is move the load
of v2 into PredBB, then v1 can be changed to a PHI instruction.
If there are two or more similar predecessors, like the test case in the bug
entry, current GVN simply gives up because otherwise it needs to split multiple
critical edges. But we can move all loads in successor blocks into predecessors.
Differential Revision: https://reviews.llvm.org/D141712
Ellis Hoag [Tue, 6 Jun 2023 19:29:03 +0000 (12:29 -0700)]
[InstrProf] Fix warning about converting double to float
In https://reviews.llvm.org/D147812 I introduced the class
`BalancedPartitioning` and it seemed to trigger a warning in flang
```
C:\Users\buildbot-worker\minipc-ryzen-win\flang-x86_64-windows\llvm-project\llvm\include\llvm/Support/BalancedPartitioning.h(89): warning C4305: 'initializing': truncation from 'double' to 'float'
```
For good measure, I converted all double literals to floats. This should
be a NFC.
Joseph Huber [Tue, 6 Jun 2023 19:32:58 +0000 (14:32 -0500)]
[libc][Docs] Add support for the printing functions
Aart Bik [Tue, 6 Jun 2023 17:56:58 +0000 (10:56 -0700)]
[mlir][sparse][gpu] add AoS COO support to cuSPARSE
Even though this feature was deprecated in release 11.2,
any library before this version still supports the feature,
which is why we are making it available under a macro.
Reviewed By: K-Wu
Differential Revision: https://reviews.llvm.org/D152290
Joseph Huber [Tue, 6 Jun 2023 18:22:15 +0000 (13:22 -0500)]
[libc] Replace use of `asm` in the GPU code with LIBC_INLINE_ASM
We should more consistently use inline assembly using the LIBC wrappers.
It's much safer to mark all of these volatile as well.
Reviewed By: lntue
Differential Revision: https://reviews.llvm.org/D152294
Jonas Devlieghere [Tue, 6 Jun 2023 17:37:12 +0000 (10:37 -0700)]
[lldb] Support file and function names in LLDB_LOGF macro
LLDB's logging machinery supports prepending log messages with the name
of the file and function that generates the log. However, currently this
functionality is limited to the LLDB_LOG macro. I meant to do this as a
follow up to D65128 but never got around to it.
Differential revision: https://reviews.llvm.org/D151764
Jessica Clarke [Tue, 6 Jun 2023 19:14:20 +0000 (20:14 +0100)]
[RISCV] Don't persist invalid feature state on .option arch error
Otherwise subsequent .option arch, +foo directives (but not -, since
those have their own separate validation) fail the parseFeatureBits
check, leading to cascading errors.
Reviewed By: luismarques, MaskRay
Differential Revision: https://reviews.llvm.org/D152273
spupyrev [Thu, 16 Feb 2023 18:52:04 +0000 (10:52 -0800)]
[BOLT] stale profile matching [part 1 out of 2]
BOLT often has to deal with profiles collected on binaries built from several
revisions behind release. As a result, a certain percentage of functions is
considered stale and not optimized. This diff adds an ability to match profile
to functions that are not 100% binary identical, which increases the
optimization coverage and boosts the performance of applications.
The algorithm consists of two phases: matching and inference:
- At the matching phase, we try to "guess" as many block and jump counts from
the stale profile as possible. To this end, the content of each basic block
is hashed and stored in the (yaml) profile. When BOLT optimizes a binary,
it computes block hashes and identifies the corresponding entries in the
stale profile. It yields a partial profile for every CFG in the binary.
- At the inference phase, we employ a network flow-based algorithm (profi) to
reconstruct "realistic" block and jump counts from the partial profile
generated at the first stage. In practice, we don't always produce proper
profile data but the majority (e.g., >90%) of CFGs get the correct counts.
This is a first part of the change; the next stacked diff extends the block hashing
and provides perf evaluation numbers.
Reviewed By: maksfb
Differential Revision: https://reviews.llvm.org/D144500
Eric Li [Tue, 2 May 2023 17:59:46 +0000 (13:59 -0400)]
[clang][TypePrinter] Add option to skip over elaborated types
Elaborated types are sugar that represent how the type was spelled in
the original source. When printing a type outside of that original
context, the qualifiers as saved in the elaborated type will be
incorrect. Additionally, their existence also inhibits the use of
`PrintingCallbacks::isScopeVisible` as a customization point.
Differential Revision: https://reviews.llvm.org/D149677
Fangrui Song [Tue, 6 Jun 2023 19:01:22 +0000 (12:01 -0700)]
[Driver][test] Remove unneeded some REQUIRES:
to decrease the number of unsupported tests on other platforms.
Ellis Hoag [Tue, 6 Jun 2023 18:43:36 +0000 (11:43 -0700)]
[InstrProf] Use BalancedPartitioning to order temporal profiling trace data
In [0] we described an algorithm called //BalancedPartitioning// (bp) to consume function traces [1] and compute a function order that reduces the number of page faults during startup.
This patch adds the `order` command to the `llvm-profdata` tool which uses bp to output a function order that can be passed to the linker via `--symbol-ordering-file=`.
Special thanks to Sergey Pupyrev and Julian Mestre for designing this balanced partitioning algorithm.
[0] https://discourse.llvm.org/t/rfc-temporal-profiling-extension-for-irpgo/68068
[1] https://reviews.llvm.org/D147287
Reviewed By: spupyrev
Differential Revision: https://reviews.llvm.org/D147812
Craig Topper [Tue, 6 Jun 2023 18:59:12 +0000 (11:59 -0700)]
[RISCV] Add special case to selectImm for constants that can be created with (ADD (SLLI C, 32), C).
Where C is a simm32.
This costs an extra temporary register, but avoids a constant pool.
Reviewed By: reames
Differential Revision: https://reviews.llvm.org/D152236
Peter Klausler [Tue, 6 Jun 2023 18:37:52 +0000 (11:37 -0700)]
[flang] Set "undefined" NEXTREC=n variable to 0 rather than random garbage
12.10.2.17 defines that a INQUIRE statement's NEXTREC=n output value
for a unit that is not connected for direct access becomes undefined,
but the current I/O runtime can fail in a confusing manner by trying
to return uninitialized stack garbage.
Reported on Slack by Tarun Prabhu as an intermittent failure in
the gfortran regression test inquire_pre.f90.
Differential Revision: https://reviews.llvm.org/D152295
Simon Pilgrim [Tue, 6 Jun 2023 18:41:29 +0000 (19:41 +0100)]
[AArch64] Regenerate tests with missing immediate hex asm comments
Reduces diff in a future commit
Andrey Portnoy [Tue, 6 Jun 2023 18:19:53 +0000 (11:19 -0700)]
[mlir][Toy] Remove unnecessary transpose from chapter 1 example
The call to 'multiply_transpose' in the initialization of the variable 'f' was
intended to have a shape mismatch. However the variable 'a' has shape <2, 3> and
the variable 'c' has shape <3, 2>, so the arguments 'transpose(a)' and 'c' have
in fact compatible shapes (<3, 2> both), the opposite of what is wanted here.
This commit removes the transpose so that arguments 'a' and 'c' have
incompatible shapes <2, 3> and <3, 2>, respectively.
Reviewed By: mehdi_amini
Differential Revision: https://reviews.llvm.org/D151897
Jacques Pienaar [Tue, 6 Jun 2023 18:16:07 +0000 (11:16 -0700)]
[mlir] Convert quantized dialect bytecode to generated.
Serves as rather self-contained documentation for using the generator
from https://reviews.llvm.org/D144820.
Differential Revision: https://reviews.llvm.org/D152118
Alex Langford [Tue, 6 Jun 2023 18:00:42 +0000 (11:00 -0700)]
Re-apply "Revert "[DebugInfo] Add error checking around data extraction in DWARFAbbreviationDeclaration::extract""
This reverts commit
11d61c079d4b4927efea42a38a27d4586887b764 to re-apply
6836a47b7e6b57927664ec6ec750ae37bb951129 with modifications.
Specifically, the errors in DWARFAbbreviationDeclaration::extract needed
to be moved as they are returned to ensure the right Error constructor
is selected.
Arthur Eubanks [Mon, 5 Jun 2023 21:32:55 +0000 (14:32 -0700)]
[lld][COFF] Don't handle an input file multiple times when retrying
Follow up to D151815.
Or else we properly handle the first instance of a file, then error out on the second instance of the same file.
Reviewed By: rnk
Differential Revision: https://reviews.llvm.org/D152198
Alex Langford [Tue, 6 Jun 2023 17:58:51 +0000 (10:58 -0700)]
Revert "[DebugInfo] Add error checking around data extraction in DWARFAbbreviationDeclaration::extract"
This reverts commit
6836a47b7e6b57927664ec6ec750ae37bb951129.
This breaks some bots, need to investigate.
Med Ismail Bennani [Mon, 5 Jun 2023 20:19:44 +0000 (13:19 -0700)]
[lldb/Commands] Fix disk completion from root directory
This patch should fix path completion starting from the root directory.
To do so, this patch adds a special case when setting the search
directory when the completion buffer points to the root directory.
Differential Revision: https://reviews.llvm.org/D152013
Signed-off-by: Med Ismail Bennani <ismail@bennani.ma>
Med Ismail Bennani [Fri, 2 Jun 2023 17:39:41 +0000 (10:39 -0700)]
[lldb/crashlog] Expand crash report file path before parsing
This patch should fix a crash in the opening a crash report that was
passed with a relative path.
This patch expands the crash report path before parsing it and raises a
`FileNotFoundError` exception if the file doesn't exist.
Differential Revision: https://reviews.llvm.org/D152012
Signed-off-by: Med Ismail Bennani <ismail@bennani.ma>
Med Ismail Bennani [Tue, 6 Jun 2023 17:24:48 +0000 (10:24 -0700)]
[lldb/Commands] Add support to auto-completion for user commands
This patch should allow the user to set specific auto-completion type
for their custom commands.
To do so, we had to hoist the `CompletionType` enum so the user can
access it and add a new completion type flag to the CommandScriptAdd
Command Object.
So now, the user can specify which completion type will be used with
their custom command, when they register it.
This also makes the `crashlog` custom commands use disk-file completion
type, to browse through the user file system and load the report.
Differential Revision: https://reviews.llvm.org/D152011
Signed-off-by: Med Ismail Bennani <ismail@bennani.ma>
Med Ismail Bennani [Fri, 2 Jun 2023 08:34:27 +0000 (01:34 -0700)]
[lldb/Target] Add ability to set a label to targets
This patch add the ability for the user to set a label for a target.
This can be very useful when debugging targets with the same executables
in the same session.
Labels can be set either at the target creation in the command
interpreter or at any time using the SBAPI.
Target labels show up in the `target list` output, following the target
index, and they also allow the user to switch targets using them.
rdar://
105016191
Differential Revision: https://reviews.llvm.org/D151859
Signed-off-by: Med Ismail Bennani <ismail@bennani.ma>
Tue Ly [Tue, 6 Jun 2023 14:10:49 +0000 (10:10 -0400)]
[libc] Remove operator T from cpp::expected.
The libc's equivalent of std::expected has a non-standard and
non-explicit operator T - https://github.com/llvm/llvm-project/issues/62738
Reviewed By: sivachandra
Differential Revision: https://reviews.llvm.org/D152270
Alex Langford [Tue, 30 May 2023 21:35:05 +0000 (14:35 -0700)]
[DebugInfo] Add error checking around data extraction in DWARFAbbreviationDeclaration::extract
In trying to hoist errors further up this callstack, I discovered that
if the data in the debug_abbrev section is invalid entirely, the code
that parses the debug_abbrev section may do strange or unpredictable
things. The underlying issue is that DataExtractor will return a value
of 0 when it encounters an error in extracting a LEB128 value. It's thus
difficult to determine if there was an error just by looking at the
return value. This patch aims to bail at the first sight of an error in
the debug_abbrev parsing code.
Differential Revision: https://reviews.llvm.org/D151755
Elizabeth Andrews [Mon, 5 Jun 2023 20:12:13 +0000 (13:12 -0700)]
[Clang][Sema] Fix access of friend class in local class
Clang currently emits an error when a friend of a local class
tries to access it's private data members. This patch fixes the bug.
Differential Revision: https://reviews.llvm.org/D152195
Simon Pilgrim [Tue, 6 Jun 2023 17:24:59 +0000 (18:24 +0100)]
Revert rG98061013e01207444cfd3980 - [X86] X86FixupVectorConstantsPass - attempt to replace full width fp vector constant loads with broadcasts on AVX+ targets
Reverting while we address an existing issue exposed by this (Issue #63108)
Dirk MG Seynhaeve [Tue, 6 Jun 2023 17:30:11 +0000 (10:30 -0700)]
[llvm] Small typo in the instruction comments of WithColor header
Fix a small but misleading/confusing typo in the comments (which shows
up in the doxygen documentation):
Black -> BLACK (the enumeration is case-sensitive).
Differential revision: https://reviews.llvm.org/D151598
Slava Zakharin [Tue, 6 Jun 2023 16:40:00 +0000 (09:40 -0700)]
[flang][hlfir] Implemented addressing an element of a polymorphic array.
The changes convert hlfir.designate to fir.array_coor/fir.embox
to represent a subscripted element of a polymorphic array.
The type information is conveyed via the fir.embox's source_box.
Reviewed By: tblah
Differential Revision: https://reviews.llvm.org/D152200
Craig Topper [Tue, 6 Jun 2023 16:44:19 +0000 (09:44 -0700)]
[RISCV] Remove uses of RISCVII::hasMergeOp from RISCVDAGToDAGISel.cpp
This property was intended to indicate when RISCVAsmPrinter should
drop the tied source operand when converting to MCInst. Using it
in RISCVDAGToDAGISel distorts what it intended for.
This should remove some changes from D151850.
Reviewed By: frasercrmck, asb
Differential Revision: https://reviews.llvm.org/D152039
Nick Desaulniers [Mon, 5 Jun 2023 21:59:46 +0000 (14:59 -0700)]
reland: [Demangle] make llvm::demangle take std::string_view rather than const std::string&
As suggested by @erichkeane in
https://reviews.llvm.org/D141451#inline-1429549
There's potential for a lot more cleanups around these APIs. This is
just a start.
Callers need to be more careful about sub-expressions producing strings
that don't outlast the expression using `llvm::demangle`. Add a
release note.
Differential Revision: https://reviews.llvm.org/D149104
Simon Pilgrim [Tue, 6 Jun 2023 17:07:33 +0000 (18:07 +0100)]
Revert rGab4b924832ce26c21b88d7f82fcf4992ea8906bb - [X86] X86FixupVectorConstantsPass - attempt to replace full width integer vector constant loads with broadcasts on AVX2+ targets
Reverting while we address an existing issue exposed by this (Issue #63108)
Aart Bik [Tue, 6 Jun 2023 03:53:49 +0000 (20:53 -0700)]
[mlir][sparse] refine absent branch feeding into custom op
Document better that unary/binary may only feed to the output
or the input of a custom reduction (not even a regular reduction
since it may have "no value"!). Also fixes a bug when present
branch is empty and feeds into custom reduction.
Reviewed By: Peiming
Differential Revision: https://reviews.llvm.org/D152224
Vy Nguyen [Wed, 31 May 2023 18:22:07 +0000 (14:22 -0400)]
[lld-macho]Ensure canonicalization happen even for "skipped" referent sections.
Details:
See bug report: https://github.com/llvm/llvm-project/issues/63039
Differential Revision: https://reviews.llvm.org/D151824
Aaron Ballman [Tue, 6 Jun 2023 16:48:22 +0000 (12:48 -0400)]
Silence a "not all control paths return a value" warning; NFC
Sam McCall [Fri, 26 May 2023 12:59:54 +0000 (14:59 +0200)]
[ADT] Fix DenseMapInfo<variant>::isEqual to delegate to DenseMapInfo, not ==
Differential Revision: https://reviews.llvm.org/D151557
Kazu Hirata [Tue, 6 Jun 2023 16:35:56 +0000 (09:35 -0700)]
[ProfileData] Remove unused declaration getMemOPSizeRangeFromOption
The corresponding function definition was removed by:
commit
1ebee7adf8966ad9d2885c172a18104c94667061
Author: Hiroshi Yamauchi <yamauchi@google.com>
Date: Fri Oct 2 13:00:40 2020 -0700
Prabhdeep Singh Soni [Tue, 6 Jun 2023 15:11:53 +0000 (11:11 -0400)]
[Flang][OpenMP] Fix unused variable warning for task depend
This patch fixes an unused variable warning that was caused by the task
depend patch.
Original Commit:
3373c8405c5e144567c2b25c28b54b4ac63b09b6
Original Differential Revision: https://reviews.llvm.org/D146766
Yaxun (Sam) Liu [Mon, 5 Jun 2023 14:19:38 +0000 (10:19 -0400)]
[CUDA][HIP] Externalize device var in anonymous namespace
Device variables in an anonymous namespace may be
referenced by host code, therefore they need to
be externalized in a similar way as a static device
variables or kernels in an anonymous namespace.
Fixes: https://github.com/ROCm-Developer-Tools/HIP/issues/3246
Reviewed by: Artem Belevich
Differential Revision: https://reviews.llvm.org/D152164
yronglin [Tue, 6 Jun 2023 15:57:57 +0000 (23:57 +0800)]
[Clang] Reject increment of bool value in unevaluated contexts after C++17
Clang now incorrectly allowed increment of bool in unevaluated contexts, we set `diagnostic::ext_increment_bool` to be SFINAEFailure to fix this issue.
```
template<class T> auto f(T t) -> decltype(++t);
auto f(...) -> void;
void g() {
f(true); // Clang wrongly makes this a hard error
}
```
```
template <class T>
concept can_increment = requires(T t) { ++t; };
template <class T> void f() {
static_assert(requires(T t) { ++t; }); // Incorrectly allowed
}
int main() {
f<bool>();
static_assert(!can_increment<bool>); // Incorrectly fails
bool b = false;
++b; // Correctly rejected
}
```
Fix issue: https://github.com/llvm/llvm-project/issues/47517
Reviewed By: erichkeane
Differential Revision: https://reviews.llvm.org/D152259
LLVM GN Syncbot [Tue, 6 Jun 2023 15:51:54 +0000 (15:51 +0000)]
[gn build] Port
7a3b528e1b54
LLVM GN Syncbot [Tue, 6 Jun 2023 15:51:54 +0000 (15:51 +0000)]
[gn build] Port
51131edf83e4
Nikolas Klauser [Tue, 6 Jun 2023 15:43:22 +0000 (08:43 -0700)]
[libc++][PSTL] Implement std::replace{,_if,_copy,_copy_if}
Reviewed By: #libc, ldionne
Spies: ldionne, libcxx-commits
Differential Revision: https://reviews.llvm.org/D151841
Nikolas Klauser [Tue, 6 Jun 2023 15:42:40 +0000 (08:42 -0700)]
[libc++][PSTL] Implement std::count{,_if}
Reviewed By: ldionne, #libc
Spies: libcxx-commits
Differential Revision: https://reviews.llvm.org/D150128
prabhukr [Tue, 6 Jun 2023 15:13:57 +0000 (08:13 -0700)]
[Triple] Add triple for UEFI
Target triple to support "x86_64-unknown-uefi"
Reviewed By: phosek
Differential Revision: https://reviews.llvm.org/D131594
Mikhail Goncharov [Tue, 6 Jun 2023 15:35:37 +0000 (17:35 +0200)]
[clang][test] Use a physical copy of FS
(missing piece from https://reviews.llvm.org/D152265)
476e7c49ecb762df1d68273696b06c36feb0fd96
Marco Elver [Tue, 6 Jun 2023 15:31:19 +0000 (17:31 +0200)]
[compiler-rt] Do not redefine builtins on Windows
Build bots are still failing, and getting it to work on Windows should
be done in a separate patch, should this even be technically feasible.
| lld-link: error:
| stage2_win_x64/obj/compiler-rt/lib/asan/asan_shared_library.asan_activation.obj:
| memcpy should not refer to special section 0
Jolanta Jensen [Fri, 2 Jun 2023 15:30:12 +0000 (15:30 +0000)]
[SVE ACLE] Extend existing aarch64_sve_mul combines to also act on aarch64_sve_mul_u.
Differential Revision: https://reviews.llvm.org/D152004
Zequan Wu [Mon, 5 Jun 2023 19:07:06 +0000 (15:07 -0400)]
[LLDB][PDB] Fix age field in UUID in PDB file.
There are two age fields in a PDB file. One from the PDB Stream and another one
from the DBI stream.
According to https://randomascii.wordpress.com/2011/11/11/source-indexing-is-underused-awesomeness/#comment-34328,
The age in DBI stream is used to against the binary's age. `Pdbstr.exe` is used
to only increment the age from PDB stream without changing the DBI age. I
also verified this by manually changing the DBI age of a PDB file and let
`windbg.exe` to load it. It shows the following logs before and after changing:
Before:
```
SYMSRV: BYINDEX: 0xA
c:\symbols*https://msdl.microsoft.com/download/symbols
nlaapi.pdb
D72AA69CD5ABE5D28C74FADB17DE3F8C1
SYMSRV: PATH: c:\symbols\nlaapi.pdb\
D72AA69CD5ABE5D28C74FADB17DE3F8C1\nlaapi.pdb
SYMSRV: RESULT: 0x00000000
*** WARNING: Unable to verify checksum for NLAapi.dll
DBGHELP: NLAapi - public symbols
c:\symbols\nlaapi.pdb\
D72AA69CD5ABE5D28C74FADB17DE3F8C1\nlaapi.pdb
...
```
After:
```
SYMSRV: BYINDEX: 0xA
c:\symbols*https://msdl.microsoft.com/download/symbols
nlaapi.pdb
D72AA69CD5ABE5D28C74FADB17DE3F8C1
SYMSRV: PATH: c:\symbols\nlaapi.pdb\
D72AA69CD5ABE5D28C74FADB17DE3F8C1\nlaapi.pdb
SYMSRV: RESULT: 0x00000000
DBGHELP: c:\symbols\nlaapi.pdb\
D72AA69CD5ABE5D28C74FADB17DE3F8C1\nlaapi.pdb - mismatched pdb
SYMSRV: BYINDEX: 0xB
c:\symbols*https://chromium-browser-symsrv.commondatastorage.googleapis.com
nlaapi.pdb
D72AA69CD5ABE5D28C74FADB17DE3F8C1
SYMSRV: PATH: c:\symbols\nlaapi.pdb\
D72AA69CD5ABE5D28C74FADB17DE3F8C1\nlaapi.pdb
SYMSRV: RESULT: 0x00000000
DBGHELP: c:\symbols\nlaapi.pdb\
D72AA69CD5ABE5D28C74FADB17DE3F8C1\nlaapi.pdb - mismatched pdb
SYMSRV: BYINDEX: 0xC
c:\src\symbols*https://msdl.microsoft.com/download/symbols
nlaapi.pdb
D72AA69CD5ABE5D28C74FADB17DE3F8C1
SYMSRV: PATH: c:\src\symbols\nlaapi.pdb\
D72AA69CD5ABE5D28C74FADB17DE3F8C1\nlaapi.pdb
SYMSRV: RESULT: 0x00000000
*** WARNING: Unable to verify checksum for NLAapi.dll
DBGHELP: NLAapi - public symbols
c:\src\symbols\nlaapi.pdb\
D72AA69CD5ABE5D28C74FADB17DE3F8C1\nlaapi.pdb
```
So, `windbg.exe` uses the DBI age to detect mismatched pdb, but it still loads
the pdb even if the age mismatched. Probably lldb should do the same and give
some warnings.
This fixes a bug that lldb can't load some windows system pdbs due to mismatched
uuid.
Reviewed By: rnk
Differential Revision: https://reviews.llvm.org/D152189
Mark de Wever [Tue, 6 Jun 2023 15:16:23 +0000 (17:16 +0200)]
[libc++] Fixes transitive includes.
paperchalice [Tue, 6 Jun 2023 15:10:10 +0000 (08:10 -0700)]
[lldb] fix dangling reference in `ClangHost.cpp`
The lifetime of clang_resource_path should be same as
kResourceDirSuffixes, because kResourceDirSuffixes doesn't own
clang_resource_path.
Differential Revision: https://reviews.llvm.org/D152225
Nikita Popov [Tue, 6 Jun 2023 13:24:09 +0000 (15:24 +0200)]
[Clang] Convert some tests to opaque pointers (NFC)
Quentin Colombet [Mon, 5 Jun 2023 13:06:07 +0000 (15:06 +0200)]
[mlir][Vector] Fix a propagation bug with broadcast
In the vector distribute patterns, we used to move
`vector.broadcast`s out of `vector.warp_execute_on_lane0`s
irrespectively of how they were defined.
This could create broadcast operations with invalid semantic.
E.g.,
```
%r = warop ...[32] ... -> vector<1x2xf32> {
%val = broadcast %in : vector<64xf32> to vetor<1x64xf32>
vector.yield %val : vector<1x64xf32>
}
```
=>
```
%r = warop ...[32] ... -> vector<64xf32> {
vector.yield %in : vector<64xf32>
}
// Broadcasting to a narrower type!
broadcast %r : vector<64xf32> to vector<1x2xf32>
```
The root issue is we are trying to broadcast something that is not the same
for each thread, so there is actually nothing to propagate here.
The fix checks that the broadcast we want to create actually makes sense.
Differential Revision: https://reviews.llvm.org/D152154
Endre Fulop [Thu, 29 Sep 2022 07:31:40 +0000 (09:31 +0200)]
[analyzer][NFC] Pass the diagnostic message to the TrackConstraintBRVisitor
The `TrackConstraintBRVisitor` should accept a message for the note
instead of creating one. It would let us inject domain-specific
knowledge in a non-intrusive way, leading to a more generic visitor.
Differential Revision: https://reviews.llvm.org/D152255
Mikhail Goncharov [Tue, 6 Jun 2023 14:26:07 +0000 (16:26 +0200)]
Revert "Reland [MergeICmps] Adapt to non-eq comparisons, bugfix"
Causes miscompile. See https://reviews.llvm.org/D141188.
This reverts commit
fb2c98a929aa65603e9d984307a41325e577e9d3
Prabhdeep Singh Soni [Thu, 23 Mar 2023 15:26:50 +0000 (11:26 -0400)]
[Flang][OpenMP] Support depend clause for task construct, excluding array sections
This patch adds support for the OpenMP 4.0 depend clause for the task
construct, excluding array sections, to Flang lowering from parse-tree
to MLIR.
Reviewed By: kiranchandramohan
Differential Revision: https://reviews.llvm.org/D146766
Marco Elver [Tue, 30 May 2023 09:59:22 +0000 (11:59 +0200)]
[compiler-rt] Avoid memintrinsic calls inserted by the compiler
D135716 introduced -ftrivial-auto-var-init=pattern where supported.
Unfortunately this introduces unwanted memset() for large stack arrays,
as shown by the new tests added for asan and msan (tsan already had this
test).
In general, the problem of compiler-inserted memintrinsic calls
(memset/memcpy/memmove) is not new to compiler-rt, and has been a
problem before.
To avoid introducing unwanted memintrinsic calls, we redefine
memintrinsics as __sanitizer_internal_mem* at the assembly level for
most source files automatically (where sanitizer_common_internal_defs.h
is included).
In few cases, redefining a symbol in this way causes issues for
interceptors, namely the memintrinsic interceptor themselves. For such
source files we have to selectively disable the redefinition.
Other alternatives have been considered, but simply do not work well in
the context of compiler-rt:
1. Linker --wrap: this does not work because --wrap only
applies to the final link, and would not apply when building
sanitizer static libraries.
2. Changing references to memset() via objcopy: this may work,
but due to the complexities of the build system, introducing
such a post-processing step for the right object files (in
particular object files defining memset cannot be touched)
seems infeasible.
The chosen solution works well (as shown by the tests). Other libraries
have chosen the same solution where nothing else works (see e.g. glibc's
"symbol-hacks.h").
v4:
- Add interface attribute to __sanitizer_internal_mem* declarations as
well, as otherwise some compilers (MSVC) will complain.
- Add SANITIZER_COMMON_NO_REDEFINE_BUILTINS to source files using
C++STL, since this could lead to ODR violations (see added comment).
v3:
- Don't use ALIAS() to alias internal_mem*() functions to
__sanitizer_internal_mem*() functions, but just define them as
ALWAYS_INLINE functions instead. This will work on darwin and windows.
v2:
- Fix ubsan_minimal build where compiler decides to insert
memset/memcpy: ubsan_minimal has work without RTSanitizerCommonLibc,
therefore do not redefine the builtins.
- Fix definition of internal_mem* functions with compilers that want the
aliased function to already be defined before.
- Fix definition of __sanitizer_internal_mem* functions with compilers
more pedantic about attribute placement around extern "C".
Reviewed By: vitalybuka, dvyukov
Differential Revision: https://reviews.llvm.org/D151152
Jessica Clarke [Tue, 6 Jun 2023 13:54:43 +0000 (14:54 +0100)]
[RISCV] Rework .option arch target streamer interface
The current interface requires some rather ugly tracking of state due to
splitting up the calls for each argument. Instead, pack them all into a
single call by passing an ArrayRef. Also clean up the dodgy whitespace
emitted for the directive whilst here; there was a stray space between
the tab and .option, and there was a tab rather than a space after the
first comma for some strange reason.
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D152193
Jessica Clarke [Tue, 6 Jun 2023 13:54:40 +0000 (14:54 +0100)]
[RISCV] Make .option arch parser less mind-bending
Currently the early-return flow in the infinite loop makes it hard to
find the non-error termination points amongst the sea of errors. Rewrite
it with a more conventional control flow that has a clear loop guard (in
place of one of the early returns) and a break (in place of the other),
and with greater code reuse.
This has a small effect on the errors given for malformed input, as seen
in the affected test, and is probably more helpful as a result. Note
that we also bail early now if parseComma fails, as is standard.
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D152192
Kadir Cetinkaya [Tue, 6 Jun 2023 13:40:33 +0000 (15:40 +0200)]
[clang][test] Use a physical copy of FS
Make use of a physical copy, rather than real FS in unittests that
change working-directory to get rid of the side effect of changing cwd for the
whole process. It's triggering crashes depending on the test order.
Differential Revision: https://reviews.llvm.org/D152265
Simon Pilgrim [Tue, 6 Jun 2023 13:38:19 +0000 (14:38 +0100)]
[GlobalISel][X86] Move G_SEXT_INREG legalization handling to beside the regular integer extension legalizations
Andrew Ng [Wed, 17 May 2023 18:20:59 +0000 (19:20 +0100)]
[llvm-objcopy][ELF] Preserve sh_link to .symtab when applicable
This change to llvm-objcopy preserves the ELF section sh_link to .symtab
so long as none of the symbol table indices have been changed.
Previously, any invocation of llvm-objcopy including a "no-op" would
clear any section sh_link to .symtab.
Differential Revision: https://reviews.llvm.org/D150859
Nikita Popov [Tue, 6 Jun 2023 12:55:56 +0000 (14:55 +0200)]
[InstCombine] Add stats for number of iterations (NFC)
Jay Foad [Tue, 6 Jun 2023 13:10:07 +0000 (14:10 +0100)]
[GlobalIsel][X86] Remove an unused variable
Jay Foad [Thu, 4 May 2023 14:34:28 +0000 (15:34 +0100)]
[AMDGPU] Remove extract_subvector patterns
Removing them seems to slightly increase code quality as well as
simplifying both the tablegen and C++ parts of the code.
Differential Revision: https://reviews.llvm.org/D149853
Corentin Jabot [Tue, 6 Jun 2023 07:21:16 +0000 (09:21 +0200)]
[Clang] Allow omitting `typename` in befriended constructors parameters
Fixes #63119
Reviewed By: #clang-language-wg, aaron.ballman
Differential Revision: https://reviews.llvm.org/D152242
Ricardo Jesus [Fri, 2 Jun 2023 09:02:06 +0000 (09:02 +0000)]
[AArch64][NFC] Normalise name of indexed forms of SQRDMLAH/SQRDMLSH
Most indexed vector instructions are suffixed with v<N><TY>_indexed.
SQRDMLAH/SQRDMLSH are the exception, being suffixed with <TY>_indexed
instead, which can complicate matching them slightly.
Differential Revision: https://reviews.llvm.org/D152161