Commit Graph

435811 Commits

Author SHA1 Message Date
Jessica Paquette e166d2e00b [llvm-remarkutil] NFC: Combine parsing + serializing for bitstream2yaml
We don't need to populate a string table, so we don't need to pre-parse the
remarks.

Split the bitstream2yaml and yaml2bitstream cases up so that we can avoid the
extra remark traversal in the bitstream2yaml case.

This kills the TODO.
2022-09-13 11:34:33 -07:00
Siva Chandra Reddy ef3e80b6bd [libc][Obvious] Use unique test file names in dup, dup2 and dup3 tests. 2022-09-13 18:20:04 +00:00
Michal Paszkowski cf46835e88 [Docs] Added LLVM SPIR-V Backend Working Group 2022-09-13 20:17:37 +02:00
Zequan Wu 901f74ca69 [gn build] port c8daf4a707 (check-lldb)
Reviewed By: thakis

Differential Revision: https://reviews.llvm.org/D133718
2022-09-13 11:17:01 -07:00
Christian Sigg d308113354 [Bazel] Bump bazel version to 5.0.
See https://discourse.llvm.org/t/use-bazelisk-for-bazel-buildbots/65188.

Reviewed By: mehdi_amini

Differential Revision: https://reviews.llvm.org/D133750
2022-09-13 20:09:13 +02:00
Craig Topper 8d7e73effe [RISCV] Teach lowerVECTOR_SHUFFLE to recognize some shuffles as vnsrl.
Unary shuffles such as <0,2,4,6,8,10,12,14> or <1,3,5,7,9,11,13,15>
where half the elements are returned, can be lowered using vnsrl.

SelectionDAGBuilder lowers such shuffles as a build_vector of
extract_elements since the mask has less elements than the source.
To fix this, I've enable the extractSubvectorIsCheapHook to allow
DAGCombine to rebuild the shuffle using 2 extract_subvectors preceding
the shufffle.

I've gone very conservative on extractSubvectorIsCheapHook to minimize
test impact and match what we have test coverage for. This can be
improved in the future.

Reviewed By: reames

Differential Revision: https://reviews.llvm.org/D133736
2022-09-13 11:07:11 -07:00
Siva Chandra Reddy 8989aa003f [libc] Add POSIX functions dup, dup2, and GNU extension function dup3.
Reviewed By: lntue

Differential Revision: https://reviews.llvm.org/D133748
2022-09-13 18:06:30 +00:00
Jim Ingham 6c089b2af5 Be more careful to maintain quoting information when parsing commands.
This is particularly a problem for alias construction, where you might
want to have a backtick surrounded option in the alias.  Before this
patch:

