platform/upstream/llvm.git
18 months ago[libc][NFC] Replace static inline and inline annotations with LIBC_INLINE.
Siva Chandra Reddy [Thu, 19 Jan 2023 08:32:50 +0000 (08:32 +0000)]
[libc][NFC] Replace static inline and inline annotations with LIBC_INLINE.

This is first of a few patches which will do similar mechanical changes.

LIBC_INLINE is a simple macro which is default defined as just `inline`.
The idea is that, different downstream contexts can define the macro as
suitable to their use case and context. For example, one can choose to
define LIBC_INLINE as `[[clang::internal_linkage]] inline`.

Reviewed By: lntue

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

18 months ago[libc++] Add FreeBSD XFAILs in preparation for CI
Ed Maste [Thu, 15 Dec 2022 14:34:29 +0000 (09:34 -0500)]
[libc++] Add FreeBSD XFAILs in preparation for CI

This at least allows us to stand up libc++ FreeBSD CI and avoid future
regressions.  The failures do need to be addressed, and can be done
iteratively.

Reviewed By: philnik, Mordante

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

18 months agoRevert "Add support for clang-cl's option `-fexcess-precision`."
Zahira Ammarguellat [Fri, 20 Jan 2023 21:42:56 +0000 (16:42 -0500)]
Revert "Add support for clang-cl's option `-fexcess-precision`."

This reverts commit 47074683c906f920cb7bba462beeb57ca4b84ab0.

Had to revert it that since it's breaking tests on MacOS. See
https://reviews.llvm.org/D141929 comments from @thakis.

18 months ago[Clang] Fix test case `clang/test/OpenMP/bug59944.c`
Shilei Tian [Fri, 20 Jan 2023 21:40:38 +0000 (16:40 -0500)]
[Clang] Fix test case `clang/test/OpenMP/bug59944.c`

18 months agoRevert "sanmd: refine selection of functions for UAR checking"
Arthur Eubanks [Fri, 20 Jan 2023 21:40:36 +0000 (13:40 -0800)]
Revert "sanmd: refine selection of functions for UAR checking"

This reverts commit 9d4f1a9eff27716069dc6a2d991baa228c197b85.

Breaks under -DCOMPILER_RT_BUILD_SANITIZERS=OFF

18 months ago[libc++] add FreeBSD atomic wait support
Konstantin Belousov [Wed, 18 Jan 2023 01:18:24 +0000 (20:18 -0500)]
[libc++] add FreeBSD atomic wait support

Reviewed By: philnik

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

18 months ago[clang][modules] Disallow importing private framework in the implementation
Jan Svoboda [Fri, 20 Jan 2023 01:02:42 +0000 (17:02 -0800)]
[clang][modules] Disallow importing private framework in the implementation

Whenever we are compiling implementation of a framework (with the `-fmodule-name=FW` option), we never translate `#import <FW/Header.h>` to an import, regardless of whether "Header.h" belongs to "FW" or "FW_Private". For the same reasons, we also disallow `@import FW`. However, we still allow `@import FW_Private`. This patch disallows that a well, to be consistent with the rest of the rules.

Reviewed By: benlangmuir

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

18 months ago[mlir][sparse] IR/SparseTensorDialect.cpp: misc code cleanup
wren romano [Thu, 19 Jan 2023 02:22:48 +0000 (18:22 -0800)]
[mlir][sparse] IR/SparseTensorDialect.cpp: misc code cleanup

Reviewed By: Peiming

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

18 months ago[Clang] [Sema] Removed a fix-it for system headers
Fahad Nayyar [Mon, 16 Jan 2023 19:42:10 +0000 (19:42 +0000)]
[Clang] [Sema] Removed a fix-it for system headers

Disabled an invalid fix-it which suggested fixes to be applied in system headers for some programs in IDEs like Xcode.

rdar://100890960

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

18 months ago[APSInt] Fix bug in APSInt mentioned in https://github.com/llvm/llvm-project/issues...
Peter Rong [Tue, 27 Dec 2022 02:05:11 +0000 (18:05 -0800)]
[APSInt] Fix bug in APSInt mentioned in https://github.com/llvm/llvm-project/issues/59515

Also provide a `tryExtValue()` API like APInt did in D139683

Reviewed By: RKSimon, efriedma

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

18 months ago[clang/CodeGenActionTest] Use the platform's path separator for the `DebugInfoCWDCode...
Argyrios Kyrtzidis [Fri, 20 Jan 2023 18:14:11 +0000 (10:14 -0800)]
[clang/CodeGenActionTest] Use the platform's path separator for the `DebugInfoCWDCodeGen` test

Fixes a failure in some Windows configuration.

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

18 months ago[AMDGPU][NFC] Clarify heterogeneous DWARF address/memory spaces
Tony Tye [Fri, 20 Jan 2023 18:08:19 +0000 (18:08 +0000)]
[AMDGPU][NFC] Clarify heterogeneous DWARF address/memory spaces

Reviewed By: scott.linder

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

18 months ago[OMPIRBuilder] Pass dependencies to createTask by value
Prabhdeep Singh Soni [Fri, 13 Jan 2023 03:58:21 +0000 (22:58 -0500)]
[OMPIRBuilder] Pass dependencies to createTask by value

This patch modifies OpenMPIRBuilder::createTask to accept its
Dependencies vector by value instead of by reference. This is
necessary because the PostOutlineCB lambda that uses this Dependencies
vector may outlive the original Dependencies vector.

Reviewed By: kiranchandramohan

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

