Commit Graph

465399 Commits

Author SHA1 Message Date
Dmitry Makogon
ce1ac1cf18 [SCEV] Don't store AddRec loop when simplifying multiplication of AddRecs
When multiplying several AddRecs, we do the following simplification:

{A1,+,A2,+,...,+,An}<L> * {B1,+,B2,+,...,+,Bn}<L> = {x=1 in [ sum y=x..2x
	[ sum z=max(y-x, y-n)..min(x,n) [
		choose(x, 2x)*choose(2x-y, x-z)*A_{y-z}*B_z]]
	],+,...up to x=2n}

This is done iteratively, pair by pair. So if we try to multiply three AddRecs
A1, A2, A3, then we'd try to simplify A1 * A2 to A1' and then try to
simplify A1' * A3 if A1' is also an AddRec.
The transform is only legal if the loops of the two AddRecs are the same.
It is checked in the code, but the loop of one of the AddRecs is stored
in a local variable and doesn't get updated when we simplify a pair to a new AddRec.
In the motivating test the new AddRec A1' was created for a different loop and,
as the loop variable didn't get updated, the check for different loops passed and
the transform worked for two AddRecs from different loops.
So it created a wrong SCEV. And it caused LSR to replace an instruction with another
one that had the same SCEV as the incorrectly computed one.

Differential Revision: https://reviews.llvm.org/D153254
2023-06-22 15:49:15 +07:00
Matthias Springer
efc290ce9c [mlir][affine] More efficient makeComposedFolded... helpers
The old code used to materialize constants as ops, immediately folded them into the resulting affine map and then deleted the constant ops again. Instead, directly fold the attributes into the affine map. Furthermore, all helpers accept `OpFoldResult` instead of `Value` now. This makes the code at call sites more efficient, because it is no longer necessary to materialize a `Value`, just to be able to use these helper functions.

Note: The API has changed (accepts OpFoldResult instead of Value), otherwise this change is NFC.

Differential Revision: https://reviews.llvm.org/D153324
2023-06-22 10:47:38 +02:00
Diana Picus
8762bc77b4 [AMDGPU] Add llvm.amdgcn.cs.chain intrinsic to IR & verifier
We only check a subset of the constraints in the verifier:
* that we only call the intrinsic from functions with a restricted set of
calling conventions
* that the 'flags' argument is an immediate

Other checks are (probably) more appropriate for codegen.

Differential Revision: https://reviews.llvm.org/D151995
2023-06-22 10:02:45 +02:00
Diana Picus
29dcc4c143 [AMDGPU] Add amdgpu_cs_chain[_preserve] CCs to IR & verifier
Add the amdgpu_cs_chain and amdgpu_cs_chain_preserve keywords to
LLVM IR and make sure we can parse and print them. Also make sure we
perform some basic checks in the IR verifier - similar to what we check
for many of the other AMDGPU calling conventions, plus the additional
restriction that we can't have direct calls to functions with these
calling conventions.

Differential Revision: https://reviews.llvm.org/D151994
2023-06-22 10:02:45 +02:00
Job Noorman
7c2604ca19 [BOLT][RISCV] Add tests for simple CFG transformations
Reviewed By: rafauler

Differential Revision: https://reviews.llvm.org/D153346
2023-06-22 09:35:54 +02:00
Job Noorman
38ba2824c8 [BOLT] Don't register internal func relocs as external references
Currently, all relocations that point inside a function are registered
as external references. If these relocations cannot be resolved as jump
tables or computed gotos, the containing function gets marked as
not-simple and excluded from optimizations.

RISC-V uses relocations for branches and jumps (to support linker
relaxation) and as such, almost no functions get marked as simple. This
patch fixes this by only registering relocations that originate outside
of the referenced function as external references.

Reviewed By: rafauler

Differential Revision: https://reviews.llvm.org/D153345
2023-06-22 09:35:54 +02:00
Job Noorman
b410d24a19 [BOLT][RISCV] Implement R_RISCV_ADD32/SUB32
Thispatch implements the R_RISCV_ADD32 and R_RISCV_SUB32 relocations for
RISC-V.

Reviewed By: rafauler

Differential Revision: https://reviews.llvm.org/D146554
2023-06-22 09:35:54 +02:00
Itay Bookstein
89f493392d [coroutine] Add missing presplitcoroutine attr to example
Signed-off-by: Itay Bookstein <itay.bookstein@nextsilicon.com>
2023-06-22 10:23:52 +03:00
Michael Platings
028c1033b1 [Driver][BareMetal] Error if no matching multilib
Previously if no matching multilib was found then the user would
typically see an error like "fatal error: 'stdio.h' file not found"
which gives no indication as to the underlying problem.
With this change the user will instead see an error like
  clang: error: no multilib found matching flags: --target=thumbv7em-none-unknown-eabi -march=...
  clang: note: available multilibs are:
  --target=armv4t-none-unknown-eabi
  --target=thumbv6m-none-unknown-eabi -mfpu=none
  ...

