platform/upstream/llvm.git
20 months ago[flang][NFC] Remove unused DispatchTableop fct
Valentin Clement [Fri, 18 Nov 2022 19:32:18 +0000 (20:32 +0100)]
[flang][NFC] Remove unused DispatchTableop fct

Remove `appendTableEntry` as it is not used.

Reviewed By: jeanPerier, PeteSteinfeld

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

20 months agoRevert "Reapply: Add an error message to the default SIGPIPE handler"
Bill Wendling [Fri, 18 Nov 2022 00:07:15 +0000 (16:07 -0800)]
Revert "Reapply: Add an error message to the default SIGPIPE handler"

This patch is spamming compiles with unhelpful and confusing messages.
E.g. the Linux kernel uses "grep -q" in several places. It's meant to
quit with a return code of zero when the first match is found. This can
cause a SIGPIPE signal, but that's expected, and there's no way to turn
this error message off to avoid spurious error messages.

UNIX03 apparently doesn't require printing an error message on SIGPIPE,
but specifically when there's an error on the stdout stream in a normal
program flow, e.g. when SIGPIPE trap is disabled.

A separate patch is planned to address the specific case we care most
about (involving llvm-nm).

This reverts commit b89bcefa6202e310eb3167dd1c37f1807377ec8d.

Link: https://github.com/llvm/llvm-project/issues/59037
Link: https://github.com/ClangBuiltLinux/linux/issues/1651
Differential Revision: https://reviews.llvm.org/D138244

20 months agoAdd more tests for C DRs and update the status page
Aaron Ballman [Fri, 18 Nov 2022 19:15:02 +0000 (14:15 -0500)]
Add more tests for C DRs and update the status page

20 months ago[Hexagon] Add checks for immediate arguments for remaining builtins
Krzysztof Parzyszek [Thu, 17 Nov 2022 23:16:06 +0000 (15:16 -0800)]
[Hexagon] Add checks for immediate arguments for remaining builtins

Checks for builtins for the following instructions were aded:
  V6_v6mpyhubs10
  V6_v6mpyhubs10_vxx
  V6_v6mpyvubs10
  V6_v6mpyvubs10_vxx
  V6_vlutvvbi
  V6_vlutvvb_oracci
  V6_vlutvwhi
  V6_vlutvwh_oracci

20 months ago[FuzzMutate] change of format and comment for further code
Peter Rong [Fri, 18 Nov 2022 18:53:29 +0000 (10:53 -0800)]
[FuzzMutate] change of format and comment for further code

Signed-off-by: Peter Rong <PeterRong96@gmail.com>
20 months ago[SDAG] Allow scalable vectors in ComputeNumSignBits
Philip Reames [Fri, 18 Nov 2022 17:57:42 +0000 (09:57 -0800)]
[SDAG] Allow scalable vectors in ComputeNumSignBits

This is a continuation of the series of patches adding lane wise support for scalable vectors in various knownbit-esq routines.

The basic idea here is that we track a single lane for scalable vectors which corresponds to an unknown number of lanes at runtime. This is enough for us to perform lane wise reasoning on many arithmetic operations.

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

20 months ago[SystemZ][z/OS] Set text flag correctly for llvm-reduce tool
Abhina Sreeskantharajan [Fri, 18 Nov 2022 18:38:53 +0000 (13:38 -0500)]
[SystemZ][z/OS] Set text flag correctly for llvm-reduce tool

This patch sets the text flag correctly for llvm-reduce files

Reviewed By: arsenm

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

20 months agoConstantFolding: Constant fold some canonicalizes
Matt Arsenault [Fri, 11 Nov 2022 19:35:14 +0000 (11:35 -0800)]
ConstantFolding: Constant fold some canonicalizes

+/-0 is obviously foldable. Other non-special, non-subnormal
values are also probably OK. For denormal values, check
the calling function's denormal mode. For now, don't fold
denormals to the input for IEEE mode because as far as I know
the langref is still pretending LLVM's float isn't IEEE.

Also folds undef to 0, although NaN may make more sense. Skips
folding nans and infinities, although it should be OK to fold those
in a future change.

20 months ago[RISCV][CodeGen] Chapter of vector instruction type corresponds with chapters in...
Michael Maitland [Fri, 18 Nov 2022 18:09:50 +0000 (10:09 -0800)]
[RISCV][CodeGen] Chapter of vector instruction type corresponds with chapters in RISCV vector specification. NFC

