platform/upstream/llvm.git
16 months ago[GISelEmitter][NFC] Correct path of GISel's td file in the comment.
Kai Luo [Mon, 20 Feb 2023 02:05:37 +0000 (10:05 +0800)]
[GISelEmitter][NFC] Correct path of GISel's td file in the comment.

`include/llvm/CodeGen/TargetGlobalISel.td` no longer exists.

16 months agoAMDGPU: Restrict foldFreeOpFromSelect combine based on legal source mods
Matt Arsenault [Mon, 23 Jan 2023 15:22:33 +0000 (11:22 -0400)]
AMDGPU: Restrict foldFreeOpFromSelect combine based on legal source mods

Provides a small code size savings for some f32 cases.

16 months agoReland "[Fuchsia] Enable llvm-driver build".
Alex Brachet [Mon, 20 Feb 2023 01:57:40 +0000 (01:57 +0000)]
Reland "[Fuchsia] Enable llvm-driver build".

The MacOS problem has been fixed. Additionally, don't enable the
driver build on Windows. We can look into enabling it later if
symlinks work better than I think on Windows.

Differential Revision: https://reviews.llvm.org/D144287

16 months agoAMDGPU: Teach fneg combines that select has source modifiers
Matt Arsenault [Thu, 15 Dec 2022 00:23:55 +0000 (19:23 -0500)]
AMDGPU: Teach fneg combines that select has source modifiers

We do match source modifiers for f32 typed selects already, but the
combiner code was never informed of this.

A long time ago the documentation lied and stated that source
modifiers don't work for v_cndmask_b32 when they in fact do. We had a
bunch fo code operating under the assumption that they don't support
source modifiers, so we tried to move fnegs around to work around
this.

Gets a few small improvements here and there. The main hazard to watch
out for is infinite loops in the combiner since we try to move fnegs
up and down the DAG. For now, don't fold fneg directly into select.
The generic combiner does this for a restricted set of cases
when getNegatedExpression obviously shows an improvement for both
operands. It turns out to be trickier to avoid infinite looping the
combiner in conjunction with pulling out source modifiers, so
leave this for a later commit.

16 months ago[GlobalISel] Fix a store-merging bug due to use of >= instead of >.
Amara Emerson [Sun, 19 Feb 2023 23:36:36 +0000 (15:36 -0800)]
[GlobalISel] Fix a store-merging bug due to use of >= instead of >.

This fixes a corner case where we would skip doing an alias check because of a
>= vs > bug, due to the presence of a non-aliasing instruction, in this case
the load %safeld.

Fixes issue #59376

16 months ago[CMake] Fix driver build on MacOS
Alex Brachet [Sun, 19 Feb 2023 23:42:11 +0000 (23:42 +0000)]
[CMake] Fix driver build on MacOS

16 months ago[InstCombine] canonicalize "extract lowest set bit" away from cttz intrinsic
Sanjay Patel [Sun, 19 Feb 2023 15:33:30 +0000 (10:33 -0500)]
[InstCombine] canonicalize "extract lowest set bit" away from cttz intrinsic

1 << (cttz X) --> -X & X
https://alive2.llvm.org/ce/z/qv3E9e

