platform/upstream/llvm.git
13 months ago[X86] X86FixupVectorConstantsPass - attempt to replace full width fp vector constant...
Simon Pilgrim [Sat, 27 May 2023 16:59:19 +0000 (17:59 +0100)]
[X86] X86FixupVectorConstantsPass - attempt to replace full width fp vector constant loads with broadcasts on AVX+ targets

lowerBuildVectorAsBroadcast will not broadcast splat constants in all cases, resulting in a lot of situations where a full width vector load that has failed to fold but is loading splat constant values could use a broadcast load instruction just as cheaply, and save constant pool space.

NOTE: SSE3 targets can use MOVDDUP but not all SSE era CPUs can perform this as cheaply as a vector load, we will need to add scheduler model checks if we want to pursue this.

13 months ago[LLDB] Add XFAIL on AArch64/Windows to TestNamespace.py
Muhammad Omair Javaid [Mon, 29 May 2023 14:53:23 +0000 (18:53 +0400)]
[LLDB] Add XFAIL on AArch64/Windows to TestNamespace.py

13 months agoRevert "[ValueTracking][InstCombine] Add a new API to allow to ignore poison generati...
Florian Hahn [Mon, 29 May 2023 14:44:35 +0000 (15:44 +0100)]
Revert "[ValueTracking][InstCombine] Add a new API to allow to ignore poison generating flags or metadatas when implying poison"

This reverts commit 754f3ae65518331b7175d7a9b4a124523ebe6eac.

Unfortunately the change can cause regressions due to dropping flags
from instructions (like nuw,nsw,inbounds), prevent further optimizations
depending on those flags.

A simple example is the IR below, where `inbounds` is dropped with the
patch and the phase-ordering test added in 7c91d82ab912fae8b.

    define i1 @test(ptr %base, i64 noundef %len, ptr %p2) {
    bb:
      %gep = getelementptr inbounds i32, ptr %base, i64 %len
      %c.1 = icmp uge ptr %p2, %base
      %c.2 = icmp ult ptr %p2, %gep
      %select = select i1 %c.1, i1 %c.2, i1 false
      ret i1 %select
    }

For more discussion, see D149404.

13 months agoRevert "[LLDB] Add/Remove xfail for some API tests on Windows"
tcwg [Mon, 29 May 2023 12:57:26 +0000 (13:57 +0100)]
Revert "[LLDB] Add/Remove xfail for some API tests on Windows"

This reverts commit 6ea1a0d4fc3823de143a288df2059b48dc01cf72.

It again marks XFAIL LLDB tests failing after
c384fcd3ea1dad782eaaea89b32fc33c0c3528b8

13 months ago[LLDB] Fix TestVarPath.py for AArch64 Windows
Muhammad Omair Javaid [Mon, 29 May 2023 12:14:51 +0000 (16:14 +0400)]
[LLDB] Fix TestVarPath.py for AArch64 Windows

Since 44bb442 LLDB TestVarPath.py crashes on AArch64 Windows.
GetValueForVariablePath function seems to be triggering the crash.
This patch disable parts of this test causing the crash.

Bug reported upstream:
https://github.com/llvm/llvm-project/issues/62983

13 months ago[SelectionDAG] Implement soft FP legalisation for bf16 FP_EXTEND and BF16_TO_FP
Alex Bradbury [Mon, 29 May 2023 09:32:28 +0000 (10:32 +0100)]
[SelectionDAG] Implement soft FP legalisation for bf16 FP_EXTEND and BF16_TO_FP

As discussed in D151436, it's safe to do this as a simple shift (as is
done in LegalizeDAG.cpp) rather than needing a libcall. The added test
cases for RISC-V previously just triggered an assertion.

Codegen for bfloat_to_double will be slightly improved by D151434.

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

13 months agoRevert "[flang][runtime] Support all non-ASCII characters in temporary path on Windows"
Muhammad Omair Javaid [Mon, 29 May 2023 08:20:58 +0000 (12:20 +0400)]
Revert "[flang][runtime] Support all non-ASCII characters in temporary path on Windows"

This reverts commit fd0d846633b05e1d0072754aea7f3985be36c0dc.

It seems to have broken various flang unit tests on AArch64 Windows platform.

https://lab.llvm.org/buildbot/#/builders/65/builds/9856
https://lab.llvm.org/buildbot/#/builders/120/builds/4883

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

13 months ago[LLDB] Remove XFAIL on Windows decorator XPASSes
Muhammad Omair Javaid [Mon, 29 May 2023 08:12:16 +0000 (12:12 +0400)]
[LLDB] Remove XFAIL on Windows decorator XPASSes

Following tests are now passing on LLDB AArch64 Windows buildbot:
  lldb-api :: commands/expression/deleting-implicit-copy-constructor/TestDeletingImplicitCopyConstructor.py
  lldb-api :: functionalities/data-formatter/data-formatter-categories/TestDataFormatterCategories.py
  lldb-api :: lang/cpp/constructors/TestCppConstructors.py
  lldb-api :: lang/cpp/namespace/TestNamespace.py
  lldb-api :: lang/cpp/this_class_type_mixing/TestThisClassTypeMixing.py

https://lab.llvm.org/buildbot/#/builders/219/builds/3012

This patch removes XFAIL decorator from all of the above.

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

13 months ago[clang] Restrict Inline Builtin to non-static, non-odr linkage
serge-sans-paille [Wed, 19 Apr 2023 14:15:17 +0000 (16:15 +0200)]
[clang] Restrict Inline Builtin to non-static, non-odr linkage

Inline builtins have a very special behavior compared to other
functions, it's better if we keep them restricted to a minimal set of
functions.

Add a linkage check which prevents considering ODR definitions as inline
builtins.

Fix #62958

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

13 months ago[NFC][TableGen] Remove dead code.
Luo, Yuanke [Mon, 29 May 2023 02:24:13 +0000 (10:24 +0800)]
[NFC][TableGen] Remove dead code.

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

