Commit Graph

463510 Commits

Author SHA1 Message Date
Louis Dionne
7d2b9fafab [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
2023-06-06 13:28:09 -07:00
Craig Topper
4f5f38bdab [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
2023-06-06 13:23:17 -07:00
Arthur Eubanks
5f8f310a1d [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
2023-06-06 13:15:09 -07:00
Noah Goldstein
e387f49d13 [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
2023-06-06 15:14:10 -05:00
Noah Goldstein
85378b7663 [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
2023-06-06 15:14:10 -05:00
Noah Goldstein
809b1d834d [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
2023-06-06 15:14:10 -05:00
Noah Goldstein
8b2767f257 [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
2023-06-06 15:14:10 -05:00
David Green
2a8df8d0b9 [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
2023-06-06 21:10:32 +01:00
Fangrui Song
698ac4aba5 [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
2023-06-06 13:06:21 -07:00
Jonas Devlieghere
7cd1d4231a [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
2023-06-06 13:02:43 -07:00
Stanislav Mekhanoshin
febcf99e9d [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
2023-06-06 12:53:23 -07:00
Guozhi Wei
84bcfa0e1b [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
2023-06-06 19:45:34 +00:00
Ellis Hoag
266ffd7aff [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.
2023-06-06 12:36:49 -07:00
Joseph Huber
8aad5012cc [libc][Docs] Add support for the printing functions 2023-06-06 14:33:08 -05:00
Aart Bik
9fc02a7a08 [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
2023-06-06 12:32:46 -07:00
Joseph Huber
27a80fc946 [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
2023-06-06 14:24:52 -05:00
Jonas Devlieghere
6099d519bb [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
2023-06-06 12:24:38 -07:00
Jessica Clarke
db1d72b155 [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
2023-06-06 20:15:12 +01:00
spupyrev
44268271f6 [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
2023-06-06 12:13:52 -07:00
Eric Li
3cb6ead77c [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
2023-06-06 15:11:09 -04:00
Fangrui Song
64666d46c0 [Driver][test] Remove unneeded some REQUIRES:
to decrease the number of unsupported tests on other platforms.
2023-06-06 12:01:22 -07:00
Ellis Hoag
1117b9a284 [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
2023-06-06 11:59:57 -07:00
Craig Topper
58b2d652af [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
2023-06-06 11:59:12 -07:00
Peter Klausler
e468f07550 [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
2023-06-06 11:58:01 -07:00
Simon Pilgrim
9a81b69757 [AArch64] Regenerate tests with missing immediate hex asm comments
Reduces diff in a future commit
2023-06-06 19:44:28 +01:00
Andrey Portnoy
444bb1f1bb [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
2023-06-06 11:23:35 -07:00
Jacques Pienaar
f007bcbc3c [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
2023-06-06 11:16:07 -07:00
Alex Langford
94935c0d9a Re-apply "Revert "[DebugInfo] Add error checking around data extraction in DWARFAbbreviationDeclaration::extract""
This reverts commit 11d61c079d to re-apply
6836a47b7e with modifications.

Specifically, the errors in DWARFAbbreviationDeclaration::extract needed
to be moved as they are returned to ensure the right Error constructor
is selected.
2023-06-06 11:13:31 -07:00
Arthur Eubanks
ec1998cd48 [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
2023-06-06 11:07:00 -07:00
Alex Langford
11d61c079d Revert "[DebugInfo] Add error checking around data extraction in DWARFAbbreviationDeclaration::extract"
This reverts commit 6836a47b7e.
This breaks some bots, need to investigate.
2023-06-06 10:59:59 -07:00
Med Ismail Bennani
e8966125e2 [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>
2023-06-06 10:58:34 -07:00
Med Ismail Bennani
3bc0baf9d4 [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>
2023-06-06 10:58:34 -07:00
Med Ismail Bennani
6a9c3e6115 [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>
2023-06-06 10:58:34 -07:00
Med Ismail Bennani
1e82b20118 [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>
2023-06-06 10:58:34 -07:00
Tue Ly
b95ed8b6d9 [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
2023-06-06 13:57:44 -04:00
Alex Langford
6836a47b7e [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
2023-06-06 10:50:54 -07:00
Elizabeth Andrews
c1401e9f3e [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
2023-06-06 10:46:50 -07:00
Simon Pilgrim
a279a09ab9 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)
2023-06-06 18:44:24 +01:00
Dirk MG Seynhaeve
f8b2cbf7ed [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
2023-06-06 10:31:13 -07:00
Slava Zakharin
4fbaefa246 [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
2023-06-06 10:26:02 -07:00
Craig Topper
45680acbbe [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
2023-06-06 10:19:52 -07:00
Nick Desaulniers
8abbc17ff3 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
2023-06-06 10:18:06 -07:00
Simon Pilgrim
78de45fd4a 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)
2023-06-06 18:07:33 +01:00
Aart Bik
e2167d89db [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
2023-06-06 09:57:15 -07:00
Vy Nguyen
7e5f4ed556 [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
2023-06-06 12:53:03 -04:00
Aaron Ballman
07028acacf Silence a "not all control paths return a value" warning; NFC 2023-06-06 12:48:22 -04:00
Sam McCall
9e932e08a8 [ADT] Fix DenseMapInfo<variant>::isEqual to delegate to DenseMapInfo, not ==
Differential Revision: https://reviews.llvm.org/D151557
2023-06-06 18:36:37 +02:00
Kazu Hirata
f705a60eb7 [ProfileData] Remove unused declaration getMemOPSizeRangeFromOption
The corresponding function definition was removed by:

  commit 1ebee7adf8
  Author: Hiroshi Yamauchi <yamauchi@google.com>
  Date:   Fri Oct 2 13:00:40 2020 -0700
2023-06-06 09:35:56 -07:00
Prabhdeep Singh Soni
e0fed04366 [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: 3373c8405c

Original Differential Revision: https://reviews.llvm.org/D146766
2023-06-06 12:29:42 -04:00
Yaxun (Sam) Liu
f2677afe91 [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
2023-06-06 12:03:48 -04:00