The [vector spec](https://github.com/riscv/riscv-v-spec/blob/master/v-spec.adoc) is organized in chapters
based on instruction type. The comments in the tablegen marked the incorrect chapters. This change
updates the comments with the correct chapter numbers.

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

20 months ago[mlir][NFC] Add static ShapedType::isDynamicShape utility
Diego Caballero [Fri, 18 Nov 2022 18:06:49 +0000 (18:06 +0000)]
[mlir][NFC] Add static ShapedType::isDynamicShape utility

This utility is useful when we need to know if shape is dynamic and
we don't have a Type itself.

Reviewed By: ftynse

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

20 months agoAMDGPU: Fix fcanonicalize constant folding not correctly handling -0.0
Matt Arsenault [Fri, 18 Nov 2022 17:36:38 +0000 (09:36 -0800)]
AMDGPU: Fix fcanonicalize constant folding not correctly handling -0.0

20 months ago[RISCV] Optimize scalable frame offset calculation when VLEN is precisely known
Philip Reames [Fri, 18 Nov 2022 17:52:01 +0000 (09:52 -0800)]
[RISCV] Optimize scalable frame offset calculation when VLEN is precisely known

When we have a precisely known VLEN, we can replace runtime usage of VLENB with compile time constants. This converts offsets involving both fixed and scalable components into fixed offsets. The result is that we avoid the csr read of vlenb, and can often fold the multiply as well.

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

20 months ago[RISCV][llvm-mca] Use LMUL Instruments to provide more accurate reports on RISCV
Michael Maitland [Fri, 4 Nov 2022 15:51:39 +0000 (08:51 -0700)]
[RISCV][llvm-mca] Use LMUL Instruments to provide more accurate reports on RISCV

On x86 and AArch, SIMD instructions encode all of the scheduling information in the instruction
itself. For example, VADD.I16 q0, q1, q2 is a neon instruction that operates on 16-bit integer
elements stored in 128-bit Q registers, which leads to eight 16-bit lanes in parallel. This kind
of information impacts how the instruction takes to execute and what dependencies this may cause.

On RISCV however, the data that impacts scheduling is encoded in CSR registers such as vtype or
vl, in addition with the instruction itself. But MCA does not track or use the data in these
registers. This patch fixes this problem by introducing Instruments into MCA.

* Replace `CodeRegions` with `AnalysisRegions`
* Add `Instrument` and `InstrumentManager`
* Add `InstrumentRegions`
* Add RISCV Instrument and `InstrumentManager`
* Parse `Instruments` in driver
* Use instruments to override schedule class
* RISCV use lmul instrument to override schedule class
* Fix unit tests to pass empty instruments
* Add -ignore-im clopt to disable this change

A prior version of this patch was commited in 5e82ee5373212323a4ee610f reverted
that change because the unit test files caused build errors. The change with fixes
were committed in b88b8307bf9e but reverted once again e8e92c8313a0 due to more
build errors.

This commit adds the prior changes and fixes the build error.

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

20 months ago[Hexagon] Add clang flags for v71, v71t, v73
Krzysztof Parzyszek [Thu, 17 Nov 2022 23:16:06 +0000 (15:16 -0800)]
[Hexagon] Add clang flags for v71, v71t, v73

20 months ago[AMDGPU] Add subtarget feature for MAD_U64/I64 bug on GFX11
Mirko Brkusanin [Fri, 18 Nov 2022 17:09:24 +0000 (18:09 +0100)]
[AMDGPU] Add subtarget feature for MAD_U64/I64 bug on GFX11

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

20 months agoAMDGPU: Add some baseline tests for llvm.amdgcn.trig.preop folding
Matt Arsenault [Wed, 16 Nov 2022 20:49:00 +0000 (12:49 -0800)]
AMDGPU: Add some baseline tests for llvm.amdgcn.trig.preop folding

20 months ago[XCOFF] llvvm-readobj support display symbol table of loader section of xcoff object...
zhijian [Fri, 18 Nov 2022 17:10:16 +0000 (12:10 -0500)]
[XCOFF] llvvm-readobj support display symbol table of loader section of xcoff object file.

Reviewers: James Henderson, Esme Yi

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

20 months ago[bolt] Pass %cflags in test/X86/is-strip.s
Nico Weber [Fri, 18 Nov 2022 16:35:35 +0000 (11:35 -0500)]
[bolt] Pass %cflags in test/X86/is-strip.s

Without this, clang builds a binary for macOS on a macOS host, and
then the linker complains that it doesn't know the -q flag.

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

20 months ago[bolt] Make test/X86/end-symbol.test not use "tac"
Nico Weber [Fri, 18 Nov 2022 16:33:23 +0000 (11:33 -0500)]
[bolt] Make test/X86/end-symbol.test not use "tac"

"tac" doesn't exist on macOS, so this makes the test pass there.

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

20 months ago[bolt] Clean up lit site cfg files a bit
Nico Weber [Fri, 18 Nov 2022 15:36:14 +0000 (10:36 -0500)]
[bolt] Clean up lit site cfg files a bit

* Stop setting config.python_executable in Unit/lit.site.cfg.py.in.
  All other projects only set this in the main lit config, not in the
  one for unit tests. (Unit tests don't spawn Python.)
* Set config.python_executable to Python3_EXECUTABLE in main
  lit.site.cfg.py.in instead of PYTHON_EXECUTABLE. All other files
  did this in c4c3883b00.
* Stop setting enable_abi_breaking_checks, enable_backtrace, enable_shared.
  Nothing in bolt's tests (or in lit) reads them.

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

20 months ago[lldb] Restore default setting of LLDB_INCLUDE_TESTS in standalone builds
Alex Langford [Thu, 17 Nov 2022 21:46:40 +0000 (13:46 -0800)]
[lldb] Restore default setting of LLDB_INCLUDE_TESTS in standalone builds

In 52f39853abd46495a6d636c4b035e1b92cf4b833 the option LLDB_INCLUDE_TESTS was
moved above the inclusion of LLDBStandalone. This isn't a problem per-se, but
it changes the default value of LLDB_INCLUDE_TESTS in standalone builds.
LLDBStandalone explicitly sets LLVM_INCLUDE_TESTS to true, indicating that
for standalone builds this is considered the default behavior.
This patch restores said default behavior.

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

20 months agoAMDGPU/GlobalISel: Fix crash after mad/fma_mix fails selection
Petar Avramovic [Fri, 18 Nov 2022 17:00:01 +0000 (18:00 +0100)]
AMDGPU/GlobalISel: Fix crash after mad/fma_mix fails selection

When selectVOP3PMadMixModsImpl fails, it can still create new copy instr
via selectVOP3ModsImpl. When selectG_FMA_FMAD gives up, new copy instr
will remain dead but will not be automatically removed.
InstructionSelect does not check if instructions created during selection
are dead.
Such dead copy doesn't have register class on dst operand and causes crash.
Fix is to build copy when operands are being added to selected instruction.

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

20 months ago[AMDGPU] Stop looking for implicit M0 uses on MOV instructions
Jay Foad [Fri, 18 Nov 2022 16:11:18 +0000 (16:11 +0000)]
[AMDGPU] Stop looking for implicit M0 uses on MOV instructions

Before D114230, indirect moves used regular MOV opcodes and were
identified by having an implicit use of M0. Since D114230 they use
dedicated opcodes instead, so remove some old code that checks for
implicit uses of M0. NFCI.

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

20 months agoInstSimplify: Add baseline tests for canonicalize
Matt Arsenault [Fri, 11 Nov 2022 18:30:22 +0000 (10:30 -0800)]
InstSimplify: Add baseline tests for canonicalize

20 months agoAMDGPU/GlobalISel: Fix strictfp fmul
Matt Arsenault [Fri, 18 Nov 2022 06:14:35 +0000 (22:14 -0800)]
AMDGPU/GlobalISel: Fix strictfp fmul

20 months ago[Clang][CodeGen][AIX] Map __builtin_frexpl, __builtin_ldexpl, and __builtin_modfl...
Xing Xue [Fri, 18 Nov 2022 16:36:56 +0000 (11:36 -0500)]
[Clang][CodeGen][AIX] Map __builtin_frexpl, __builtin_ldexpl, and __builtin_modfl to 'double' version lib calls in 64-bit 'long double' mode

Summary:
AIX library functions frexpl(), ldexpl(), and modfl() are for 128-bit IBM long double, i.e. __ibm128. Other *l() functions, e.g., acosl(), are for 64-bit long double. The AIX Clang compiler currently maps builtin functions __builtin_frexpl(), __builtin_ldexpl(), and __builtin_modfl() to frexpl(), ldexpl(), and modfl() in 64-bit long double mode which results in seg-faults or incorrect return values. This patch changes to map __builtin_frexpl(), __builtin_ldexpl(), and __builtin_modfl() to double version lib functions frexp(), ldexp() and modf() in 64-bit long double mode.

Reviewed by: hubert.reinterpretcast, daltenty

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

20 months ago[libc++] Use numeric_limits instead of raw INT_MAX
Louis Dionne [Thu, 17 Nov 2022 15:33:08 +0000 (10:33 -0500)]
[libc++] Use numeric_limits instead of raw INT_MAX

This allows discard_block_engine to work on platforms that might not
provide a full <limits.h> header.

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

20 months ago[AArch64][SVE] Use PTRUE instruction instead of WHILELO if the range is appropriate...
Dinar Temirbulatov [Fri, 18 Nov 2022 16:21:10 +0000 (16:21 +0000)]
[AArch64][SVE] Use PTRUE instruction instead of WHILELO if the range is appropriate for predicator constant.

While get_active_lane_mask lowering it uses WHILELO instruction,
but forconstant range suitable for PTRUE then we could issue PTRUE instruction
instead.

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

20 months ago[LLDB][AArch64] Add BF16BF16, SME2p1 and SVE2p1 to disassembler test
David Spickett [Fri, 18 Nov 2022 16:15:51 +0000 (16:15 +0000)]
[LLDB][AArch64] Add BF16BF16, SME2p1 and SVE2p1 to disassembler test

See:
https://reviews.llvm.org/rGcf69895ab31b
https://reviews.llvm.org/D136352
https://reviews.llvm.org/D137410

20 months ago[Hexagon] Add missing patterns for mulhs/mulhu
Krzysztof Parzyszek [Fri, 18 Nov 2022 15:35:03 +0000 (07:35 -0800)]
[Hexagon] Add missing patterns for mulhs/mulhu

20 months ago[MLIR][Parser] Add `parseBase64Bytes`.
bzcheeseman [Wed, 16 Nov 2022 05:23:18 +0000 (21:23 -0800)]
[MLIR][Parser] Add `parseBase64Bytes`.

This patch adds `parseBase64Bytes` to the parser. It attempts to avoid double-allocating the buffer by re-using the token's spelling directly and eliding the quotes if they exist. It also avoids extra allocations by using std::vector<char> in the API - something we should change when the llvm::decodeBase64 API changes.

Reviewed By: rriddle

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

20 months ago[lldb] Fix that empty target.run-args are not actually used when launching process
Raphael Isemann [Wed, 16 Nov 2022 23:52:02 +0000 (00:52 +0100)]
[lldb] Fix that empty target.run-args are not actually used when launching process

`GetPropertyAtIndexAsArgs` returns true on success and false on failure. Right
now it returns the converted `size_t` returned from `GetArgs` which describes
the number of arguments in the argument list. So for empty argument lists
(`(size_t)0` -> `(bool)false`) this function always fails.

The only observable effect of this seems to be that empty arguments are never
propagated to the internal LaunchInfo for a process. This causes that once any
argument has been added to `target.run-args`, clearing `target.run-args` doesn't
have any effect.

Fixes issue #55568

Reviewed By: JDevlieghere, jingham

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

20 months ago[libcxx] Fix link to Buildbot interface
David Spickett [Fri, 18 Nov 2022 12:55:15 +0000 (12:55 +0000)]
[libcxx] Fix link to Buildbot interface

Reviewed By: #libc, philnik, ldionne

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

20 months ago[SDAG] Allow scalable vectors in ComputeKnownBits
Philip Reames [Fri, 18 Nov 2022 15:23:10 +0000 (07:23 -0800)]
[SDAG] Allow scalable vectors in ComputeKnownBits

his is the SelectionDAG equivalent of D136470, and is thus an alternate patch to D128159.

The basic idea here is that we track a single lane for scalable vectors which corresponds to an unknown number of lanes at runtime. This is enough for us to perform lane wise reasoning on many arithmetic operations.

This patch also includes an implementation for SPLAT_VECTOR as without it, the lane wise reasoning has no base case. The original patch which inspired this (D128159), also included STEP_VECTOR. I plan to do that as a separate patch.

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

20 months ago[clang][NFC] Remove unused parameter from ParseConstantExpression
Timm Bäder [Fri, 18 Nov 2022 13:53:28 +0000 (14:53 +0100)]
[clang][NFC] Remove unused parameter from ParseConstantExpression

20 months ago[llvm-reduce] Do not crash when accessing landingpads of invokes.
Florian Hahn [Fri, 18 Nov 2022 15:19:50 +0000 (15:19 +0000)]
[llvm-reduce] Do not crash when accessing landingpads of invokes.

Unconditionally removing landing pads results in invalid IR,
if there is a different `invoke` that uses it. Update the code
to only remove the landing pad if the current invoke is the only
user. Also carefully avoid creating plain branches to bbs with
landing pads we couldn't remove.

Reviewed By: arsenm, aeubanks

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

20 months ago[clang][parse] Avoid creating StmtVectors every loop iteration
Timm Bäder [Fri, 18 Nov 2022 13:46:16 +0000 (14:46 +0100)]
[clang][parse] Avoid creating StmtVectors every loop iteration

20 months ago[clang][sema][NFC] Make some local variables const
Timm Bäder [Sat, 12 Nov 2022 17:06:06 +0000 (18:06 +0100)]
[clang][sema][NFC] Make some local variables const

We don't modify them. Also use auto here since we already wrote the full
type in the cast.

20 months agoARCRegisterInfo::eliminateFrameIndex updated to fix build error caused by 32bd75716c2...
Alexander Timofeev [Fri, 18 Nov 2022 15:16:10 +0000 (16:16 +0100)]
ARCRegisterInfo::eliminateFrameIndex updated to fix build error caused by 32bd75716c27d1a094c2436529b596ce1547f6eb

20 months agoPEI should be able to use backward walk in replaceFrameIndicesBackward.
Alexander Timofeev [Thu, 17 Nov 2022 18:03:22 +0000 (19:03 +0100)]
PEI should be able to use backward walk in replaceFrameIndicesBackward.

The backward register scavenger has correct register
liveness information. PEI should leverage the backward register scavenger.

Reviewed By: arsenm

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

20 months ago[mlir][linalg] Do not check if added dimension are static in linalg.broadcast.
Oleg Shyshkov [Fri, 18 Nov 2022 13:45:33 +0000 (14:45 +0100)]
[mlir][linalg] Do not check if added dimension are static in linalg.broadcast.

Added dimensions can be both static and dinamic. Mapped dimension should be the same in the input and the init.

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

20 months ago[bolt] add missing space in "llvm-bolt -help" output
Nico Weber [Fri, 18 Nov 2022 14:47:01 +0000 (09:47 -0500)]
[bolt] add missing space in "llvm-bolt -help" output

20 months ago[llvm-ar] Fix when llvm-ar fails to replace existing members when updating a thin...
gbreynoo [Fri, 18 Nov 2022 14:37:56 +0000 (14:37 +0000)]
[llvm-ar] Fix when llvm-ar fails to replace existing members when updating a thin archive

As seen in https://github.com/llvm/llvm-project/issues/55023 when a thin
archive is updated when not in the CWD, replacement does not work as
expected. This change fixes the relative file path comparison so the
correct files are updated.

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

20 months ago[AArch64][SME2] Remove vector constraints from zip/uzp (2-vector) instruction classes
David Sherwood [Fri, 18 Nov 2022 13:07:35 +0000 (13:07 +0000)]
[AArch64][SME2] Remove vector constraints from zip/uzp (2-vector) instruction classes

The zip/uzp (2-vector) instruction classes have the incorrect
register constraints and mark the destination as also being an
input. However, the instructions are fully destructive so I've
restructured the classes.

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

20 months ago[mlir][llvm] Iterative constant import from LLVM IR.
Tobias Gysi [Fri, 18 Nov 2022 14:04:38 +0000 (15:04 +0100)]
[mlir][llvm] Iterative constant import from LLVM IR.

Instead of importing constant expressions recursively, the revision
walks all dependencies of an LLVM constant iteratively. The actual
conversion then iterates over a list of constants and all intermediate
constant values are added to the value mapping. As a result, an LLVM IR
constant maps to exactly one MLIR operation per function. The revision
adapts the existing tests since the constant ordering changed for
aggregate types. Additionally, it adds extra tests that mix aggregate
constants and constant expressions.

Depends on D137416

Reviewed By: ftynse

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

20 months ago[clang-tidy] Remove a duplicated if-branch in the unused-using-decl
Haojian Wu [Fri, 18 Nov 2022 14:05:56 +0000 (15:05 +0100)]
[clang-tidy] Remove a duplicated if-branch in the unused-using-decl
check, NFC

20 months ago[docs] remove extra slash from llvm github url
Aarush Bhat [Fri, 18 Nov 2022 13:54:31 +0000 (21:54 +0800)]
[docs] remove extra slash from llvm github url

Reviewed By: tstellar

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

20 months ago[X86] Use lock add/sub for cases that we only care about the EFLAGS
Phoebe Wang [Fri, 18 Nov 2022 13:08:01 +0000 (21:08 +0800)]
[X86] Use lock add/sub for cases that we only care about the EFLAGS

This fixes #36373, #36905 and partial of #58685.

Reviewed By: RKSimon

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

20 months ago[reland][libc][bazel] Add tests to the bazel build
Guillaume Chatelet [Fri, 18 Nov 2022 10:14:37 +0000 (10:14 +0000)]
[reland][libc][bazel] Add tests to the bazel build

This patch adds bazel tests for llvm-libc.

Some math tests rely on the `mpfr` library. This is controlled via the `--@llvm-project//libc:libc_math_mpfr` flag. It can take three values:
 - `external` (default) will build `mpfr` and `gmp` from source.
 - `system` will use the system installed `mpfr` library.
 - `disable` will skip tests relying on `mpfr`.

Reviewed By: sivachandra, GMNGeoffrey

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

20 months ago[Support] Add support for attaching payloads to points and ranges
Tom Praschan [Wed, 16 Nov 2022 23:20:37 +0000 (00:20 +0100)]
[Support] Add support for attaching payloads to points and ranges

This is useful where tests previously encoded information in the name
names of ranges and points. Currently, this is pretty limited because
names consist of only alphanumeric characters and '_'.

With this patch, we can keep the names simple and attach optional
payloads to ranges and points instead.

The new syntax should be fully backwards compatible (if I haven't missed
anything). I tested this against clangd unit tests and everything still passes.

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

20 months ago[include-cleaner] Add self-contained file support for PragmaIncludes.
Haojian Wu [Mon, 14 Nov 2022 08:58:39 +0000 (09:58 +0100)]
[include-cleaner] Add self-contained file support for PragmaIncludes.

And use it findHeaders. findHeaders now finds all header candidates
given a symbol location (these headers will be attached with proper
signals, in a followup patch).

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

20 months ago[X86] Pre-commit tests for pr58685
Phoebe Wang [Fri, 18 Nov 2022 12:50:24 +0000 (20:50 +0800)]
[X86] Pre-commit tests for pr58685

20 months ago[Assignment Tracking][24/*] Always RemoveRedundantDbgInstrs in instcombine in assignm...
OCHyams [Fri, 18 Nov 2022 12:36:41 +0000 (12:36 +0000)]
[Assignment Tracking][24/*] Always RemoveRedundantDbgInstrs in instcombine in assignment tracking builds

The Assignment Tracking debug-info feature is outlined in this RFC:

https://discourse.llvm.org/t/
rfc-assignment-tracking-a-better-way-of-specifying-variable-locations-in-ir

This reduces peak memory overhead by 15% when building CTMark's tramp3d-v4 with
-O2 -g with assignment tracking enabled.

Reviewed By: jmorse

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

20 months agoFix inliner test after e3cd498ff7748f967be1bdcc0a994e40ce82268f
OCHyams [Fri, 18 Nov 2022 12:20:58 +0000 (12:20 +0000)]
Fix inliner test after e3cd498ff7748f967be1bdcc0a994e40ce82268f

Bot failure: https://lab.llvm.org/buildbot/#/builders/16/builds/38156

e3cd498ff7748f967be1bdcc0a994e40ce82268f (D133318) updates CloneBlock to
preserve debug use-before-defs. Update local-as-metadata-undominated-use.ll to
reflect this.

20 months ago[AArch64][SME]: Generate streaming-compatible code for ISD::INSERT_VECTOR_ELT.
Hassnaa Hamdi [Thu, 17 Nov 2022 17:40:51 +0000 (17:40 +0000)]
[AArch64][SME]: Generate streaming-compatible code for ISD::INSERT_VECTOR_ELT.

1- Enable custom lowering INSERT_VECTOR_ELT to generate code compatible
   to streaming mode.
2- Add testing file:
   insert-vector-elt.ll

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

20 months ago[AArch64][SME]: Add precursory tests for D138222
Hassnaa Hamdi [Thu, 17 Nov 2022 17:38:30 +0000 (17:38 +0000)]
[AArch64][SME]: Add precursory tests for D138222

20 months ago[mlir][OpenMP] Add order clause definition to simd construct
Dominik Adamski [Thu, 20 Oct 2022 13:20:37 +0000 (08:20 -0500)]
[mlir][OpenMP] Add order clause definition to simd construct

Update simd construct definition and add mlir tests to prove
that order(concurrent) clause is correctly modeled for simd
construct.

20 months ago[AMDGPU] Test MAD formation on GFX11
Jay Foad [Fri, 18 Nov 2022 11:56:12 +0000 (11:56 +0000)]
[AMDGPU] Test MAD formation on GFX11

GFX11 has no MAD instructions, only FMA, so this is just testing that we
generate separate MUL and ADD.

20 months ago[Assignment Tracking][21/*] Account for assignment tracking in inliner
OCHyams [Fri, 18 Nov 2022 11:49:43 +0000 (11:49 +0000)]
[Assignment Tracking][21/*] Account for assignment tracking in inliner

The Assignment Tracking debug-info feature is outlined in this RFC:

https://discourse.llvm.org/t/
rfc-assignment-tracking-a-better-way-of-specifying-variable-locations-in-ir

The inliner requires two additions:

fixupAssignments - Update inlined instructions' DIAssignID metadata so that
inlined DIAssignID attachments are unique to the inlined instance.

trackInlinedStores - Treat inlined stores to caller-local variables
(i.e. callee stores to argument pointers that point to the caller's allocas) as
assignments. Track them using trackAssignments, which is the same method as is
used by the AssignmentTrackingPass. This means that we're able to detect stale
memory locations due to DSE after inlining. Because the stores are only tracked
_after_ inlining, any DSE or movement of stores _before_ inlining will not be
accounted for. This is an accepted limitation mentioned in the RFC.

One change is also required:

Update CloneBlock to preserve debug use-before-defs. Otherwise the assignments
will be dropped due to having the intrinsic operands replaced with empty
metadata (see use-before-def.ll in this patch and this related discourse post.

Reviewed By: jmorse

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

20 months ago[gn build] port 7059a6c32cfa
Nico Weber [Fri, 18 Nov 2022 11:48:07 +0000 (06:48 -0500)]
[gn build] port 7059a6c32cfa

20 months ago[AArch64][SME]: Use SVE mov instruction for FPR128 registers in streaming-compatible...
Hassnaa Hamdi [Thu, 17 Nov 2022 15:27:45 +0000 (15:27 +0000)]
[AArch64][SME]: Use SVE mov instruction for FPR128 registers in streaming-compatible mode.

1- in streaming mode, use SVE OR/mov instruction instead of NEON OR,
   during copying phyReg -AArch64InstrInfo::copyPhysReg-.
2- add testing file:
   register-mov.ll

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

20 months ago[AMDGPU][GFX11][NFC] Refactor VOPD operands handling (part 2)
Dmitry Preobrazhensky [Fri, 18 Nov 2022 11:12:22 +0000 (14:12 +0300)]
[AMDGPU][GFX11][NFC] Refactor VOPD operands handling (part 2)

Rename interface functions and operands to make code clearer.

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

20 months ago[AMDGPU] Fix PreRARematStage::sinkTriviallyRematInsts region boundary update after...
Valery Pykhtin [Thu, 17 Nov 2022 19:19:04 +0000 (20:19 +0100)]
[AMDGPU] Fix PreRARematStage::sinkTriviallyRematInsts region boundary update after sinking.

First boundary of a region wasn't updated when a sinked instruction was added first into the region.

Reviewed By: vangthao

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

20 months ago[mlir] GreedyPatternRewriter: Reprocess modified ops
Matthias Springer [Fri, 18 Nov 2022 10:18:19 +0000 (11:18 +0100)]
[mlir] GreedyPatternRewriter: Reprocess modified ops

Ops that were modifed in-place (`finalizeRootUpdate` was called) should be reprocessed by the GreedyPatternRewriter. This is currently not happening with `GreedyRewriteConfig::maxIterations = 1`.

Note: If your project goes into an infinite loop because of this change, you likely have one or multiple faulty patterns that modify the same operations in-place (`updateRootInplace`) indefinitely.

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

20 months ago[DAG] Allow folding AND of anyext masked_load with >1 user to zext version
Benjamin Maxwell [Fri, 18 Nov 2022 10:14:55 +0000 (10:14 +0000)]
[DAG] Allow folding AND of anyext masked_load with >1 user to zext version

This now allows folding an AND of a anyext masked_load to a
zext_masked_load even if the masked load has multiple users.  Doing is
eliminates some redundant ANDs/MOVs for certain AArch64 SVE code.

I'm not sure if there's any cases where doing this could negatively the
other users of the masked_load.  Looking at other optimizations of
masked loads, most don't apply if the load is used more than once, so it
doesn't look like this would interfere.

Reviewed By: c-rhodes

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

20 months ago[Driver] exclude recently added tests from Windows
Matt Jacobson [Fri, 18 Nov 2022 10:19:53 +0000 (05:19 -0500)]
[Driver] exclude recently added tests from Windows

20 months ago[Assignment Tracking][15/*] Account for assignment tracking in simplifycfg
OCHyams [Fri, 18 Nov 2022 10:07:30 +0000 (10:07 +0000)]
[Assignment Tracking][15/*] Account for assignment tracking in simplifycfg

The Assignment Tracking debug-info feature is outlined in this RFC:

https://discourse.llvm.org/t/
rfc-assignment-tracking-a-better-way-of-specifying-variable-locations-in-ir

Update simplifycfg:
sinkLastInstruction - preserve debug use-before-defs.

SpeculativelyExecuteBB - replace the value component of dbg.assign intrinsics
when stores are hoisted and merged using a select, and don't delete them.

Reviewed By: jmorse

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

20 months ago[mlir][SubElementInterfaces] Add a recursivelyReplaceElementsIn helper to AttrTypeRep...
River Riddle [Fri, 18 Nov 2022 04:51:38 +0000 (20:51 -0800)]
[mlir][SubElementInterfaces] Add a recursivelyReplaceElementsIn helper to AttrTypeReplacer

This somewhat improves the ergonomics when replacing recursively within
a set of IR.

20 months ago[mlir][AsmPrinter] Allow explicitly disabling debug info
River Riddle [Fri, 18 Nov 2022 04:44:27 +0000 (20:44 -0800)]
[mlir][AsmPrinter] Allow explicitly disabling debug info

This adds an `enable` flag to OpPrintingFlags::enableDebugInfo
that allows for overriding any command line flags for debug printing,
and matches the format that we use for other `enableBlah` API.

20 months ago[mlir] Fix ordering of intermixed attribute/type aliases
River Riddle [Thu, 17 Nov 2022 00:26:18 +0000 (16:26 -0800)]
[mlir] Fix ordering of intermixed attribute/type aliases

We properly order dependencies between attribute/type aliases,
but we currently always print attribute aliases separately from type
aliases. This creates problems if an attribute wants to use a type
alias during printing.

This commit refactors alias collection such that attribute/type aliases
are collected together and printed together.

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

20 months ago[Assignment Tracking][14/*] Account for assignment tracking in instcombine
OCHyams [Fri, 18 Nov 2022 09:22:29 +0000 (09:22 +0000)]
[Assignment Tracking][14/*] Account for assignment tracking in instcombine

The Assignment Tracking debug-info feature is outlined in this RFC:

https://discourse.llvm.org/t/
rfc-assignment-tracking-a-better-way-of-specifying-variable-locations-in-ir

Most of the updates here are just to ensure DIAssignID attachments are
maintained and propagated correctly.

Reviewed By: jmorse

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

20 months ago[mlir][Bazel] Add DebugImporter sources to build target.
Adrian Kuegel [Fri, 18 Nov 2022 09:18:37 +0000 (10:18 +0100)]
[mlir][Bazel] Add DebugImporter sources to build target.

20 months ago[clang] Fix assert message
serge-sans-paille [Fri, 18 Nov 2022 09:10:21 +0000 (10:10 +0100)]
[clang] Fix assert message

20 months ago[flang] Lower ArrayRef to hlfir.designate
Jean Perier [Fri, 18 Nov 2022 09:08:56 +0000 (10:08 +0100)]
[flang] Lower ArrayRef to hlfir.designate

Also add support for fir.boxchar in HLFIRTools so that character
designator with none constant lengths can be processed/converted to
fir::ExtendedValue.

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

20 months agoRevert "Revert "[opt][clang] Enable using -module-summary/-flto=thin with -S/-emit...
Alexander Shaposhnikov [Fri, 18 Nov 2022 08:45:05 +0000 (08:45 +0000)]
Revert "Revert "[opt][clang] Enable using -module-summary/-flto=thin with -S/-emit-llvm""

This reverts commit 7f608a2497c7578b9f3ca98014176ab95cffe3c0
and removes the dependency of Object on IRPrinter.

20 months ago[NFC][asan] Simplify __sanitizer_annotate_contiguous_container
Vitaly Buka [Fri, 18 Nov 2022 08:54:21 +0000 (00:54 -0800)]
[NFC][asan] Simplify __sanitizer_annotate_contiguous_container

20 months ago[LoongArch] Implement assembler branches pseudo instructions
wanglei [Fri, 18 Nov 2022 08:33:49 +0000 (16:33 +0800)]
[LoongArch] Implement assembler branches pseudo instructions

These instructions always output the canonical mnemonic. The GNU tools
emit the canonical mnemonic for the branch pseudo instructions as well
(e.g. "bgt" will be recognised by the assembler but never printed by
objdump).

Reviewed By: xen0n

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

20 months ago[mlir][llvm] Import additional debug info from LLVMIR.
Tobias Gysi [Fri, 18 Nov 2022 08:44:26 +0000 (09:44 +0100)]
[mlir][llvm] Import additional debug info from LLVMIR.

Add a DebugImporter to convert LLVMIR debug metadata into
MLIR debug attributes. It is the counterpart to the
DebugTranslation class and supports the same attributes.
The revision only supports the translation of instruction,
function, and module debug information. The import of
intrinsics is left to a later revision.

Depends on D138206

Reviewed By: rriddle

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

20 months ago[mlir][llvm] Make some debug info attribute parameters optional.
Tobias Gysi [Fri, 18 Nov 2022 08:35:15 +0000 (09:35 +0100)]
[mlir][llvm] Make some debug info attribute parameters optional.

The revision makes specific debug information attribute parameters
optional since some of them can be omitted in LLVMIR. The additional
flexibility enables a later revision that will support importing
debug information from LLVMIR. A special case is the types parameter
of the SubroutineTypeAttr. For void functions, its first entry is
null in LLVMIR. This revision splits the type parameter in an optional
resultType parameter and an argumentTypes array to support this corner
case.

Reviewed By: rriddle

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

20 months ago[include-cleaner] Fix building with LLVM_LINK_LLVM_DYLIB=ON on mingw
Martin Storsjö [Fri, 18 Nov 2022 08:27:46 +0000 (10:27 +0200)]
[include-cleaner] Fix building with LLVM_LINK_LLVM_DYLIB=ON on mingw

Make sure to use clang_target_link_libraries, which skips linking
against libraries and links against libclang-cpp instead, if
LLVM_LINK_LLVM_DYLIB is enabled.

This fixes errors like these:

ld.lld: error: duplicate symbol: clang::PPCallbacks::~PPCallbacks()
>>> defined at libclangLex.a(PPCallbacks.cpp.obj)
>>> defined at libclang-cpp.dll

20 months agoRevert "[opt][clang] Enable using -module-summary/-flto=thin with -S/-emit-llvm"
Mikhail Goncharov [Fri, 18 Nov 2022 08:25:45 +0000 (09:25 +0100)]
Revert "[opt][clang] Enable using -module-summary/-flto=thin with -S/-emit-llvm"

This reverts commit 34ab474348e2623cc67abddb7bb662385297ac65.

as it has introduced circular dependency lib - analysis

20 months ago[llvm][Bazel] Remove dependency to avoid cycyle.
Adrian Kuegel [Fri, 18 Nov 2022 07:46:54 +0000 (08:46 +0100)]
[llvm][Bazel] Remove dependency to avoid cycyle.

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

20 months ago[flang] Add hlfir.designate definition
Jean Perier [Fri, 18 Nov 2022 07:38:11 +0000 (08:38 +0100)]
[flang] Add hlfir.designate definition

Add hlfir.designate operation definition. This is the HLFIR building
blocks to represent Fortran designator. An hlfir.designator is a
Fortran "part-ref" and an optional susbstring or part ref.
See the operation added description for more detail, and
https://github.com/llvm/llvm-project/blob/main/flang/docs/HighLevelFIR.md
for the rational of this operation.

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

20 months ago[Coroutines] Handle the writes to promise alloca prior to
Chuanqi Xu [Thu, 17 Nov 2022 07:01:32 +0000 (15:01 +0800)]
[Coroutines] Handle the writes to promise alloca prior to
llvm.coro.begin

Previously we've taken care of the writes to allocas prior to llvm.coro.begin.
However, since the promise alloca is special so that we never handled it
before. For the long time, since the programmers can't access the
promise_type due to the c++ language specification, we still failed to
recognize the problem until a recent report:
https://github.com/llvm/llvm-project/issues/57861

And we've tested many codes that the problem gone away after we handle
the writes to the promise alloca prior to @llvm.coro.begin()
prope until a recent report:
https://github.com/llvm/llvm-project/issues/57861

And we've tested many codes that the problem gone away after we handle
the writes to the promise alloca prior to @llvm.coro.begin() properly.

Closes https://github.com/llvm/llvm-project/issues/57861

20 months ago[mlir] [transform] Error for duplicated processor mapping
Guray Ozen [Fri, 18 Nov 2022 07:38:03 +0000 (08:38 +0100)]
[mlir] [transform] Error for duplicated processor mapping

In a nested loop nest, it is not feasible to map different loops to the same processing unit; for an example, check the code below. This modification includes a check in this circumstance.

```
scf.foreach_thread (%i, %j) in (%c32, %c32) {...}
{ mapping = [#gpu.thread<x>, #gpu.thread<x>] }

```

Note: It also deletes a test because it is not possible to reproduce this error.

Depends on D138020

Reviewed By: ftynse

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

20 months ago[NFC][OpenMP] Remove unused label
Vitaly Buka [Fri, 18 Nov 2022 07:30:54 +0000 (23:30 -0800)]
[NFC][OpenMP] Remove unused label

20 months ago[Driver] move FreeBSD header search path management to the driver
Matt Jacobson [Thu, 17 Nov 2022 04:42:15 +0000 (23:42 -0500)]
[Driver] move FreeBSD header search path management to the driver

This matches OpenBSD, and it supports Swift's use of clang for its C interop
functionality.  Recent changes to Swift use AddClangSystemIncludeArgs() to
inspect the cc1 args; this doesn't work for platforms where cc1 adds standard
include paths implicitly.  See:

<https://github.com/apple/swift/commit/cf3354222d9f480de74db390f53a6dcc749fde14>

Also clean up InitHeaderSearch, making it clearer which targets manage header
search paths in the driver.

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

20 months ago[NFC][OpenMP] Fix const cast warning
Vitaly Buka [Fri, 18 Nov 2022 07:17:15 +0000 (23:17 -0800)]
[NFC][OpenMP] Fix const cast warning

20 months ago[test][OpenMP] Expect more tsan reports
Vitaly Buka [Fri, 18 Nov 2022 07:16:31 +0000 (23:16 -0800)]
[test][OpenMP] Expect more tsan reports

20 months ago[NFC][OpenMP] Remove extra ";"
Vitaly Buka [Fri, 18 Nov 2022 07:05:17 +0000 (23:05 -0800)]
[NFC][OpenMP] Remove extra ";"

20 months ago[NFC][OpenMP] Fix warning about non-virtual dtor
Vitaly Buka [Fri, 18 Nov 2022 07:03:01 +0000 (23:03 -0800)]
[NFC][OpenMP] Fix warning about non-virtual dtor

20 months ago[NFC][asan] Rename variables in test
Vitaly Buka [Fri, 18 Nov 2022 06:34:30 +0000 (22:34 -0800)]
[NFC][asan] Rename variables in test

20 months ago[RegisterScavenger][RISCV] Don't search for FrameSetup instrs if we were searching...
luxufan [Fri, 18 Nov 2022 06:56:36 +0000 (14:56 +0800)]
[RegisterScavenger][RISCV] Don't search for FrameSetup instrs if we were searching from Non-FrameSetup instrs

Otherwise, the spill position may point to position where before
FrameSetup instructions. In which case, the spill instruction may store
to caller's frame since the stack pointer has not been adjustted.

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

Reviewed By: craig.topper

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

20 months ago[PowerPC] mark dead def for ctr be clobber.
Chen Zheng [Thu, 17 Nov 2022 05:18:04 +0000 (05:18 +0000)]
[PowerPC] mark dead def for ctr be clobber.

TLS pseudo ADDIStlsgdHA will have such def. This dead def should
also prevent PPC from generating CTR loops.

20 months ago[openmp] [test] Fix warnings about printf format mismatches on Windows
Martin Storsjö [Tue, 8 Nov 2022 09:45:41 +0000 (11:45 +0200)]
[openmp] [test] Fix warnings about printf format mismatches on Windows

This fixes warnings like this:

```
openmp/runtime/test/omp_testsuite.h:107:60: warning: format specifies type 'unsigned int' but the argument has type 'DWORD' (aka 'unsigned long') [-Wformat]
    fprintf(stderr, "CreateThread() failed: Error #%u.\n", GetLastError());
                                                   ~~      ^~~~~~~~~~~~~~
                                                   %lu
```

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

20 months ago[openmp] Only try to add the -mrtm flag on i386/x86_64
Martin Storsjö [Tue, 8 Nov 2022 13:31:40 +0000 (15:31 +0200)]
[openmp] Only try to add the -mrtm flag on i386/x86_64

Clang does accept the flag for any architecture, but prints a
warning:

    clang-16: warning: argument unused during compilation: '-mrtm' [-Wunused-command-line-argument]

This flag is documented as an x86 specific flag, so don't try to
add it for other architectures, to silence this warning.

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

20 months ago[RISCV] Make lowerVECTOR_SHUFFLEAsVSlidedown follow source until not EXTRACT_SUBVECTOR.
Han-Kuan Chen [Tue, 15 Nov 2022 11:34:44 +0000 (03:34 -0800)]
[RISCV] Make lowerVECTOR_SHUFFLEAsVSlidedown follow source until not EXTRACT_SUBVECTOR.

Current lowerVECTOR_SHUFFLEAsVSlidedown only seeks whether input are
EXTRACT_SUBVECTOR and their source are same. The commit will make the
function seek input and their source until they are not
EXTRACT_SUBVECTOR.

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

20 months ago[RISCV] Pre-commit test.
Han-Kuan Chen [Tue, 15 Nov 2022 12:02:41 +0000 (04:02 -0800)]
[RISCV] Pre-commit test.

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

20 months ago[asan] Simplify the test
Vitaly Buka [Fri, 18 Nov 2022 06:29:19 +0000 (22:29 -0800)]
[asan] Simplify the test

20 months agoApply clang-tidy fixes for llvm-else-after-return in SparseTensorCodegen.cpp (NFC)
Mehdi Amini [Thu, 17 Nov 2022 09:09:30 +0000 (09:09 +0000)]
Apply clang-tidy fixes for llvm-else-after-return in SparseTensorCodegen.cpp (NFC)