platform/upstream/llvm.git
19 months ago[LoopFlatten] Precommit test for GH issue #59339. NFC.
Sjoerd Meijer [Mon, 5 Dec 2022 15:36:24 +0000 (15:36 +0000)]
[LoopFlatten] Precommit test for GH issue #59339. NFC.

19 months ago[LoopFlatten] Add some LLVM_DEBUG messages. NFC.
Sjoerd Meijer [Mon, 5 Dec 2022 15:34:23 +0000 (15:34 +0000)]
[LoopFlatten] Add some LLVM_DEBUG messages. NFC.

19 months ago[flang] Map symbols in expressions when copying interface symbols
Peter Klausler [Fri, 2 Dec 2022 15:19:49 +0000 (07:19 -0800)]
[flang] Map symbols in expressions when copying interface symbols

Given a MODULE SUBROUTINE or MODULE FUNCTION interface followed
later by a corresponding separate module subprogram definition in a
MODULE PROCEDURE, the copies of the interface's dummy argument and
function result symbols that populate the initial scope of that
MODULE PROCEDURE need to have any symbol references in their types
or bounds adjusted to point to their new counterparts.

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

19 months ago[flang][NFC] Add a no-arg constructor for `Verbatim`.
Samira Bazuzi [Mon, 5 Dec 2022 15:30:29 +0000 (07:30 -0800)]
[flang][NFC] Add a no-arg constructor for `Verbatim`.

In C++20, types that declare or delete any constructors are no longer aggregates, breaking compilation of many existing uses of aggregate initialization.

Although `Verbatim` declares itself to not have a no-arg default constructor, this is circumvented in `basic-parsers.h` which returns a `RESULT{}` a.k.a. `Verbatim{}`. Adding the no-arg constructor while still deleting the copy/assignment constructors maintains the current state and also supports eventually building this in c++20 mode.

Fix suggested in https://discourse.llvm.org/t/build-failure-when-attempting-to-build-flang-with-c-20/66953.

Reviewed By: klausler

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

19 months ago[ConstraintElim] Add test with implicit/explicit GEP index truncate.
Florian Hahn [Mon, 5 Dec 2022 15:25:07 +0000 (15:25 +0000)]
[ConstraintElim] Add test with implicit/explicit GEP index truncate.

The implicit index truncate example is currently being miscompiled.

19 months agoRevert "Recommit "[LoopFlatten] Enable it by default""
Sjoerd Meijer [Mon, 5 Dec 2022 14:52:40 +0000 (14:52 +0000)]
Revert "Recommit "[LoopFlatten] Enable it by default""

This reverts commit 3ea6a9a469fde168c527b1c34c09f6d684ec86af because of the
reported miscompilation in: https://github.com/llvm/llvm-project/issues/59339

19 months ago[AAch64] Optimize muls with operands having enough sign bits.
bipmis [Mon, 5 Dec 2022 15:08:31 +0000 (15:08 +0000)]
[AAch64] Optimize muls with operands having enough sign bits.

Muls with 64bit operands where each of the operand is having more than 32 sign bits, we can generate a single smull instruction on a 32bit operand.

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

19 months agoValueTracking: Teach canCreateUndefOrPoison about more intrinsics
Matt Arsenault [Sun, 4 Dec 2022 00:40:06 +0000 (19:40 -0500)]
ValueTracking: Teach canCreateUndefOrPoison about more intrinsics

I tried to test the fallthrough to noundef callsite return attribute
case, but it seems that folds out as-is.

19 months ago[LLDB][RISCV] Add RV64F instruction support for EmulateInstructionRISCV
Emmmer [Sat, 3 Dec 2022 13:49:50 +0000 (21:49 +0800)]
[LLDB][RISCV] Add RV64F instruction support for EmulateInstructionRISCV

Reviewed By: DavidSpickett

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

19 months agoValueTracking: Add some baseline intrinsic with freeze tests
Matt Arsenault [Sun, 4 Dec 2022 00:37:57 +0000 (19:37 -0500)]
ValueTracking: Add some baseline intrinsic with freeze tests

19 months ago[gn build] Port dbe8c2c316c4
LLVM GN Syncbot [Mon, 5 Dec 2022 14:27:33 +0000 (14:27 +0000)]
[gn build] Port dbe8c2c316c4

19 months agocompiler-rt/test/metadata: restrict tests to x86_64
Dmitry Vyukov [Mon, 5 Dec 2022 14:12:37 +0000 (15:12 +0100)]
compiler-rt/test/metadata: restrict tests to x86_64

aarch64 builder broke with:

-- Supported architectures for crt: aarch64
CMake Error at compiler-rt/cmake/config-ix.cmake:244 (message):
  Unsupported architecture: x86_64
