Commit Graph

459678 Commits

Author SHA1 Message Date
Jakub Kuderski
46740dd02b [mlir][arith] Add narrowing patterns for subi, divsi, and divui
Each of these ops is compatible with only one extension kind and
produces an extra result bit.

I checked these transformation in Alive2:
1. subi + extsi: https://alive2.llvm.org/ce/z/ipmZZA
2. divsi + extsi: https://alive2.llvm.org/ce/z/fAcqUv
3. divui + extui: https://alive2.llvm.org/ce/z/QZJpFp

Reviewed By: antiagainst

Differential Revision: https://reviews.llvm.org/D149531
2023-05-02 10:44:29 -04:00
Cullen Rhodes
707b6e94b8 [mlir][SparseTensor][ArmSVE] Fix missing lli substitutions
The MLIR SVE integration tests are now enabled in the
clang-aarch64-full-2stage buildbot under emulation (QEMU) and two of the
sparse integration tests are failing [1]:

  * mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_sorted_coo.mlir
  * mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_spmm.mlir

The reason for this is the SVE RUN lines use plain 'lli' rather than the
'%lli_host_or_aarch64_cmd' substitution that's necessary to run under
emulation. The CI doesn't support SVE so the tests will SIGILL unless
run under emulation.

I should note the logs don't show a SIGILL, only the non-descript:

  FileCheck error: '<stdin>' is empty.

but I expect this is what's actually happening.

https://lab.llvm.org/buildbot/#/builders/179/builds/6051/steps/12/logs/stdio
2023-05-02 14:43:48 +00:00
Joseph Huber
2353b52eae [libc] Fix some missing features from the hermetic test support
This patch addresses some of the flags and features that are currently
missing from the hermetic test support. This mostly just fixes the
`add_libc_test` option failing to find a few dependencies or missing
arguments from the previous unit test support.

Reviewed By: lntue

Differential Revision: https://reviews.llvm.org/D149629
2023-05-02 09:40:24 -05:00
Job Noorman
d755e10e7a [BOLT] Make sure Mach-O binaries are actually linked
Note that this issue is also solved by D147544.

Reviewed By: alexander-shaposhnikov

Differential Revision: https://reviews.llvm.org/D149244
2023-05-02 16:22:49 +02:00
Job Noorman
f3ea4228fd [BOLT] Make sure all section allocations have deterministic contents
For empty sections, RuntimeDyld always allocates 1 byte but leaves it
uninitialized. This causes the contents of some output sections to be
non-deterministic.

Note that this issue is also solved by D147544.

Fixes #59008

Reviewed By: maksfb

Differential Revision: https://reviews.llvm.org/D149243
2023-05-02 16:18:01 +02:00
Jakub Kuderski
e2f7563d7c [mlir][arith] Add narrowing patterns for addi and muli
These two ops are handled in a very similar way -- the only difference
in the number result bits produced.

I checked these transformation with Alive2:
1.  addi + sext: https://alive2.llvm.org/ce/z/3NSs9T
2.  addi + zext: https://alive2.llvm.org/ce/z/t7XHOT
3.  muli + sext: https://alive2.llvm.org/ce/z/-7sfW9
4.  muli + zext: https://alive2.llvm.org/ce/z/h4yntF

Reviewed By: antiagainst

Differential Revision: https://reviews.llvm.org/D149530
2023-05-02 10:10:10 -04:00
Jay Foad
55678b43b5 [CodeGen] One more use of MachineBasicBlock::phis. NFC. 2023-05-02 14:55:24 +01:00
Joel E. Denny
fa280c1994 [OpenMP] In libomptarget, assume alignment at powers of two
This patch fixes a bug introduced by D142586, which landed as
434992c96e.  The fix was to only look for alignments that are powers
of 2.  See the new test case for details.

Reviewed By: jdoerfert, jhuber6

Differential Revision: https://reviews.llvm.org/D149490
2023-05-02 09:44:58 -04:00
Alexey Lapshin
709bc11266 [DWARFLinker][NFC] Make interfaces to be compatible.
This patch makes interface of AddressManager from DWARFLinker
to be compatible with AddressesMap from DWARFLinkerParallel.
This makes both linkers to be interchangeable.

Differential Revision: https://reviews.llvm.org/D147455
2023-05-02 14:59:23 +02:00
4vtomat
fa43608d16 [RISCV][RISCV][clang] Split out SiFive Vector C intrinsics from riscv_vector.td
Since we don't always need the vendor extension to be in riscv_vector.td,
so it's better to make it be in separated header.