13 months ago[MemCpyOpt] remove byval from memcpy size crtical test(NFC)
khei4 [Mon, 29 May 2023 06:38:51 +0000 (15:38 +0900)]
[MemCpyOpt] remove byval from memcpy size crtical test(NFC)
Differential Revision: https://reviews.llvm.org/D151626
Reviewed By: nikic

13 months ago[CodeGen] Use llvm::LLVMContext::MD_nontemporal (NFC)
Kazu Hirata [Mon, 29 May 2023 07:41:51 +0000 (00:41 -0700)]
[CodeGen] Use llvm::LLVMContext::MD_nontemporal (NFC)

13 months ago[emacs] Highlight 'nocapture' keyword as an attribute
Noah Goldstein [Mon, 29 May 2023 07:15:07 +0000 (02:15 -0500)]
[emacs] Highlight 'nocapture' keyword as an attribute

Seems natural to highlight 'nocapture' along with other attributes
like 'nonnull', 'noundef', etc..

Reviewed By: nikic

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

13 months ago[lsan] Don't use InternalMmapVectorNoCtor as local var
Vitaly Buka [Mon, 29 May 2023 06:33:47 +0000 (23:33 -0700)]
[lsan] Don't use InternalMmapVectorNoCtor as local var

13 months ago[lsan] Iterate MemoryMappingLayout once
Vitaly Buka [Mon, 29 May 2023 06:01:45 +0000 (23:01 -0700)]
[lsan] Iterate MemoryMappingLayout once

Iterating many time can be very expensive.

13 months ago[libc++][spaceship] Implement `operator<=>` for `multiset` and `set`
Hristo Hristov [Mon, 22 May 2023 20:33:45 +0000 (23:33 +0300)]
[libc++][spaceship] Implement `operator<=>` for `multiset` and `set`

Implements parts of P1614R2

Implemented `operator<=>` for `multiset` and `set`

Reviewed By: #libc, Mordante

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

13 months ago[LICM] Reassociate & hoist sub expressions
Max Kazantsev [Mon, 29 May 2023 05:05:50 +0000 (12:05 +0700)]
[LICM] Reassociate & hoist sub expressions

LICM could reassociate mixed variant/invariant comparison/arithmetic operations
and hoist invariant parts out of loop if it can prove that they can be computed
without overflow. Motivating example here:
```
  INV1 - VAR1 < INV2
```
can be turned into
```
  VAR > INV1 - INV2
```
if we can prove no-signed-overflow here. Then `INV1 - INV2` can be computed
out of loop, so we save one arithmetic operation in-loop.

Reviewed By: skatkov
Differential Revision: https://reviews.llvm.org/D148001

13 months ago[NFC][lsan] Change Mac root regions scan
Vitaly Buka [Mon, 29 May 2023 05:25:53 +0000 (22:25 -0700)]
[NFC][lsan] Change Mac root regions scan

13 months ago[bazel] Port for 9f6250f591057e68c0bda564716b6918b8e39a84.
Haojian Wu [Mon, 29 May 2023 05:18:41 +0000 (07:18 +0200)]
[bazel] Port for 9f6250f591057e68c0bda564716b6918b8e39a84.

13 months ago[NFC][lsan] Add CHECKs for root regions
Vitaly Buka [Mon, 29 May 2023 05:09:09 +0000 (22:09 -0700)]
[NFC][lsan] Add CHECKs for root regions

13 months ago[NFC][lsan] Make mutex static
Vitaly Buka [Mon, 29 May 2023 04:50:08 +0000 (21:50 -0700)]
[NFC][lsan] Make mutex static

13 months ago[NFC][lsan] Rename RootRegion and replace size with end
Vitaly Buka [Mon, 29 May 2023 04:20:01 +0000 (21:20 -0700)]
[NFC][lsan] Rename RootRegion and replace size with end

13 months ago[NFC][CLANG] Fix issue with dereference null return value in EvaluateBuiltinClassifyT...
Manna, Soumi [Mon, 29 May 2023 03:08:54 +0000 (20:08 -0700)]
[NFC][CLANG] Fix issue with dereference null return value in EvaluateBuiltinClassifyType()

This patch uses cast instead of dyn_cast which will assert if the type doesn't match.

Reviewed By: erichkeane

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

13 months agouse ref to avoid copy in range for-loop
Wang, Xin10 [Mon, 29 May 2023 02:23:32 +0000 (22:23 -0400)]
use ref to avoid copy in range for-loop

Use big obj copy in range for-loop will call copy constructor every time,
which can be avoided by use ref instead.

Reviewed By: skan

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

13 months ago[NFC][DAGISel] Remove dead code.
Luo, Yuanke [Mon, 29 May 2023 01:55:47 +0000 (09:55 +0800)]
[NFC][DAGISel] Remove dead code.

13 months ago[lld] Partially revert "Always emit symbol table when dwarf section exists in COFF"
Haohai Wen [Mon, 29 May 2023 01:22:20 +0000 (09:22 +0800)]
[lld] Partially revert "Always emit symbol table when dwarf section exists in COFF"

This reverts part of commit 44363f2ff2736e4edf4a260f442b513ceac661fc.

Fixup for NO symbol table test has been reserved.

Reviewed By: wxiao3

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

13 months ago[X86][NFC] Fix a bug after D150436 and update some comments
Wang, Xin10 [Mon, 29 May 2023 01:09:08 +0000 (21:09 -0400)]
[X86][NFC] Fix a bug after D150436 and update some comments

D150436 changed the order for INC*r, but unintentionally remove 'isConvertibleToThreeAddress = 1' for INC*r_alt.
This patch also update wrong comment X86InstrArithmetic.td, and move class ITy to InstrInfo.td for it's a general class.

Reviewed By: skan

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

13 months ago[Clang][AArch64][SME] Add vector load/store (ld1/st1) intrinsics
Bryan Chan [Mon, 15 May 2023 04:54:45 +0000 (00:54 -0400)]
[Clang][AArch64][SME] Add vector load/store (ld1/st1) intrinsics