18 months ago[lldb] Implement SymbolFile::CopyType
Augusto Noronha [Wed, 18 Jan 2023 20:22:43 +0000 (12:22 -0800)]
[lldb] Implement SymbolFile::CopyType

SymbolFiles should be the only point of creation of Types to ensure
that they aren't destroyed prematurely by keeping them in the
SymbolFile's TypeList. This patch hides the copy constructor of Types,
and adds a new CopyType function to SymbolFile, so Types can still be
copied safely.

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

18 months ago[lldb] Remove timer from SBModule copy ctor
Dave Lee [Tue, 29 Nov 2022 00:21:16 +0000 (16:21 -0800)]
[lldb] Remove timer from SBModule copy ctor

The SBModule copy constructor has fast execution, and is high firing. Fast and
frequent functions are not good candidates for timers.

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

18 months ago[bazel] Fix up dependency
Benjamin Kramer [Fri, 20 Jan 2023 20:58:56 +0000 (21:58 +0100)]
[bazel] Fix up dependency

18 months agoRevert "Revert "[MLIR] Update bazel build file after 455305624884cf9237143e2ba0635fcc...
Benjamin Kramer [Fri, 20 Jan 2023 20:56:25 +0000 (21:56 +0100)]
Revert "Revert "[MLIR] Update bazel build file after 455305624884cf9237143e2ba0635fcc5ba5206""

This reverts commit 9ef7ae507387f133cf34ca0bc0edd3f009a3ff71.

18 months ago[LSR] Style cleanup for code recently added in D132443
Philip Reames [Fri, 20 Jan 2023 20:44:47 +0000 (12:44 -0800)]
[LSR] Style cleanup for code recently added in D132443

Also add FIXMEs which highlight correctness bugs in this recently added off by default option.  These have also been raised on the original review.

18 months ago[clang/driver] Add `-gno-modules` as the negative version of `-gmodules`
Argyrios Kyrtzidis [Fri, 20 Jan 2023 18:04:59 +0000 (10:04 -0800)]
[clang/driver] Add `-gno-modules` as the negative version of `-gmodules`

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

18 months agoCorrect documentation for the refersToType AST matcher
Aaron Ballman [Fri, 20 Jan 2023 20:35:54 +0000 (15:35 -0500)]
Correct documentation for the refersToType AST matcher

The docs used a nonexisting matcher that caused some confusion. It has
now been replaced with the correct syntax.

Fixes #58044

18 months ago[mlir][Index] Implement InferIntRangeInterface, re-land
Krzysztof Drewniak [Mon, 9 Jan 2023 17:09:17 +0000 (17:09 +0000)]
[mlir][Index] Implement InferIntRangeInterface, re-land

Re-land D140899 to fix a missing dependency in the index dialect's
CMakeLists.txt.

Reviewed By: Mogball

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

18 months ago[PowerPC] Remove the lax warning for explicit casts
Maryam Moghadas [Fri, 20 Jan 2023 15:55:20 +0000 (09:55 -0600)]
[PowerPC] Remove the lax warning for explicit casts

This patch is to remove the erroneous lax vector conversion warning for CStyle; explicit; casts
that was added as part of D126540.

Reviewed By: nemanjai

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

18 months agoRecommit "[RISCV][TableGen] Move XLen detection into getMArch in RISCVTargetDefEmitte...
Craig Topper [Fri, 20 Jan 2023 20:20:58 +0000 (12:20 -0800)]
Recommit "[RISCV][TableGen] Move XLen detection into getMArch in RISCVTargetDefEmitter. NFC"

Using the correct feature name to detect 64bit this time. Previously,
I mistakenly compared the expected record name against a string inside
the record.

18 months ago[LSR] Generalize one aspect of terminator folding (recently introduced in D132443)
Philip Reames [Fri, 20 Jan 2023 20:15:44 +0000 (12:15 -0800)]
[LSR] Generalize one aspect of terminator folding (recently introduced in D132443)

There's no need to require the start value to come directly from the loop predecessor.  This was sometimes covering up a latent miscompile in this off-by-default option, but the miscompile needs fixed anyways and the issue has been raised on the original review.

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

18 months agoAllow a target loop to be used inside a parallel.
Doru Bercea [Wed, 11 Jan 2023 16:17:02 +0000 (10:17 -0600)]
Allow a target loop to be used inside a parallel.

18 months ago[OpenMP] Fix for distributed barrier.
Terry Wilmarth [Thu, 12 Jan 2023 16:29:20 +0000 (10:29 -0600)]
[OpenMP] Fix for distributed barrier.

Distributed barrier was found to cause hangs in some test cases. Found
that a section updating the barrier size was improperly shifted to a
different code section during patching.  Restored to original
location, all tests run to completion.

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

18 months agoUpdate the status of some C11 and C99 features we support
Aaron Ballman [Fri, 20 Jan 2023 19:49:25 +0000 (14:49 -0500)]
Update the status of some C11 and C99 features we support

This updates the status of:

N505 Make qualifiers idempotent
N725 Integer promotion rules
N1311 Initializing static of external variables

18 months ago[bazel] Remove some unused dependencies
Benjamin Kramer [Fri, 20 Jan 2023 19:43:57 +0000 (20:43 +0100)]
[bazel] Remove some unused dependencies

18 months ago[bazel] Add missing dependency after 16f8d17f7b
Benjamin Kramer [Fri, 20 Jan 2023 19:40:06 +0000 (20:40 +0100)]
[bazel] Add missing dependency after 16f8d17f7b