Depends on D148223 and D148680

Differential Revision: https://reviews.llvm.org/D148308
2023-05-02 05:51:51 -07:00
Alexandre Ganea
8efc7de0e6 [llvm][unittests] Silence warning on MSVC after 5b2423183c
Differential revision: https://reviews.llvm.org/D149609
2023-05-02 08:49:47 -04:00
Dmitry Chernenkov
73e15b5edb [lldb] Add cstdio include to fix a595b931f1 2023-05-02 12:47:37 +00:00
4vtomat
4bf846ba40 [RISCV] Split out part of riscv_vector.td to riscv_vector_common.td
This makes other new targets able to reuse predefined classes
in their own *.td files.

Differential Revision: https://reviews.llvm.org/D148680
2023-05-02 05:40:13 -07:00
Nelson Chu
8ed9cf06e9 [SiFive][RISCV][clang] Support C intrinsics for xsfvcp extension.
Depends on D147934 and D147935

Differential Revision: https://reviews.llvm.org/D148223
2023-05-02 05:40:13 -07:00
Jay Foad
4b2381a5f0 [CodeGen] Make use of MachineBasicBlock::phis. NFC. 2023-05-02 13:39:01 +01:00
Shilei Tian
8a11c5522f Revert "[OpenMP] Make libomptarget link against libomp"
This reverts commit dc049a4ea6.

It causes issue of export target.
2023-05-02 08:35:55 -04:00
Mariya Podchishchaeva
7133283835 [clang] Do not attempt to zero-extend _BitInt(1) when not required
`ConvertTypeForMem` doesn't return wider type for _BitInt unless it is
used in a bitfield, so no need to extend when trying to initialize a
global variable.

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

Reviewed By: erichkeane, shafik

Differential Revision: https://reviews.llvm.org/D149436
2023-05-02 08:23:22 -04:00
Zhiyao Ma
1d0ccebcd7 [ARM] Don't allocate memory if free space in segmented stack is just enough
Assuming that the stack grows downwards, it is fine if the stack
pointer is exactly at the stacklet boundary. We should use
less-or-equal condition when deciding whether to skip new memory
allocation.

Differential Revision: https://reviews.llvm.org/D149315
2023-05-02 13:09:49 +01:00
Kiran Chandramohan
39e8e59950 [Flang][OpenMP] Use fir.if instead of scf.if in lastprivate lowering
For finding the last iteration of a loop, or the last section an
if condition is generated. Using scf::if can cause some lowering
issues since the code contained inside it can have branches. Using
fir::if instead ensures that the fir::if is lowered into branches
along with any code contained inside that can generate branches.

Fixes #62458.

Reviewed By: NimishMishra

Differential Revision: https://reviews.llvm.org/D149547
2023-05-02 12:02:04 +00:00
Michael Buch
52882de0e6 [lldb][test] TestCPP20Standard.py: make it a libc++ test
We just want to test whether the language switch works.
This is easier to control for libc++, since for bots building
the tests against libstdc++ we might not have the necessary
`<compare>` header available currently.
2023-05-02 07:38:53 -04:00
LU Hongyi
e15d6b520e [lldb][DWARFExpression] Fix DW_OP_div to use signed division
This patch resolves an issue where a value
is incorrectly displayed if it is represented
by DW_OP_div.

This issue is caused by lldb evaluating
operands of DW_OP_div as unsigned
and performed unintended unsigned
division.

This issue is resolved by creating two
temporary signed scalar and performing
signed division.