This patch adds support for the following SME ACLE intrinsics (as defined
in https://arm-software.github.io/acle/main/acle.html):

  - svld1_hor_za8      // also for _za16, _za32, _za64 and _za128
  - svld1_hor_vnum_za8 // also for _za16, _za32, _za64 and _za128
  - svld1_ver_za8      // also for _za16, _za32, _za64 and _za128
  - svld1_ver_vnum_za8 // also for _za16, _za32, _za64 and _za128
  - svst1_hor_za8      // also for _za16, _za32, _za64 and _za128
  - svst1_hor_vnum_za8 // also for _za16, _za32, _za64 and _za128
  - svst1_ver_za8      // also for _za16, _za32, _za64 and _za128
  - svst1_ver_vnum_za8 // also for _za16, _za32, _za64 and _za128

SveEmitter.cpp is extended to generate arm_sme.h (currently named
arm_sme_draft_spec_subject_to_change.h) and other SME definitions from
arm_sme.td, which is modeled after arm_sve.td. Common TableGen definitions
are moved into arm_sve_sme_incl.td.

Co-authored-by: Sagar Kulkarni <sagar.kulkarni1@huawei.com>
Reviewed By: sdesmalen, kmclaughlin

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

13 months ago[NFC][sanitizer] Micro optimize push_back()
Vitaly Buka [Mon, 29 May 2023 00:53:54 +0000 (17:53 -0700)]
[NFC][sanitizer] Micro optimize push_back()

13 months ago[MLIR] NFC. JitRunner - use range-based for
Uday Bondhugula [Sat, 27 May 2023 10:48:57 +0000 (16:18 +0530)]
[MLIR] NFC. JitRunner - use range-based for

Address clang-tidy warning in JitRunner.cpp. Use range-based for.

13 months agoFix fold of 0-result 0-trip-count `affine.for`
Vinayaka Bandishti [Sun, 28 May 2023 20:23:31 +0000 (01:53 +0530)]
Fix fold of 0-result 0-trip-count `affine.for`

Folding 0-result ops is tricky. An 0-trip-count `affine.for` that does
not return any results is not erased at the end of its usual fold
method. Attempting fold it to only results in an infinite loop of folds
on the same op. Fix this by attempting for fold away only those
`affine.for` ops that return a non-zero number of results.

Reviewed By: bondhugula

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

13 months ago[Bitcode] Modernize PerRecordStats (NFC)
Kazu Hirata [Sun, 28 May 2023 20:13:14 +0000 (13:13 -0700)]
[Bitcode] Modernize PerRecordStats (NFC)

13 months agoFix typos in documentation
Kazu Hirata [Sun, 28 May 2023 20:13:12 +0000 (13:13 -0700)]
Fix typos in documentation

13 months ago[clang][c++20][NFC] `ComparisonCategoryType` - updated comment, removed `std:*_equality`
Hristo Hristov [Sun, 28 May 2023 08:57:32 +0000 (11:57 +0300)]
[clang][c++20][NFC] `ComparisonCategoryType` - updated comment, removed `std:*_equality`

`weak_equality` and `strong_equality` are removed from the standard:
- https://wg21.link/P1959R0
- https://eel.is/c++draft/cmp.categories.pre

Reviewed By: rsmith

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

13 months ago[CodeGen] Remove unused declaration getOrCreateRelativeStub
Kazu Hirata [Sun, 28 May 2023 19:11:28 +0000 (12:11 -0700)]
[CodeGen] Remove unused declaration getOrCreateRelativeStub

The corresponding function definition was removed by:

  commit cf8ff75bade763b054476321dcb82dcb2e7744c7
  Author: Leonard Chan <leonardchan@google.com>
  Date:   Tue Jul 14 14:56:38 2020 -0700

13 months ago[Serialization] Remove unused declaration ReadExplicitTemplateArgumentList
Kazu Hirata [Sun, 28 May 2023 19:11:26 +0000 (12:11 -0700)]
[Serialization] Remove unused declaration ReadExplicitTemplateArgumentList

The function was renamed to ReadTemplateKWAndArgsInfo, but the
original declaration remained:

  commit 7945c981b974f58c021762e77f13cd4859ac447b
  Author: Abramo Bagnara <abramo.bagnara@gmail.com>
  Date:   Fri Jan 27 09:46:47 2012 +0000

13 months ago[Driver] Remove unused declaration AddStaticDeviceLibsPostLinking
Kazu Hirata [Sun, 28 May 2023 19:11:24 +0000 (12:11 -0700)]
[Driver] Remove unused declaration AddStaticDeviceLibsPostLinking

The corresponding function definition was removed by:

  commit 6f96dadb7a5b1593a0b6348539f66f7e945f2561
  Author: Joseph Huber <jhuber6@vols.utk.edu>
  Date:   Mon Jan 23 07:13:33 2023 -0600

13 months ago[LV] Add check line with VF=4 to uniformity test.
Florian Hahn [Sun, 28 May 2023 19:01:03 +0000 (20:01 +0100)]
[LV] Add check line with VF=4 to uniformity test.

Extend test coverage for D148841.

13 months ago[ARM] Allow D-reg copies to use VMOVD with fpregs64
David Green [Sun, 28 May 2023 18:12:45 +0000 (19:12 +0100)]
[ARM] Allow D-reg copies to use VMOVD with fpregs64

This instruction should be available with MVE, where we have D regs, not
requiring the full FP64 target feature.

13 months ago[Hexagon] Explicitly make vector subregs have unknown size and offset
Krzysztof Parzyszek [Fri, 26 May 2023 20:29:13 +0000 (13:29 -0700)]
[Hexagon] Explicitly make vector subregs have unknown size and offset

Vector length depends on the HVX mode, so make the size and offset unknown
instead using values for some specific mode.

13 months ago[LSV] Fix the ContextInst for computeKnownBits.
Justin Lebar [Sun, 28 May 2023 14:53:04 +0000 (07:53 -0700)]
[LSV] Fix the ContextInst for computeKnownBits.

Previously we used the later of GEPA or GEPB.  This is hacky because
really we should be using the later of the two load/store instructions
being considered.  But also it's flat-out incorrect, because GEPA and
GEPB might be in different BBs, in which case we cannot ask which one
comes last (assertion failure,
https://reviews.llvm.org/D149893#4378332).

Fixed, now we use the correct context instruction.

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

13 months ago[clang][NFC] Update latest released Clang versions in make_cxx_dr_status
Vlad Serebrennikov [Sun, 28 May 2023 12:58:14 +0000 (15:58 +0300)]
[clang][NFC] Update latest released Clang versions in make_cxx_dr_status

This changes a handful of recently implemented DRs from "unreleased" to "full" styling in cxx_dr_status.html

13 months ago[clang][HeaderSearch] Fix implicit module when using header maps
Ivan Murashko [Sun, 28 May 2023 10:47:29 +0000 (11:47 +0100)]
[clang][HeaderSearch] Fix implicit module when using header maps

Previously, if a header was found via in a header map, and not just remapped.
we wouldn't also find the module it maps to when using implicit modules (for
module maps that were explicitly loaded).

This diff just updates these code paths to also locate the owning module via
`findUsableModuleForHeader`.

Reviewed By: benlangmuir

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

13 months ago[libcxx] [test] Fix the new alloc tests for Windows
Martin Storsjö [Wed, 24 May 2023 07:45:51 +0000 (07:45 +0000)]
[libcxx] [test] Fix the new alloc tests for Windows

Use ASSERT_WITH_OPERATOR_NEW_FALLBACKS where relevant to waive
the known cases where operator new isn't overridden as expected,
in MinGW DLL configurations.

Clarify the reason for why the fallback in
new.delete.array/new.size_align_nothrow.replace.indirect doesn't
work as expected, which can be considered a vcruntime bug.

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

13 months ago[clang-repl] Fix REPL_EXTERNAL_VISIBILITY and building libclang-cpp.dll for MinGW...
Martin Storsjö [Fri, 26 May 2023 22:09:39 +0000 (22:09 +0000)]
[clang-repl] Fix REPL_EXTERNAL_VISIBILITY and building libclang-cpp.dll for MinGW configurations

This fixes two issues that are observed after
5111286f06e1e10f24745007a45a830760f1790c:

For builds with GCC with LLVM_LINK_LLVM_DYLIB=ON, we previously got
build errors, as libclang-cpp.dll suddenly only contained the
functions that were marked dllexport via REPL_EXTERNAL_VISIBILITY,
instead of all symbols as expected.

For MinGW builds with Clang, building previously succeeded (as it
used either the __attribute__((visibility("default"))) annotation or
nothing at all), and the functions were exported from libclang-cpp.dll
if that was built, but the unit test failed (as neither of those cases
made the functions exported from an EXE).

Don't use the visibility attributes on MinGW targets for these purposes;
setting default visibility only makes a difference if building with
e.g. -fvisibility=hidden, but it doesn't make the symbols exported
from an EXE.

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

13 months ago[Clang][RISCV] Reduce boilerplate under RVVEmitter::createHeader. NFC
eopXD [Sun, 28 May 2023 08:29:36 +0000 (01:29 -0700)]
[Clang][RISCV] Reduce boilerplate under RVVEmitter::createHeader. NFC

Signed-off by: eop Chen <eop.chen@sifive.com>

13 months ago[ModuleInliner] Remove an inapplicable comment
Kazu Hirata [Sun, 28 May 2023 05:26:37 +0000 (22:26 -0700)]
[ModuleInliner] Remove an inapplicable comment

The module inliner has its own logic in deciding the order in which
call sites are inlined, so the comment is inapplicable.

13 months ago[StaticAnalyzer] Remove unused declaration handleLVectorSplat
Kazu Hirata [Sat, 27 May 2023 21:53:54 +0000 (14:53 -0700)]
[StaticAnalyzer] Remove unused declaration handleLVectorSplat

The corresponding function definition was removed by:

  commit 55662b24a4755680e4fd34dc22a3dd555fdb1291
  Author: Balazs Benics <balazs.benics@sigmatechnology.se>
  Date:   Thu Jul 1 10:54:28 2021 +0200

13 months ago[StaticAnalyzer] Remove unused declaration findDirectConstructorForCurrentCFGElement
Kazu Hirata [Sat, 27 May 2023 21:53:53 +0000 (14:53 -0700)]
[StaticAnalyzer] Remove unused declaration findDirectConstructorForCurrentCFGElement

The corresponding definition was removed by:

  commit a84374dc0e4e756a92191dd55efca43165e3977d
  Author: Artem Dergachev <artem.dergachev@gmail.com>
  Date:   Thu Jun 14 01:40:49 2018 +0000

13 months ago[StaticAnalyzer] Remove unused declaration evalLoadCommon
Kazu Hirata [Sat, 27 May 2023 21:53:51 +0000 (14:53 -0700)]
[StaticAnalyzer] Remove unused declaration evalLoadCommon

The corresponding function definition was removed by:

  commit e0fb481cc57f5a9fb4908ab0a871c49d7ee61382
  Author: Artem Dergachev <artem.dergachev@gmail.com>
  Date:   Fri May 4 23:01:10 2018 +0000

13 months ago[mlir][sparse][gpu] fix merge conflict
Aart Bik [Sat, 27 May 2023 20:38:36 +0000 (13:38 -0700)]
[mlir][sparse][gpu] fix merge conflict

Reviewed By: K-Wu

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

13 months ago[mlir][bazel] Port for 660f714, third attempt
Eugene Burmako [Sat, 27 May 2023 20:25:36 +0000 (13:25 -0700)]
[mlir][bazel] Port for 660f714, third attempt

Reviewed By: aartbik

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

13 months ago[mlir][gpu][sparse] adding cusparse sddmm support
Kun Wu [Wed, 24 May 2023 02:21:55 +0000 (02:21 +0000)]
[mlir][gpu][sparse] adding cusparse sddmm support

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

13 months ago[MLIR] Reformat the Bazel build
Eugene Burmako [Fri, 26 May 2023 21:16:47 +0000 (14:16 -0700)]
[MLIR] Reformat the Bazel build

This patch normalizes formatting of the the root BUILD.bazel file by: 1) adjusting indentation a little bit, 2) alphabetically ordering dependencies. These small deviations were introduced by some yesterday's patches:
  * https://reviews.llvm.org/D151104
  * https://reviews.llvm.org/D151346
  * https://reviews.llvm.org/rG16fe2b37365c00b0c6d0ed22c2e6521f2d5de01a
  * https://reviews.llvm.org/rG4d1cd1d8caab13d6b76ce6fc4ff76a01a7931c34

