464053 Commits

Author SHA1 Message Date
Craig Topper
11e5a0d290 [RISCV] Merge RISCVMCInstLower.cpp into RISCVAsmPrinter.cpp.
The separation here doesn't make much sense. I think it's a
leftover from the creation of the MC layer that has been
replicated to new targets.

By merging them we can avoid passing the AsmPrinter to the
MCInstLowering functions. We can make them member functions instead.

I think we can still do more integration of lowerSymbolOperand
and lowerRISCVVMachineInstrToMCInst, but I wanted to get feedback
on the direction first.

Reviewed By: asb, barannikov88

Differential Revision: https://reviews.llvm.org/D152311
2023-06-12 09:36:57 -07:00
Aart Bik
80fe3168b5 [mlir][sparse] add support for direct prod/and/min/max reductions
We recently fixed a bug in "sparsifying" such reductions, since
it incorrectly changed this into reductions over stored elements
only , which only works for add/sub/or/xor. However, we still want
to be able to "sparsify" the reductions even in the general case,
and this is a first step by rewriting them into a custom reduction
that feeds in the implicit zeros. NOTE HOWEVER, that in the long run
we want to do this better and feed in any implicit zero only ONCE
for efficiency.

Reviewed By: Peiming

Differential Revision: https://reviews.llvm.org/D152580
2023-06-12 09:27:47 -07:00
Anna Thomas
b2195bc771 [SelectionDAG][AArch64] Legalize FMAXIMUM/FMINIMUM
The missing legalization in SelectionDAG was identified when adding the
intrinsic support for vector reduction for maximum/minimum (D152370).

Fixes part of PR: https://github.com/llvm/llvm-project/issues/63267

Differential Revision: https://reviews.llvm.org/D152718
2023-06-12 12:22:21 -04:00
OCHyams
9dcae2f524 [DebugInfo] Add DW_ATE_complex_float case to assert in isUnsignedDIType
Without this patch a `DW_ATE_complex_float` encoding trips an assertion in
`DebugHandlerBase::isUnsignedDIType` with the message `"Unsupported
encoding"`.

By adding a case to the `assert` for `DW_ATE_complex_float` it becomes
supported, behaving in the same way as the already supported `DW_ATE_float`
type (return false).

Note: For the reported reproducer:

    #include <complex.h>
    int main() {
      long double complex r1;
    }

The assertion isn't tripped without assignment tracking because instcombine
deletes everything, including the `dbg.declare`, without recovering any
location information. Whereas with assignment tracking we track a zeroing
memset that is emitted by clang.

Reviewed By: probinson

Differential Revision: https://reviews.llvm.org/D151795
2023-06-12 17:09:04 +01:00
Florian Hahn
06dab8f743
[ConstraintElim] Extend monotonic phi test coverage.
Add additional tests which exposed some crashes in upcoming patches and
test for and-implied-by-operands handling.
2023-06-12 17:07:36 +01:00
Nico Weber
7b31d3dada Revert "[RDF] Allow RegisterRef to contain register unit" and follow-ups
This reverts commit 859b05b02d3fd9ab6b77f2bed8df6902fe704806.

Also reverts these follow-ups:

Revert "[RDF] Remove `constexpr` from `hash"
This reverts commit 621507ce20ad8eef2986be2712631165e53b7d91.

Revert "[RDF] Do not use trailing return type after all, NFC"
This reverts commit 46e19e3a2c45e7fb5f501bdb983a7151c158304f.

Revert "[RDF] Stop looking when reached code node in getNextRef with NextOnly"
This reverts commit a049ce9d1bd5a7c1c4fcccc6a801b72b00ea8e0f.

Revert "[RDF] Use trailing return type syntax, NFC"
This reverts commit d3b34b7f3a7cbfc96aea897419f167b5ee19e61a.

Revert "[RDF] Define short type names: NodeAddr<XyzNode*> -> Xyz, NFC"
This reverts commit f8ed60b56d1948422dda924fcf450560591e8a19.
2023-06-12 11:35:28 -04:00
Hans Wennborg
b18ca7296e Revert "[Driver] Mark many target-specific driver-only options as TargetSpecific"
This broke building the TSan runtime on Mac, see comment on
5548843d69