Call Stack (most recent call first):
  compiler-rt/cmake/config-ix.cmake:280 (get_target_flags_for_arch)
  compiler-rt/test/metadata/CMakeLists.txt:7 (get_test_cc_for_arch)
-- Configuring incomplete, errors occurred!

https://lab.llvm.org/buildbot/#/builders/223/builds/11423

Restrict the tests to x86_64 only.

Reviewed By: melver

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

19 months ago[NFC] Fix test/CodeGen/PowerPC/O0-pipeline.ll
Roman Lebedev [Mon, 5 Dec 2022 14:21:29 +0000 (17:21 +0300)]
[NFC] Fix test/CodeGen/PowerPC/O0-pipeline.ll

19 months agoclang: Convert builtins test to opaque pointers
Matt Arsenault [Sat, 3 Dec 2022 19:25:43 +0000 (14:25 -0500)]
clang: Convert builtins test to opaque pointers

19 months ago[LinkerWrapper] Fix use-after-free when using JIT
Joseph Huber [Mon, 5 Dec 2022 13:48:30 +0000 (07:48 -0600)]
[LinkerWrapper] Fix use-after-free when using JIT

Summary:
This portion of the code was unused until now and wasn't properly
updated after we moved to using `StringRef`.

19 months agoUse-after-return sanitizer binary metadata
Dmitry Vyukov [Mon, 17 Oct 2022 13:13:56 +0000 (15:13 +0200)]
Use-after-return sanitizer binary metadata

Currently per-function metadata consists of:
(start-pc, size, features)

This adds a new UAR feature and if it's set an additional element:
(start-pc, size, features, stack-args-size)

Reviewed By: melver

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

19 months agoValueTracking: Teach CannotBeOrderedLessThanZero about trivial ops
Matt Arsenault [Sun, 4 Dec 2022 03:49:47 +0000 (22:49 -0500)]
ValueTracking: Teach CannotBeOrderedLessThanZero about trivial ops

Handle canonicalize and arithmetic.fence

19 months agoValueTracking: Teach isKnownNeverNaN about arithmetic_fence
Matt Arsenault [Sun, 4 Dec 2022 03:28:57 +0000 (22:28 -0500)]
ValueTracking: Teach isKnownNeverNaN about arithmetic_fence

19 months agoValueTracking: Teach isKnownNeverInfinity about arithmetic.fence
Matt Arsenault [Sun, 4 Dec 2022 03:25:34 +0000 (22:25 -0500)]
ValueTracking: Teach isKnownNeverInfinity about arithmetic.fence

19 months agoIntrinsics: Fix not speculating llvm.fptrunc.round
Matt Arsenault [Sun, 4 Dec 2022 15:54:44 +0000 (10:54 -0500)]
Intrinsics: Fix not speculating llvm.fptrunc.round

Move its definition to be with the other FP rounding intrinsics.

19 months ago[GlobalISel][DebugInfo] Propagate debug location for localized constants
Vladislav Dzhidzhoev [Mon, 20 Jun 2022 12:49:08 +0000 (15:49 +0300)]
[GlobalISel][DebugInfo] Propagate debug location for localized constants

After IRTranslator pass, constants are deduplicated and translated into instructions at entry block, having debug locations lost.
Localization of constants may cause emission of extra zero lines in debug_line section, like here https://godbolt.org/z/ecvsxxfKn. In this example, constant gets placed as
a first instruction in entry block, and despite it has no debug location, AsmPrinter emits zero line for it.

If a localized constant has the only user, we can assume that it has the same debug location as its user, since they are placed consequently.

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

19 months ago[NFC][Clang][Driver][AMDGPU] Avoid temporary copies of std::string by using Twine...
Juan Manuel MARTINEZ CAAMAÑO [Mon, 5 Dec 2022 12:30:51 +0000 (06:30 -0600)]
[NFC][Clang][Driver][AMDGPU] Avoid temporary copies of std::string by using Twine and StringRef

Reviewed By: tra

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

19 months ago[AMDGPU][MC] Correct handling of mandatory literals
Dmitry Preobrazhensky [Mon, 5 Dec 2022 13:03:17 +0000 (16:03 +0300)]
[AMDGPU][MC] Correct handling of mandatory literals

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

19 months agoAn iwyu cleanup in flang/Frontend/TargetOptions.h
Haojian Wu [Mon, 5 Dec 2022 13:18:33 +0000 (14:18 +0100)]
An iwyu cleanup in flang/Frontend/TargetOptions.h

19 months ago[AArch64][SME] Avoid going through memory for streaming-compatible splats
Sander de Smalen [Mon, 5 Dec 2022 12:06:10 +0000 (12:06 +0000)]
[AArch64][SME] Avoid going through memory for streaming-compatible splats

Reviewed By: david-arm, paulwalker-arm

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