This creates an extra use of the input value, so that's generally
not preferred, but there are advantages to this direction:
1. 'negate' and 'and' allow for better analysis than 'cttz'.
2. This is more likely to induce follow-on transforms (in the
   example from issue #60801, we'll get the decrement pattern).
3. The more basic ALU ops are more likely to result in better
   codegen across a variety of targets.

This won't solve the motivating bugs (see issue #60799) because
we do not recognize the redundant icmp+sel, and the x86 backend
may not have the pattern-matching to produce the optimal BMI
instructions.

Differential Revision: https://reviews.llvm.org/D144329

16 months agoRecommit "[Support] change StringMap hash function from djbHash to xxHash"
Erik Desjardins [Sun, 19 Feb 2023 18:47:09 +0000 (13:47 -0500)]
Recommit "[Support] change StringMap hash function from djbHash to xxHash"

This reverts commit 37eb9d13f891f7656f811516e765b929b169afe0.

Test failures have been fixed:

- ubsan failure fixed by 72eac42f21c0f45a27f3eaaff9364cbb5189b9e4
- warn-unsafe-buffer-usage-fixits-local-var-span.cpp fixed by
  03cc52dfd1dbb4a59b479da55e87838fb93d2067 (wasn't related)
- test-output-format.ll failure was spurious, build failed at
  https://lab.llvm.org/buildbot/#/builders/54/builds/3545 (b4431b2d945b6fc19b1a55ac6ce969a8e06e1e93)
  but passed at
  https://lab.llvm.org/buildbot/#/builders/54/builds/3546 (5ae99be0377248c74346096dc475af254a3fc799)
  which is before my revert
  https://github.com/llvm/llvm-project/compare/b4431b2d945b6fc19b1a55ac6ce969a8e06e1e93...5ae99be0377248c74346096dc475af254a3fc799

Original commit message:

    Depends on https://reviews.llvm.org/D142861.

    Alternative to https://reviews.llvm.org/D137601.

    xxHash is much faster than djbHash. This makes a simple Rust test case with a large constant string 10% faster to compile.

    Previous attempts at changing this hash function (e.g. https://reviews.llvm.org/D97396) had to be reverted due to breaking tests that depended on iteration order.
    No additional tests fail with this patch compared to `main` when running `check-all` with `-DLLVM_ENABLE_PROJECTS="all"` (on a Linux host), so I hope I found everything that needs to be changed.

    Differential Revision: https://reviews.llvm.org/D142862

16 months ago[SLP] Fix infinite loop in isUndefVector.
Florian Hahn [Sun, 19 Feb 2023 21:42:04 +0000 (21:42 +0000)]
[SLP] Fix infinite loop in isUndefVector.

This fixes an infinite loop if isa<T>(II->getOperand(1)) is true.
Update Base at the top of the loop, before the continue.

Reviewed By: ABataev

Differential Revision: https://reviews.llvm.org/D144292

16 months ago[RISCV][MC] Mark Zawrs extension as non-experimental
Alex Bradbury [Sun, 19 Feb 2023 20:40:58 +0000 (20:40 +0000)]
[RISCV][MC] Mark Zawrs extension as non-experimental

Support for the unratified 1.0-rc3 specification was introduced in
D133443. The specification has since been ratified (in November 2022
according to the recently ratified extensions list
<https://wiki.riscv.org/display/HOME/Recently+Ratified+Extensions>.

A review of the diff
<https://github.com/riscv/riscv-zawrs/compare/V1.0-rc3...main> of the
1.0-rc3 spec vs the current/ratified document shows no changes to the
instruction encoding or naming. At one point, a note was added
<https://github.com/riscv/riscv-zawrs/commit/e84f42406a7c88eb92452515b2035144a7023a51>
indicating Zawrs depends on the Zalrsc extension (not officially
specified, but I believe to be just the LR/SC instructions from the A
extension). The final text ended up as "The instructions in the Zawrs
extension are only useful in conjunction with the LR instructions, which
are provided by the A extension, and which we also expect to be provided
by a narrower Zalrsc extension in the future." I think it's consistent
with this phrasing to not require the A extension for Zawrs, which
matches what was implemented.

No intrinsics are implemented for Zawrs currently, meaning we don't need
to additionally review whether those intrinsics can be considered
finalised and ready for exposure to end users.

Differential Revision: https://reviews.llvm.org/D143507

16 months ago[RISCV] Add fgtq.s and fgeq.s assembler aliases for Zfa.
Craig Topper [Sun, 19 Feb 2023 20:27:24 +0000 (12:27 -0800)]
[RISCV] Add fgtq.s and fgeq.s assembler aliases for Zfa.

We can swap operands and use fltq.s and fleq.s. Similar for D and H.

16 months ago[RISCV] Remove Commutable property from Zfa fltq/fleq instructions.
Craig Topper [Sun, 19 Feb 2023 19:37:17 +0000 (11:37 -0800)]
[RISCV] Remove Commutable property from Zfa fltq/fleq instructions.

16 months agoUse APInt::popcount instead of APInt::countPopulation (NFC)
Kazu Hirata [Sun, 19 Feb 2023 19:29:12 +0000 (11:29 -0800)]
Use APInt::popcount instead of APInt::countPopulation (NFC)

This is for consistency with the C++20-style bit manipulation
functions in <bit>.

16 months ago[lld][test][RISCV] Don't use incorrectly normalised arch string in riscv-attributes...
Alex Bradbury [Sun, 19 Feb 2023 19:15:32 +0000 (19:15 +0000)]
[lld][test][RISCV] Don't use incorrectly normalised arch string in riscv-attributes-place.s

Per the psABI, the arch string should be normalised to (amongest other
things) always include the full version of each extension in form
zfoo1p0. riscv-attributes-place.s didn't conform to this, which is not a
problem for the current parsing logic, but this behaviour would change
with a patch I'm about to propose.

This makes riscv-sttributes-place.s feature a valid arch string, and
maintains test coverage for this particular form of invalid arch string
by adding it to riscv-attributes.s.

16 months ago[ARM] Add targets for Arm DebugInfo tests. NFC
David Green [Sun, 19 Feb 2023 19:13:41 +0000 (19:13 +0000)]
[ARM] Add targets for Arm DebugInfo tests. NFC

This prevents the instructions being invalid for the subtarget.

16 months ago[VPlan] Make sure properlyDominates(A, A) returns false.
Florian Hahn [Sun, 19 Feb 2023 18:01:15 +0000 (18:01 +0000)]
[VPlan] Make sure properlyDominates(A, A) returns false.

At the moment, properlyDominates(A, A) can return true via
LocalComesBefore. Add an early exit to ensure it returns false if
A == B.

Note: no test has been added because the existing test suite covers this
case already with libc++ with assertions enabled.

Fixes https://github.com/llvm/llvm-project/issues/60850.

16 months agoFix potential crash in Flang generateLLVMIR() when MLIR fails to translate to LLVM
Mehdi Amini [Sun, 19 Feb 2023 06:14:20 +0000 (22:14 -0800)]
Fix potential crash in Flang generateLLVMIR() when MLIR fails to translate to LLVM

This is pure code motion, to ensure that the check if we have a valid llvmModule
comes before trying to set option on this module.

Differential Revision: https://reviews.llvm.org/D144342

16 months ago[libc++][format] Disables test on GCC-12.
Mark de Wever [Sun, 19 Feb 2023 15:44:56 +0000 (16:44 +0100)]
[libc++][format] Disables test on GCC-12.

These tests fail in D144331, for the same reason other format tests fail
in GCC. This is a resource issue.

16 months agoFix clang-tools-extra docs build
Carlos Galvez [Sun, 19 Feb 2023 13:58:31 +0000 (13:58 +0000)]
Fix clang-tools-extra docs build

16 months ago[clang-tidy] Introduce HeaderFileExtensions and ImplementationFileExtensions options
Carlos Galvez [Wed, 25 Jan 2023 05:26:07 +0000 (05:26 +0000)]
[clang-tidy] Introduce HeaderFileExtensions and ImplementationFileExtensions options

Re-introduce the patch that was reverted previously.
In the first attempt, the checks would not be able to
read from the global option, since getLocalOrGlobal
only works with string types. Additional logic is needed
in order to support both use cases in the transition
period. All that logic will be removed when the local
options are fully removed.

We have a number of checks designed to analyze problems
in header files only, for example:

bugprone-suspicious-include
google-build-namespaces
llvm-header-guard
misc-definitions-in-header
...

All these checks duplicate the same logic and options
to determine whether a location is placed in the main
source file or in the header. More checks are coming
up with similar requirements.

Thus, to remove duplication, let's move this option
to the top-level configuration of clang-tidy (since
it's something all checks should share).

Add a deprecation notice for all checks that use the
local option, prompting to update to the global option.

Differential Revision: https://reviews.llvm.org/D142655

16 months agoRevert "[SimplifyCFG] Check if the return instruction causes undefined behavior"
DianQK [Sun, 19 Feb 2023 13:08:29 +0000 (21:08 +0800)]
Revert "[SimplifyCFG] Check if the return instruction causes undefined behavior"

This reverts commit b6eed9a82e0ce530d94a194c88615d6c272e1854.

17 months ago[SimplifyCFG] Check if the return instruction causes undefined behavior
DianQK [Sun, 19 Feb 2023 08:42:33 +0000 (16:42 +0800)]
[SimplifyCFG] Check if the return instruction causes undefined behavior

This should fix https://github.com/rust-lang/rust/issues/107681.

Return undefined to a noundef return value is undefined.

Example:

```
define noundef i32 @test_ret_noundef(i1 %cond) {
entry:
  br i1 %cond, label %bb1, label %bb2
bb1:
  br label %bb2
bb2:
  %r = phi i32 [ undef, %entry ], [ 1, %bb1 ]
  ret i32 %r
}
```

Differential Revision: https://reviews.llvm.org/D144319

17 months ago[lldb] Add missing wasm switch case
Benjamin Kramer [Sun, 19 Feb 2023 09:54:10 +0000 (10:54 +0100)]
[lldb] Add missing wasm switch case

TypeSystemClang.cpp:4855:13: error: enumeration value 'WasmExternRef' not handled in switch [-Werror,-Wswitch]

17 months ago[BOLT] Attempt to fix bolt/test/runtime/AArch64/adrrelaxationpass.s after D144079
Kristina Bessonova [Sun, 19 Feb 2023 08:09:23 +0000 (10:09 +0200)]
[BOLT] Attempt to fix bolt/test/runtime/AArch64/adrrelaxationpass.s after D144079

Differential Revision: https://reviews.llvm.org/D144344

17 months ago[SCEV] Add automated test checks for some tests
Joshua Cao [Sun, 19 Feb 2023 06:10:36 +0000 (22:10 -0800)]
[SCEV] Add automated test checks for some tests

17 months ago[sanitizers] Update global_symbols.txt
Vitaly Buka [Sun, 19 Feb 2023 07:39:34 +0000 (23:39 -0800)]
[sanitizers] Update global_symbols.txt

17 months agollvm-tblgen: Anonymize some functions.
NAKAMURA Takumi [Fri, 17 Feb 2023 14:25:40 +0000 (23:25 +0900)]
llvm-tblgen: Anonymize some functions.

17 months ago[RISCV] Add Zfa test cases for strict ONE and UEQ comparisons. NFC
Craig Topper [Sun, 19 Feb 2023 01:24:10 +0000 (17:24 -0800)]
[RISCV] Add Zfa test cases for strict ONE and UEQ comparisons. NFC

These correspond to islessgreater and it inverse.

17 months ago[mlir] Execute all requested translations in MlirTranslateMain
Fabian [Sat, 18 Feb 2023 20:31:37 +0000 (21:31 +0100)]
[mlir] Execute all requested translations in MlirTranslateMain

Currently, MlirTranslateMain only executes one of the requested translations, and does not error if multiple are specified. This commit enables translations to be chained in the specified order.

This makes round-trip tests easier, since existing import/export passes can be reused and no combined round-trip passes have to be registered (example: mlir-translate  -serialize-spirv -deserialize-spirv).

Additionally, by leveraging TranslateRegistration with file-to-file TranslateFunctions, generic pre- and post-processing can be added before/after conversion to/from MLIR.

Reviewed By: lattner, Mogball

Differential Revision: https://reviews.llvm.org/D143719

17 months ago[RISCV] Handle RISCVISD::SplitF64 and RISCVISD::BuildPairF64 during isel with Zfa.
Craig Topper [Sun, 19 Feb 2023 00:43:50 +0000 (16:43 -0800)]
[RISCV] Handle RISCVISD::SplitF64 and RISCVISD::BuildPairF64 during isel with Zfa.

Instead of special casing Zfa in the custom inserters, select the
correct instructions during isel.

BuildPairF64 we can do with pattern, but SplitF64 requires custom
selection due to the two destinations.

If we didn't need SplitF64 without Zfa, I would have an extract low
and extract high ISD opcode for Zfa to avoid that issue.

17 months ago[DivRemPairs] Strip division's poison generating flag
Juneyoung Lee [Sat, 18 Feb 2023 20:43:26 +0000 (20:43 +0000)]
[DivRemPairs] Strip division's poison generating flag

Given this transformation: X % Y -> X - (X / Y) * Y

This patch strips off the poison-generating flag of X / Y such as exact, because it may make the optimized form result poison whereas X % Y does not.

The issue was reported here: https://github.com/llvm/llvm-project/issues/60748

Reviewed By: nikic

Differential Revision: https://reviews.llvm.org/D144333

17 months agoAdd a test for D144333
Juneyoung Lee [Sat, 18 Feb 2023 20:03:15 +0000 (20:03 +0000)]
Add a test for D144333

17 months ago[clang-format] Handle tabs in file path for git-clang-format
Michael Kirk [Sat, 18 Feb 2023 20:50:44 +0000 (12:50 -0800)]
[clang-format] Handle tabs in file path for git-clang-format

17 months ago[SCEV] Fix FoldID::addInteger(unsigned long I)
Vitaly Buka [Sat, 18 Feb 2023 02:29:42 +0000 (18:29 -0800)]
[SCEV] Fix FoldID::addInteger(unsigned long I)

"unsigned long" can be 8 bytes, but the code assumes 4.

This this the real root cause D122215 was reverted.

Reviewed By: fhahn

Differential Revision: https://reviews.llvm.org/D144316

17 months agoRevert "[SimplifyCFG] Check if the return instruction causes undefined behavior"
Vitaly Buka [Sat, 18 Feb 2023 20:21:10 +0000 (12:21 -0800)]
Revert "[SimplifyCFG] Check if the return instruction causes undefined behavior"

Breaks bots
https://lab.llvm.org/buildbot/#/builders/236/builds/2349
https://lab.llvm.org/buildbot/#/builders/74/builds/17361
https://lab.llvm.org/buildbot/#/builders/168/builds/11972

This reverts commit 7be55b007698f6b6398cbbea69c327b5a971938a.

17 months ago[AArch64] Concat zip1 and zip2 is a wider zip1
David Green [Sat, 18 Feb 2023 19:54:29 +0000 (19:54 +0000)]
[AArch64] Concat zip1 and zip2 is a wider zip1

Given concat(zip1(a, b), zip2(a, b)), we can convert that to a 128bit zip1(a, b)
if we widen a and b out first.

Fixes #54226

Differential Revision: https://reviews.llvm.org/D121088

17 months ago[ValueTracking] Add cases for additional ops in `isKnownNonZero`
Noah Goldstein [Sat, 18 Feb 2023 19:36:06 +0000 (13:36 -0600)]
[ValueTracking] Add cases for additional ops in `isKnownNonZero`

Add cases for the following ops:
    - 0-X            -- https://alive2.llvm.org/ce/z/6C75Li
    - bitreverse(X)  -- https://alive2.llvm.org/ce/z/SGG1q9
    - bswap(X)       -- https://alive2.llvm.org/ce/z/p7pzwh
    - ctpop(X)       -- https://alive2.llvm.org/ce/z/c5y3BC
    - abs(X)         -- https://alive2.llvm.org/ce/z/yxXGz_
                        https://alive2.llvm.org/ce/z/rSRg4K
    - uadd_sat(X, Y) -- https://alive2.llvm.org/ce/z/Zw-y4W
                        https://alive2.llvm.org/ce/z/2NRqRz
                        https://alive2.llvm.org/ce/z/M1OpF8

Reviewed By: nikic

Differential Revision: https://reviews.llvm.org/D142828

17 months ago[ValueTracking] Add tests for additional `isKnownNonZero` cases; NFC
Noah Goldstein [Sat, 18 Feb 2023 19:36:24 +0000 (13:36 -0600)]
[ValueTracking] Add tests for additional `isKnownNonZero` cases; NFC

Add cases for the following ops:
    - 0-X
    - bitreverse(X)
    - bswap(X)
    - ctpop(X)
    - abs(X)
    - uadd_sat(X, Y)

Reviewed By: nikic

Differential Revision: https://reviews.llvm.org/D142827

17 months ago[ValueTracking] Add KnownBits patterns `xor(x, x - 1)` and `and(x, -x)` for knowing...
Noah Goldstein [Thu, 26 Jan 2023 17:36:05 +0000 (11:36 -0600)]
[ValueTracking] Add KnownBits patterns `xor(x, x - 1)` and `and(x, -x)` for knowing upper bits to be zero

These two BMI pattern will clear the upper bits of result past the
first set bit. So if we know a single bit in `x` is set, we know that
`results[bitwidth - 1, log2(x) + 1] = 0`.

Alive2:
blsmsk: https://alive2.llvm.org/ce/z/a397BS
blsi: https://alive2.llvm.org/ce/z/tsbQhC

Differential Revision: https://reviews.llvm.org/D142271

17 months ago[ValueTracking] Add tests for known bits after common BMI pattern (blsmsk/blsi); NFC
Noah Goldstein [Thu, 26 Jan 2023 17:36:16 +0000 (11:36 -0600)]
[ValueTracking] Add tests for known bits after common BMI pattern (blsmsk/blsi); NFC

Differential Revision: https://reviews.llvm.org/D142270

17 months ago[KnownBits] Add blsi and blsmsk
Jay Foad [Thu, 26 Jan 2023 17:34:50 +0000 (11:34 -0600)]
[KnownBits] Add blsi and blsmsk

Reviewed By: nikic

Differential Revision: https://reviews.llvm.org/D142519

17 months ago[llvm-tapi-diff] add default case to switch for symbol flags
Cyndy Ishida [Sat, 18 Feb 2023 19:27:44 +0000 (11:27 -0800)]
[llvm-tapi-diff] add default case to switch for symbol flags

17 months ago[TextAPI] Capture new properties from TBD to InterfaceFile
Cyndy Ishida [Sat, 18 Feb 2023 18:37:44 +0000 (10:37 -0800)]
[TextAPI] Capture new properties from TBD to InterfaceFile

* Deployment Versions for targets
* Run Search Paths
* Text vs Data Segment attributes to symbols

Reviewed By: pete

Differential Revision: https://reviews.llvm.org/D144158

17 months agollvm-tblgen: Add "TableGenBackends.h" to each emitter.
NAKAMURA Takumi [Sat, 18 Feb 2023 17:52:39 +0000 (02:52 +0900)]
llvm-tblgen: Add "TableGenBackends.h" to each emitter.

"TableGenBackends.h" has declarations of emitters.

17 months agollvm-tblgen: Add missing includes
NAKAMURA Takumi [Sat, 18 Feb 2023 18:01:00 +0000 (03:01 +0900)]
llvm-tblgen: Add missing includes

17 months agollvm-tblgen: Reformat
NAKAMURA Takumi [Sat, 18 Feb 2023 14:15:23 +0000 (23:15 +0900)]
llvm-tblgen: Reformat

17 months ago[GlobalISel] Fix G_ZEXTLOAD being converted to G_SEXTLOAD incorrectly.
Amara Emerson [Sat, 18 Feb 2023 17:51:17 +0000 (09:51 -0800)]
[GlobalISel] Fix G_ZEXTLOAD being converted to G_SEXTLOAD incorrectly.

The extending loads combine tries to prefer sign-extends folding into loads vs
zexts, and in cases where a G_ZEXTLOAD is first used by a G_ZEXT, and then used
by a G_SEXT, it would select the G_SEXT even though the load is already
zero-extending.

Fixes issue #59630

17 months agoRevert "[SCCP] Remove legacy SCCP pass."
Florian Hahn [Sat, 18 Feb 2023 18:00:18 +0000 (18:00 +0000)]
Revert "[SCCP] Remove legacy SCCP pass."

This reverts commit 5356fefc19df3fbf32d180b1b10e6226e8743541.

It looks like Polly still relies on the legacy SCCP pass. Bring it back
until the best way forward is determined.

17 months ago[NFC][libc++][format] Small improvements.
Mark de Wever [Sat, 18 Feb 2023 17:30:56 +0000 (18:30 +0100)]
[NFC][libc++][format] Small improvements.

While working on the formatter for the thread::id several minor issues
where spotted. This fixes them.

17 months ago[SCCP] Remove legacy SCCP pass.
Florian Hahn [Sat, 18 Feb 2023 17:54:29 +0000 (17:54 +0000)]
[SCCP] Remove legacy SCCP pass.

This is part of the optimization pipeline, of which the legacy pass manager version is deprecated.

Reviewed By: aeubanks

Differential Revision: https://reviews.llvm.org/D144201

17 months ago[NFC][libc++][doc] Fixes formatting.
Mark de Wever [Sat, 18 Feb 2023 17:30:56 +0000 (18:30 +0100)]
[NFC][libc++][doc] Fixes formatting.

17 months ago[Flang] Add PowerPC intrinsics
Kelvin Li [Sat, 18 Feb 2023 05:09:13 +0000 (00:09 -0500)]
[Flang] Add PowerPC intrinsics

This patch adds a subset of PowerPC intrinsics - fmadd,
fmsub, fnmadd and fnmsub.

Differential Revision: https://reviews.llvm.org/D143951

17 months ago[AArch64InstPrinter][llvm-objdump] Print ADR PC-relative label as a target address...
Kristina Bessonova [Sat, 18 Feb 2023 16:31:21 +0000 (18:31 +0200)]
[AArch64InstPrinter][llvm-objdump] Print ADR PC-relative label as a target address hexadecimal form

This is similar to ADRP and matches GNU objdump:

GNU objdump:
```
0000000000200100 <_start>:
  200100:    adr    x0, 201000 <_start+0xf00>
```

llvm-objdump (before patch):
```
0000000000200100 <_start>:
  200100:    adr    x0, #3840
```

llvm-objdump (after patch):
```
0000000000200100 <_start>:
  200100:    adr    x0, 0x201000 <_start+0xf00>
```

Reviewed By: simon_tatham, peter.smith

Differential Revision: https://reviews.llvm.org/D144079

17 months ago[SimplifyCFG] Check if the return instruction causes undefined behavior
DianQK [Sat, 18 Feb 2023 15:09:07 +0000 (23:09 +0800)]
[SimplifyCFG] Check if the return instruction causes undefined behavior

This should fix https://github.com/rust-lang/rust/issues/107681.

Return undefined to a noundef return value is undefined.

Example:

```
define noundef i32 @test_ret_noundef(i1 %cond) {
entry:
  br i1 %cond, label %bb1, label %bb2
bb1:
  br label %bb2
bb2:
  %r = phi i32 [ undef, %entry ], [ 1, %bb1 ]
  ret i32 %r
}
```

Reviewed By: nikic

Differential Revision: https://reviews.llvm.org/D144319

17 months ago[libc][bazel] Fix missing dependency in test/src/stdlib targets.
Tue Ly [Sat, 18 Feb 2023 15:16:13 +0000 (10:16 -0500)]
[libc][bazel] Fix missing dependency in test/src/stdlib targets.

17 months ago[InstCombine] add tests for 1<<cttz(x); NFC
Sanjay Patel [Sat, 18 Feb 2023 12:19:04 +0000 (07:19 -0500)]
[InstCombine] add tests for 1<<cttz(x); NFC

issue #60799
issue #60801

17 months ago[libc++] Fix header includes in <__atomic/cxx_atomic_impl.h>
Nikolas Klauser [Sat, 18 Feb 2023 00:27:24 +0000 (01:27 +0100)]
[libc++] Fix header includes in <__atomic/cxx_atomic_impl.h>

Reviewed By: #libc, philnik

Spies: Mordante, paulkirth, libcxx-commits

Differential Revision: https://reviews.llvm.org/D144307

17 months ago[libc++][test] Removes rapid-cxx-test.h.
Mark de Wever [Sat, 21 Jan 2023 12:35:30 +0000 (13:35 +0100)]
[libc++][test] Removes rapid-cxx-test.h.

Depends on D142808

Reviewed By: #libc, ldionne

Differential Revision: https://reviews.llvm.org/D143383

17 months ago[Doc] Fix type-o under LangRef
eopXD [Sat, 18 Feb 2023 10:12:24 +0000 (02:12 -0800)]
[Doc] Fix type-o under LangRef

Signed-off-by: eop Chen <eop.chen@sifive.com>
17 months ago[NFC][GlobalISel] Regenerate test checks for extending-loads test.
Amara Emerson [Sat, 18 Feb 2023 09:48:25 +0000 (01:48 -0800)]
[NFC][GlobalISel] Regenerate test checks for extending-loads test.

17 months ago[WebAssembly] assert(false) -> llvm_unreachable
Benjamin Kramer [Sat, 18 Feb 2023 08:38:18 +0000 (09:38 +0100)]
[WebAssembly] assert(false) -> llvm_unreachable

Avoids warnings in -asserts builds.

ASTContext.cpp:4098:1: error: non-void function does not return a value in all control paths [-Werror,-Wreturn-type]
}
^

17 months ago[flang] Remove macro replacement in angular bracket includes
Ethan Luis McDonough [Sat, 18 Feb 2023 07:56:15 +0000 (01:56 -0600)]
[flang] Remove macro replacement in angular bracket includes

Addresses Github issue [[ https://github.com/llvm/llvm-project/issues/60317 | #60317 ]].

Reviewed By: klausler

Differential Revision: https://reviews.llvm.org/D143469

17 months ago[gn build] Port 79320a0c3f82
LLVM GN Syncbot [Sat, 18 Feb 2023 06:30:26 +0000 (06:30 +0000)]
[gn build] Port 79320a0c3f82

17 months agoReland "[TextAPI] Implement TBDv5 Reader"
Cyndy Ishida [Sat, 18 Feb 2023 03:55:47 +0000 (19:55 -0800)]
Reland "[TextAPI] Implement TBDv5 Reader"

Introduce initial reader for TBDv5 which is in JSON. This captures all
the currently understood fields within the internal structure
`InterfaceFile`.
New fields will be followed up in future PRs.

Reviewed By: pete

Differential Revision: https://reviews.llvm.org/D144156

17 months ago[X86][NFC] Assert MRMr0 format from emitREXPrefix
Shengchen Kan [Sat, 18 Feb 2023 06:11:52 +0000 (14:11 +0800)]
[X86][NFC] Assert MRMr0 format from emitREXPrefix

The only instruction of this format is VEX encoding

17 months ago[llvm-jitlink] Discard allocation actions in -noexec mode.
Lang Hames [Sat, 18 Feb 2023 04:16:16 +0000 (20:16 -0800)]
[llvm-jitlink] Discard allocation actions in -noexec mode.

Allocation actions may run JIT'd code, which isn't permitted in -noexec mode.

Testcases that depend on actions running should be moved to the ORC runtime.

17 months ago[LSAN] Mask out tags from pointers on ARM in MaybeUserPointer heuristic
Kirill Stoimenov [Sat, 18 Feb 2023 00:02:06 +0000 (00:02 +0000)]
[LSAN] Mask out tags from pointers on ARM in MaybeUserPointer heuristic

This caused false positives because the existing logic was not taking into account that pointers could have a tag in them.

Reviewed By: vitalybuka

Differential Revision: https://reviews.llvm.org/D144305

17 months ago[WebAssembly] Initial support for reference type externref in clang
Paulo Matos [Sat, 18 Feb 2023 02:38:58 +0000 (18:38 -0800)]
[WebAssembly] Initial support for reference type externref in clang

This patch introduces a new type __externref_t that denotes a WebAssembly opaque
reference type. It also implements builtin __builtin_wasm_ref_null_extern(),
that returns a null value of __externref_t. This lays the ground work
for further builtins and reference types.

Reviewed By: aaron.ballman

Differential Revision: https://reviews.llvm.org/D122215

17 months ago[OpenMP] Make isDone lightweight without calling synchronize
Ye Luo [Sat, 18 Feb 2023 01:55:40 +0000 (19:55 -0600)]
[OpenMP] Make isDone lightweight without calling synchronize

~TaskAsyncInfoWrapperTy() calls isDone. With synchronize inside isDone, we need to handle the error return from synchronize in the destructor.
The consumers of TaskAsyncInfoWrapperTy, targetDataMapper and targetKernel, both call AsyncInfo.synchronize() before exiting.
For this reason in ~TaskAsyncInfoWrapperTy(), calling synchronize() via isDone() is redundant.
This patch removes synchronize() call inside isDone() and makes it a lightweight check.
__tgt_target_nowait_query needs to call synchronize() before checking isDone().

Differential Revision: https://reviews.llvm.org/D144315

17 months agoIROutliner: cast instead of dyn_cast and assert
Matt Arsenault [Mon, 26 Dec 2022 17:14:36 +0000 (12:14 -0500)]
IROutliner: cast instead of dyn_cast and assert

17 months agoCodeExtractor: Fix creating addrspacecasts for lifetime markers
Matt Arsenault [Thu, 5 Jan 2023 16:13:44 +0000 (11:13 -0500)]
CodeExtractor: Fix creating addrspacecasts for lifetime markers

Also stop caring about typed pointers.

17 months agoSimplify with hasFeature. NFC
Fangrui Song [Sat, 18 Feb 2023 02:22:24 +0000 (18:22 -0800)]
Simplify with hasFeature. NFC

17 months ago[flang] Adding fir::getSymbolAttrName attribute to the function corresponding to...
Renaud-K [Fri, 17 Feb 2023 20:44:33 +0000 (12:44 -0800)]
[flang] Adding fir::getSymbolAttrName attribute to the function corresponding to the main subprogram.
This is because the source name cannot be deconstructed from _QQmain

Differential revision: https://reviews.llvm.org/D144295

17 months ago[RISCV] Add missing plumbing and tests for zfa
Philip Reames [Sat, 18 Feb 2023 00:25:01 +0000 (16:25 -0800)]
[RISCV] Add missing plumbing and tests for zfa

Experimental support for the zfa extension was recently added in https://reviews.llvm.org/D141984. A couple of the normal test changes and clang plumbing got missed in that change. This commit updates the usual suspects.

Differential Revision: https://reviews.llvm.org/D144288

17 months ago[lldb] Make persisting result variables configurable
Dave Lee [Thu, 16 Feb 2023 23:39:09 +0000 (15:39 -0800)]
[lldb] Make persisting result variables configurable

Context: The `expression` command uses artificial variables to store the expression
result. This result variable is unconditionally kept around after the expression command
has completed. These variables are known as persistent results. These are the variables
`$0`, `$1`, etc, that are displayed when running `p` or `expression`.

This change allows users to control whether result variables are persisted, by
introducing a `--persistent-result` flag.

This change keeps the current default behavior, persistent results are created by
default. This change gives users the ability to opt-out by re-aliasing `p`. For example:

```
command unalias p
command alias p expression --persistent-result false --
```

For consistency, this flag is also adopted by `dwim-print`. Of note, if asked,
`dwim-print` will create a persistent result even for frame variables.

Differential Revision: https://reviews.llvm.org/D144230

17 months ago[lldb] Add expression command options in dwim-print
Dave Lee [Wed, 15 Feb 2023 16:23:57 +0000 (08:23 -0800)]
[lldb] Add expression command options in dwim-print

Adopt `expression`'s options in `dwim-print`.

This is primarily added to support the `--language`/`-l` flag.

Differential Revision: https://reviews.llvm.org/D144114

17 months ago[gn build] Port 07e3ca238e68
LLVM GN Syncbot [Sat, 18 Feb 2023 00:29:10 +0000 (00:29 +0000)]
[gn build] Port 07e3ca238e68

17 months agoRevert "[TextAPI] Implement TBDv5 Reader"
Cyndy Ishida [Sat, 18 Feb 2023 00:25:33 +0000 (16:25 -0800)]
Revert "[TextAPI] Implement TBDv5 Reader"

This reverts commit b861b1225380175a5a724e2a677754f5f74e5b0d.
This reverts commit 4be17641b05df1e63fa8e069af92676f1246eb83.

This patch wont build on some compilers on buildbot.

17 months ago[TextAPI] wrap returned Errors in std::move
Cyndy Ishida [Sat, 18 Feb 2023 00:15:12 +0000 (16:15 -0800)]
[TextAPI] wrap returned Errors in std::move

17 months ago[gn build] Port b861b1225380
LLVM GN Syncbot [Sat, 18 Feb 2023 00:06:09 +0000 (00:06 +0000)]
[gn build] Port b861b1225380

17 months ago[TextAPI] Implement TBDv5 Reader
Cyndy Ishida [Fri, 17 Feb 2023 23:58:04 +0000 (15:58 -0800)]
[TextAPI] Implement TBDv5 Reader

    [TextAPI] Implement TBDv5 Reader

    Introduce initial reader for TBDv5 which is in JSON. This captures all
    the currently understood fields within the internal structure
    `InterfaceFile`.

    New fields & follow up tests will be followed up in future PRs.

Reviewed By: pete

Differential Revision: https://reviews.llvm.org/D144156

17 months ago[GlobalISel] Combine out-of-range shifts to undef.
Amara Emerson [Fri, 17 Feb 2023 22:35:22 +0000 (14:35 -0800)]
[GlobalISel] Combine out-of-range shifts to undef.

Differential Revision: https://reviews.llvm.org/D144303

17 months ago[Clang] Fix __VA_OPT__ implementation so that it treats the concatenation of a non...
Shafik Yaghmour [Fri, 17 Feb 2023 22:56:02 +0000 (14:56 -0800)]
[Clang] Fix __VA_OPT__ implementation so that it treats the concatenation of a non-placemaker token and placemaker token as a non-placemaker token

Currently the implementation of __VA_OPT__ will treat the concatenation of a
non-placemaker token and placemaker token as a placemaker token which is not
correct. This will fix the implementation and treat the result as a
non-placemaker token.

This fixes: https://github.com/llvm/llvm-project/issues/60268

Differential Revision: https://reviews.llvm.org/D142604

17 months ago[RISCV] Use MCSubtargetInfo::hasFeature where possible. NFC
Craig Topper [Fri, 17 Feb 2023 22:36:48 +0000 (14:36 -0800)]
[RISCV] Use MCSubtargetInfo::hasFeature where possible. NFC

Rather than using operator[] on getFeatureBits we can use
hasFeature to shorten the code.

Reviewed By: MaskRay

Differential Revision: https://reviews.llvm.org/D144300

17 months ago[AArch64] Simplify with MCSubtargetInfo::hasFeature. NFC
Fangrui Song [Fri, 17 Feb 2023 22:29:21 +0000 (14:29 -0800)]
[AArch64] Simplify with MCSubtargetInfo::hasFeature. NFC

17 months agoRevert "[Fuchsia] Enable llvm-driver build"
Alex Brachet [Fri, 17 Feb 2023 21:29:14 +0000 (21:29 +0000)]
Revert "[Fuchsia] Enable llvm-driver build"

This reverts commit 4eadd19cc423b860f7ce0217000276da769b7809.

Doesn't work on macos. I'll investigate more

17 months ago[libc++][NFC] Remove TODOs that are already done
Nikolas Klauser [Fri, 17 Feb 2023 21:17:45 +0000 (22:17 +0100)]
[libc++][NFC] Remove TODOs that are already done

17 months ago[llvm-cov] Create syntax to pass source w/o binary.
Daniel Thornburgh [Wed, 15 Feb 2023 23:27:21 +0000 (15:27 -0800)]
[llvm-cov] Create syntax to pass source w/o binary.

Since binary ID lookup makes CLI object arguments optional, it should be
possible to pass a list of source files without a binary. Unfortunately,
the current syntax will always interpret the first source file as a
binary. This change adds a `-sources` option to cause all later
positional arguments to be considered sources.

Reviewed By: gulfem

Differential Revision: https://reviews.llvm.org/D144207

17 months ago[Fuchsia] Enable llvm-driver build
Alex Brachet [Fri, 17 Feb 2023 21:02:18 +0000 (21:02 +0000)]
[Fuchsia] Enable llvm-driver build

Differential Revision: https://reviews.llvm.org/D144287

17 months ago[libc++][NFC] Replace _VSTD and _LIBCPP_INLINE_VISIBILITY in <__atomic/*>
Nikolas Klauser [Fri, 17 Feb 2023 12:00:21 +0000 (13:00 +0100)]
[libc++][NFC] Replace _VSTD and _LIBCPP_INLINE_VISIBILITY in <__atomic/*>

Reviewed By: Mordante, #libc

Spies: libcxx-commits

Differential Revision: https://reviews.llvm.org/D144258

17 months ago[RISCV] Select signed and unsigned bitfield extracts for XTHeadBb
Philipp Tomsich [Fri, 17 Feb 2023 20:11:51 +0000 (21:11 +0100)]
[RISCV] Select signed and unsigned bitfield extracts for XTHeadBb

The XTHeadBb extension hab both signed and unsigned bitfield
extraction instructions (TH.EXT and TH.EXTU, respectively) which have
previously only been supported for sign extension on byte, halfword,
and word-boundaries.

This adds the infrastructure to use TH.EXT and TH.EXTU for arbitrary
bitfield extraction.

Reviewed By: craig.topper

Differential Revision: https://reviews.llvm.org/D144229

17 months ago[lldb] StructuredData should not truncate uint64_t values
Alex Langford [Fri, 17 Feb 2023 02:17:59 +0000 (18:17 -0800)]
[lldb] StructuredData should not truncate uint64_t values

In json::Value, getAsInteger returns an optional<int64_t> and getAsNumber
returns an optional<double>. If a value is larger than what an int64_t
can hold but smaller than what a uint64_t can hold, the getAsInteger
function will fail but the getAsNumber will succeed. However, the value
shouldn't be interpreted as a double.

rdar://105556974

Differential Revision: https://reviews.llvm.org/D144238

17 months ago[libc++][format] Addresses LWG3810.
Mark de Wever [Fri, 17 Feb 2023 17:10:14 +0000 (18:10 +0100)]
[libc++][format] Addresses LWG3810.

  LWG3810 CTAD for std::basic_format_args

Reviewed By: #libc, philnik

Differential Revision: https://reviews.llvm.org/D144275

17 months ago[NVPTX] Use by default 'sm_60' architecture when expanding %ptxas-verify macro.
Pavel Kopyl [Fri, 13 Jan 2023 18:02:49 +0000 (19:02 +0100)]
[NVPTX] Use by default 'sm_60' architecture when expanding %ptxas-verify macro.

Also get rid of explicitly specified '-march' values for old architectures.
This simplifies %ptxas-verify statements.
After the change, we can potentially miss cases where a new functionality
is added to the architecture without appropriate checks in the
backend. On the other hand, this is mostly true for old architectures
that have been thoroughly tested.

Differential Revision: https://reviews.llvm.org/D141736

17 months ago[libc++] Mark a test relying on `typeid` as unsupported without RTTI.
Konstantin Varlamov [Fri, 17 Feb 2023 19:20:29 +0000 (11:20 -0800)]
[libc++] Mark a test relying on `typeid` as unsupported without RTTI.

17 months ago[libc] Add basic fuzz target for the printf parser
Michael Jones [Fri, 10 Feb 2023 23:00:32 +0000 (15:00 -0800)]
[libc] Add basic fuzz target for the printf parser

The goal is to fuzz the entirety of printf, but the plan is to do it in
pieces for simplicity. This test fuzzes just the parser, while later
tests will fuzz the converters. This also adds a mock version of the
arg_list class.

Reviewed By: sivachandra

Differential Revision: https://reviews.llvm.org/D143784

17 months ago[libc] add mock arg list
Michael Jones [Thu, 16 Feb 2023 00:03:04 +0000 (16:03 -0800)]
[libc] add mock arg list

For testing purposes we need to be able to mock out the ArgList class.
This patch adds a mock version of that class as well as a flag to enable
it.

Reviewed By: sivachandra

Differential Revision: https://reviews.llvm.org/D144145

17 months ago[mlir][tensor] Do not use affine ops on non-perfect-tiling unpack cases.
Hanhan Wang [Thu, 16 Feb 2023 01:36:21 +0000 (17:36 -0800)]
[mlir][tensor] Do not use affine ops on non-perfect-tiling unpack cases.

Do not create an Affine ops for expanded size because the affine op is
too complicated which would hit an assertion in affine ops
simplification.

Reviewed By: mravishankar

Differential Revision: https://reviews.llvm.org/D144151

17 months ago[RISCV] For rv32, accept constants like 0xfffff800 as a valid simm12.
Craig Topper [Fri, 17 Feb 2023 18:53:44 +0000 (10:53 -0800)]
[RISCV] For rv32, accept constants like 0xfffff800 as a valid simm12.

Internally we store constants in int64_t after parsing, but this is
kind of an implementation detail. If we only supported rv32, we might
have chosen int32_t.

For rv32, I think it makes sense to accept the constants that we
would accept if int32_t was the internal type. In fact we already
do this for the `li` alias. This patch extends this to sign
extended constants for other instructions.

This matches the GNU assembler. The difference between LLVM and gcc
was previously noted here. https://github.com/riscv-non-isa/riscv-asm-manual/pull/71

Reviewed By: reames

Differential Revision: https://reviews.llvm.org/D144166

17 months agoRevert "[RISCV] Add performMULcombine to perform strength-reduction"
Philipp Tomsich [Fri, 17 Feb 2023 18:46:13 +0000 (19:46 +0100)]
Revert "[RISCV] Add performMULcombine to perform strength-reduction"

This reverts commit 20cc23c708f04ca3fbc4289a68302a4b684ce448.