> so that they get an error on other targets. This change uses let statements to
> apply `Flags = [TargetSpecific]` to options (mostly -m*) without specifying `Flags`.
> Follow-up to D151590.
>
> For some options, e.g. -mdefault-build-attributes (D31813), -mbranch-likely
> (D38168), -mfpu=/-mabi= (6890b9b71e525020ab58d436336664beede71575), a warning
> seems desired in at least certain cases. This is not the best practice, but this
> change works around them by not applying `Flags = [TargetSpecific]`.
>
> (
> For Intel CPU errata -malign-branch= family options, we also drop the unneeded
> NotXarchOption flag. This flag reports an error if the option is used with
> -Xarch_*. This error reporting does not seem very useful.
> )

This reverts commit 5548843d692a92a7840f14002debc3cebcb3cdc3.
2023-06-12 17:18:09 +02:00
Justin Cady
10e1d50809 [test][ASAN] Fix incorrect REQUIRES directive for scandir.c
The missing colon caused the test to run on unintended platforms.

Reviewed By: emaste

Differential Revision: https://reviews.llvm.org/D152711
2023-06-12 11:16:31 -04:00
Kazu Hirata
583371be4d [FlowSensitive] Use {DenseMapBase,StringMap}::lookup (NFC) 2023-06-12 08:11:01 -07:00
Kazu Hirata
1f9aaf5fb6 [IR] Remove getABITypeAlignment
The last use of getABITypeAlignment was removed by:

  commit 26bd6476c61f08fc8c01895caa02b938d6a37221
  Author: Guillaume Chatelet <gchatelet@google.com>
  Date:   Fri Jan 13 15:05:24 2023 +0000

Differential Revision: https://reviews.llvm.org/D152670
2023-06-12 08:11:00 -07:00
Kazu Hirata
9eea63bc9c [AMDGPU] Fix resource-usage-pal.ll 2023-06-12 08:06:46 -07:00
Akash Banerjee
3401a5f758 [OpenMP][OMPIRBuilder] Migrate emitOffloadingArrays and EmitNonContiguousDescriptor from Clang
This patch migrates the emitOffloadingArrays and EmitNonContiguousDescriptor functions from Clang codegen to OpenMPIRBuilder.

Reviewed By: jdoerfert

Differential Revision: https://reviews.llvm.org/D149872
2023-06-12 15:43:09 +01:00
Jie Fu
c2b486a111 Remove unused variable 's32' in X86LegalizerInfo.cpp (NFC)
/data/llvm-project/llvm/lib/Target/X86/X86LegalizerInfo.cpp:470:13: error: unused variable 's32' [-Werror,-Wunused-variable]
  const LLT s32 = LLT::scalar(32);
            ^
1 error generated.
2023-06-12 22:34:08 +08:00
Simon Pilgrim
1baa5b8050 [GlobalIsel][X86] Move G_SITOFP/G_FPTOSI getActionDefinitionsBuilder out of setLegalizerInfo64bit and add basic 32-bit support
We were using x86_64-only support as a SSE2 proxy - vector support is still missing.
2023-06-12 15:26:12 +01:00
Andrzej Warzynski
678360fd9d [mlir][linalg] Add scalar broadcast load case to the vectoriser
This patch extends the Linalg vectoriser so that scalar loads are
correctly identified as scalar rather than gather loads. Below is an
example of a scalar load (note that both indices are loop invariant):
```
func.func @example(%arg0: tensor<80x16xf32>, %arg2: tensor<1x4xf32>) -> tensor<1x4xf32> {
%c8 = arith.constant 8 : index
%c16 = arith.constant 16 : index
%1 = linalg.generic {
    indexing_maps = [affine_map<(d0, d1) -> (d0, d1)>],
    iterator_types = ["parallel", "parallel"]
  } outs(%arg2 : tensor<1x4xf32>) {
  ^bb0(%out: f32):
    %2 = linalg.index 0 : index
    %extracted = tensor.extract %arg0[%2, %c16] : tensor<80x16xf32>
    linalg.yield %extracted : f32
  } -> tensor<1x4xf32>
  return %1 : tensor<1x4xf32>
}
```

This patch also makes sure that these scalar loads are indeed lowered to
a scalar load followed by a broadcast:
```
    %extracted = tensor.extract %arg0[%1, %c16] : tensor<80x16xf32>
    %2 = vector.broadcast %extracted : f32 to vector<1x4xf32>
```

Differential Revision: https://reviews.llvm.org/D149678
2023-06-12 15:18:42 +01:00
Baptiste
3604fdf18d [AMDGPU] Do not assume stack size for PAL code object indirect calls
There is no need to set a big default stack size for PAL code object indirect
calls. The driver knows the max recursion depth, so it can compute a more
accurate value from the minimum scratch size.

Reviewed By: arsenm