18 months ago[Clang][OpenMP] Bail out early if `Scope` is nullptr in case of any crash
Shilei Tian [Fri, 20 Jan 2023 19:40:16 +0000 (14:40 -0500)]
[Clang][OpenMP] Bail out early if `Scope` is nullptr in case of any crash

When there is any compile error, clang still tries to compile as many code as
possible, therefore `Scope` can be `nullptr` here. However, we didn't check it
beforehand, causing compiler crash.

Fix #59944.

Reviewed By: ABataev

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

18 months ago[RS4GC] Add a GCStrategy option to enable RS4GC
Campbell Suter [Fri, 20 Jan 2023 15:00:01 +0000 (18:00 +0300)]
[RS4GC] Add a GCStrategy option to enable RS4GC

Currently, the RewriteStatepointsForGC pass has a hardcoded list of GC
strategies that it operates on, forcing downstream projects to patch
LLVM to enable it for their own strategies. The diff D141110 changes
that to each GCStrategy having a flag to enable or disable RS4GC.

This patch adds that flag. It currently doesn't do anything, but is
provided so downstream projects can enable it to smooth the transition.

Reviewed By: dantrushin

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

18 months ago[BOLT][DWARF] Change loclist encoding to use base_addrx
Alexander Yermolovich [Fri, 20 Jan 2023 19:30:04 +0000 (11:30 -0800)]
[BOLT][DWARF] Change loclist encoding to use base_addrx

Doing the same thing as for rangelists. Changing loclists to use base_addrx, it
slightly increases .debug_loclists, but reduces .debug_addr section.

| section             | clang-16.bolt.base | clang-16.bolt | raw       |  % |
| debug_loclists |  198208                  |  203398          | 5190     | 102%  |
| .debug_addr    | 14415808              | 14351448        | -64360 |99.5% |

Reviewed By: maksfb

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

18 months ago[InstCombine] adjust tests for fptoui + trunc; NFC
Sanjay Patel [Fri, 20 Jan 2023 19:10:23 +0000 (14:10 -0500)]
[InstCombine] adjust tests for fptoui + trunc; NFC

Tests were duplicated for undef-ness, but that's not necessary.
There were no tests for bfloat/double.

I deleted the fptosi tests for now because those will just
be a bitwidth adjustment to the fptoui tests once we settle
on the right set of tests.

I think it should just be 2 tests on either side of the
bitwidth boundary to allow a fold with a couple of extra
tests thrown in to show other type constraints are not
a factor.

Goes with:
D142093

18 months ago[mlir] Add "memref::MemRefDialect" as dependentDialects for GpuToLLVMConversionPass
Xiang Li [Wed, 18 Jan 2023 04:20:11 +0000 (23:20 -0500)]
[mlir] Add "memref::MemRefDialect" as dependentDialects for GpuToLLVMConversionPass

For https://github.com/llvm/llvm-project/issues/60070.
The issue is caused by memref.store is not registed.
Registe it by add "memref::MemRefDialect" as dependetDialects for GpuToLLVMConsersionPass.

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

18 months agoAdd Parse/Sema for iterator for map clause.
Doru Bercea [Fri, 6 Jan 2023 17:17:57 +0000 (11:17 -0600)]
Add Parse/Sema for iterator for map clause.

18 months ago[CVP] Expand bound `udiv`'s, symmetrically with `urem`'s
Roman Lebedev [Fri, 20 Jan 2023 17:56:40 +0000 (20:56 +0300)]
[CVP] Expand bound `udiv`'s, symmetrically with `urem`'s

Symmetrical with the `urem` case, added in 66efb986322b206834e7c9e1eb777fa053912c39.

Simple case: https://alive2.llvm.org/ce/z/gRumLd / https://alive2.llvm.org/ce/z/rxEeC5
Second variant of precondition: https://alive2.llvm.org/ce/z/cAm9TD

18 months ago[NFC][CVP] Add tests for udiv expansion
Roman Lebedev [Fri, 20 Jan 2023 17:45:24 +0000 (20:45 +0300)]
[NFC][CVP] Add tests for udiv expansion

18 months agoRevert "[llvm] Move bit counting functions to bit.h (NFC)"
Nico Weber [Fri, 20 Jan 2023 18:51:29 +0000 (13:51 -0500)]
Revert "[llvm] Move bit counting functions to bit.h (NFC)"

This reverts commit f37614b25ccaa9c0710cc8a4fc2ba2fb0fcb9159.
Doesn't build on Windows: https://reviews.llvm.org/D142078#4068417

18 months agoRevert "[RISCV][TableGen] Move XLen detection into getMArch in RISCVTargetDefEmitter...
Craig Topper [Fri, 20 Jan 2023 18:44:49 +0000 (10:44 -0800)]
Revert "[RISCV][TableGen] Move XLen detection into getMArch in RISCVTargetDefEmitter. NFC"

This reverts commit e58010f712ccac83194852fa95ed70ef76ba6a33.

Seems this is failing on the build bots.

18 months ago[PGO] incorrect classof in InstrProfIncrementInst
Ellis Hoag [Fri, 20 Jan 2023 18:00:21 +0000 (10:00 -0800)]
[PGO] incorrect classof in InstrProfIncrementInst

Class InstrProfIncrementInstStep inherits from InstrProfIncrementInst but cannot cast to InstrProfIncrementInst, because InstrProfIncrementInst::classof does not cover such circumstance。