19 months ago[ConstraintElim] Update comment after recent changes.
Florian Hahn [Mon, 5 Dec 2022 12:19:09 +0000 (12:19 +0000)]
[ConstraintElim] Update comment after recent changes.

Update the comment to reflect the current code.

19 months ago[mlir] Fix infinite loop in collapse
Guray Ozen [Fri, 2 Dec 2022 15:34:58 +0000 (16:34 +0100)]
[mlir] Fix infinite loop in collapse

Incrementing `counter` variable is inside the if statement. If the code does not enter there, the while loop will iterate infinitely. This revision moves the codes outside of if statement.

Reviewed By: mravishankar

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

19 months ago[SCCP] Propagate equality of a not-constant
luxufan [Mon, 5 Dec 2022 11:38:25 +0000 (19:38 +0800)]
[SCCP] Propagate equality of a not-constant

The equality state of a not-constant can be used to do constant
propagation. For example,
```
define i32 @equal_not_constant(ptr noundef %p, ptr noundef %q) {
entry:
  %cmp = icmp ne ptr %p, null
  br i1 %cmp, label %if.then, label %if.end

if.then:                                          ; preds = %entry
  %cmp.then = icmp eq ptr %p, %q
  br i1 %cmp.then, label %if.then1, label %if.end

if.then1:                                         ; preds = %if.then
  %cmp.then1 = icmp ne ptr %q, null
  call void @use(i1 %cmp.then1)
  br label %if.end

if.end:
  ret i32 0
}

```
In this case, we can fold `%cmp.then1` as `true`.

Reviewed By: nikic

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

19 months agoAMDGPU/MC: Simplify AsmParser for VOP3P
Petar Avramovic [Mon, 5 Dec 2022 10:49:20 +0000 (11:49 +0100)]
AMDGPU/MC: Simplify AsmParser for VOP3P

Remove check that instruction has src_modifiers because
isRegOrImmWithInputMods essentially includes this check.
isMod is no longer used after the refactor. Also, was unreachable case
inside for loop. clamp and omod operands are handled after the loop.

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

19 months ago[LLVM][Runtimes] Surround unknown runtime with ""
David Spickett [Mon, 5 Dec 2022 11:33:29 +0000 (11:33 +0000)]
[LLVM][Runtimes] Surround unknown runtime with ""

So that when you do something like:
-DLLVM_ENABLE_RUNTIMES=;compiler-rt;libcxx;libcxxabi;libunwind

You get:
Runtime "" is not a supported runtime.  Supported runtimes are:

Instead of:
Runtime is not a supported runtime.  Supported runtimes are:

Which implies that "Runtime" is the name of the runtime you
tried to build, but in fact it was "".

19 months ago[include-cleaner] Add two command-line flags to the include-cleaner
Haojian Wu [Mon, 5 Dec 2022 11:18:58 +0000 (12:18 +0100)]
[include-cleaner] Add two command-line flags to the include-cleaner
category.

19 months agoRevert "[AArch64] Improve TargetParser API"
Tomas Matheson [Mon, 5 Dec 2022 11:09:03 +0000 (11:09 +0000)]
Revert "[AArch64] Improve TargetParser API"

This reverts commit e83f1502f1be7a2a3b9a33f5a73867767e78ba6b.

Did not build with C++20 and caused problems with dynamic libs.

19 months ago[SCCP] Add support for with.overflow intrinsics
Nikita Popov [Wed, 9 Nov 2022 11:09:03 +0000 (12:09 +0100)]
[SCCP] Add support for with.overflow intrinsics

This adds SCCP support for extractvalues of with.overflow.
We compute both the range of the result value and determine when
the overflow value is always false.

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

19 months ago[lldb][Test] TestModulesCompileError.py: fix expected error string
Michael Buch [Mon, 5 Dec 2022 10:47:08 +0000 (10:47 +0000)]
[lldb][Test] TestModulesCompileError.py: fix expected error string

19 months ago[NFC] Rename variable MaxBECount -> ConstantMaxBECount
Max Kazantsev [Mon, 5 Dec 2022 09:35:18 +0000 (16:35 +0700)]
[NFC] Rename variable MaxBECount -> ConstantMaxBECount

Just to distinguish it from symbolic max which we plan to compute
here as well.

19 months agoFix MSVC "not all control paths return a value" warning. NFC.
Simon Pilgrim [Mon, 5 Dec 2022 10:39:49 +0000 (10:39 +0000)]
Fix MSVC "not all control paths return a value" warning. NFC.

19 months ago[mlir][Tensor] Apply ClangTidy performance finding (NFC)
Adrian Kuegel [Mon, 5 Dec 2022 10:22:20 +0000 (11:22 +0100)]
[mlir][Tensor] Apply ClangTidy performance finding (NFC)