Reviewed By: aartbik

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

13 months ago[ConstraintElimination] Add tests with incrementing pointer IV.
Florian Hahn [Sat, 27 May 2023 19:47:57 +0000 (20:47 +0100)]
[ConstraintElimination] Add tests with incrementing pointer IV.

Add initial set of tests for improved loop phi handling.

13 months ago[gn build] Port ddeab07ca632
LLVM GN Syncbot [Sat, 27 May 2023 19:23:49 +0000 (19:23 +0000)]
[gn build] Port ddeab07ca632

13 months ago[gn] port b22965df1304
Nico Weber [Sat, 27 May 2023 19:23:26 +0000 (15:23 -0400)]
[gn] port b22965df1304

13 months ago[Analysis] Remove unused declaration getCurrentLVarDefinition
Kazu Hirata [Sat, 27 May 2023 17:45:18 +0000 (10:45 -0700)]
[Analysis] Remove unused declaration getCurrentLVarDefinition

The declaration was added without a corresponding function definition
by:

  commit ae497deddfd9c631380bc622fa3e184531c2600a
  Author: DeLesley Hutchins <delesley@google.com>
  Date:   Sat Apr 19 00:35:54 2014 +0000

13 months ago[Serialization] Remove unused declaration SLocCursorForID
Kazu Hirata [Sat, 27 May 2023 17:45:16 +0000 (10:45 -0700)]
[Serialization] Remove unused declaration SLocCursorForID