command alias expression -Z \`argc\` -- argv

for instance would be rendered as:

expression -Z argc -- argv

and would fail to work.

Differential Revision: https://reviews.llvm.org/D133045
2022-09-13 11:02:47 -07:00
Scott Linder bfc550a361 Add pointer-to-member example to AMDGPUDwarfExtensionAllowLocationDescriptionOnTheDwarfExpressionStack.md
Differential Revision: https://reviews.llvm.org/D133735
2022-09-13 17:57:28 +00:00
Scott Linder a17401cc08 Fix typo in AMDGPUDwarfExtensionAllowLocationDescriptionOnTheDwarfExpressionStack.md
Differential Revision: https://reviews.llvm.org/D133734
2022-09-13 17:57:28 +00:00
Scott Linder 3cf2cf2c53 dos2unix AMDGPUDwarfExtensionAllowLocationDescriptionOnTheDwarfExpressionStack.md
Differential Revision: https://reviews.llvm.org/D133733
2022-09-13 17:57:28 +00:00
Alex Bradbury c44c1e9d3e [RISCV] Implement isMaskAndCmp0FoldingBeneficial hook
This hook is currently only used by CodeGenPrepare, which will sink *and
duplicate* an 'and' into a block that has an 'icmp 0' user of it if the
hook returns true.

This hook is less useful for RISC-V than for targets like AArch64 that
have a TBZ (test bit and branch if zero instruction), but may still be
profitable if Zbs is available and a BEXTI can be selected.

Conservatively, we return false even if Zbs is enabled for any masks
that fit in the ANDI immediate because it's possible the only use is a
branch on the result, and ANDI+BNEZ => BEXTI+BNEZ isn't a profitable
transformation.

Differential Revision: https://reviews.llvm.org/D131492
2022-09-13 18:54:00 +01:00
Zequan Wu 08d4d7cb8d [gn build] port a3172df59c (check-lldb)
https://reviews.llvm.org/rGa3172df59c32aac48c113eb7d6a1324aaa95c474 breaks
check-lldb gn build.

Reviewed By: thakis

Differential Revision: https://reviews.llvm.org/D133604
2022-09-13 10:52:56 -07:00
Gabriel Ravier 7240436c94
[lldb] Fixed a number of typos
I went over the output of the following mess of a command:

  (ulimit -m 2000000; ulimit -v 2000000; git ls-files -z | parallel
  --xargs -0 cat | aspell list --mode=none --ignore-case | grep -E
  '^[A-Za-z][a-z]*$' | sort | uniq -c | sort -n | grep -vE '.{25}' |
  aspell pipe -W3 | grep : | cut -d' ' -f2 | less)

and proceeded to spend a few days looking at it to find probable typos
and fixed a few hundred of them in all of the llvm project (note, the
ones I found are not anywhere near all of them, but it seems like a
good start).

Differential revision: https://reviews.llvm.org/D131122
2022-09-13 10:38:38 -07:00
Christian Sigg c519751730 [MLIR] Remove unused lit test replacements.
The following replacements have been changed to `%mlir_lib_dir`:

- `%linalg_test_lib_dir`
- `%cuda_wrapper_library_dir`
- `%spirv_wrapper_library_dir`
- `%vulkan_wrapper_library_dir`
- `%mlir_runner_utils_dir`
- `%mlir_integration_test_dir`

If there are no requests to delay submission, I plan to submit this on 9/13/2002 (Tuesday).

See also PSA: https://discourse.llvm.org/t/psa-removing-mlir-lit-test-replacements/65124

Reviewed By: herhut

Differential Revision: https://reviews.llvm.org/D133409
2022-09-13 19:27:42 +02:00
Jessica Paquette 444320ab48 [llvm-remarkutil] Make tryParseRemarksFromInputFile static
All the functions in this file should be static to avoid ODR violations.
2022-09-13 10:19:41 -07:00
Daniel Bertalan 025a5b22c8
[lld-macho] Sort data-in-code entries
Previously, we would add entries to DataInCodeSection in the order they
appeared in input files. Because of this, entries would not be sorted if
sections were reordered due to e.g. `-order_file` or call graph profile
sorting. ld64 always keeps data-in-code information sorted.

This commit also fixes an incorrect assertion. The original assertion
from D103006 used to check that data-in-code entries are sorted in the
input objects -- likely because we use binary search on that data. In
D115556, the assertion was moved into `collectDataInCodeEntries`, but
the checked variable's name was not changed, so it ended up checking the
final contents of the DataInCodeSection.

We no longer crash when building LLVM with PGO using an asserts build of
LLD as the linker.

Fixes https://bugs.chromium.org/p/chromium/issues/detail?id=1265937

Numbers for linking the Chromium Framework reproducer from #48001, which
has 6829 data-in-code entries:

  x before
  + after
      N           Min           Max        Median           Avg        Stddev
  x  20     2.1076453     2.3059683     2.1132485     2.1350302   0.049905767
  +  20     2.1069031     2.3915262       2.14465     2.1728429   0.084065898
  No difference proven at 95.0% confidence

Differential Revision: https://reviews.llvm.org/D133581
2022-09-13 19:08:35 +02:00
Slava Zakharin d8a57c7788 [mlir][arith] Canonicalization patterns for subi.
subi(addi(a, b), b) -> a
subi(addi(a, b), a) -> b
subi(subi(a, b), a) -> subi(0, b)

Differential Revision: https://reviews.llvm.org/D133615
2022-09-13 09:42:29 -07:00
David M. Lary f4fc405631 lldb: Add support for R_386_32 relocations to ObjectFileELF
I encountered an issue where `p &variable` was finding an incorrect address for
32-bit PIC ELF files loaded into a running process.  The problem was that the
R_386_32 ELF relocations were not being applied to the DWARF section, so all
variables in that file were reporting as being at the start of their respective
section.  There is an assert that catches this on debug builds, but silently
ignores the issue on non-debug builds.

In this changeset, I added handling for the R_386_32 relocation type to
ObjectFileELF, and a supporting function to ELFRelocation to differentiate
between DT_REL & DT_RELA in ObjectFileELF::ApplyRelocations().

Demonstration of issue:
```
[dmlary@host work]$ cat rel.c
volatile char padding[32] = "make sure var isnt at .data+0";
volatile char var[] = "test";
[dmlary@host work]$ gcc -c rel.c -FPIC -fpic -g -m32

[dmlary@host work]$ lldb ./exec
(lldb) target create "./exec"
Current executable set to '/home/dmlary/src/work/exec' (i386).
(lldb) process launch --stop-at-entry
Process 21278 stopped
* thread #1, name = 'exec', stop reason = signal SIGSTOP
    frame #0: 0xf7fdb150 ld-2.17.so`_start