19 months ago[AArch64][SVE2] Add patterns for eor3
Tiehu Zhang [Mon, 5 Dec 2022 07:50:30 +0000 (15:50 +0800)]
[AArch64][SVE2] Add patterns for eor3

Add patterns for:
    eor x, (eor y, z) -> eor3 x, y, z

Reviewed By: dmgreen, sdesmalen
Differential Revision: https://reviews.llvm.org/D138793

19 months ago[NFC][clang] Strengthen checks in matrix-type-operators.c
John McIver [Mon, 5 Dec 2022 10:13:18 +0000 (10:13 +0000)]
[NFC][clang] Strengthen checks in matrix-type-operators.c

* Add tbaa attribute checks
* Add end-of-line check to load instructions

19 months ago[NFC][clang] Strengthen checks in matrix-type-operators.cpp
John McIver [Mon, 5 Dec 2022 10:12:08 +0000 (10:12 +0000)]
[NFC][clang] Strengthen checks in matrix-type-operators.cpp

* Add tbaa attribute checks
* Add end-of-line check to load instructions

19 months ago[flang][NFC] Remove implemented TODOs
Valentin Clement [Mon, 5 Dec 2022 09:32:08 +0000 (10:32 +0100)]
[flang][NFC] Remove implemented TODOs

19 months ago[Test] Add 2 more simplified test with missing opts
Max Kazantsev [Mon, 5 Dec 2022 08:56:23 +0000 (15:56 +0700)]
[Test] Add 2 more simplified test with missing opts

These are simplified versions of one existing test, but we cannot deal
with them either.

19 months ago[flang] Pointer assignment with remapping involcing polymorphic entities
Valentin Clement [Mon, 5 Dec 2022 08:35:50 +0000 (09:35 +0100)]
[flang] Pointer assignment with remapping involcing polymorphic entities

Lower pointer assignment with remapping involving polymorphic entities
to runtime call to PointerAssociateRemapping.
For the time being all pointer assignment involcing polymorphic entities are
done with the runtime call. When lhs is not unlimited polymorphic
we might be able to do it inlined as well.

Reviewed By: jeanPerier, PeteSteinfeld

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

19 months ago[LAA] Use cross-iteration alias analysis
Nikita Popov [Mon, 14 Nov 2022 15:13:51 +0000 (16:13 +0100)]
[LAA] Use cross-iteration alias analysis

LAA analyzes cross-iteration memory dependencies, as such AA should
not make assumptions about equality of values inside the loop, as
they may come from different iterations.

Fix this by exposing the MayBeCrossIteration AA flag and enabling
it for LAA.

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

19 months ago[mlir][tensor] Fold rank-reducing insert_slice with inverse collapse_shape
Matthias Springer [Mon, 5 Dec 2022 08:16:05 +0000 (09:16 +0100)]
[mlir][tensor] Fold rank-reducing insert_slice with inverse collapse_shape

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

19 months ago[mlir][tensor] Fold rank-reducing extract_slice with inverse expand_shape
Matthias Springer [Mon, 5 Dec 2022 08:15:52 +0000 (09:15 +0100)]
[mlir][tensor] Fold rank-reducing extract_slice with inverse expand_shape

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

19 months ago[LegacyPM] Remove dead declarations
Fangrui Song [Mon, 5 Dec 2022 08:09:23 +0000 (08:09 +0000)]
[LegacyPM] Remove dead declarations

19 months ago[flang] Lower function return to HLFIR
Jean Perier [Mon, 5 Dec 2022 08:05:37 +0000 (09:05 +0100)]
[flang] Lower function return to HLFIR

The only special thing that is needed is to update the bridge symbol
lookup to deal with the HLFIR symbol lookup (symbols are mapped to
fir::FortranVariableInterface operations, not Fortran::Lower::SymbolBox).

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

19 months ago[PowerPC] Remove unused MacOSX check
Fangrui Song [Mon, 5 Dec 2022 07:54:11 +0000 (07:54 +0000)]
[PowerPC] Remove unused MacOSX check

PPC Darwin support was removed long ago.

19 months ago[LegacyPM] Remove AnnotationRemarksLegacyPass
Fangrui Song [Mon, 5 Dec 2022 07:51:17 +0000 (07:51 +0000)]
[LegacyPM] Remove AnnotationRemarksLegacyPass

Following recent changes to remove non-core features of the legacy
PM/optimization pipeline. This is a new pass (2020-11) to generate remarks from
!annotation metadata (e.g. -ftrivial-auto-var-init=).

19 months ago[PowerPC] Use default attributes for intrinsics
Nikita Popov [Tue, 8 Nov 2022 11:26:34 +0000 (12:26 +0100)]
[PowerPC] Use default attributes for intrinsics