Differential Revision: https://reviews.llvm.org/D150609
2023-06-12 10:14:17 -04:00
Leonard Grey
c24a39b726 [gn] Mac support for check-asan target
Differential Revision: https://reviews.llvm.org/D152591
2023-06-12 09:58:29 -04:00
Guillaume Chatelet
5e32765c15 [libc] Improve memcmp latency and codegen
This is based on ideas from @nafi to:
 - use a branchless version of 'cmp' for 'uint32_t',
 - completely resolve the lexicographic comparison through vector
   operations when wide types are available. We also get rid of byte
   reloads and serializing '__builtin_ctzll'.

I did not include the suggestion to replace comparisons of 'uint16_t'
with two 'uint8_t' as it did not seem to help the codegen. This can
be revisited in sub-sequent patches.

The code been rewritten to reduce nested function calls, making the
job of the inliner easier and preventing harmful code duplication.

Reviewed By: nafi3000

Differential Revision: https://reviews.llvm.org/D148717
2023-06-12 13:47:16 +00:00
Timm Bäder
aa28875a74 [clang][tests] Replace a %clang++ with %clang
%clang++ does not work on windows, see e.g.:

https://lab.llvm.org/staging/#/builders/204/builds/2141
2023-06-12 15:42:26 +02:00
oontvoo
5b1c62c0f2 [MC][MachO]Do not emit DWARF for no-personality case
Detail: Follow up to D144999, where we emitted DWARF for non-canonical personality.

Reviewed By: jyknight

Differential Revision: https://reviews.llvm.org/D152540
2023-06-12 09:36:56 -04:00
Tue Ly
a982431295 [libc] Add platform independent floating point rounding mode checks.
Many math functions need to check for floating point rounding modes to
return correct values.  Currently most of them use the internal implementation
of `fegetround`, which is platform-dependent and blocking math functions to be
enabled on platforms with unimplemented `fegetround`.  In this change, we add
platform independent rounding mode checks and switching math functions to use
them instead. https://github.com/llvm/llvm-project/issues/63016

Reviewed By: sivachandra

Differential Revision: https://reviews.llvm.org/D152280
2023-06-12 09:36:41 -04:00
Nikita Popov
282324aa4a [GVN] Fix verifyRemoved() verification
Fix the verification failure reported in
https://reviews.llvm.org/D141712#4413647. We need to remove the
load from the VN table as well, not just the leader table.

Also make sure that this verification always runs when assertions
are enabled, rather than only when -debug is passed.
2023-06-12 15:14:27 +02:00
Nikita Popov
2b7c347c7f [LoopVectorize] Convert test to opaque pointers (NFC)
I'm keeping the bitcast in the input here, because without it
we end up introducing a stride 1 assumption and end up testing
a different case.
2023-06-12 14:49:45 +02:00
Nikita Popov
9929f9533d [LoopVectorize] Convert test to opaque pointers (NFC) 2023-06-12 14:31:54 +02:00
Nikita Popov
aa92ae5924 [LoopVectorize] Regenerate test checks (NFC) 2023-06-12 14:31:54 +02:00
indev
2499beeb5a [clang-tidy] run-clang-tidy: forward warnings-as-errors argument
Forward `warnings-as-errors` argument to clang-tidy.

Reviewed By: PiotrZSL

Differential Revision: https://reviews.llvm.org/D152625
2023-06-12 12:24:08 +00:00
Martin Braenne
3f31d3204b [clang][dataflow] Model pointer value for builtin functions.
This fixes a false positive in the Crubit nullability verification.

Reviewed By: gribozavr2

Differential Revision: https://reviews.llvm.org/D152683
2023-06-12 12:23:18 +00:00
Ivan Kosarev
d09fa8ff2c [AMDGPU][GFX11] Add test coverage for cases involving conversions from and to fp16 values.
Other such tests, of which there are many, are to be updated with
separate patches.

Reviewed By: arsenm

Differential Revision: https://reviews.llvm.org/D152557
2023-06-12 13:04:40 +01:00
Kugan Vivekanandarajah
a8ad413f0d [RFC][clangd] Move preamble index out of document open critical path
We would like to move the preamble index out of the critical path.
This patch is an RFC to get feedback on the correct implementation and potential pitfalls to keep into consideration.

I am not entirely sure if the lazy AST initialisation would create using Preamble AST in parallel. I tried with tsan enabled clangd but it seems to work OK (at least for the cases I tried)

Reviewed By: kadircet