(Addresses GH#61727)

Differential Revision: https://reviews.llvm.org/D147370
2023-05-02 07:38:52 -04:00
Samira Bazuzi
2cdb6b84c1 [clang][dataflow] Expose DataflowAnalysisContext from DataflowEnvironment.
This will eliminate the need for more pass-through APIs. Also replace pass-through usages with this exposure.

Reviewed By: ymandel, gribozavr2, xazax.hun

Differential Revision: https://reviews.llvm.org/D149464
2023-05-02 11:32:19 +00:00
Nikita Popov
084ca632ac [EarlyCSE] Only combine metadata for load CSE
There is no need to combine metadata if we're performing store to
load forwarding. In that case we would end up combining metadata
on an unrelated load instruction.
2023-05-02 12:51:56 +02:00
Nikita Popov
a67a21bf41 [EarlyCSE] Add additional metadata preservation test (NFC) 2023-05-02 12:51:55 +02:00
LLVM GN Syncbot
7cf7ebd917 [gn build] Port 852bf52cc9 2023-05-02 10:31:09 +00:00
Balázs Kéri
852bf52cc9 [clang-tidy] Add check bugprone-multiple-new-in-one-expression.
Reviewed By: donat.nagy
Fixed test failures with previous commit.

Differential Revision: https://reviews.llvm.org/D138777
2023-05-02 12:29:17 +02:00
Nikita Popov
5362a0d859 [LCSSA] Remove unused ScalarEvolution argument (NFC)
After D149435, LCSSA formation no longer needs access to
ScalarEvolution, so remove the argument from the utilities.
2023-05-02 12:17:05 +02:00
David Green
41549b5350 [AArch64] Add sign bits handling for vector compare nodes
This adds ComputeNumSignBits for the NEON vector comparison nodes, which all
either return 0 or -1. Also adds sign_extend_inreg from VASHR+VSHL to show it
performing transforms.

Differential Revision: https://reviews.llvm.org/D148624
2023-05-02 11:05:35 +01:00
Simon Pilgrim
da942fee5b Fix MSVC "truncation of constant value" warnings. NFC. 2023-05-02 10:43:28 +01:00
Simon Pilgrim
14390ecb75 Fix MSVC "not all control paths return a value" warnings. NFC. 2023-05-02 10:43:28 +01:00
Vassil Vassilev
87ae746924 [clang-repl] Add a test coverage for nested out-of-line dtor disambiguation.
This came up as a review comment in https://reviews.llvm.org/D148425
2023-05-02 09:39:48 +00:00
Jay Foad
16980c08cb [AMDGPU] Make use of new tablegen operator !range. NFC. 2023-05-02 10:36:15 +01:00
LLVM GN Syncbot
61cfb96fd3 [gn build] Port 7b7a6b641a 2023-05-02 09:28:16 +00:00
Balázs Kéri
7b7a6b641a Revert "[clang-tidy] Add check bugprone-multiple-new-in-one-expression."
This reverts commit 1aa36da153.
2023-05-02 11:23:31 +02:00
Christian Ulmann
a4cc7e784f [PGO] Avoid potential const_cast UB (NFC)
This commit removes potential UB in the PGO instrumentation passes that
was caused by casting away constness and then potentially modifying the
object.

Reviewed By: gysit

Differential Revision: https://reviews.llvm.org/D148903
2023-05-02 09:18:37 +00:00
LLVM GN Syncbot
aa8a08976b [gn build] Port 1aa36da153 2023-05-02 09:11:37 +00:00
Victor Perez
b8064c1a03 [mlir][llvm] Add trap intrinsics to the dialect
Define llvm.trap, llvm.debugtrap, and llvm.ubsantrap intrinsics in the
llvm dialect.

Signed-off-by: Victor Perez <victor.perez@codeplay.com>

Differential Revision: https://reviews.llvm.org/D149574
2023-05-02 10:09:31 +01:00
Nikita Popov
371612500a [SCEV] Reuse Accum variable when handling GEP flags
The GEP minus the base pointer (which is the pre-inc addrec) is
exactly the Accum value that was already calculated.
2023-05-02 11:03:38 +02:00
Balázs Kéri
1aa36da153 [clang-tidy] Add check bugprone-multiple-new-in-one-expression.
Reviewed By: donat.nagy

Differential Revision: https://reviews.llvm.org/D138777
2023-05-02 10:59:07 +02:00
Hans Wennborg
55224bc55c Typo fix 2023-05-02 10:31:37 +02:00
NAKAMURA Takumi
95d4506dda add_tablegen: Quick fix to reflect LLVM_TABLEGEN to llvm-min-tblgen
`sanitizer-x86_64-linux-android` uses LLVM_TABLEGEN.
2023-05-02 17:05:42 +09:00
Nikita Popov
5cbb9f7a58 [LCSSA] Don't invalidate SCEV
LCSSA currently invalidates SCEV for all instructions for which
LCSSA phi nodes are created. This used to be necessary, because
SCEV has historically tried to maintain LCSSA form as well. As
such, some SCEV uses of the value would have to become uses of
the phi node instead.

However, nowadays SCEV itself no longer maintains LCSSA form.
The SCEV of on LCSSA phi node will be the same as the SCEV of its
argument. LCSSA is instead maintained in the SCEVExpander.

As such, I believe it is no longer necessary to perform any SCEV
invalidation during LCSSA construction.

After this patch the ScalarEvolution argument to the LCSSA utilities
is no longer necessary -- I'll remove it in a followup NFC patch to
keep this patch more concise.

Differential Revision: https://reviews.llvm.org/D149435
2023-05-02 10:01:50 +02:00
Ulrich Weigand
a257616bce [LLD][MachO] Do not run Mach-O tests on big-endian hosts
Currently, most Mach-O tests fail when executed on a big-endian host. This is
because the Mach-O back-end does not perform the necessary byte swaps when
accessing the (little-endian) binary file format.

For now, simply consider all Mach-O tests unsupported on big-endian hosts,
to enable running the test suite at all on such hosts.

Reviewed by: oontvoo

Differential Revision: https://reviews.llvm.org/D149270
2023-05-02 09:33:16 +02:00
Jonas Devlieghere
ddd9358bca
[lldb] Remove unused will_modify argument (NFC)
Various OptionValue related classes are passing around will_modify but
the value is never used. This patch simplifies the interfaces by
removing the redundant argument.
2023-05-02 00:20:34 -07:00
Adrian Kuegel
3c83afb68b [mlir][Bazel] Adjust BUILD file for changes in 5e118f933b 2023-05-02 08:37:44 +02:00
Théo Degioanni
1367c5d6e0 [mlir][mem2reg] Follow-up adjustments (NFC).
Ajustments to the MLIR mem2reg changes.

Reviewed By: gysit, kuhar

Differential Revision: https://reviews.llvm.org/D149431
2023-05-02 06:17:05 +00:00
Mehdi Amini
5e118f933b Introduce MLIR Op Properties
This new features enabled to dedicate custom storage inline within operations.
This storage can be used as an alternative to attributes to store data that is
specific to an operation. Attribute can also be stored inside the properties
storage if desired, but any kind of data can be present as well. This offers
a way to store and mutate data without uniquing in the Context like Attribute.
See the OpPropertiesTest.cpp for an example where a struct with a
std::vector<> is attached to an operation and mutated in-place:

struct TestProperties {
  int a = -1;
  float b = -1.;
  std::vector<int64_t> array = {-33};
};

More complex scheme (including reference-counting) are also possible.

The only constraint to enable storing a C++ object as "properties" on an
operation is to implement three functions:

- convert from the candidate object to an Attribute
- convert from the Attribute to the candidate object
- hash the object

Optional the parsing and printing can also be customized with 2 extra
functions.

A new options is introduced to ODS to allow dialects to specify:

  let usePropertiesForAttributes = 1;

When set to true, the inherent attributes for all the ops in this dialect
will be using properties instead of being stored alongside discardable
attributes.
The TestDialect showcases this feature.

Another change is that we introduce new APIs on the Operation class
to access separately the inherent attributes from the discardable ones.
We envision deprecating and removing the `getAttr()`, `getAttrsDictionary()`,
and other similar method which don't make the distinction explicit, leading
to an entirely separate namespace for discardable attributes.

Recommit d572cd1b06 after fixing python bindings build.

Differential Revision: https://reviews.llvm.org/D141742
2023-05-01 23:16:34 -07:00
Shengchen Kan
8f966cedea [SelectionDAG] Use int64_t to store the integer power of llvm.powi
https://llvm.org/docs/LangRef.html#llvm-powi-intrinsic
The max length of the integer power of `llvm.powi` intrinsic is 32, and
the value can be negative. If we use `int32_t` to store this value, `-Val`
will underflow when it is `INT32_MIN`

The issue was reported in D149033.
2023-05-02 14:08:42 +08:00
Phoebe Wang
c2dd36cd39 [Coverity] Fix unchecked return value, NFC
The `ReversePredicate` should have made sure the reverse predicate is
supported by target, but the check comes from early function and might
be invalid by any mistake. So it's better to double confirm it here.

Differential Revision: https://reviews.llvm.org/D149586
2023-05-02 13:43:28 +08:00
Phoebe Wang
bd08f1bfb5 [MC] Remove dead code, NFC
This code was added in 408b5e6603, but neither the return value nor
`Res` was used in the following code.

Differential Revision: https://reviews.llvm.org/D149584
2023-05-02 13:43:27 +08:00