This switches a large subset of PowerPC intrinsics to use default
attributes (nosync, nofree, nocallback and willreturn). In
particular the presence of willreturn is important to avoid
optimization regression in the future.

This patch primarily covers readnone/readonly intrinsics.

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

19 months ago[llvm-c] Remove C API functions that are incompatible with opaque pointers
Nikita Popov [Wed, 5 Oct 2022 15:13:25 +0000 (17:13 +0200)]
[llvm-c] Remove C API functions that are incompatible with opaque pointers

These deprecated functions are incompatible with opaque pointers,
and have replacements that accept an explicit type. Drop them now
as a final warning to consumers of the C API to migrate their code
(while LLVMGetElementType still exists as a temporary workaround).

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

19 months ago[lldb] Fix the way we set up the lldb modules infrastructure.
Vassil Vassilev [Mon, 5 Dec 2022 07:18:23 +0000 (07:18 +0000)]
[lldb] Fix the way we set up the lldb modules infrastructure.

D127284 introduced a new language option which is not benign from modules
perspective. Before this patch lldb would set up the compiler invocation and
later enable incremental processing. Post-D127284 this does not work because
the option causes a module hash mismatch for implicit modules.

In addition, D127284 enables parsing statements on the global scope if
incremental processing is on and thus `syntax_error_for_lldb_to_find` was
rightfully not recognized as a declaration and is considered a statement
which produces a slightly different diagnostic.

Thanks to Michael Buch for the help in understanding this issue. This patch
should appease the lldb bots.

More discussion available at: https://reviews.llvm.org/D127284

19 months ago[Kaleidoscope] Fix build after std::optional changes
Nikita Popov [Mon, 5 Dec 2022 07:37:08 +0000 (08:37 +0100)]
[Kaleidoscope] Fix build after std::optional changes

19 months ago[mlir][Linalg] Apply ClangTidy fixes (NFC)
Adrian Kuegel [Mon, 5 Dec 2022 07:18:00 +0000 (08:18 +0100)]
[mlir][Linalg] Apply ClangTidy fixes (NFC)

19 months ago[AST] Make AliasSetTracker work on BatchAA
Nikita Popov [Mon, 14 Nov 2022 14:08:44 +0000 (15:08 +0100)]
[AST] Make AliasSetTracker work on BatchAA

D138014 restricted AST to work on immutable IR. This means it is
also safe to use a single BatchAA instance for the entire AST
lifetime, instead of only batching parts of individual queries.

The primary motivation for this is not compile-time, but rather
having a central place to control cross-iteration AA, which will
be used by D137958.

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

19 months agoTransforms/IPO: llvm::Optional => std::optional
Fangrui Song [Mon, 5 Dec 2022 07:07:19 +0000 (07:07 +0000)]
Transforms/IPO: llvm::Optional => std::optional

19 months ago[test][msan] Update for noundef on retval
Vitaly Buka [Mon, 5 Dec 2022 06:29:15 +0000 (22:29 -0800)]
[test][msan] Update for noundef on retval

19 months agoRemove unused #include "llvm/ADT/Optional.h"
Fangrui Song [Mon, 5 Dec 2022 06:31:11 +0000 (06:31 +0000)]
Remove unused #include "llvm/ADT/Optional.h"

19 months ago[iwyu] Add Hashing.h
Fangrui Song [Mon, 5 Dec 2022 06:26:26 +0000 (06:26 +0000)]
[iwyu] Add Hashing.h

19 months agoForward-declare raw_ostream (NFC)
Kazu Hirata [Mon, 5 Dec 2022 05:43:10 +0000 (21:43 -0800)]
Forward-declare raw_ostream (NFC)

This patch adds forward declarations of raw_ostream to those header
files that are relying on the forward declaration of raw_ostream in
llvm/include/llvm/ADT/Optional.h.

I'm planning to move operator<< for Optional<T> and std::optional<T>
from Optional.h to llvm/include/llvm/Support/raw_ostream.h.  Once I do
so, we no longer need to forward-declare raw_ostream in Optional.h.

19 months ago[ELF] Produce DT_RISCV_VARIANT_CC
Fangrui Song [Mon, 5 Dec 2022 05:08:37 +0000 (21:08 -0800)]
[ELF] Produce DT_RISCV_VARIANT_CC

https://github.com/riscv/riscv-elf-psabi-doc/pull/190 introduced STO_RISCV_VARIANT_CC.
The linker should:

* Copy the STO_RISCV_VARIANT_CC bit to .symtab/.dynsym: already fulfilled after
  82ed93ea0552c8f82df05859ee93e70b71c4e65d
* Produce DT_RISCV_VARIANT_CC if at least one R_RISCV_JUMP_SLOT relocation
  references a symbol with the STO_RISCV_VARIANT_CC bit. Done by this patch.