ld-2.17.so`_start:
->  0xf7fdb150 <+0>: movl   %esp, %eax
    0xf7fdb152 <+2>: calll  0xf7fdb990                ; _dl_start

ld-2.17.so`_dl_start_user:
    0xf7fdb157 <+0>: movl   %eax, %edi
    0xf7fdb159 <+2>: calll  0xf7fdb140
Process 21278 launched: '/home/dmlary/src/work/exec' (i386)

(lldb) image add ./rel.o
(lldb) image load --file rel.o .text 0x40000000 .data 0x50000000
section '.text' loaded at 0x40000000
section '.data' loaded at 0x50000000

(lldb) image dump symtab rel.o
Symtab, file = rel.o, num_symbols = 13:
               Debug symbol
               |Synthetic symbol
               ||Externally Visible
               |||
Index   UserID DSX Type            File Address/Value Load Address       Size               Flags      Name
------- ------ --- --------------- ------------------ ------------------ ------------------ ---------- ----------------------------------
[    0]      1     SourceFile      0x0000000000000000                    0x0000000000000000 0x00000004 rel.c
[    1]      2     Invalid         0x0000000000000000                    0x0000000000000020 0x00000003
[    2]      3     Invalid         0x0000000000000000 0x50000000 0x0000000000000020 0x00000003
[    3]      4     Invalid         0x0000000000000025                    0x0000000000000000 0x00000003
[    4]      5     Invalid         0x0000000000000000                    0x0000000000000020 0x00000003
[    5]      6     Invalid         0x0000000000000000                    0x0000000000000020 0x00000003
[    6]      7     Invalid         0x0000000000000000                    0x0000000000000020 0x00000003
[    7]      8     Invalid         0x0000000000000000                    0x0000000000000020 0x00000003
[    8]      9     Invalid         0x0000000000000000                    0x0000000000000020 0x00000003
[    9]     10     Invalid         0x0000000000000000                    0x0000000000000020 0x00000003
[   10]     11     Invalid         0x0000000000000000                    0x0000000000000020 0x00000003
[   11]     12   X Data            0x0000000000000000 0x50000000 0x0000000000000020 0x00000011 padding
[   12]     13   X Data            0x0000000000000020 0x50000020 0x0000000000000005 0x00000011 var