Differential Revision: https://reviews.llvm.org/D153292
2023-06-22 08:10:43 +01:00
Tobias Gysi
88f07a3119 [mlir][llvm] Fix import of SwitchOp
This revision ensures SwitchOps with case and condition
bitwidths other than 32-bit are imported properly. It adds an
APInt based builder to the SwitchOp and implements
a verifier that checks that the condition and the case
value types match.

Reviewed By: Dinistro

Differential Revision: https://reviews.llvm.org/D153438
2023-06-22 06:27:32 +00:00
Petr Hosek
f3b64887de [libc] Place headers in the right include directory
When LLVM_ENABLE_PER_TARGET_RUNTIME_DIR is enabled, place headers
in `include/<target>` directory, otherwise use `include/`.

Differential Revision: https://reviews.llvm.org/D152592
2023-06-22 06:22:32 +00:00
Vitaly Buka
9540f50281 [test][sanitizer] Reformat and print to stderr 2023-06-21 23:21:41 -07:00
Christian Sigg
cd482968dc [Bazel][mlir] Avoid ODR violation introduced in 7ab749c.
This change also prepares for 9119325 to land again.

Adds `mlir_c_runner_utils_hdrs` and `mlir_runner_utils_hdrs` targets which do not depend on `//llvm::Support`.

These can be used by other 'runner.so' targets if they are loaded along with the 'runner_utils.so' without calling `__mlir_execution_engine_init()` twice.
2023-06-22 08:00:50 +02:00
Elliot Goodrich
cea0eea28e [llvm] Split out DenseMapInfo<variant> specialization
Remove the `DenseMapInfo<std::variant<Ts...>>` variant out from
`llvm/ADT/DenseMapInfo.h` into a separate header
`llvm/ADT/DenseMapInfoVariant.h`

This allows us to remove the `<variant>` include, which is being
transitively and unncessary included in all translation units that
include `llvm/ADT/DenseMap.h`.

There have been similar changes to move out specializations for

    * `APInt.h` fd7e309e02 and
    * `StringRef.h`/`ArrayRef.h`
      983565a6fe

to reduce the compilation time. As we are unable to move the
specialization into `<variant>`, we create a separate
`DenseMapInfoVariant.h` header that can be used by anyone who needs this
specialization.

This reduces the total number of preprocessing tokens across the LLVM
source files in lib from (roughly) 1,964,876,961 to 1,936,551,496 - a
reduction of ~1.44%. This should result in a small improvement in
compilation time.

Differential Revision: https://reviews.llvm.org/D150997
2023-06-22 06:50:54 +01:00
Jacques Pienaar
791c3cb7e6 [mlir][docgen] Enable op grouping mechanism.
Add ability to be able to group ops together in documentation generation. This
results in section of ops grouped together under one summary & description.
This doesn't do anything special for the groups beyond nesting yet.

Differential Revision: https://reviews.llvm.org/D153306
2023-06-21 21:50:30 -07:00
Vitaly Buka
9e68b7e0e0 [NFC][sanitizer] Rename internal getters 2023-06-21 21:05:27 -07:00
Michael Maitland
845ea71d0b [RISCV] Separate scheduler calsses for vfredmax/min
vfredmax/min may have different scheduling behavior on different
microarchitectures compared to other reductions. This different
behavior can be described by giving vfredmax/min separate
scheduling resources.

Differential Revision: https://reviews.llvm.org/D153450
2023-06-21 19:56:23 -07:00
Matt Arsenault
1717c18664 Intrinsics: Allow tablegen to mark parameters with dereferenceable 2023-06-21 21:36:22 -04:00
Matt Arsenault
c448e1dabe HIP: Directly call ldexp builtins 2023-06-21 21:34:42 -04:00
Aart Bik
f14c8eb595 [mlir][sparse][gpu] refine SDDMM pattern for cuSPARSE
Old pattern was missing some cases (e.g. swapping the arguments)
but it also allowed too many cases (e.g. non-empty "absent" or
different arguments for add/mul). This fixes the issues.

Reviewed By: K-Wu

Differential Revision: https://reviews.llvm.org/D153487
2023-06-21 18:31:55 -07:00
Matt Arsenault
92ee60b66f AMDGPU: Drop and upgrade llvm.amdgcn.atomic.inc/dec to atomicrmw 2023-06-21 21:20:26 -04:00
Craig Topper
017a24eb1b [RISCV] Minor refactoring of some code in copyPhysReg. NFC
Move some of the vmv.v.i handling into the vmv.v.v if. This
reduces the scope of one variable.
2023-06-21 18:02:58 -07:00
Craig Topper
d846ce7bc4 [TableGen][Target] Rename Attribute field in SubtargetFeature class to FieldName.
The word "attribute" has a specific meaning in LLVM. Avoid using it
here to mean something different.