Reviewed By: kito-cheng

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

19 months ago[NFC][XCOFF] format `XCOFFObjectWriter.cpp`
esmeyi [Mon, 5 Dec 2022 04:57:33 +0000 (23:57 -0500)]
[NFC][XCOFF] format `XCOFFObjectWriter.cpp`

19 months ago[iwyu] Fix files which would break without #include Optional.h
Fangrui Song [Mon, 5 Dec 2022 04:53:28 +0000 (04:53 +0000)]
[iwyu] Fix files which would break without #include Optional.h

19 months ago[clang] Use std::nullopt instead of None in comments (NFC)
Kazu Hirata [Mon, 5 Dec 2022 04:31:05 +0000 (20:31 -0800)]
[clang] Use std::nullopt instead of None in comments (NFC)

This is part of an effort to migrate from llvm::Optional to
std::optional:

https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716

19 months agoCheckedArithmetic: llvm::Optional => std::optional
Fangrui Song [Mon, 5 Dec 2022 04:30:54 +0000 (04:30 +0000)]
CheckedArithmetic: llvm::Optional => std::optional

19 months agoRemove unused #include "llvm/ADT/Optional.h"
Fangrui Song [Mon, 5 Dec 2022 04:21:07 +0000 (04:21 +0000)]
Remove unused #include "llvm/ADT/Optional.h"

19 months ago[RISCV] Support .variant_cc directive for the assembler.
Yeting Kuo [Sat, 19 Nov 2022 14:46:24 +0000 (22:46 +0800)]
[RISCV] Support .variant_cc directive for the assembler.

The patch is split from D103435. The patch supported a new directive .variant_cc
that annotates function with STO_RISCV_VARIANT_CC. Symbols marked with
STO_RISCV_VARIANT_CC do not use standard calling conversion or use parameter not
passed in GPR/FPR.

Related: https://github.com/riscv/riscv-elf-psabi-doc/pull/190

Initial authored by: HsiangKai

Reviewed By: MaskRay

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

19 months ago[IR] llvm::Optional => std::optional
Fangrui Song [Mon, 5 Dec 2022 04:13:11 +0000 (04:13 +0000)]
[IR] llvm::Optional => std::optional