Differential Revision: https://reviews.llvm.org/D148088
2023-06-12 12:56:41 +01:00
Francesco Petrogalli
45902a25fa [MISched] Require asserts and AArch64 registered target for test.
Fixes failure at https://lab.llvm.org/buildbot/#/builders/124/builds/7472:

```
llc: Unknown command line argument '-debug-only=machine-scheduler'. Try: '/home/buildbot/as-worker-91/clang-with-lto-ubuntu/build/stage1/bin/llc --help'
```

Reviewed By: fhahn

Differential Revision: https://reviews.llvm.org/D152703
2023-06-12 13:51:19 +02:00
Simon Pilgrim
3d34f7be73 [GlobalIsel][X86] Rename x86_64-select-fcmp.mir to select-fcmp.mir and add 32-bit test coverage
x86_64 was being used as shorthand for SSE2
2023-06-12 12:41:27 +01:00
Sergio Afonso
667ee52551 [OpenMP][Flang][MLIR] Add MLIR support for OpenMP requires directive
This patch introduces an MLIR attribute to the OpenMP dialect
representing the clauses that a 'requires' directive can define.

The `OffloadModuleInterface` is also updated to provide methods to get
and set a new dialect attribute `omp.requires`, to allow storing and using this
information during the lowering stages to LLVM IR.