The corresponding function body was removed by:

  commit 925296b4c2cbb358c34323dfcffbea6d59eb9c1e
  Author: Douglas Gregor <dgregor@apple.com>
  Date:   Tue Jul 19 16:10:42 2011 +0000

13 months ago[AST] Remove unused function removeLocalCVRQualifiers
Kazu Hirata [Sat, 27 May 2023 17:29:23 +0000 (10:29 -0700)]
[AST] Remove unused function removeLocalCVRQualifiers

The last use was removed by:

  commit 0eb06cb3aa2700508c20da28f22ff91e7b82a436
  Author: Roy Jacobson <roi.jacobson1@gmail.com>
  Date:   Tue Mar 14 21:25:54 2023 +0200

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

13 months ago[Bitcode] Modernize PerBlockIDStats (NFC)
Kazu Hirata [Sat, 27 May 2023 17:29:21 +0000 (10:29 -0700)]
[Bitcode] Modernize PerBlockIDStats (NFC)

13 months ago[polly] Fix typos in documentation
Kazu Hirata [Sat, 27 May 2023 17:29:20 +0000 (10:29 -0700)]
[polly] Fix typos in documentation

13 months ago[Hexagon] Use scalar evolution to calculate pointer difference in HVC
Krzysztof Parzyszek [Fri, 26 May 2023 16:20:12 +0000 (09:20 -0700)]
[Hexagon] Use scalar evolution to calculate pointer difference in HVC

13 months ago[CGP] Disable default copy ctor and copy assignment operator for InstructionRemover
Bing1 Yu [Fri, 26 May 2023 08:48:39 +0000 (16:48 +0800)]
[CGP] Disable default copy ctor and copy assignment operator for InstructionRemover

class InstructionRemover manages resources such as dynamically allocated memory, it's generally a good practice to either implement a custom copy constructor or disable the default one.

Reviewed By: pengfei

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

13 months ago[NFC][CLANG] Fix nullptr dereference issue in CodeGenModule::GetConstantArrayFromStri...
Manna, Soumi [Sat, 27 May 2023 14:15:24 +0000 (07:15 -0700)]
[NFC][CLANG] Fix nullptr dereference issue in CodeGenModule::GetConstantArrayFromStringLiteral()

This patch adds an assert.

Reviewed By: erichkeane

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

13 months ago[X86] lowerBuildVectorAsBroadcast - broadcast Constant of original (BuildVector)...
Simon Pilgrim [Wed, 24 May 2023 18:51:21 +0000 (19:51 +0100)]
[X86] lowerBuildVectorAsBroadcast - broadcast Constant of original (BuildVector) element size

Noticed in D150143/D150526 - we currently create scalar Constant values using the broadcast instruction width, which might be wider than the original build vector width, making it tricky to recognise the original constant bits data.

If we have widened the broadcast value, its much more useful for asm comments if we create a ConstantVector with the original element data, add that to the constant-pool and load that with the same (wider) broadcast instruction.

13 months ago[flang][runtime] Support all non-ASCII characters in temporary path on Windows
Markus Mützel [Sat, 27 May 2023 12:54:18 +0000 (14:54 +0200)]
[flang][runtime] Support all non-ASCII characters in temporary path on Windows

If the path to the TEMP folder contains (non-ASCII) characters that cannot be
encoded in the current 8-bit locale of the user, openfile_mkstemp might fail
on Windows.
That is an unlikely scenario. But given that the path to the default TEMP
folder on Windows contains the Windows user name, it is still possible.

Use the wide character Windows API to avoid that (unlikely) issue.

Reviewed By: vzakhari

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

13 months ago[libc++][format][test] Adds Windows support.
Mark de Wever [Sat, 27 May 2023 11:57:26 +0000 (13:57 +0200)]
[libc++][format][test] Adds Windows support.

These tests pass on Windows without additional changes. This has been
tested in D150593.

13 months agoReland "[CMake] Bumps minimum version to 3.20.0.
Mark de Wever [Wed, 24 May 2023 16:12:32 +0000 (18:12 +0200)]
Reland "[CMake] Bumps minimum version to 3.20.0.