Many llvm/IR/* files have been migrated by other contributors.
This migrates most remaining files.

19 months ago[lldb] Use std::nullopt instead of None in comments (NFC)
Kazu Hirata [Mon, 5 Dec 2022 04:11:39 +0000 (20:11 -0800)]
[lldb] Use std::nullopt instead of None in comments (NFC)

This is part of an effort to migrate from llvm::Optional to
std::optional:

https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716

19 months ago[mlir] Use std::nullopt instead of None in comments (NFC)
Kazu Hirata [Mon, 5 Dec 2022 03:58:32 +0000 (19:58 -0800)]
[mlir] Use std::nullopt instead of None in comments (NFC)

This is part of an effort to migrate from llvm::Optional to
std::optional:

https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716

19 months ago[llvm] Use std::nullopt instead of None in comments (NFC)
Kazu Hirata [Mon, 5 Dec 2022 03:47:13 +0000 (19:47 -0800)]
[llvm] Use std::nullopt instead of None in comments (NFC)

This is part of an effort to migrate from llvm::Optional to
std::optional:

https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716

19 months ago[LoongArch] Specify registers used for exception handling
Weining Lu [Mon, 5 Dec 2022 03:42:22 +0000 (11:42 +0800)]
[LoongArch] Specify registers used for exception handling

See definition in backend D134709 and the doc [1] for more detail.

With the benefit of this change, most libcxx and libcxxabi tests pass.

[1]: https://llvm.org/docs/ExceptionHandling.html

Reviewed By: xen0n, wangleiat

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

19 months ago[MCDisassembler] Work around GCC 7 after f4c16c44737caac25bf09ec2d85809820579ae40
Fangrui Song [Mon, 5 Dec 2022 03:34:14 +0000 (03:34 +0000)]
[MCDisassembler] Work around GCC 7 after f4c16c44737caac25bf09ec2d85809820579ae40

The use of union isn't really necessary. So just flatten its fields.

19 months ago[PowerPC][GISel]support for float point and integer convertion
Chen Zheng [Mon, 5 Dec 2022 02:53:59 +0000 (21:53 -0500)]
[PowerPC][GISel]support for float point and integer convertion

Add support for fptosi,fptoui,sitofp,uitofp

For now only handle 64 bit integer to make it does not depend on
any other patches. 32 bit integer needs handling for G_SEXT/G_ZEXT.

Reviewed By: arsenm

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

19 months ago[test][CodeGen] Check noundef for omited return
Vitaly Buka [Sat, 3 Dec 2022 00:54:24 +0000 (16:54 -0800)]
[test][CodeGen] Check noundef for omited return

19 months ago[test][CodeGen] Check noundef for return value
Vitaly Buka [Sat, 3 Dec 2022 00:09:59 +0000 (16:09 -0800)]
[test][CodeGen] Check noundef for return value

19 months ago[NFC][CodeGen] Extract HasStrictReturn
Vitaly Buka [Fri, 2 Dec 2022 23:22:29 +0000 (15:22 -0800)]
[NFC][CodeGen] Extract HasStrictReturn

19 months ago[NFC][CodeGen] Add const to a method
Vitaly Buka [Fri, 2 Dec 2022 22:59:13 +0000 (14:59 -0800)]
[NFC][CodeGen] Add const to a method

19 months ago[flang] Diagnostic for shape argument in c_f_pointer
Qihan Cai [Sat, 26 Nov 2022 10:46:29 +0000 (21:46 +1100)]
[flang] Diagnostic for shape argument in c_f_pointer

Fix #59177, add check for dimensionality for shape argument against rank of FPTR argument in c_f_pointer

Reviewed By: peixin

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

19 months ago[RISCV] Use findFirstSet instead of countTrailingZeros. NFC
Craig Topper [Mon, 5 Dec 2022 02:00:36 +0000 (18:00 -0800)]
[RISCV] Use findFirstSet instead of countTrailingZeros. NFC

findFirstSet is a wrapper around countTrailingZeros so they are
equivalent here, but I think findFirstSet more cleary describes
the algorithm here.

19 months ago[RISCV] Use emplace_back to shorten lines in RISCVMatInt. NFC
Craig Topper [Mon, 5 Dec 2022 02:00:27 +0000 (18:00 -0800)]
[RISCV] Use emplace_back to shorten lines in RISCVMatInt. NFC

A few other minor improvements.

19 months ago[PowerPC] don't check CTR clobber in hardware loop insertion pass
Chen Zheng [Fri, 2 Dec 2022 05:39:39 +0000 (00:39 -0500)]
[PowerPC] don't check CTR clobber in hardware loop insertion pass

We added a new post-isel CTRLoop pass in D122125. That pass will expand
the hardware loop related intrinsic to CTR loop or normal loop based
on the loop context. So we don't need to conservatively check the CTR
clobber now on the IR level.

Reviewed By: lkail

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

19 months ago[clang-tools-extra] Use std::nullopt instead of None in comments (NFC)
Kazu Hirata [Mon, 5 Dec 2022 01:40:28 +0000 (17:40 -0800)]
[clang-tools-extra] Use std::nullopt instead of None in comments (NFC)

This is part of an effort to migrate from llvm::Optional to
std::optional:

https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716

19 months ago[llvm] Use std::nullopt instead of None in comments (NFC)
Kazu Hirata [Mon, 5 Dec 2022 01:31:16 +0000 (17:31 -0800)]
[llvm] Use std::nullopt instead of None in comments (NFC)

This is part of an effort to migrate from llvm::Optional to
std::optional:

https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716

19 months ago[mlir] Use std::nullopt instead of None in comments (NFC)
Kazu Hirata [Mon, 5 Dec 2022 01:23:50 +0000 (17:23 -0800)]
[mlir] Use std::nullopt instead of None in comments (NFC)

This is part of an effort to migrate from llvm::Optional to
std::optional:

https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716

19 months ago[llvm] Use std::nullopt instead of None in comments (NFC)
Kazu Hirata [Mon, 5 Dec 2022 01:12:44 +0000 (17:12 -0800)]
[llvm] Use std::nullopt instead of None in comments (NFC)

This is part of an effort to migrate from llvm::Optional to
std::optional:

https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716

19 months ago[flang] Don't propagate PRIVATE into submodule module files
Peter Klausler [Thu, 17 Nov 2022 21:34:40 +0000 (13:34 -0800)]
[flang] Don't propagate PRIVATE into submodule module files

Module files for submodules should not contain PRIVATE attributes,
since everything in them is local to the parent module and
accessible to all descendant submodules.

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

19 months ago[lldb/unittests] Use std::nullopt instead of None (NFC)
Kazu Hirata [Mon, 5 Dec 2022 00:51:27 +0000 (16:51 -0800)]
[lldb/unittests] Use std::nullopt instead of None (NFC)

This patch mechanically replaces None with std::nullopt where the
compiler would warn if None were deprecated.  The intent is to reduce
the amount of manual work required in migrating from Optional to
std::optional.

This is part of an effort to migrate from llvm::Optional to
std::optional:

https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716

19 months ago[lldb] Use std::nullopt instead of None (NFC)
Kazu Hirata [Mon, 5 Dec 2022 00:51:25 +0000 (16:51 -0800)]
[lldb] Use std::nullopt instead of None (NFC)

This patch mechanically replaces None with std::nullopt where the
compiler would warn if None were deprecated.  The intent is to reduce
the amount of manual work required in migrating from Optional to
std::optional.

This is part of an effort to migrate from llvm::Optional to
std::optional:

https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716

19 months ago[gn build] Port 122efef8ee9b
LLVM GN Syncbot [Mon, 5 Dec 2022 00:11:52 +0000 (00:11 +0000)]
[gn build] Port 122efef8ee9b

19 months ago[DebugInfo] llvm::Optional => std::optional
Fangrui Song [Mon, 5 Dec 2022 00:09:22 +0000 (00:09 +0000)]
[DebugInfo] llvm::Optional => std::optional

https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716

19 months ago[clang] Use std::nullopt instead of None in comments (NFC)
Kazu Hirata [Sun, 4 Dec 2022 23:57:24 +0000 (15:57 -0800)]
[clang] Use std::nullopt instead of None in comments (NFC)

This is part of an effort to migrate from llvm::Optional to
std::optional:

https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716

19 months agoRevert "Reapply "[CodeGen] Add new pass for late cleanup of redundant definitions.""
Jonas Paulsson [Sun, 4 Dec 2022 23:52:00 +0000 (00:52 +0100)]
Revert "Reapply "[CodeGen] Add new pass for late cleanup of redundant definitions.""

This reverts commit 17db0de330f943833296ae72e26fa988bba39cb3.

Some more bots got broken - need to investigate.

19 months ago[flang] Check restrictions on TRANSFER()
Peter Klausler [Thu, 17 Nov 2022 01:10:05 +0000 (17:10 -0800)]
[flang] Check restrictions on TRANSFER()

Enforce detectable compilation-time violations of restrictions on the
arguments to the TRANSFER() intrinsic function (16.9.163) with
error messages, and mark other potential problems with warnings.

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

19 months ago[SanitizerBinaryMetadata] Use weak __start_/__stop_ instead of dummy empty section
Fangrui Song [Sun, 4 Dec 2022 23:06:34 +0000 (15:06 -0800)]
[SanitizerBinaryMetadata] Use weak __start_/__stop_ instead of dummy empty section

D130887 uses a dummy empty section `sanmd_covered` (with the SHF_GNU_RETAIN flag on
ELF) to prevent `undefined symbol: __start_sanmd_covered` if all `sanmd_covered`
are discarded by `ld --gc-sections` (in `-z start-stop-gc` mode).

The dummy `sanmd_covered` does not have the SHF_LINK_ORDER flag, so mixing it
with SHF_LINK_ORDER `sanmd_covered` causes an issue to GNU ld<2.36
(https://sourceware.org/bugzilla/show_bug.cgi?id=26256).

Similar to D98903 for SanitizerCoverage, let's make encapsulation symbols
undefined weak[1]. This additionally avoids size cost due to the dummy section and
symbol.

[1]: https://maskray.me/blog/2021-01-31-metadata-sections-comdat-and-shf-link-order

Reviewed By: melver

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

19 months ago[IR] Use std::nullopt instead of None (NFC)
Kazu Hirata [Sun, 4 Dec 2022 23:05:22 +0000 (15:05 -0800)]
[IR] Use std::nullopt instead of None (NFC)

This is part of an effort to migrate from llvm::Optional to
std::optional:

https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716

19 months ago[VPlan] Support sinking VPScalarIVStepsRecipe.
Florian Hahn [Sun, 4 Dec 2022 22:59:16 +0000 (22:59 +0000)]
[VPlan] Support sinking VPScalarIVStepsRecipe.

This patch extends VP-based sinking to also sink VPScalarStepsRecipe.
This takes us a step closer towards retiring the IR based sinking.

The main change is extending VPScalarIVStepsRecipe::execute to support
executing in a replicate-region.

Depends on D133758.

Reviewed By: Ayal

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

19 months ago[Target] llvm::Optional => std::optional
Fangrui Song [Sun, 4 Dec 2022 22:43:14 +0000 (22:43 +0000)]
[Target] llvm::Optional => std::optional

The updated functions are mostly internal with a few exceptions (virtual functions in
TargetInstrInfo.h, TargetRegisterInfo.h).
To minimize changes to LLVMCodeGen, GlobalISel files are skipped.

https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716

19 months ago[flang] Use std::nullopt instead of None (NFC)
Kazu Hirata [Sun, 4 Dec 2022 22:40:10 +0000 (14:40 -0800)]
[flang] Use std::nullopt instead of None (NFC)

I've verified that every single instance of std::nullopt in this patch
affects generated files and would reduce the number of warnings if
None were deprecated.

This is part of an effort to migrate from llvm::Optional to
std::optional:

https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716