Differential Revision: https://reviews.llvm.org/D147214
2023-06-12 12:38:04 +01:00
rikhuijzer
fc560cdb46 [MLIR][Quant] Fix equations in Quantization.md
This patch fixes the equations on the Quantization page
(https://mlir.llvm.org/docs/Quantization/).

I don't know what caused the equations to be broken, it
might be https://github.com/llvm/mlir-www/pull/152, but
I'm not sure. Irregardless, let's just fix it and be
done with it.

I've fixed the equations by moving some subscripts to
the text. For some reason, the large number of subscripts
caused Mathjax to fail. I've also tried KaTeX, which
failed at exactly the same number of subscripts.

The workflow to inspect the fix is as follows:

```
$ git clone --depth=1 https://github.com/llvm/mlir-www.git /some/path/mlir-www

$ git clone --depth=1 https://github.com/llvm/llvm-project.git /some/path/llvm-project

$ cp /some/path/llvm-project/mlir/docs/Quantization.md \
    /some/path/mlir-www/website/content/Quantization.md

$ cd /some/path/mlir-www/website

$ hugo serve
[...]
Web Server is available at http://localhost:1313/ (bind address 127.0.0.1)
Press Ctrl+C to stop
```
and view the page at http://localhost:1313/Quantization/.

Reviewed By: stellaraccident

Differential Revision: https://reviews.llvm.org/D152651
2023-06-12 13:29:10 +02:00
Jie Fu
dff3ebc8de Remove unused variable 's8' in X86LegalizerInfo.cpp (NFC)
/data/llvm-project/llvm/lib/Target/X86/X86LegalizerInfo.cpp:443:13: error: unused variable 's8' [-Werror,-Wunused-variable]
  const LLT s8 = LLT::scalar(8);
            ^
1 error generated.
2023-06-12 19:24:56 +08:00
Simon Pilgrim
22c17c6a1f [GlobalIsel][X86] Move G_FCMP getActionDefinitionsBuilder out of setLegalizerInfo64bit and add 32-bit support
We were using x86_64-only support as a SSE2 proxy
2023-06-12 12:18:37 +01:00
Simon Pilgrim
6a12ab874a [GlobalIsel][X86] Regenerate legalize-fcmp.mir 2023-06-12 12:18:36 +01:00
Simon Pilgrim
1a576aa09d [GlobalIsel][X86] Rename x86_64-legalize-fcmp to legalize-fcmp
32-bit support will be added shortly - x86_64 was being used a shorthand for SSE2
2023-06-12 12:18:36 +01:00
Nikita Popov
9cf67f6ea0 [LoopVectorize] Convert most tests to opaque pointers (NFC)
The unsized-pointee-crash.ll and zero-sized-pointee-crash.ll tests
have been removed, because these issues are not relevant for opaque
pointers.
2023-06-12 13:10:22 +02:00
Timm Bäder
5cc721b3f9 [clang][Driver] Add -fcaret-diagnostics-max-lines= as a driver option
Since https://reviews.llvm.org/D147875 landed, setting different values
(or reverting to the old default of 1) is more important than before,
so promote this option to a driver flag.

Differential Revision: https://reviews.llvm.org/D152090
2023-06-12 12:44:25 +02:00
Nikita Popov
8a19af513d [Clang] Remove uses of PointerType::getWithSamePointeeType (NFC)
No longer relevant with opaque pointers.
2023-06-12 12:18:28 +02:00
Adrian Kuegel
b2f8e3121a [mlir][Linalg] Apply ClangTidy finding (NFC) 2023-06-12 12:03:37 +02:00
Nikita Popov
5c6ff3a602 [DAGCombine] Move setcc of freeze fold to brcond
This fold goes against the usual approach of pushing freeze into
operands. The idea behind the fold is that if the setcc feeds into
a brcond, the freeze can be dropped entirely.

Move the fold to brcond, where we can remove the freeze directly.
This ensures that there can be no infinite combine loops due to
conflicting transforms.

Differential Revision: https://reviews.llvm.org/D152544
2023-06-12 12:01:29 +02:00
Kadir Cetinkaya
ea20f339d9
[clangd] Enforce strict unused includes by default
Depends on D152685

Differential Revision: https://reviews.llvm.org/D152686
2023-06-12 11:47:03 +02:00
Kadir Cetinkaya
031ffc3e06
[clangd] Decouple IncludeCleaner implementation from Config
This should help managing tests as we change defaults in configs.

Differential Revision: https://reviews.llvm.org/D152685
2023-06-12 11:38:58 +02:00
Luke Lau
2a1716dec5 [LegalizeTypes][VP] Widen load/store of fixed length vectors to VP ops
If we have a load/store with an illegal fixed length vector result type that
needs widened, e.g. `x:v6i32 = load p`
Instead of just widening it to: `x:v8i32 = load p`
We can widen it to the equivalent VP operation and set the EVL to the
exact number of elements needed: `x:v8i32 = vp_load a, b, mask=true, evl=6`
Provided that the target supports vp_load/vp_store on the widened type.

Scalable vectors are already widened this way where possible, so this
largely reuses the same logic.

Reviewed By: craig.topper

Differential Revision: https://reviews.llvm.org/D148713
2023-06-12 10:21:04 +01:00
Martin Braenne
bbeda83090 [clang][dataflow][NFC] Expand comments on losing values in optional checker.
While working on the ongoing migration to strict handling of value
categories (see https://discourse.llvm.org/t/70086), I ran into issues related
to losing the value associated with an optional.

This issue is hinted at in the existing comments, but the issue didn't become
sufficiently clear to me from those, so I thought it would be worth capturing
more details, along with ideas for how this issue might be fixed.

Reviewed By: ymandel

Differential Revision: https://reviews.llvm.org/D152369
2023-06-12 08:46:34 +00:00
Guillaume Chatelet
1ec995cc1c Revert D148717 "[libc] Improve memcmp latency and codegen"
This broke aarch64 debug buildbot https://lab.llvm.org/buildbot/#/builders/223/builds/21703
This reverts commit bd4f978754758d5ef29d1f10370f45362da3de37.
2023-06-12 08:32:00 +00:00
David Carlier
203078bc14 sanitizers: intercept FreeBSD's cpuset_getaffinity call.
Reviewed By: melver

Differential Revision: https://reviews.llvm.org/D152609
2023-06-12 09:05:31 +01:00
Guillaume Chatelet
bd4f978754 [libc] Improve memcmp latency and codegen
This is based on ideas from @nafi to:
 - use a branchless version of 'cmp' for 'uint32_t',
 - completely resolve the lexicographic comparison through vector
   operations when wide types are available. We also get rid of byte
   reloads and serializing '__builtin_ctzll'.

I did not include the suggestion to replace comparisons of 'uint16_t'
with two 'uint8_t' as it did not seem to help the codegen. This can
be revisited in sub-sequent patches.

The code been rewritten to reduce nested function calls, making the
job of the inliner easier and preventing harmful code duplication.

Reviewed By: nafi3000

Differential Revision: https://reviews.llvm.org/D148717
2023-06-12 07:56:23 +00:00
Francesco Petrogalli
15a16ef8e0 [MISched] Use StartAtCycle in trace dumps.
This commit re-work the methods that dump traces with resource usage to take into account the StartAtCycle value added by https://reviews.llvm.org/D150310.

For each i, the values of the lists StartAtCycle and ReservedCycles is  are printed with the interval [StartAtCycle[i], ReservedCycles[i])

```
... | StartAtCycle[i] | ... | ReservedCycles[i] - 1 | ReservedCycles[i] | ...
    | xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx |                   |
```

Reviewed By: andreadb

Differential Revision: https://reviews.llvm.org/D150311
2023-06-12 09:11:48 +02:00