This reverts commit d763c6e5e2d0a6b34097aa7dabca31e9aff9b0b6.

Adds the patch by @hans from
https://github.com/llvm/llvm-project/issues/62719
This patch fixes the Windows build.

d763c6e5e2d0a6b34097aa7dabca31e9aff9b0b6 reverted the reviews

D144509 [CMake] Bumps minimum version to 3.20.0.

This partly undoes D137724.

This change has been discussed on discourse
https://discourse.llvm.org/t/rfc-upgrading-llvms-minimum-required-cmake-version/66193

Note this does not remove work-arounds for older CMake versions, that
will be done in followup patches.

D150532 [OpenMP] Compile assembly files as ASM, not C

Since CMake 3.20, CMake explicitly passes "-x c" (or equivalent)
when compiling a file which has been set as having the language
C. This behaviour change only takes place if "cmake_minimum_required"
is set to 3.20 or newer, or if the policy CMP0119 is set to new.

Attempting to compile assembly files with "-x c" fails, however
this is workarounded in many cases, as OpenMP overrides this with
"-x assembler-with-cpp", however this is only added for non-Windows
targets.

Thus, after increasing cmake_minimum_required to 3.20, this breaks
compiling the GNU assembly for Windows targets; the GNU assembly is
used for ARM and AArch64 Windows targets when building with Clang.
This patch unbreaks that.

D150688 [cmake] Set CMP0091 to fix Windows builds after the cmake_minimum_required bump

The build uses other mechanism to select the runtime.

Fixes #62719

Reviewed By: #libc, Mordante

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

13 months ago[bazel] Add missing dependency for ddeab07ca63235f8d952e1171b56fdb0f2d761c9
Benjamin Kramer [Sat, 27 May 2023 10:04:36 +0000 (12:04 +0200)]
[bazel] Add missing dependency for ddeab07ca63235f8d952e1171b56fdb0f2d761c9

13 months ago[Docs] Fix Sphinx documentation formatting issues in LanguageExtensions.rst
M. Zeeshan Siddiqui [Sat, 27 May 2023 08:43:35 +0000 (16:43 +0800)]
[Docs] Fix Sphinx documentation formatting issues in LanguageExtensions.rst

Fix indentation and spacing.

Reviewed By: pengfei

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

13 months ago[clang-repl][CUDA] Re-land: Initial interactive CUDA support for clang-repl
Anubhab Ghosh [Mon, 6 Mar 2023 11:20:02 +0000 (16:50 +0530)]
[clang-repl][CUDA] Re-land: Initial interactive CUDA support for clang-repl

CUDA support can be enabled in clang-repl with --cuda flag.
Device code linking is not yet supported. inline must be used with all
__device__ functions.

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

13 months ago[mlir][bazel] Port for 660f714e26999d266232a1fbb02712bb879bd34e, second
Haojian Wu [Sat, 27 May 2023 06:37:45 +0000 (08:37 +0200)]
[mlir][bazel] Port for 660f714e26999d266232a1fbb02712bb879bd34e, second
attempt.

13 months ago[mlir][bazel] Port for 660f714e26999d266232a1fbb02712bb879bd34e
Haojian Wu [Sat, 27 May 2023 06:03:02 +0000 (08:03 +0200)]
[mlir][bazel] Port for 660f714e26999d266232a1fbb02712bb879bd34e

13 months ago[Clang][BFloat16] Upgrade __bf16 to arithmetic type, change mangling, and extend...
M. Zeeshan Siddiqui [Sat, 27 May 2023 03:45:12 +0000 (11:45 +0800)]
[Clang][BFloat16] Upgrade __bf16 to arithmetic type, change mangling, and extend excess precision support

Pursuant to discussions at
https://discourse.llvm.org/t/rfc-c-23-p1467r9-extended-floating-point-types-and-standard-names/70033/22,
this commit enhances the handling of the __bf16 type in Clang.
- Firstly, it upgrades __bf16 from a storage-only type to an arithmetic
  type.
- Secondly, it changes the mangling of __bf16 to DF16b on all
  architectures except ARM. This change has been made in
  accordance with the finalization of the mangling for the
  std::bfloat16_t type, as discussed at
  https://github.com/itanium-cxx-abi/cxx-abi/pull/147.
- Finally, this commit extends the existing excess precision support to
  the __bf16 type. This applies to hardware architectures that do not
  natively support bfloat16 arithmetic.
Appropriate tests have been added to verify the effects of these
changes and ensure no regressions in other areas of the compiler.

Reviewed By: rjmccall, pengfei, zahiraam

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

13 months ago[CodeGen] Remove unused MachineMemOperand::Profile (NFC)
Sergei Barannikov [Sat, 27 May 2023 04:34:48 +0000 (07:34 +0300)]
[CodeGen] Remove unused MachineMemOperand::Profile (NFC)

The last use was removed by
commit 48b185d6f718f0408a54bc7be8387beb3237cff3
Author: Dan Gohman <gohman@apple.com>
Date:   Fri Sep 25 20:36:54 2009 +0000

13 months ago[Sema] Remove unused declaration startLambdaDefinition
Kazu Hirata [Sat, 27 May 2023 03:19:23 +0000 (20:19 -0700)]
[Sema] Remove unused declaration startLambdaDefinition

The corresponding function definition was removed by:

  commit 93d7002dc4644b0a6f15a998dff0d55c72012e87
  Author: Corentin Jabot <corentinjabot@gmail.com>
  Date:   Sun Feb 6 22:58:43 2022 +0100

13 months ago[clangd] Remove unused declaration onCallHierarchyOutgoingCalls
Kazu Hirata [Sat, 27 May 2023 03:19:22 +0000 (20:19 -0700)]
[clangd] Remove unused declaration onCallHierarchyOutgoingCalls

The corresponding function definition was removed by:

  commit 1a929525e86a20d0b3455a400d0dbed40b325a13
  Author: Kadir Cetinkaya <kadircet@google.com>
  Date:   Tue Dec 21 17:06:40 2021 +0100