This addresses feedback from D153180.

Reviewed By: arsenm

Differential Revision: https://reviews.llvm.org/D153444
2023-06-21 17:53:50 -07:00
Brad Richardson
0867d41573 [flang] don't require -flang-experimental-exec flag anymore
Reviewed By: awarzynski, PeteSteinfeld

Differential Revision: https://reviews.llvm.org/D153379
2023-06-21 16:47:52 -07:00
Vitaly Buka
116b5e1eb4 [test][sanitizer] Pre-commit huge malloc test 2023-06-21 16:20:02 -07:00
Vitaly Buka
bda0a93a91 Revert "[test][sanitizer] Precommit huge malloc test"
Wrong accidental commit.

This reverts commit 1f18c9624b.
2023-06-21 16:17:23 -07:00
Shoaib Meenai
b1dadab3d9 [MachO] Remove redundant .section directive
See https://reviews.llvm.org/D153382#inline-1483291
2023-06-21 16:16:46 -07:00
Vitaly Buka
1f18c9624b [test][sanitizer] Precommit huge malloc test 2023-06-21 16:14:07 -07:00
Vitaly Buka
758935061c [test] Add llvm-xray into XRAY_TEST_DEPS 2023-06-21 16:13:47 -07:00
Vitaly Buka
2cb547a719 [test] Add lli into ORC_TEST_DEPS 2023-06-21 16:13:47 -07:00
Mitch Phillips
3c3ebebca2 Revert "[mlir][RunnerUtils] Make symbols private + implement loading mechanism."
This reverts commit bba2b65611.

Reason: Broke the HWASan buildbot. See https://reviews.llvm.org/D153250
for more information.
2023-06-22 01:01:19 +02:00
Rashmi Mudduluru
db3dcedb9c [-Wunsafe-buffer-usage] Handle pointer initializations for grouping related variables
Differential Revision: https://reviews.llvm.org/D150489
2023-06-21 15:54:09 -07:00
Shoaib Meenai
1df10f1580 [Frontend] Remove ShowIncludesPretendHeader
It hasn't been written to since https://reviews.llvm.org/D46652, so it
was always empty. I don't have enough context on that diff to know if
the removal of the write to ShowIncludesPretendHeader in that diff was
intentional, but no one's complained about it for five years, so I
assume we're okay to just get rid of it entirely.

Reviewed By: hans

Differential Revision: https://reviews.llvm.org/D153176
2023-06-21 15:48:28 -07:00
Shoaib Meenai
67a11290df [Frontend] Don't output skipped includes from predefines
`-H` displays a tree of included header files, but that tree is supposed
to omit two categories of header files:
1. Any header files pulled in via `-include`, which the code refers to
   as the "predefines".
2. Any header files whose inclusion was skipped because they'd already
   been included (assuming header guards or `#pragma once`).

`-fshow-skipped-includes` was intended to make `-H` display the second
category of files. It wasn't checking for the first category, however,
so you could end up with only the middle of the `-include` hierarchy
displayed, e.g. the added test would previously output:

```
... /data/users/smeenai/llvm-project/clang/test/Frontend/Inputs/test2.h
. /data/users/smeenai/llvm-project/clang/test/Frontend/Inputs/test.h
```

This diff adds a check to prevent that and correctly omit headers from
`-include` even when `-fshow-skipped-includes` is passed. While I'm
here, add tests for the interaction between `-fshow-skipped-includes`
and `-sys-header-deps` as well.

Reviewed By: hans

Differential Revision: https://reviews.llvm.org/D153175
2023-06-21 15:48:27 -07:00
Valentin Clement
2bcbcbefcd
[flang] Enhance getTypeAsString to support more FIR types
Add support for couple of FIR types such as fir.ptr, fir.heap,
fir.box, fir.class

Reviewed By: razvanlupusoru

Differential Revision: https://reviews.llvm.org/D153461
2023-06-21 15:33:27 -07:00
Owen Pan
8e85739a5f [clang-format] Don't finalize #if, #else, #endif, etc.
Don't finalize a preprocessor branch directive if it's the first
token of an annotated line. See the rationale at
https://reviews.llvm.org/D150057#inline-1449546.

Fixes #63379

Differential Revision: https://reviews.llvm.org/D153243
2023-06-21 15:15:57 -07:00
Christopher Ferris
a27c416b89 [scudo] Change overloaded function name append.
The ScopedString class has two functions named append. One takes
a va_list, but on some platforms va_list is typedef'd to char*.
That means that this call:

  std::string value;
  Str.append("print this string %s", value.c_str());