Function InstrProfiling::run traverse all instruction in a module and try to cast them to InstrProfIncrementInst using dyn_cast, but it will return nullptr if the instruction is InstrProfIncrementInstStep(subclass of InstrProfIncrementInst).

Reviewed By: tejohnson, ellis

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

18 months ago[RISCV][TableGen] Move XLen detection into getMArch in RISCVTargetDefEmitter. NFC
Craig Topper [Fri, 20 Jan 2023 18:15:27 +0000 (10:15 -0800)]
[RISCV][TableGen] Move XLen detection into getMArch in RISCVTargetDefEmitter. NFC

We no longer need the XLen in two places. Fold it into the code
that determines the default march.

18 months ago[InstCombine] regenerate test checks; NFC
Sanjay Patel [Fri, 20 Jan 2023 18:10:56 +0000 (13:10 -0500)]
[InstCombine] regenerate test checks; NFC

We have better value name propagation now. Eliminates some noise
in case something in this set of tests has a real change.

18 months ago[RISCV] Remove Features from CPUInfo in RISCVTargetParser.
Craig Topper [Fri, 20 Jan 2023 18:03:37 +0000 (10:03 -0800)]
[RISCV] Remove Features from CPUInfo in RISCVTargetParser.

Instead of having separate feature bits, get information from march.
Invalid is now implied by empty march.
64-bit is now implied by march starting with "rv64".

Reviewed By: fpetrogalli

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

18 months ago[Sanitizers] intercept hexdump on FreeBSD.
David Carlier [Fri, 20 Jan 2023 17:59:00 +0000 (17:59 +0000)]
[Sanitizers] intercept hexdump on FreeBSD.

Reviewers: vitalybuka
Reviewed-By: vitalybuka
Differential Revision: https://reviews.llvm.org/D110471

18 months ago[gn] port a920ae3b8d1e9 (DWARFLinkerParallel)
Nico Weber [Fri, 20 Jan 2023 17:52:22 +0000 (12:52 -0500)]
[gn] port a920ae3b8d1e9 (DWARFLinkerParallel)

18 months ago[AArch64] Enable libm vectorized functions via SLEEF
Daniel Kiss [Fri, 20 Jan 2023 17:52:14 +0000 (18:52 +0100)]
[AArch64] Enable libm vectorized functions via SLEEF

It enables trigonometry functions vectorization via SLEEF: http://sleef.org/.

  - A new vectorization library enum is added to TargetLibraryInfo.h: SLEEF.
  - A new option is added to TargetLibraryInfoImpl - ClVectorLibrary: SLEEF.
  - A comprehensive test case is included in this changeset.
  - A new vectorization library argument is added to -fveclib: -fveclib=SLEEF.

Trigonometry functions that are vectorized by sleef:
acos
asin
atan
atanh
cos
cosh
exp
exp2
exp10
lgamma
log10
log2
log
sin
sinh
sqrt
tan
tanh
tgamma

Co-authored-by: Stefan Teleman
Reviewed By: paulwalker-arm

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

18 months ago[AArch64][SME2] Add multi-vector FP convert from Float to interleave Half/BFloat...
Caroline Concatto [Fri, 20 Jan 2023 17:14:16 +0000 (17:14 +0000)]
[AArch64][SME2] Add multi-vector FP convert from Float to interleave Half/BFloat intrinsic

Add the following intrinsic:
  FCVTN
  BFCVTN

NOTE: These intrinsics are still in development and are subject to future changes.

Reviewed By: david-arm

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

18 months ago[MachineCombiner] Use default latency model when no detailed model available
Philip Reames [Fri, 20 Jan 2023 16:59:24 +0000 (08:59 -0800)]
[MachineCombiner] Use default latency model when no detailed model available

This change adjusts the cost modeling used when the target does not have a schedule model with individual instruction latencies. After this change, we use the default latency information available from TargetSchedule. The default latency information essentially ends up treating most instructions as latency 1, with a few "expensive" ones getting a higher cost.