13 months ago[CodeGen] Remove unused declarations emitNonSPMDParallelCall and emitSPMDParallelCall
Kazu Hirata [Sat, 27 May 2023 03:07:52 +0000 (20:07 -0700)]
[CodeGen] Remove unused declarations emitNonSPMDParallelCall and emitSPMDParallelCall

The corresponding function definitions were removed by:

  commit a2dbfb6b72db19ed851464160ef7539b50d43894
  Author: Giorgis Georgakoudis <georgakoudis1@llnl.gov>
  Date:   Wed Apr 21 11:41:31 2021 -0700

13 months ago[AST] Remove unused declaration enumerateVFPtrs
Kazu Hirata [Sat, 27 May 2023 03:07:51 +0000 (20:07 -0700)]
[AST] Remove unused declaration enumerateVFPtrs

The corresponding function definition was removed by:

  commit 9c6e9e313d61284f3d7fa46c86b6f999c8a1adea
  Author: Reid Kleckner <reid@kleckner.net>
  Date:   Thu Feb 27 19:40:09 2014 +0000

13 months ago[Sema] Remove unused declaration ConvertIntegerToTypeWarnOnOverflow
Kazu Hirata [Sat, 27 May 2023 03:07:49 +0000 (20:07 -0700)]
[Sema] Remove unused declaration ConvertIntegerToTypeWarnOnOverflow

The corresponding function definition was removed by:

  commit 077d083b4dd12538fc824d5784d455da0d86a1ea
  Author: Richard Smith <richard-llvm@metafoo.co.uk>
  Date:   Mon Aug 4 00:40:48 2014 +0000

13 months ago[Driver] Remove redundant -z special case. NFC
Fangrui Song [Sat, 27 May 2023 02:39:19 +0000 (19:39 -0700)]
[Driver] Remove redundant -z special case. NFC

13 months ago[hwasan] support hwasan-match-all-tag flag for hwasan meminstrinsic calls
Enna1 [Sat, 27 May 2023 02:35:18 +0000 (10:35 +0800)]
[hwasan] support hwasan-match-all-tag flag for hwasan meminstrinsic calls

This patch implements `__hwasan_memset_match_all`, `__hwasan_memcpy_match_all` and `__hwasan_memmove_match_all`, making hwasan-match-all-tag flag working for hwasan versions of memset, memcpy and memmove.

Reviewed By: vitalybuka

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

13 months ago[hwasan] support hwasan-match-all-tag flag for callback memory access instrumentation
Enna1 [Sat, 27 May 2023 02:27:28 +0000 (10:27 +0800)]
[hwasan] support hwasan-match-all-tag flag for callback memory access instrumentation

Currently, hwasan-match-all-tag flag is supported in inline memory access instrumentation and outline memory access instrumentation, but not supported in callback memory access instrumentation.

- For inline memory access instrumentation: a hwasan-match-all-tag check is added following the tag-mismtach check, if tag from pointer is mismatched with tag from shadow memory and tag from pointer is not equal with hwasan-match-all-tag, then a tag-mismatch will be report.
- For outline memory acess instrumentation: MatchAllTag is encoded in AccessInfo, when emit HWASAN memaccess symbols, asm-printer emits assembly instructions to check if tag from pointer is equal with hwasan-match-all-tag.
- For callback memory access instrumentation: hwasan-match-all-tag check is not implemented in `__hwasan_load`/`__hwasan_store`.

This patch implements a set of callback functions: `__hwasan_[load|store][1|2|4|8|16|n]_match_all` and `__hwasan_load[load|store][1|2|4|8|16|n]_match_all_noabort`, making hwasan-match-all-tag flag working for callback memory access instrumentation.

Reviewed By: vitalybuka

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

13 months ago[Driver][test] Replace legacy -target with --target=
Fangrui Song [Sat, 27 May 2023 02:01:39 +0000 (19:01 -0700)]
[Driver][test] Replace legacy -target with --target=

13 months ago[mlir] Fix non-const lvalue reference to type 'uint64_t' cannot bind to type 'size_t...
Jie Fu [Sat, 27 May 2023 01:53:10 +0000 (09:53 +0800)]
[mlir] Fix non-const lvalue reference to type 'uint64_t' cannot bind to type 'size_t' error (NFC)

/Users/jiefu/llvm-project/mlir/lib/Bytecode/Reader/BytecodeReader.cpp:1007:39: error: non-const lvalue reference to type 'uint64_t' (aka 'unsigned long long') cannot bind to a value of unrelated type 'size_t' (aka 'unsigned long')
    if (failed(propReader.parseVarInt(count)))
                                      ^~~~~