(lldb) p &var
(volatile char (*)[5]) $1 = 0x50000000
```

Reviewed By: labath

Differential Revision: https://reviews.llvm.org/D132954
2022-09-13 18:38:48 +02:00
Kazu Hirata d3649c2be4 [Vectorize] Fix a warning
This patch fixes:

  llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:5879:5: error:
  expression result unused [-Werror,-Wunused-value]
2022-09-13 09:30:06 -07:00
Arthur Eubanks 5a33d1f0b9 [SimplifyCFG] Don't hoist allocas
D129370 started hoisting allocas across stacksave/stackrestore
boundaries which is wrong.

Reviewed By: chill, rnk

Differential Revision: https://reviews.llvm.org/D133730
2022-09-13 09:23:39 -07:00
Valery N Dmitriev 18dde772d6 [SLP] Unify main/alternate selection for CmpInst instructions
Make main/alternate operation selection logic for CmpInst
consistent across SLP vectorizer.

Differential Revision: https://reviews.llvm.org/D133430
2022-09-13 09:20:25 -07:00
Craig Topper efd5acf120 [LegalizeTypes][NVPTX] Remove extra compare from fallback code for ISD::ADD in ExpandIntRes_ADDSUB.
This is the ultimate fallback code if UADDO isn't supported.

If the target uses 0/1 we used one compare, but if the target doesn't
use 0/1 we emitted two compares. Regardless of boolean constants we
should only need to check that the Result is less than one of the
original operands. So we only need one compare.

Reviewed By: spatel

Differential Revision: https://reviews.llvm.org/D133708
2022-09-13 09:07:56 -07:00
Hendrik Greving 393a17b5d1 [ValueTypes] Define MVTs for v256i2/v128i4.
Adds MVT::v256i2, MVT::v128i4.

Differential Revision: https://reviews.llvm.org/D133603
2022-09-13 09:02:23 -07:00
Alex Zinenko 4b728ff076 [mlir] optional verbose debug messages for transform application
Introduce the additional "transform-dialect-print-top-level-after-all" debug
category that allows the user to print the paylaod IR after each transformation
performed by the transform dialect. This is useful for understanding and
debugging the effects of individual transformations in complex transformations
scripts, including in downstreams, without having to modify the transformation
script itself.

Reviewed By: mravishankar

Differential Revision: https://reviews.llvm.org/D133775
2022-09-13 18:01:19 +02:00
Alex Bradbury 547160848c [RISCV] Return true in hasBitTest when Zbs is enabled and update BEXTI pattern for resulting canonicalisation
As the Zbs extension includes bext[i] for bit extract, we can
unconditionally return true from this hook. This hook causes the DAG
combiner to perform the following canonicalisation:

  and (not (srl X, C)), 1 --> (and X, 1<<C) == 0
  and (srl (not X), C)), 1 --> (and X, 1<<C) == 0

As simply changing the hook causes a codegen regression, this patch also
modifies a BEXTI pattern to match this canonicalised form.

As BSETINVMask is now used for BEXT as well as BSET and BINV, it has
been renamed to the more generic SingleBitSetMask.

There is one codegen change in bittest.ll for bittest_31_i64 (NOT+BEXTI
rather than NOT+SRLIW). This is neutral in terms of code quality.

Differential Revision: https://reviews.llvm.org/D131482
2022-09-13 16:51:47 +01:00
Craig Topper 5224bae613 [RISCV] Fix a bug in i32 FP_TO_UINT_SAT lowering on RV64.
We use the saturating behavior of fcvt.wu.h/s/d but forgot to
take into account that fcvt.wu will sign extend the saturated
result. According to computeKnownBits a promoted FP_TO_UINT_SAT
is expected to zero extend the saturated value.

In many case the upper bits aren't be demanded so this wouldn't
be an issue. But if we computeKnownBits caused an AND to be removed
it would be a bug.

This patch inserts an AND during to zero the upper bits.

Unfortunately, this pessimizes code if we aren't able to tell if
the upper bits are demanded. To fix that we could custom type
promote the FP_TO_UINT_SAT with SEXT_INREG after it, but I'll
leave that for future work.

I haven't found a failure from this, I was revisiting the code to
add vector support and spotted it.

Differential Revision: https://reviews.llvm.org/D133746
2022-09-13 08:41:32 -07:00
Nicolas Vasilache 845dc178c0 [mlir][Vector] Support broadcast vector type in distribution of vector.warp_execute_on_lane_0.
This revision significantly improves and tests the broadcast behavior of vector.warp_execute_on_lane_0.

Previously, the implementation of the broadcast behavior of vector.warp_execute_on_lane_0
assumed that the broadcasted value was always of scalar type.

This is not necessarily the case.

Differential Revision: https://reviews.llvm.org/D133767
2022-09-13 08:18:47 -07:00
Aaron Ballman b8266f512a Correct the __has_c_attribute value for fallthrough
The original proposal was seen in Apr 2019 and we accidentally used
that date (201904L) as the feature testing value. However, WG14 N2408
was adopted at the Oct 2019 meeting and so that's the correct date for
the feature testing macro. The committee draft for C2x shows 201910L
for this value, so this changes brings us in line with the standard.
2022-09-13 11:08:58 -04:00
Alex Zinenko 59a640a381 [mlir] improve the error message in expensive transform checks
Include the transform op being applied when reporting it using an invalidated
handle. This was missing previously and made it harder for the user to
understand where the handle is being used, especially if the transform script
included some sort of iteration.

Reviewed By: guraypp

Differential Revision: https://reviews.llvm.org/D133774
2022-09-13 16:58:52 +02:00
Nico Weber 15e2e34097 [gn build] port 30578c0856 2022-09-13 10:48:48 -04:00
David Green 993b203b6a [AArch64] Sink splat(s/zext(..)) to uses
If the Shuffle is a splat and the operand is a zext/sext, sinking the
operand and the s/zext can help create indexed s/umull. This is
especially useful to prevent i64 mul being scalarized.

Differential Revision: https://reviews.llvm.org/D133355
2022-09-13 15:47:41 +01:00
Matt Arsenault 740f920a1f LiveRegUnits: Break register loop when a clobber is encountered 2022-09-13 10:15:08 -04:00
Christian Sigg 5c6d8a74e1 [MLIR] Only substitute `mlir-spirv-cpu-runner` tool if enabled
This tool is only used if `MLIR_ENABLE_SPIRV_CPU_RUNNER` was specified and should only be substituted in that case. Alternatively, we could make the substitution optional.

Reviewed By: mehdi_amini

Differential Revision: https://reviews.llvm.org/D133752
2022-09-13 15:42:14 +02:00
Aaron Ballman 843d074400 Update the C Status page for the Clang 15 release
Now that Clang 15 is out, we can swap all the unreleased entries over.
2022-09-13 09:36:54 -04:00
Aaron Ballman 0f28cf416d Correct the __has_c_attribute value for maybe_unused
The original proposal was adopted in Apr 2019, but was subsequently
updated by WG14 N2662 in June 2021. We already supported the attribute
on a label and it behaved as expected, but we had not bumped the
feature test value.
2022-09-13 09:33:20 -04:00
Nico Weber df193a1a12 Revert "[llvm-dwp] Report the filename if it cannot be found"
This reverts commit 35028d417b.
Breaks tests on Windows, see https://reviews.llvm.org/D133549#3785952
2022-09-13 09:07:16 -04:00
Simon Pilgrim 8ae9cf550b [LoopVectorize][X86] Add uniform shift costs checks for VF=1/2/4 2022-09-13 13:46:52 +01:00
Matt Arsenault b7dae832e6 DeadMachineInstructionElim: Don't repeat per-function init
This was happening for every iteration but only needs to be done once.
2022-09-13 08:19:54 -04:00
Matt Arsenault 243632c63e LiveRegUnits: Cleanup isReg checks
This is the common case and should be checked first. Provides a very
marginal compile time improvement on the example I'm looking at.
2022-09-13 08:19:53 -04:00
Aaron Ballman db10b47104 Fix the LLVM sphinx build
This addresses the failures found in:
https://lab.llvm.org/buildbot/#/builders/30/builds/25899
2022-09-13 08:17:55 -04:00
Aaron Ballman 1b19df12b8 Correct the __has_c_attribute value for nodiscard
The original proposal was adopted in Apr 2019 and so the previous value
was 201904L. However, a subsequent proposal (N2448) was adopted to add
an optional message argument to the attribute. We already support that
functionality, but had not bumped the feature test value.
2022-09-13 08:13:01 -04:00
Animesh Kumar 7f57b646d1 [OpenMP] Extend lit test for parallel for simd construct
This construct is being tested for atomic operation based upon
the test 5.0/parallel_for_simd/test_parallel_for_simd_atomic.c
from the SOLLVE repo: https://github.com/SOLLVE/sollve_vv

Differential Revision: https://reviews.llvm.org/D132643
2022-09-13 17:07:11 +05:30
Tres Popp fb60b1f859 [mlir] Decrease stack allocations in Presburger's Matrix
The class set a SmallVector stack allocation size to 64 elements which
is uncommonly large. These structures are then used extensively and
copied often in functions which led to stack frame sizes considered
excessively large for some use cases.

Differential Revision: https://reviews.llvm.org/D133761
2022-09-13 13:21:41 +02:00
Zain Jaffal 67a7854719
[InstCombine] Test for matrix multiplication negation optimisation.
If one of the operands is negated in a multiplication we can optimise the operation by moving the negation to the smallest operand or to the result

Reviewed By: fhahn

Differential Revision: https://reviews.llvm.org/D133287
2022-09-13 11:35:18 +01:00
Simon Pilgrim 8bf04e9f2a [X86] Add GFNI test coverage for bitreverse codegen
We should be able to efficiently use the vector version for scalar bitreverse, like we do for XOP.
2022-09-13 11:23:03 +01:00
Simon Pilgrim ac89b03934 [CostModel][X86] Add CostKinds test coverage for bitreverse intrinsics 2022-09-13 11:23:03 +01:00
Alexander Kornienko 637da9de4c Revert "[clang] template / auto deduction deduces common sugar"
This reverts commit d200db3863, which causes a
clang crash. See https://reviews.llvm.org/D111283#3785755

Test case for convenience:
```
template <typename T>
using P = int T::*;

template <typename T, typename... A>
void j(P<T>, T, A...);

template <typename T>
void j(P<T>, T);

struct S {
  int b;
};
void g(P<S> k, S s) { j(k, s); }
```
2022-09-13 12:18:07 +02:00
David Spickett 0b8a44388e [llvm][AArch64] Explain why certain registers are reserved on Arm64EC
This extends 4658366d95 to add a note
explaining why the register is reserved.

note: x13 is clobbered by asynchronous signals when using Arm64EC.

I've added testing for w/x registers and v/q/s/d and h floating point
registers.

llvm will accept, but silently do nothing with, b registers. So they
are not tested here (clang rejects them so at least for C you're safe anyway).

Reviewed By: efriedma

Differential Revision: https://reviews.llvm.org/D133701
2022-09-13 10:13:06 +00:00
Jay Foad 3743f9afeb [AMDGPU] Add GFX11 globalisel test coverage for fptosi/fptoui 2022-09-13 10:51:02 +01:00