Previously, we unconditionally applied the first legal pattern - without any consideration of profitability. As a result, this change both prevents some patterns being applied, and changes which patterns are exercised. (i.e. previously the first pattern was applied, afterwards, maybe the second one is because the first wasn't profitable.)

The motivation here is two fold.

First, this brings the default behavior in line with the behavior when -mcpu or -mtune is specified. This improves test coverage, and generally makes it less likely we will have bad surprises when providing more information to the compiler.

Second, this enables some reassociation for ILP by default. Despite being unconditionally enabled, the prior code tended to "reassociate" repeatedly through an entire chain and simply moving the first operand to the end. The result was still a serial chain, just a different one. With this change, one of the intermediate transforms is unprofitable and we end up with a partially flattened tree.

Note that the resulting code diffs show significant room for improvement in the basic algorithm. I am intentionally excluding those from this patch.

For the test diffs, I don't seen any concerning regressions. I took a fairly close look at the RISCV ones, but only skimmed the x86 (particularly vector x86) changes.

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

18 months ago[X86] `LowerBUILD_VECTOR()`: fix all-UNDEF detection
Roman Lebedev [Fri, 20 Jan 2023 16:58:53 +0000 (19:58 +0300)]
[X86] `LowerBUILD_VECTOR()`: fix all-UNDEF detection

The original check was trying to avoid checking UndefMask itself,
and deduce it via simpler means, but checking `NonZeroMask`
does not, e.g., check `ZeroMask`.

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

18 months ago[ARM][AArch64] Switch to generic MEMBARRIER node
Philip Reames [Fri, 20 Jan 2023 16:50:14 +0000 (08:50 -0800)]
[ARM][AArch64] Switch to generic MEMBARRIER node

This change switches both targets from using target specific CompilerBarrier nodes to the recently introduced generic MEMBARRIER instruction.

A couple things to call out.

First, this changes the assembly comment printed. I'm not sure this matters, but if it does, we can simply drop this patch. This is a minor clean up at best.

Second, the ordering operand on the target instruction appears to be unused. We could easily add ordering to the generic instruction, but since we don't seem to have a motivating case in tree, I simply dropped the ordering when selecting to the generic instruction.

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

18 months ago[NFC][DWARFLinker] Refactor address emitting code.
Alexey Lapshin [Fri, 20 Jan 2023 15:48:13 +0000 (16:48 +0100)]
[NFC][DWARFLinker] Refactor address emitting code.

As a preparation for implementing DWARFv5 address ranges generation,
this patch refactors existing address ranges generation code:
Split emitUnitRangesEntries into two functions emitDwarfDebugArangesTable
and emitDwarfDebugRangesTableFragment. Use AddressRanges to prepare linked
address ranges. Refactor Unit.getLowPc(), to use std::nullopt as undefined value.

Reviewed By: JDevlieghere

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

18 months ago[NFC]Fix github identification.
Alexey Bataev [Fri, 20 Jan 2023 16:40:00 +0000 (08:40 -0800)]
[NFC]Fix github identification.

18 months ago[libc++][format] range-default-formatter for set.
Mark de Wever [Thu, 5 May 2022 16:57:32 +0000 (18:57 +0200)]
[libc++][format] range-default-formatter for set.

Implements the range-default-formatter specialization range_format::set.

Implements parts of
- P2286R8 Formatting Ranges
- P2585R0 Improving default container formatting

Depends on D140801

Reviewed By: ldionne, #libc

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

18 months agoRecommit "[LoopUnroll] Directly update DT instead of DTU."
Florian Hahn [Fri, 20 Jan 2023 16:33:39 +0000 (16:33 +0000)]
Recommit "[LoopUnroll] Directly update DT instead of DTU."

This reverts commit c5ea42bcf48c8f3d3e35a6bff620b06d2a499108.

Recommit the patch with a fix for loops where the exiting terminator is
not a branch instruction. In that case, ExitInfos may be empty. In
addition to checking if there's a single exiting block also check if
there's a single ExitInfo.

A test case has been added in f92b35392ed8e4631.

18 months ago[mlir] use stable_sort for OperationLegalizer::computeOpLegalizationDepth
Xiang Li [Thu, 19 Jan 2023 14:23:30 +0000 (09:23 -0500)]
[mlir] use stable_sort for OperationLegalizer::computeOpLegalizationDepth

For https://github.com/llvm/llvm-project/issues/60070.
llvm::array_pod_sort will cause non-determinism when select pattern.
It is exposed by difference between windows build and linux build.

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

18 months agoAdd support for clang-cl's option `-fexcess-precision`.
Zahira Ammarguellat [Tue, 17 Jan 2023 14:02:35 +0000 (09:02 -0500)]
Add support for clang-cl's option `-fexcess-precision`.

This option is useful for clang and clang-cl.

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

18 months ago[RISCV][LSR] Precommit test coverage for an upcoming change
Philip Reames [Fri, 20 Jan 2023 16:19:04 +0000 (08:19 -0800)]
[RISCV][LSR] Precommit test coverage for an upcoming change

Main point of these is to show the difference between a loop with and without a use outside the loop.

18 months agoFix unused variable warning.
Johannes Reifferscheid [Fri, 20 Jan 2023 16:20:12 +0000 (17:20 +0100)]
Fix unused variable warning.

18 months ago[NFC] Reformat isBuiltinSupported with early exit
serge-sans-paille [Fri, 20 Jan 2023 10:33:25 +0000 (11:33 +0100)]
[NFC] Reformat isBuiltinSupported with early exit

18 months ago[modules] Allow parsing a duplicate Obj-C interface if a previous one comes from...
Volodymyr Sapsai [Wed, 14 Dec 2022 05:25:47 +0000 (21:25 -0800)]
[modules] Allow parsing a duplicate Obj-C interface if a previous one comes from a hidden [sub]module.

Instead of emitting a redefinition error, check that definitions are
equivalent and allow such scenario.

A few non-obvious implementation details:
* to avoid multiple definitions in the redeclaration chain we just drop
  the new definition after checking for equivalence;
* for checking definition equivalence use ODR hash instead of
  ASTStructuralEquivalence because it avoids excessive recursive
  deserialization. Though after detecting a mismatch we do deserialize
  multiple entities to provide a better error message.

rdar://82908223

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

18 months ago[ODRHash] Hash `ObjCInterfaceDecl` and diagnose discovered mismatches.
Volodymyr Sapsai [Fri, 9 Dec 2022 02:35:07 +0000 (18:35 -0800)]
[ODRHash] Hash `ObjCInterfaceDecl` and diagnose discovered mismatches.

When two modules contain interfaces with the same name, check the
definitions are equivalent and diagnose if they are not.

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

18 months ago[Bitcode] Fix invalid !nonnull metadata in test (NFC)
Nikita Popov [Fri, 20 Jan 2023 16:12:13 +0000 (17:12 +0100)]
[Bitcode] Fix invalid !nonnull metadata in test (NFC)

18 months ago[libc++] Move iota_view::iterator and sentinel out of iota_view
Nikolas Klauser [Sun, 4 Dec 2022 15:13:53 +0000 (16:13 +0100)]
[libc++] Move iota_view::iterator and sentinel out of iota_view

This makes it a lot easier to specialize traits types for it, like __segmented_iterator_traits.

Reviewed By: var-const, #libc

Spies: libcxx-commits

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

18 months ago[libc++] Enable clang-tidy from the buildkite pipeline instead of hard-coding it...
Nikolas Klauser [Mon, 9 Jan 2023 16:45:45 +0000 (17:45 +0100)]
[libc++] Enable clang-tidy from the buildkite pipeline instead of hard-coding it in run-buildbot

Reviewed By: ldionne, #libc, Mordante, emaste

Spies: emaste, Mordante, libcxx-commits, arichardson

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

18 months ago[InstCombine] Fixup check lines in test (NFC)
Nikita Popov [Fri, 20 Jan 2023 16:08:24 +0000 (17:08 +0100)]
[InstCombine] Fixup check lines in test (NFC)

These were broken by dfb0581bfa7b5fb9061876bd1b9af814408aaf95.

18 months ago[LoopUnroll] Add test case exposing crash with d0907ce7ed9f.
Florian Hahn [Fri, 20 Jan 2023 16:08:25 +0000 (16:08 +0000)]
[LoopUnroll] Add test case exposing crash with d0907ce7ed9f.

18 months ago[mlir] fix python types
Alex Zinenko [Fri, 20 Jan 2023 16:02:31 +0000 (16:02 +0000)]
[mlir] fix python types

18 months ago[Assignment Tracking] Fix tests for buildbot failure (2)
OCHyams [Fri, 20 Jan 2023 15:43:27 +0000 (15:43 +0000)]
[Assignment Tracking] Fix tests for buildbot failure (2)

Follow-up for 4ece50737d5385fb80cfa23f5297d1111f8eed39 (D142027).

Assignment Tracking Analysis now always runs and is skipped internally if
assignment tracking is disabled. Update these tests to expect to see the
pass run.

Buildbot failure: https://lab.llvm.org/buildbot/#/builders/57/builds/24094

18 months agoFix !nonnull syntax in test [NFC]
Nuno Lopes [Fri, 20 Jan 2023 15:57:58 +0000 (15:57 +0000)]
Fix !nonnull syntax in test [NFC]

18 months ago[lldb][test] Skip TestRerunAndExprDylib on Ubuntu 18.04
Dave Lee [Thu, 19 Jan 2023 18:38:21 +0000 (10:38 -0800)]
[lldb][test] Skip TestRerunAndExprDylib on Ubuntu 18.04

Disable this test on Ubuntu 18.04, where it fails for yet to be determined reasons.

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

18 months ago[OpenMP] Only test kmp_atomic_float10_max_min.c on X86
Shilei Tian [Fri, 20 Jan 2023 15:52:47 +0000 (10:52 -0500)]
[OpenMP] Only test kmp_atomic_float10_max_min.c on X86

The test `openmp/runtime/test/atomic/kmp_atomic_float10_max_min.c` uses a compiler
flag `-mlong-double-80` that might not be supported by all targets. Currently it
requires `x86-registered-target`, but that requirement can be true when LLVM
supports X86 while the actual `libomp` arch is not X86. For example, when LLVM
is built on AArch64 with all targets enabled, `x86-registered-target` can be met.
If `libomp` is built with native target, aka. AArch64, the test will still be enabled,
causing test failure.

This patch only enables the test if the actual target is X86. The actual target
is determined by `LIBOMP_ARCH`.

Fix #53696.

Reviewed By: jlpeyton

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

18 months ago[MLIR] Remove scf.if builder with explicit result types and callbacks
Frederik Gossen [Fri, 20 Jan 2023 15:51:16 +0000 (10:51 -0500)]
[MLIR] Remove scf.if builder with explicit result types and callbacks

Instead, use the builder and infer the return type based on the inner `yield` ops.
Also, fix uses that do not create the terminator as required for the callback builders.

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

18 months ago[Mem2Reg] Only convert !nonnull to assume if !noundef present
Nikita Popov [Thu, 12 Jan 2023 13:57:34 +0000 (14:57 +0100)]
[Mem2Reg] Only convert !nonnull to assume if !noundef present

After D141386 !nonnull violation returns poison rather than
resulting in immediate undefined behavior. However, converting
it into an assume would result in IUB. As such, we can only
perform this transform if !noundef is also present.

18 months ago[MLIR] Address post-submit comments on scf.if's InferTypeOpInterface
Frederik Gossen [Fri, 20 Jan 2023 15:36:40 +0000 (10:36 -0500)]
[MLIR] Address post-submit comments on scf.if's InferTypeOpInterface

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

18 months ago[DWARF][dsymutil][llvm-dwarfutil] Create a placeholder library DWARFLinkerParallel.
Alexey Lapshin [Fri, 20 Jan 2023 14:43:11 +0000 (15:43 +0100)]
[DWARF][dsymutil][llvm-dwarfutil] Create a placeholder library DWARFLinkerParallel.

This patch is extracted from D96035. It creates an empty library DWARFLinkerParallel.

Reviewed By: JDevlieghere

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

18 months ago[mlir][LLVM] Add passthrough import support
Christian Ulmann [Fri, 20 Jan 2023 15:28:56 +0000 (16:28 +0100)]
[mlir][LLVM] Add passthrough import support

This commit extends the LLVMIR import to support function attributes by
adding them to the passthrough array attribute.

Depends on D142013

Reviewed By: gysit

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

18 months ago[MLIR][LLVM] Support inlining LLVM::CallOp to LLVM::FuncOp.
Johannes de Fine Licht [Fri, 20 Jan 2023 15:13:48 +0000 (16:13 +0100)]
[MLIR][LLVM] Support inlining LLVM::CallOp to LLVM::FuncOp.

Extend `LLVMInlinerInterface` to handle calls from an `LLVM::CallOp` to
an `LLVM::FuncOp` when there are no attributes present that require
special handling.

Depends on D141676

Reviewed By: gysit

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

18 months ago[clang][nfc] refactor Module::Header to use OptionalFileEntryRef
Richard Howell [Wed, 18 Jan 2023 22:58:15 +0000 (14:58 -0800)]
[clang][nfc] refactor Module::Header to use OptionalFileEntryRef

Refactor the `Module::Header` class to use an `OptionalFileEntryRef`
instead of a `FileEntry*`. This is preparation for refactoring the
`TopHeaderNames` to use `FileEntryRef` so that we preserve the
lookup path of the headers when serializing.

This is mostly based on https://reviews.llvm.org/D90497

Reviewed By: jansvoboda11

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

18 months agosanmd: refine selection of functions for UAR checking
Dmitry Vyukov [Fri, 20 Jan 2023 09:26:20 +0000 (10:26 +0100)]
sanmd: refine selection of functions for UAR checking

There are no intrinsic functions that leak arguments.
If the called function does not return, the current function
does not return as well, so no possibility of use-after-return.
Sanitizer function also don't leak or don't return.
It's safe to both pass pointers to local variables to them
and to tail-call them.

Reviewed By: melver

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

18 months ago[Assignment Tracking] Fix tests for buildbot failure
OCHyams [Fri, 20 Jan 2023 15:16:39 +0000 (15:16 +0000)]
[Assignment Tracking] Fix tests for buildbot failure

Follow-up for 4ece50737d5385fb80cfa23f5297d1111f8eed39 (D142027).

Assignment Tracking Analysis now always runs and is skipped internally if
assignment tracking is disabled. Update these tests to expect to see the
pass run.

Buildbot failure: https://lab.llvm.org/buildbot/#/builders/216/builds/16085

18 months ago[flang] Add lowering of move_alloc to IntrinsicCall
David Truby [Fri, 20 Jan 2023 14:32:14 +0000 (14:32 +0000)]
[flang] Add lowering of move_alloc to IntrinsicCall

This patch relies on D141286 for the runtime implementation of
move_alloc.

Reviewed By: jeanPerier

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

18 months ago[mlir][Linalg] fix comparison of integers with different signs
Tom Eccles [Fri, 20 Jan 2023 12:14:10 +0000 (12:14 +0000)]
[mlir][Linalg] fix comparison of integers with different signs

Since https://reviews.llvm.org/D142053, building mlir with clang using -Werror
fails reporting comparison of integers with different signs.

Fix this by using unsigned return types for
RelayoutOp::getSourceRank,getDestRank

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

18 months ago[mlgo] Stream the training data
Mircea Trofin [Fri, 20 Jan 2023 01:37:08 +0000 (17:37 -0800)]
[mlgo] Stream the training data

This leverages the new logging format in that we don't need to buffer
the training data, we can just write it out.

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

18 months ago[DAG] visitINSERT_VECTOR_ELT - move mergeInsertEltWithShuffle / combineInsertEltToShu...
Simon Pilgrim [Fri, 20 Jan 2023 14:25:55 +0000 (14:25 +0000)]
[DAG] visitINSERT_VECTOR_ELT - move mergeInsertEltWithShuffle / combineInsertEltToShuffle folds after canonicalization

Noticed while triaging D127115 regressions - there's no need to attempt these costly folds until after the easy canonicalization cases have been addressed

18 months ago[DirectX] Fix i8 alignment in datalayout of lit test
Jannik Silvanus [Fri, 20 Jan 2023 14:40:49 +0000 (15:40 +0100)]
[DirectX] Fix i8 alignment in datalayout of lit test

An llc lit test used overaligned i8, apparently originating from the old DXIL data layout.
The new DXIL data layout uses naturally aligned i8.

llc ignores the data layout of a module and instead sets the data layout based
on the target. Change the data layout string in the test to match that target-derived
data layout.

18 months ago[Transforms] Fix i8 alignment in datalayout of lit test
Jannik Silvanus [Fri, 20 Jan 2023 14:38:28 +0000 (15:38 +0100)]
[Transforms] Fix i8 alignment in datalayout of lit test

A lit test used overaligned i8, apparently due to an old copy-paste
error, intending to specify i16 alignment.

Change the datalayout string to use naturally aligned i8.

18 months ago[X86] Fix i8 alignment in datalayout of lit test
Jannik Silvanus [Fri, 20 Jan 2023 14:37:25 +0000 (15:37 +0100)]
[X86] Fix i8 alignment in datalayout of lit test

A lit test used overaligned i8, apparently due to an old copy-paste
error, intending to specify i32 alignment.

Change the datalayout string to use naturally aligned i8.

18 months ago[polly] Fix i8 alignment in datalayout of lit test
Jannik Silvanus [Fri, 20 Jan 2023 14:36:13 +0000 (15:36 +0100)]
[polly] Fix i8 alignment in datalayout of lit test

Two lit test used overaligned i8, without the test case actually
depending on i8 alignment.
Change the datalayout string to use naturally aligned i8,
preparing for the upcoming requirement of naturally aligned i8.

18 months ago[docs] Update release notes to mention that LoongArch supports JITLink
wanglei [Fri, 20 Jan 2023 14:49:23 +0000 (22:49 +0800)]
[docs] Update release notes to mention that LoongArch supports JITLink

18 months ago[DebugInfo] Store instr-ref mode of MachineFunction in member
Jeremy Morse [Fri, 20 Jan 2023 14:14:39 +0000 (14:14 +0000)]
[DebugInfo] Store instr-ref mode of MachineFunction in member

Add a flag state (and a MIR key) to MachineFunctions indicating whether they
contain instruction referencing debug-info or not. Whether DBG_VALUEs or
DBG_INSTR_REFs are used needs to be determined by LiveDebugValues at least, and
using the current optimisation level as a proxy is proving unreliable.

Test updates are purely adding the flag to tests, in a couple of cases it
involves separating out VarLocBasedLDV/InstrRefBasedLDV tests into separate
files, as they can no longer share the same input.

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

18 months ago[LLVM][OpenMP] Correct the function signature of `__kmpc_parallel_level`
Shilei Tian [Fri, 20 Jan 2023 14:46:24 +0000 (09:46 -0500)]
[LLVM][OpenMP] Correct the function signature of `__kmpc_parallel_level`

`__kmpc_parallel_level` used to be a function w/o any argument, but in the new
device runtime, it accepts two. This patch simply corrects it in `OMPKinds.def`.
```
uint16_t __kmpc_parallel_level(IdentTy *Loc, uint32_t);
```

Reviewed By: jhuber6

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

18 months ago[Mem2Reg] Add additional noundef variations to nonnull tests (NFC)
Nikita Popov [Fri, 20 Jan 2023 14:39:00 +0000 (15:39 +0100)]
[Mem2Reg] Add additional noundef variations to nonnull tests (NFC)

18 months ago[Assignment Tracking] Fix -fexperimental-assignment-tracking cc1 flag
OCHyams [Fri, 20 Jan 2023 14:30:58 +0000 (14:30 +0000)]
[Assignment Tracking] Fix -fexperimental-assignment-tracking cc1 flag

This change allows `-fexperimental-assignment-tracking` to be negated using the
negative equivalent `-fno-experimental-assignment-tracking`, and fixes the flag
so that the default behaviour can be changed (currently the default is still
false / disabled).

Reviewed By: StephenTozer

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

18 months ago[ARM] Fix condition in cmov to csinc combine.
David Green [Fri, 20 Jan 2023 14:35:23 +0000 (14:35 +0000)]
[ARM] Fix condition in cmov to csinc combine.

This fixes the cmov fold from 90f24bef47227d58f2ccdcc481ca22eff32248ca,
where the condition needs to be inverted between the cmov and the csinc.

18 months ago[Assignment Tracking] Fix invalidated iterator usage
OCHyams [Fri, 20 Jan 2023 14:24:57 +0000 (14:24 +0000)]
[Assignment Tracking] Fix invalidated iterator usage

The iterator `FirstOverlap` is invalidated after the call to `insert` - avoid
dereferencing the iterator after the call to `insert`.

Reviewed By: CarlosAlbertoEnciso

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

18 months ago[Local] Preserve range metadata if the type did not change
Nikita Popov [Fri, 20 Jan 2023 14:27:19 +0000 (15:27 +0100)]
[Local] Preserve range metadata if the type did not change

In copyRangeMetadata() and by extension copyLoadMetadata(),
handle the trivial case where the type did not change, in which
case we can simply preserve the range metadata as is.

18 months ago[Assignment Tracking][NFC] Replace LLVM command line option with a module flag
OCHyams [Fri, 20 Jan 2023 14:19:14 +0000 (14:19 +0000)]
[Assignment Tracking][NFC] Replace LLVM command line option with a module flag

Remove LLVM flag -experimental-assignment-tracking. Assignment tracking is
still enabled from Clang with the command line -Xclang
-fexperimental-assignment-tracking which tells Clang to ask LLVM to run the
pass declare-to-assign. That pass converts conventional debug intrinsics to
assignment tracking metadata. With this patch it now also sets a module flag
debug-info-assignment-tracking with the value `i1 true` (using the flag conflict
rule `Max` since enabling assignment tracking on IR that contains only
conventional debug intrinsics should cause no issues).

Update the docs and tests too.

Reviewed By: CarlosAlbertoEnciso

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

18 months ago[SROA] Use copyMetadataForLoad() helper
Nikita Popov [Thu, 19 Jan 2023 16:04:06 +0000 (17:04 +0100)]
[SROA] Use copyMetadataForLoad() helper

Instead of copying just nonnull metadata, use the generic helper
to copy metadata to the new load. This helper is specifically
designed for the case where the load type may change, so it's
safe to use in this context.

18 months ago[arith] Allow integer casts of 0-D vectors
Benjamin Kramer [Thu, 19 Jan 2023 17:44:31 +0000 (18:44 +0100)]
[arith] Allow integer casts of 0-D vectors

This just works, no reason to disallow it.

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

18 months ago[clang] Fix typos in member initializers
Kadir Cetinkaya [Fri, 20 Jan 2023 08:43:48 +0000 (09:43 +0100)]
[clang] Fix typos in member initializers

This was regressed in ca619613801233ef2def8c3cc7d311d5ed0033cb. As we
attached InitExprs as-is to the AST, without performing transformations.

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