The compiler can incorrectly think this is the va_list function,
leading to crashes when calling this. To fix this, change the name
of the va_list function to be vappend to avoid this.

Fix https://github.com/llvm/llvm-project/issues/62893

Reviewed By: Chia-hungDuan

Differential Revision: https://reviews.llvm.org/D153389
2023-06-21 15:11:47 -07:00
Louis Dionne
b356928058 [libc++] Fix the check-format job
Previously, it wouldn't take into account files in ignore_format.txt
(at least not on OSX) because the `find` command would return file names
like `libcxx/src//new_handler.cpp`, which never matched the file names
in `ignore_format.txt`.

Differential Revision: https://reviews.llvm.org/D153416
2023-06-21 17:59:32 -04:00
Jason Molenda
3858e9d6c5 Add two new entitlements when debugserver is built by Apple
Two new entitlements, com.apple.private.thread-set-state and
com.apple.private.set-exception-port should be included in the
debugserver entitlement plist when built internally at Apple.
The desktop builds of debugserver don't need these entitlements;
don't add them to debugserver-macosx-entitlements.plist.

rdar://108912676
rdar://103032208
2023-06-21 14:56:11 -07:00
Louis Dionne
bcca95da5e [libc++] Refactor the selection of string's ABI in __config
This doesn't change the selection, but it expands the conditions to
add comments and make it clearer what's happening. It also removes a
-Wundef instance when we checked __ARM_ARCH_7K__ >= 2 without checking
that it is defined in the first place.

Differential Revision: https://reviews.llvm.org/D153413
2023-06-21 17:53:57 -04:00
David Green
400b3c47c2 [ARM] Repair check lines in sub-cmp-peephole.ll test. NFC
Commit ec77747fbd regenerated the check lines
without being very careful about which lines were updated. This attempts to fix
them to make sure the V7 and V8 lines are emitted as needed.
2023-06-21 22:47:30 +01:00
Amilendra Kodithuwakku
9246df7049 Revert "Revert "[LLD][ELF] Cortex-M Security Extensions (CMSE) Support""
This reverts commit a685ddf1d1.

This relands Arm CMSE support (D139092) and fixes the GCC build bot errors.
2023-06-21 22:27:13 +01:00
Razvan Lupusoru
20ba5c61ea [mlir][openacc] Update host_data data operands list name
For all other compute and data constructs, the data operands list
is named `dataClauseOperands`. Update `acc.host_data` to be
consistent with this naming.

Reviewed By: clementval

Differential Revision: https://reviews.llvm.org/D153425
2023-06-21 14:25:31 -07:00
Peiming Liu
e7df82816b [mlir][sparse] rewrite arith::SelectOp to semiring operations to sparsify it.
Reviewed By: aartbik, K-Wu

Differential Revision: https://reviews.llvm.org/D153397
2023-06-21 21:22:18 +00:00
Tomasz Kuchta
d9b3691166 [DFSAN] Add support for strncat
This patch adds a support for the libc strncat() function in DFSAN

Reviewed by: browneee

Differential Revision: https://reviews.llvm.org/D152196
2023-06-21 21:21:13 +00:00
Valentin Clement
7c9b9d316d
[flang][openacc] Use acc.private and acc.firstprivate when lowering clauses
Lower private and firstprivate operands through their corresponding
data entry operation to support array section.

Depends on D152972

Reviewed By: razvanlupusoru

Differential Revision: https://reviews.llvm.org/D152974
2023-06-21 14:19:55 -07:00
Valentin Clement
8fb247e2de
[mlir][openacc] Add acc.firstprivate operation as data entry operation
acc.firstprivate operation will be used as data entry operation
for the firstprivate operands.

Depends on D152970

Reviewed By: razvanlupusoru

Differential Revision: https://reviews.llvm.org/D152972
2023-06-21 14:18:48 -07:00
Valentin Clement
cfba521dbd
[mlir][openacc] Add acc.private operation as data entry operation
acc.private operation will be used as data entry operation
for the private operands.

Reviewed By: razvanlupusoru

Differential Revision: https://reviews.llvm.org/D152970
2023-06-21 14:17:32 -07:00
Med Ismail Bennani
d10a61c8d2 [lldb/test] Disable TestStackCoreScriptedProcess.py
This patch disables TestStackCoreScriptedProcess.py since it times out
non deterministicly.

Signed-off-by: Med Ismail Bennani <ismail@bennani.ma>
2023-06-21 14:05:55 -07:00
Arthur Eubanks
ff4fcbb5f4 [test] Add test for null_pointer_is_valid and Inliner instsimplify interaction
As requested in D151254

Reviewed By: arsenm

Differential Revision: https://reviews.llvm.org/D153435
2023-06-21 14:00:53 -07:00