/Users/jiefu/llvm-project/mlir/lib/Bytecode/Reader/BytecodeReader.cpp:191:39: note: passing argument to parameter 'result' here
  LogicalResult parseVarInt(uint64_t &result) {
                                      ^
/Users/jiefu/llvm-project/mlir/lib/Bytecode/Reader/BytecodeReader.cpp:1020:44: error: non-const lvalue reference to type 'uint64_t' (aka 'unsigned long long') cannot bind to a value of unrelated type 'size_t' (aka 'unsigned long')
      if (failed(offsetsReader.parseVarInt(dataSize)) ||
                                           ^~~~~~~~
/Users/jiefu/llvm-project/mlir/lib/Bytecode/Reader/BytecodeReader.cpp:191:39: note: passing argument to parameter 'result' here
  LogicalResult parseVarInt(uint64_t &result) {
                                      ^
2 errors generated.

13 months ago[CodeGen][NFC] Declare copy constructor & copy assignment as deleted for ScheduleDAG
Shengchen Kan [Fri, 26 May 2023 06:26:06 +0000 (14:26 +0800)]
[CodeGen][NFC] Declare copy constructor & copy assignment as deleted for ScheduleDAG

ScheduleDAG has derived classes ScheduleDAGVLIW and ScheduleDAGRRList,
which own resources that are freed in their destructors. Static analyzer
warns b/c they do not have user-written copy constructors.

According to the design of ScheduleDAG, it seems that it should always
be passed by reference. So I declare them as deleted in this patch.

Reviewed By: RKSimon

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

13 months ago[MLIR] Add native Bytecode support for properties
Mehdi Amini [Fri, 26 May 2023 04:04:35 +0000 (21:04 -0700)]
[MLIR] Add native Bytecode support for properties

This is adding a new interface (`BytecodeOpInterface`) to allow operations to
opt-in skipping conversion to attribute and serializing properties to native
bytecode.

The scheme relies on a new section where properties are stored in sequence

  { size, serialize_properties }, ...

The operations are storing the index of a properties, a table of offset is
built when loading the properties section the first time.

This is a re-commit of 837d1ce0dc which conflicted with another patch upgrading
the bytecode and the collision wasn't properly resolved before.

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

13 months ago[MemProf] Clean up MemProf instrumentation pass invocation
Teresa Johnson [Fri, 26 May 2023 22:07:24 +0000 (15:07 -0700)]
[MemProf] Clean up MemProf instrumentation pass invocation

First, removes the invocation of the memprof instrumentation passes from
the end of the module simplification pass builder, where it doesn't
really belong. However, it turns out that this was never being invoked,
as it is guarded by an internal option not used anywhere (even tests).

These passes are actually added via clang under the -fmemory-profile
option. Changed this to add via the EP callback interface, similar to
the sanitizer passes. They are added to the EP for the end of the
optimization pipeline, which is roughly where they were being added
already (end of the pre-LTO link pipelines and non-LTO optimization
pipeline).

Ideally we should plumb the output file through to LLVM and set it up
there, so I have added a TODO.

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

13 months ago[Vectorize] Fix warnings
Kazu Hirata [Sat, 27 May 2023 00:27:25 +0000 (17:27 -0700)]
[Vectorize] Fix warnings

This patch fixes:

  llvm/lib/Transforms/Vectorize/LoadStoreVectorizer.cpp:140:20: error:
  unused function 'operator<<' [-Werror,-Wunused-function]

  llvm/lib/Transforms/Vectorize/LoadStoreVectorizer.cpp:176:6: error:
  unused function 'dumpChain' [-Werror,-Wunused-function]

13 months ago[Vectorize] Fix a warning
Kazu Hirata [Sat, 27 May 2023 00:02:34 +0000 (17:02 -0700)]
[Vectorize] Fix a warning

This patch fixes:

  llvm/lib/Transforms/Vectorize/LoadStoreVectorizer.cpp:1429:23:
  error: comparison of integers of different signs: 'int' and 'const
  size_t' (aka 'const unsigned long') [-Werror,-Wsign-compare]

13 months ago[mlir][spirv][NFC] Clean up SPIR-V canonicalization
Jakub Kuderski [Fri, 26 May 2023 23:54:44 +0000 (19:54 -0400)]
[mlir][spirv][NFC] Clean up SPIR-V canonicalization

Follow best practices. Use llvm helper functions for readability.

Reviewed By: antiagainst

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

13 months ago[RISCV] Add isel patterns to form tail undisturbed vfwadd.wv from fpextend_vl+vfwadd_...
Craig Topper [Fri, 26 May 2023 23:44:20 +0000 (16:44 -0700)]
[RISCV] Add isel patterns to form tail undisturbed vfwadd.wv from fpextend_vl+vfwadd_vl+vp_merge.

We use a special TIED instructions for vfwadd.wv to avoid an
earlyclobber constraint preventing the first source and the destination
from being the same register.

This prevents our normal post process for forming TU instructions.
Add manual isel pattern instead. This matches what we do for FMA
for example.

13 months agoskip test run on amdgcn-amd-amdhsa
Jennifer Yu [Fri, 26 May 2023 23:14:03 +0000 (16:14 -0700)]
skip test run on amdgcn-amd-amdhsa

13 months ago[mlir][spirv] Enhance folding capability of spirv::CompositeExtractOp::fold
Nishant Patel [Fri, 26 May 2023 23:20:53 +0000 (19:20 -0400)]
[mlir][spirv] Enhance folding capability of spirv::CompositeExtractOp::fold

This PR improves the `spirv::CompositeExtractOp::fold` function by adding a backtracking mechanism.
The updated function can now traverse a chain of `CompositeInsertOp`s to find a match.

Patch By: nbpatel
Reviewed By: kuhar

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

13 months agoFix -Wsign-compare from D149893.
Justin Lebar [Fri, 26 May 2023 23:22:16 +0000 (16:22 -0700)]
Fix -Wsign-compare from D149893.

13 months agoFix runtime crash inside __kmpc_init_allocator
Jennifer Yu [Fri, 26 May 2023 17:48:51 +0000 (10:48 -0700)]
Fix runtime crash inside __kmpc_init_allocator

It seems load of traits.addr should be passed in runtime call.  Currently
the load of load traits.addr gets passed cause runtime to fail.

To fix this, skip the call to EmitLoadOfScalar for extra load.

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

13 months ago[Dexter] XFAIL Dexter tests for Apple Silicon (arm64)
Jonas Devlieghere [Fri, 26 May 2023 22:42:42 +0000 (15:42 -0700)]
[Dexter] XFAIL Dexter tests for Apple Silicon (arm64)

13 months agoRevert "[lldb] Disable variable watchpoints when going out of scope"
Jason Molenda [Fri, 26 May 2023 22:31:41 +0000 (15:31 -0700)]
Revert "[lldb] Disable variable watchpoints when going out of scope"

Reverting https://reviews.llvm.org/D151366 until Ismail has a chance
to look at the ubuntu CI test failures and can reland.

This reverts commit 7c847ac4bd1bd8a89c7fbb4581328fa8cb0498f1.

13 months agoFix test failure after 2be0abb7fe7 (caused by bad merge, sorry).
Justin Lebar [Fri, 26 May 2023 22:30:10 +0000 (15:30 -0700)]
Fix test failure after 2be0abb7fe7 (caused by bad merge, sorry).