platform/upstream/llvm.git
21 months ago[AArch64][SME] Remove get.pstatesm intrinsic.
Sander de Smalen [Thu, 20 Oct 2022 11:17:34 +0000 (12:17 +0100)]
[AArch64][SME] Remove get.pstatesm intrinsic.

This intrinsic can be removed in favour of using a call to
__arm_sme_state() directly and testing the LSB of X0.

In IR that would look like:

   %pstate = call aarch64_sme_preservemost_from_x2 {i64, i64} @__arm_sme_state()
   %pstate.x0 = extractvalue {i64, i64} %pstate, 0
   %pstate.sm = and i64 %pstate.x0, 1

21 months ago[AMDGPU][MC][GFX11][NFC] Fix trivial typos in tests
Dmitry Preobrazhensky [Thu, 20 Oct 2022 12:17:22 +0000 (15:17 +0300)]
[AMDGPU][MC][GFX11][NFC] Fix trivial typos in tests

21 months ago[analyzer] Move unexecuted test block into it's own source file
isuckatcs [Fri, 14 Oct 2022 16:03:13 +0000 (18:03 +0200)]
[analyzer] Move unexecuted test block into it's own source file

Inside lambdas.cpp a block of code wasn't executed,
because it required the standard to be at least c++14.
This patch moves this block of code into it's own
source file and makes sure it's tested.

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

21 months ago[AMDGPU][MC][GFX11][NFC] Improve error message when a VOPD opcode is used with WS64
Dmitry Preobrazhensky [Thu, 20 Oct 2022 12:12:54 +0000 (15:12 +0300)]
[AMDGPU][MC][GFX11][NFC] Improve error message when a VOPD opcode is used with WS64

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

21 months agoIntroduce options for Windows packaging script
Pierrick Bouvier [Thu, 20 Oct 2022 12:12:28 +0000 (14:12 +0200)]
Introduce options for Windows packaging script

Options:
--version: [required] version to build
--help: display this help
--x86: build and test x86 variant
--x64: build and test x64 variant

Note: At least one variant to build is required.

Example: build_llvm_release.bat --version 15.0.0 --x64

Reviewed By: hans, thieta

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

21 months ago[InstCombine] Fix assert condition in `foldSelectShuffleOfSelectShuffle`
Nabeel Omer [Thu, 20 Oct 2022 12:06:01 +0000 (12:06 +0000)]
[InstCombine] Fix assert condition in `foldSelectShuffleOfSelectShuffle`

Bug introduced in e239198cdbbf.

The assert() is making an assumption that the resulting shuffle mask
will always select elements from both vectors, this is untrue in the
case of two shuffles being folded if the former shuffle has a mask with
undef elements in it. In such a case folding the shuffles might result
in a mask which only selects from one of the vectors because the other
elements (in the mask) are undef.

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

21 months ago[AMDGPU][MC] Correct v_cndmask operand types
Dmitry Preobrazhensky [Thu, 20 Oct 2022 12:05:40 +0000 (15:05 +0300)]
[AMDGPU][MC] Correct v_cndmask operand types

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

21 months ago[mlir][llvm] Handle llvm.noundef attribute when converting to LLVM IR
Victor Perez [Thu, 20 Oct 2022 11:58:43 +0000 (12:58 +0100)]
[mlir][llvm] Handle llvm.noundef attribute when converting to LLVM IR

Translate LLVMIR llvm.noundef attribute to its equivalent in LLVM IR.

Reviewed By: ftynse

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

21 months ago[libc][automemcpy] fix build after change in Arg enum
Guillaume Chatelet [Thu, 20 Oct 2022 11:58:54 +0000 (11:58 +0000)]
[libc][automemcpy] fix build after change in Arg enum

21 months ago[LoopSimplifyCFG] Forget loop and block dispos after merging blocks.
Florian Hahn [Thu, 20 Oct 2022 10:23:29 +0000 (11:23 +0100)]
[LoopSimplifyCFG] Forget loop and block dispos after merging blocks.

This fixes another case where block and loop dispositions weren't
properly invalidate after changing the CFG.

Fixes #58489.

21 months ago[FuncAttrs] Extract code for adding a location access (NFC)
Nikita Popov [Wed, 19 Oct 2022 14:55:24 +0000 (16:55 +0200)]
[FuncAttrs] Extract code for adding a location access (NFC)

This code is the same for accesses from call arguments and for
accesses from other (single-location) instructions. Extract i
into a common function.

21 months ago[FunctionAttrs] Volatile operations can access inaccessible memory
Nikita Popov [Thu, 13 Oct 2022 10:16:26 +0000 (12:16 +0200)]
[FunctionAttrs] Volatile operations can access inaccessible memory

Per LangRef, volatile operations are allowed to access the location
of their pointer argument, plus inaccessible memory:

> Any volatile operation can have side effects, and any volatile
> operation can read and/or modify state which is not accessible
> via a regular load or store in this module.
> [...]
> The allowed side-effects for volatile accesses are limited. If
> a non-volatile store to a given address would be legal, a volatile
> operation may modify the memory at that address. A volatile
> operation may not modify any other memory accessible by the
> module being compiled. A volatile operation may not call any
> code in the current module.

FunctionAttrs currently does not model this and ends up marking
functions with volatile accesses on arguments as argmemonly,
even though they should be inaccessiblemem_or_argmemonly.

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

21 months ago[LoongArch] Fix 32-bit and 64-bit atomicrmw nand operand order errors
gonglingqin [Thu, 20 Oct 2022 09:25:58 +0000 (17:25 +0800)]
[LoongArch] Fix 32-bit and 64-bit atomicrmw nand operand order errors

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

21 months ago[libc][NFC] add missing static qualifiers in tests
Guillaume Chatelet [Thu, 20 Oct 2022 08:52:56 +0000 (08:52 +0000)]
[libc][NFC] add missing static qualifiers in tests

21 months ago[libc][NFC] remove unneeded -lpthread for utils_test
Guillaume Chatelet [Thu, 20 Oct 2022 08:48:22 +0000 (08:48 +0000)]
[libc][NFC] remove unneeded -lpthread for utils_test

21 months agoFix crash in constraining partial specialization on nested template.
Utkarsh Saxena [Wed, 19 Oct 2022 14:29:42 +0000 (16:29 +0200)]
Fix crash in constraining partial specialization on nested template.

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

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

21 months ago[flang] optionally lower scalar and explicit shape with fir.declare
Jean Perier [Thu, 20 Oct 2022 08:30:42 +0000 (10:30 +0200)]
[flang] optionally lower scalar and explicit shape with fir.declare

Lower scalar and explicit shape arrays to fir.declare under the -hlfir option.
Update the SymMap so that it can hold fir::FortranVariableInterface.

The plan is to go towards a SymMap that only contains fir::FortranVariableInterface
once current expression lowering can be replaced. This should make the SymMap lighter
than it is today (SymBox/ExtendedValue are above 256 bytes).

Assumed shape, allocatable and pointer are left TODOs for now. Anything with a
specification expression that is not a constant expression will only be able to
be lowered when the HLFIR expression lowering skeleton is added.

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

21 months ago[flang] add fir.declare codegen support
Jean Perier [Thu, 20 Oct 2022 08:15:14 +0000 (10:15 +0200)]
[flang] add fir.declare codegen support

For now, nothing is done about debug info and the fir.declare is simply
replaced by the memref argument. This is done in the PreCGRewrite in
order to avoid requiring adding support for fir.shape codegen, which
would still be useless and undesired at that point.

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

21 months ago[gn build] Port 3c397c90c183
LLVM GN Syncbot [Thu, 20 Oct 2022 07:32:37 +0000 (07:32 +0000)]
[gn build] Port 3c397c90c183

21 months ago[llvm-debuginfo-analyzer] (04/09) - Locations and ranges
Carlos Alberto Enciso [Thu, 20 Oct 2022 06:01:31 +0000 (07:01 +0100)]
[llvm-debuginfo-analyzer] (04/09) - Locations and ranges

llvm-debuginfo-analyzer is a command line tool that processes debug
info contained in a binary file and produces a debug information
format agnostic “Logical View”, which is a high-level semantic
representation of the debug info, independent of the low-level
format.

The code has been divided into the following patches:

1) Interval tree
2) Driver and documentation
3) Logical elements
4) Locations and ranges
5) Select elements
6) Warning and internal options
7) Compare elements
8) ELF Reader
9) CodeView Reader

Full details:
https://discourse.llvm.org/t/llvm-dev-rfc-llvm-dva-debug-information-visual-analyzer/62570

This patch:

Locations and ranges
- All functionality for logical debug locations and ranges:
  LVLocation, LVRanges.

Reviewed By: psamolysov, probinson

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

21 months ago[mlir][aarch64] Disable bf16 tests on AArch64
Andrzej Warzynski [Wed, 19 Oct 2022 17:22:58 +0000 (17:22 +0000)]
[mlir][aarch64] Disable bf16 tests on AArch64

This patch disables 2 bf16 tests that are currently not supported on
AArch64. I've triaged these failures and opened [1] to track this. I
don't have a simple reproducer for dense_output_bf16.mlir, but it's
rather clear that both tests fail due to missing support for `bfloat`
operations in the AArch64 backend.

I'm not sure what the path forward to enable these tests on AArch64
should be. I think that there are two options:
  * AArch64 backened gains capability to legalize these nodes containing
    `bfloat` operands, or
  * MLIR (similarly to Clang) is taught not to emit such nodes in the
    first place.

[1] https://github.com/llvm/llvm-project/issues/58465

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

21 months ago[libc][Obvious] Fix incomplete spec definition of sys/random.h.
Siva Chandra Reddy [Thu, 20 Oct 2022 06:57:00 +0000 (06:57 +0000)]
[libc][Obvious] Fix incomplete spec definition of sys/random.h.

21 months ago[X86] Move 128/256-bit FP16/BF16 typedef to emmintrin.h or avxintrin.h, NFCI
Phoebe Wang [Thu, 20 Oct 2022 06:12:19 +0000 (14:12 +0800)]
[X86] Move 128/256-bit FP16/BF16 typedef to emmintrin.h or avxintrin.h, NFCI

21 months ago[mlir][llvm] Use longer variable names in LLVM IR import (NFC).
Tobias Gysi [Thu, 20 Oct 2022 05:26:10 +0000 (08:26 +0300)]
[mlir][llvm] Use longer variable names in LLVM IR import (NFC).

Rename single letter member variables and function arguments to use
longer names in ConvertFromLLVMIR.cpp. Also drop some uses of auto in
favor our spelling out the type and refactor some llvm::enumerate loops.

Reviewed By: ftynse

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

21 months ago[gn build] Port e28b9357b14c
LLVM GN Syncbot [Thu, 20 Oct 2022 05:20:35 +0000 (05:20 +0000)]
[gn build] Port e28b9357b14c

21 months ago[llvm-debuginfo-analyzer] (03/09) - Logical elements
Carlos Alberto Enciso [Wed, 19 Oct 2022 10:01:14 +0000 (11:01 +0100)]
[llvm-debuginfo-analyzer] (03/09) - Logical elements

llvm-debuginfo-analyzer is a command line tool that processes debug
info contained in a binary file and produces a debug information
format agnostic “Logical View”, which is a high-level semantic
representation of the debug info, independent of the low-level
format.

The code has been divided into the following patches:

1) Interval tree
2) Driver and documentation
3) Logical elements
4) Locations and ranges
5) Select elements
6) Warning and internal options
7) Compare elements
8) ELF Reader
9) CodeView Reader

Full details:
https://discourse.llvm.org/t/llvm-dev-rfc-llvm-dva-debug-information-visual-analyzer/62570

This patch:

Logical elements
- All basic functionality for the logical elements:
  LVScope, LVLine, LVSymbol, LVType.
- The logical reader:
  LVReader.h

Reviewed By: psamolysov, probinson

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

21 months ago[MLIR] Enable distribution target in standalone builds
Michał Górny [Wed, 19 Oct 2022 17:14:59 +0000 (19:14 +0200)]
[MLIR] Enable distribution target in standalone builds

Invoke llvm_distribution_add_targets() when doing standalone build
explicitly in order to create the `distribution` target.

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

21 months ago[testcase][OpenMP] Fix the testcase error of check-all when DCLANG_DEFAULT_OPENMP_RUN...
Zi Xuan Wu (Zeson) [Thu, 20 Oct 2022 01:44:38 +0000 (09:44 +0800)]
[testcase][OpenMP] Fix the testcase error of check-all when DCLANG_DEFAULT_OPENMP_RUNTIME is not libomp

When DCLANG_DEFAULT_OPENMP_RUNTIME is set to libgomp, there is some check-all error.
The expected CHECK result only displays when fopenmp=libomp is specified explicitly.

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

21 months ago[X86] Remove redundant static from constexpr. NFC
Phoebe Wang [Thu, 20 Oct 2022 01:29:22 +0000 (09:29 +0800)]
[X86] Remove redundant static from constexpr. NFC

21 months ago[CMake] Disable BOLT instrumentation of Clang on instrumented build
Amir Ayupov [Thu, 20 Oct 2022 01:23:43 +0000 (18:23 -0700)]
[CMake] Disable BOLT instrumentation of Clang on instrumented build

This enables multi-stage PGO build optimized by BOLT using BOLT.cmake cache.

The issue is that `-DPGO_BUILD_CONFIGURATION` cache file is passed to both
stage2-instrumented and stage2-optimized builds (for them to be identical),
but in case of BOLT.cmake, it doesn't make sense to BOLT-instrument the
instrumented binary (it's not going to be optimized). Hence turn off
`CLANG_BOLT_INSTRUMENT` code if `LLVM_BUILD_INSTRUMENTED` is enabled.

The final workflow that enables multi-stage InstrPGO+ThinLTO+BOLT Clang build:
```
cmake <llvm-project>/llvm -GNinja -DLLVM_ENABLE_LLD=ON \
  -DBOOTSTRAP_LLVM_ENABLE_LLD=ON -DBOOTSTRAP_BOOTSTRAP_LLVM_ENABLE_LLD=ON \
  -DPGO_INSTRUMENT_LTO=Thin -C llvm-project/clang/cmake/caches/BOLT-PGO.cmake
ninja stage2-clang++-bolt
```

Reviewed By: rafauler

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

21 months ago[gn build] Port 62ca79102cf9
LLVM GN Syncbot [Thu, 20 Oct 2022 01:14:27 +0000 (01:14 +0000)]
[gn build] Port 62ca79102cf9

21 months ago[X86][1/2] Support PREFETCHI instructions
Phoebe Wang [Thu, 20 Oct 2022 00:44:52 +0000 (08:44 +0800)]
[X86][1/2] Support PREFETCHI instructions

For more details about these instructions, please refer to the latest ISE document: https://www.intel.com/content/www/us/en/develop/download/intel-architecture-instruction-set-extensions-programming-reference.html

Reviewed By: craig.topper

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

21 months ago[docs] Update compiler-rt/CODE_OWNERS.TXT
Vitaly Buka [Mon, 10 Oct 2022 21:06:01 +0000 (14:06 -0700)]
[docs] Update compiler-rt/CODE_OWNERS.TXT

Reviewed By: compnerd, kcc, lhames, phosek, tejohnson, dvyukov, MaskRay

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

21 months ago[mlir][NVGPU] Handle native mma.sync and ldmatrix(x4) sizes
Manish Gupta [Wed, 12 Oct 2022 05:17:32 +0000 (05:17 +0000)]
[mlir][NVGPU] Handle native mma.sync and ldmatrix(x4) sizes

This patch handles native `mma.sync` sizes and enables issuing `ldmatrix` on
largest possible tiles for matrixB. It requires handling
`vector.extract_strided_slice` from vector to ngpu lowering.

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

21 months ago[test][asan][Darwin] Pass -mlinker-version=133 to linker invocation in odr-lto.cpp
Arthur Eubanks [Wed, 19 Oct 2022 23:33:30 +0000 (16:33 -0700)]
[test][asan][Darwin] Pass -mlinker-version=133 to linker invocation in odr-lto.cpp

When building clang with lld, we don't get a default mlinker-version [1]. This causes us to not pass -lto_library to ld64 [2].
Explicitly pass -mlinker-version=133 so we properly pass -lto_library to ld64 and don't get LLVM bitcode version mismatches due to LTO.

[1] https://github.com/llvm/llvm-project/blob/55ae180a4cb7fc68b3ac153f07752c8c6a2d92f0/clang/CMakeLists.txt#L345
[2] https://github.com/llvm/llvm-project/blob/55ae180a4cb7fc68b3ac153f07752c8c6a2d92f0/clang/lib/Driver/ToolChains/Darwin.cpp#L262-L270

21 months ago[VP] Teach isVPBinaryOp to recognize vp.smin/smax/umin/umax/minnum/maxnum.
Yeting Kuo [Wed, 12 Oct 2022 07:44:09 +0000 (15:44 +0800)]
[VP] Teach isVPBinaryOp to recognize vp.smin/smax/umin/umax/minnum/maxnum.

Those vp intrinsics should be vp binary operations.

Reviewed By: craig.topper

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

21 months ago[clang][RISCV] Set vscale_range attribute based on VLEN
Philip Reames [Wed, 19 Oct 2022 23:05:39 +0000 (16:05 -0700)]
[clang][RISCV] Set vscale_range attribute based on VLEN

Follow up on D135894, restructure code to work in terms of minimum and maximum VLEN coming from RISCVISAInfo.cpp. In the original review, I'd mentioned that MinVLEN was sometimes zero. This turns out to be a case of human error, combined with really bad (lack of) error reporting.

This patch adds appropriate tests for various vector extension combinations to show the mechanism works, but doesn't try to provide exhaustive coverage of the extension interactions. Presumably, that is already covered in existing tests elsewhere.

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

21 months ago[VE] Change the way to lower selectcc
Kazushi (Jam) Marukawa [Fri, 14 Oct 2022 23:04:00 +0000 (08:04 +0900)]
[VE] Change the way to lower selectcc

Change to use VEISD::CMPI/CMPU/CMPF/CMPQ and VEISD::CMOV in combineSelectCC
for better optimization.  Support VEISD::CMPI/CMPU in combineTRUNCATE also
to optimize truncate.  Remove obsolete lower patterns from VEInstrInfo.td.
Update regression tests also.

Reviewed By: efocht

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

21 months ago[libc][Obvious] Add termios.h to the list of x86_64 linux headers.
Siva Chandra Reddy [Wed, 19 Oct 2022 22:59:50 +0000 (22:59 +0000)]
[libc][Obvious] Add termios.h to the list of x86_64 linux headers.

21 months ago[RISCV] Remove -enable-unsafe-fp-math from machine combiner tests. NFC
Craig Topper [Wed, 19 Oct 2022 22:54:28 +0000 (15:54 -0700)]
[RISCV] Remove -enable-unsafe-fp-math from machine combiner tests. NFC

The optimization is using fast math flags on the instructions instead.

21 months ago[clang] Disable assertion that can "easily happen"
Jonas Devlieghere [Wed, 19 Oct 2022 20:32:31 +0000 (13:32 -0700)]
[clang] Disable assertion that can "easily happen"

Disable the assertion for getting a module ID for non-local,
non-imported module. According to the FIXME this can "easily happen" and
indeed, we're hitting this assertion regularly. Disable it until it can
be properly investigated.

rdar://99352728

Differential revision: https://reviews.llvm.org/D136290

21 months ago[examples][ORC] Make sure eh-frame registration code is linked into an example.
Lang Hames [Wed, 19 Oct 2022 21:58:57 +0000 (14:58 -0700)]
[examples][ORC] Make sure eh-frame registration code is linked into an example.

Since aedeb8d5570, which switched to EPC-based eh-frame registration, the
eh-frame registration functions need to be forcibly linked into the target
process.

We need a general solution to this problem, but for now just force it in this
example to fix the test failures in
https://green.lab.llvm.org/green/job/clang-stage1-RA/31497

rdar://101083784

21 months ago[Sema] Don't treat a non-null template argument as if it were null.
Eli Friedman [Wed, 19 Oct 2022 21:40:52 +0000 (14:40 -0700)]
[Sema] Don't treat a non-null template argument as if it were null.

The way this code checks whether a pointer is null is wrong for other
reasons; it doesn't actually check whether a null pointer constant is a
"constant" in the C++ standard sense.  But this fix at least makes sure
we don't treat a non-null pointer as if it were null.

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

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

21 months ago[Hexagon] Fix insertion point for pointer difference calculation
Krzysztof Parzyszek [Wed, 19 Oct 2022 21:14:48 +0000 (14:14 -0700)]
[Hexagon] Fix insertion point for pointer difference calculation

HVC::calculatePointerDifference inserts temporary instructions for
simplification, and calulation of known bits. These instructions were
inserted at the end of a basic block (after the terminator), which
caused BB->getTerminator() to return nullptr. This, in turn, caused
a crash when a PHI instruction was examined in computeKnownBits.

21 months ago[mlir][sparse] Fix breakage on older versions of cmake
wren romano [Wed, 19 Oct 2022 20:37:17 +0000 (13:37 -0700)]
[mlir][sparse] Fix breakage on older versions of cmake

Per https://reviews.llvm.org/D136005#3866692 the introduction of the MLIRSparseTensorEnums target in D136002 caused breakage on some versions of cmake.  This differential aims to fix those errors.

Reviewed By: aartbik

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

21 months ago[lldb] Allow SymbolFileDWARFDebugMap to register multiple compile units
Augusto Noronha [Mon, 17 Oct 2022 20:39:36 +0000 (13:39 -0700)]
[lldb] Allow SymbolFileDWARFDebugMap to register multiple compile units

Currently, SymbolFileDWARFDebugMap works on the assumption that there is
only one compile unit per object file. This patch documents this
limitation (when using the general SymbolFile API), and allows users of
the concrete SymbolFileDWARFDebugMap class to find out about these extra
compile units.

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

21 months ago[mlgo] Fix one test post-D135934
Mircea Trofin [Wed, 19 Oct 2022 20:48:24 +0000 (13:48 -0700)]
[mlgo] Fix one test post-D135934

The test was checking output opcodes, one changed as result of D135934.

21 months ago[mlir][linalg] Add back split reduction tests dropped by previous commit
Thomas Raoux [Wed, 19 Oct 2022 20:23:36 +0000 (20:23 +0000)]
[mlir][linalg] Add back split reduction tests dropped by previous commit

The transition to transform dialect based tests dropped several cases of
the split reduction testing. Adding them back.

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

21 months ago[BitcodeReader] Convert pair to triple in preparation for MemProf (NFC)
Teresa Johnson [Wed, 19 Oct 2022 18:39:10 +0000 (11:39 -0700)]
[BitcodeReader] Convert pair to triple in preparation for MemProf (NFC)

Extracted from D135714 which adds summary support for MemProf. We will
need a 3rd tuple member in the ValueIdToValueInfoMap, this patch makes a
number of NFC changes to the existing clients of that map to reflect the
conversion of pair to tuple.

21 months ago[SPIR-V] Add get_image_num_mip_levels implementation
Michal Paszkowski [Wed, 19 Oct 2022 20:29:16 +0000 (22:29 +0200)]
[SPIR-V] Add get_image_num_mip_levels implementation

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

21 months ago[SPIR-V] Add atomic_init and fix atomic explicit lowering
Michal Paszkowski [Wed, 19 Oct 2022 20:12:07 +0000 (22:12 +0200)]
[SPIR-V] Add atomic_init and fix atomic explicit lowering

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

21 months ago[lldb] Add matching based on Python callbacks for data formatters.
Jorge Gorbe Moya [Tue, 11 Oct 2022 07:44:06 +0000 (00:44 -0700)]
[lldb] Add matching based on Python callbacks for data formatters.

This patch adds a new matching method for data formatters, in addition
to the existing exact typename and regex-based matching. The new method
allows users to specify the name of a Python callback function that
takes a `SBType` object and decides whether the type is a match or not.

Here is an overview of the changes performed:

- Add a new `eFormatterMatchCallback` matching type, and logic to handle
  it in `TypeMatcher` and `SBTypeNameSpecifier`.

- Extend `FormattersMatchCandidate` instances with a pointer to the
  current `ScriptInterpreter` and the `TypeImpl` corresponding to the
  candidate type, so we can run registered callbacks and pass the type
  to them. All matcher search functions now receive a
  `FormattersMatchCandidate` instead of a type name.

- Add some glue code to ScriptInterpreterPython and the SWIG bindings to
  allow calling a formatter matching callback. Most of this code is
  modeled after the equivalent code for watchpoint callback functions.

- Add an API test for the new callback-based matching feature.

For more context, please check the RFC thread where this feature was
originally discussed:
https://discourse.llvm.org/t/rfc-python-callback-for-data-formatters-type-matching/64204/11

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

21 months ago[SLP][NFC]Remove unused variable, NFC.
Alexey Bataev [Wed, 19 Oct 2022 19:29:49 +0000 (12:29 -0700)]
[SLP][NFC]Remove unused variable, NFC.

21 months ago[NFC][CostModel] Added floating point frem test for SVE
Jolanta Jensen [Tue, 18 Oct 2022 16:30:23 +0000 (16:30 +0000)]
[NFC][CostModel] Added floating point frem test for SVE

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

21 months ago[mlir][sparse] end-to-end sparse vector insertion codegen
Aart Bik [Wed, 19 Oct 2022 17:37:25 +0000 (10:37 -0700)]
[mlir][sparse] end-to-end sparse vector insertion codegen

Reviewed By: Peiming

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

21 months ago[clang][modules] Add time traces for AST serialization
Andreas Hollandt [Wed, 19 Oct 2022 18:34:09 +0000 (11:34 -0700)]
[clang][modules] Add time traces for AST serialization

Fills gaps in the time trace when precompiled headers are created/loaded.

Reviewed By: jansvoboda11

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

21 months ago[RISCV] Add more check prefixes to extractelt-fp.ll to fix a conflicting case.
Craig Topper [Wed, 19 Oct 2022 19:12:25 +0000 (12:12 -0700)]
[RISCV] Add more check prefixes to extractelt-fp.ll to fix a conflicting case.

The existing prefix conflicted and the script silently dropped the checks.

21 months ago[BOLT] Ignore duplicate global symbols
Rafael Auler [Tue, 18 Oct 2022 02:01:46 +0000 (19:01 -0700)]
[BOLT] Ignore duplicate global symbols

We noticed some binaries with duplicated global symbol
entries (same name, address and size). Ignore them as it is possibly a
bug in the linker, and continue processing, unless the symbol has a
different size or address.

Reviewed By: #bolt, maksfb

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

21 months ago[flang][NFC] Add fir.dispatch codegen test with pass object at pos 1
Valentin Clement [Wed, 19 Oct 2022 12:06:56 +0000 (14:06 +0200)]
[flang][NFC] Add fir.dispatch codegen test with pass object at pos 1

D136189 was missing a test where the pass object is not at
position 0. This patch adds one.

Reviewed By: jeanPerier, PeteSteinfeld

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

21 months ago[mlir][NVGPU] Fixing minor typo (first test commit)
Manish Gupta [Wed, 19 Oct 2022 18:03:59 +0000 (11:03 -0700)]
[mlir][NVGPU] Fixing minor typo (first test commit)

21 months ago[docs] Add myself for LLVM Office hours
Quentin Colombet [Wed, 19 Oct 2022 18:24:41 +0000 (18:24 +0000)]
[docs] Add myself for LLVM Office hours

Add an entry for my office hours. Intended focus is low-level LLVM
stuff.

Differential Version: https://reviews.llvm.org/D136270

21 months agoRevert D135427 "[LTO] Make local linkage GlobalValue in non-prevailing COMDAT availab...
Fangrui Song [Wed, 19 Oct 2022 18:24:12 +0000 (11:24 -0700)]
Revert D135427 "[LTO] Make local linkage GlobalValue in non-prevailing COMDAT available_externally"

This reverts commit 8ef3fd8d59ba0100bc6e83350ab1e978536aa531.

I mentioned that GlobalAlias was not handled. It turns out GlobalAlias has to be handled in the same patch (as opposed to in a follow-up),
as otherwise clang codegen of C5/D5 constructor/destructor would regress (https://reviews.llvm.org/D135427#3869003).

21 months ago[mlir][sparse] remove vector support in sparsification
Peiming Liu [Tue, 18 Oct 2022 16:41:03 +0000 (16:41 +0000)]
[mlir][sparse] remove vector support in sparsification

Sparse compiler used to generate vectorized code for sparse tensors computation, but it should really be delegated to other vectorization passes for better progressive lowering.

 https://discourse.llvm.org/t/rfc-structured-codegen-beyond-rectangular-arrays/64707

Reviewed By: aartbik

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

21 months ago[lit] fix a error when using --show-used-features
Yuanfang Chen [Wed, 19 Oct 2022 17:51:13 +0000 (10:51 -0700)]
[lit] fix a error when using --show-used-features

The error is
```
NotADirectoryError: [Errno 20] Not a directory: '<build-dir>/unittests/Analysis/./AnalysisTests/0/40'
```

Exclude unittests when collecting features because
unittests don't make use of feature keywords.

21 months ago[lld-macho][nfc] Clean up includes
Vy Nguyen [Wed, 19 Oct 2022 16:45:49 +0000 (12:45 -0400)]
[lld-macho][nfc] Clean up includes

- remove unused/duplicate includes
- reformatting/whitespaces

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

21 months ago[JMCInstrument] rename ELF section name from ".just.my.code" to ".data.just.my.code"
Yuanfang Chen [Wed, 19 Oct 2022 17:36:36 +0000 (10:36 -0700)]
[JMCInstrument] rename ELF section name from ".just.my.code" to ".data.just.my.code"

This gives linker scripts a hint about where to place the section.

21 months ago[BOLT][DWARF] Add support for DW_FORM_addr for DW_AT_call_return_pc
Alexander Yermolovich [Wed, 19 Oct 2022 17:44:09 +0000 (10:44 -0700)]
[BOLT][DWARF] Add support for DW_FORM_addr for DW_AT_call_return_pc

GCC 12 produces DW_FORM_addr for DW_AT_call_return_pc. Added support for that.
Fixes facebookincubator/BOLT#307

Reviewed By: maksfb

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

21 months ago[NFC] Updating an incorrect code comment
Chris Bieneman [Wed, 19 Oct 2022 15:52:17 +0000 (10:52 -0500)]
[NFC] Updating an incorrect code comment

This slipped in by accident.

21 months ago[libc++][doc] Fixes status pages.
Mark de Wever [Wed, 19 Oct 2022 17:26:37 +0000 (19:26 +0200)]
[libc++][doc] Fixes status pages.

Addresses post-commit review comment in D134742.

21 months ago[mlir][sparse] Replace the folding of nop convert with a codegen rule.
bixia1 [Wed, 19 Oct 2022 00:22:13 +0000 (17:22 -0700)]
[mlir][sparse] Replace the folding of nop convert with a codegen rule.

This is to allow the use of a nop convert to express that the sparse tensor
allocated through bufferization::AllocTensorOp will be expanded to sparse
tensor storage by sparse tensor codegen.

Reviewed By: aartbik

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

21 months ago[OMPIRBuilder] Support depend clause for task
Prabhdeep Singh Soni [Fri, 7 Oct 2022 20:55:13 +0000 (16:55 -0400)]
[OMPIRBuilder] Support depend clause for task

This patch adds support for the `depend` clause for the `task`
construct.

Reviewed By: jdoerfert

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

21 months ago[DX] Fix missing preserved analysis
Chris Bieneman [Wed, 19 Oct 2022 17:09:43 +0000 (12:09 -0500)]
[DX] Fix missing preserved analysis

The ShaderFlagsAnalysisWrapper needs to be marked to preserve all
analyssis.

Fixes #58474 (https://github.com/llvm/llvm-project/issues/58474)

21 months ago[AArch64] Fix minor issue introduced in D135950.
Sander de Smalen [Wed, 19 Oct 2022 16:53:18 +0000 (16:53 +0000)]
[AArch64] Fix minor issue introduced in D135950.

The Key for the SubtargetMap had the StreamingSVEModeDisabled in the
wrong place. This change is non-functional, since the string (key) is
still unique.

21 months ago[DirectX] Disabling currently failing test
Chris Bieneman [Wed, 19 Oct 2022 16:50:08 +0000 (11:50 -0500)]
[DirectX] Disabling currently failing test

The pretty-printer isn't working because the resource analysis isn't
properly preservered.

21 months ago[AArch64] SME2 Single-multi vector ternary int/FP 2 and 4 registers
Caroline Concatto [Mon, 3 Oct 2022 13:11:01 +0000 (14:11 +0100)]
[AArch64] SME2 Single-multi vector ternary int/FP 2 and 4 registers

This patch adds the assembly/disassembly for the following instructions:

For INT:
    ADD(array results, multiple and single vector): Add replicated single
        vector to multi-vector with ZA array vector results.
    SUB(array results, multiple and single vector): Subtract replicated single
        vector from multi-vector with ZA array vector results.
For FP:
    FMLA (multiple and single vector): Multi-vector floating-point fused
          multiply-add by vector.
    FMLS (multiple and single vector): Multi-vector floating-point
          multiply-subtract long by vector.
The reference can be found here:

https://developer.arm.com/documentation/ddi0602/2022-09

The Matriz Operand has 2 new sizes 32(.s) and 64(.d) bits
(MatrixOp32 and MatrixOp64)

Depends on: D135448

Depends on:  D135952

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

21 months ago[AArch64][SME] Disable (SLP|Loop)Vectorizer when function may be executed in streamin...
Sander de Smalen [Wed, 19 Oct 2022 14:14:00 +0000 (14:14 +0000)]
[AArch64][SME] Disable (SLP|Loop)Vectorizer when function may be executed in streaming mode.

When the SME attributes tell that a function is or may be executed in Streaming
SVE mode, we currently need to be conservative and disable _any_ vectorization
(fixed or scalable) because the code-generator does not yet support generating
streaming-compatible code.

Scalable auto-vec will be gradually enabled in the future when we have
confidence that the loop-vectorizer won't use any SVE or NEON instructions
that are illegal in Streaming SVE mode.

Reviewed By: paulwalker-arm

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

21 months ago[MLIR][Tensor] Remove assert in PadOp builder
Lorenzo Chelini [Wed, 19 Oct 2022 15:31:22 +0000 (17:31 +0200)]
[MLIR][Tensor] Remove assert in PadOp builder

The assert is misplaced as the result type is allowed to be null. A few
lines below the result type is inferred if it is passed a nullptr.
Besides, this behavior is described in the documentation of the builder.

Reviewed By: ftynse

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

21 months agoMove HLSL builtins into hlsl namespace
Chris Bieneman [Wed, 19 Oct 2022 15:18:19 +0000 (10:18 -0500)]
Move HLSL builtins into hlsl namespace

Should have done this from the start. Since all the injected AST types
are in the hlsl namespace we should also put the header-defined types
and functions in there too.

This updates the basic_types test to run once with the namespaced types
and once without, and adds using declarations or namespaces calls in
other tests.

Reviewed By: python3kgae

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

21 months ago[X86][RFC] Using `__bf16` for AVX512_BF16 intrinsics
Phoebe Wang [Wed, 19 Oct 2022 08:26:54 +0000 (16:26 +0800)]
[X86][RFC] Using `__bf16` for AVX512_BF16 intrinsics

This is an alternative of D120395 and D120411.

Previously we use `__bfloat16` as a typedef of `unsigned short`. The
name may give user an impression it is a brand new type to represent
BF16. So that they may use it in arithmetic operations and we don't have
a good way to block it.

To solve the problem, we introduced `__bf16` to X86 psABI and landed the
support in Clang by D130964. Now we can solve the problem by switching
intrinsics to the new type.

Reviewed By: LuoYuanke, RKSimon

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

21 months ago[AMDGPU] New helper function SIInsertWaitcnts::getVmemWaitEventType
Jay Foad [Wed, 19 Oct 2022 12:39:20 +0000 (13:39 +0100)]
[AMDGPU] New helper function SIInsertWaitcnts::getVmemWaitEventType

This just commons up and simplifies some logic that was repeated in
SIInsertWaitcnts::updateEventWaitcntAfter. NFCI.

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

21 months ago[SLP][NFC]Add a test for possible reordering gap in SLP, NFC.
Alexey Bataev [Wed, 19 Oct 2022 15:21:09 +0000 (08:21 -0700)]
[SLP][NFC]Add a test for possible reordering gap in SLP, NFC.

21 months agoAvoid exporting 80-bit fp functions for architectures other than Intel.
Malhar Jajoo [Wed, 19 Oct 2022 14:55:15 +0000 (15:55 +0100)]
Avoid exporting 80-bit fp functions for architectures other than Intel.

This patch is a partial fix for [[ https://github.com/llvm/llvm-project/issues/56349 | issue ]], due to functions affected by D117473.

Implementation details:
The patch essentially creates a new macro if the architecture is either
intel32 or intel64, since the generate-def.pl cannot process boolean algebra
on macros.

Reviewed By: jlpeyton

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

21 months ago[analyzer] Make directly bounded LazyCompoundVal as lazily copied
Tomasz Kamiński [Wed, 19 Oct 2022 09:38:21 +0000 (11:38 +0200)]
[analyzer] Make directly bounded LazyCompoundVal as lazily copied

Previously, `LazyCompoundVal` bindings to subregions referred by
`LazyCopoundVals`, were not marked as //lazily copied//.

This change returns `LazyCompoundVals` from `getInterestingValues()`,
so their regions can be marked as //lazily copied// in `RemoveDeadBindingsWorker::VisitBinding()`.

Depends on D134947

Authored by: Tomasz Kamiński <tomasz.kamiński@sonarsource.com>

Reviewed By: martong

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

21 months ago[analyzer] Fix the liveness of Symbols for values in regions referred by LazyCompoundVal
Tomasz Kamiński [Wed, 19 Oct 2022 09:38:21 +0000 (11:38 +0200)]
[analyzer] Fix the liveness of Symbols for values in regions referred by LazyCompoundVal

To illustrate our current understanding, let's start with the following program:
https://godbolt.org/z/33f6vheh1
```lang=c++
void clang_analyzer_printState();

struct C {
   int x;
   int y;
   int more_padding;
};

struct D {
   C c;
   int z;
};

C foo(D d, int new_x, int new_y) {
   d.c.x = new_x;       // B1
   assert(d.c.x < 13);  // C1

   C c = d.c;           // L

   assert(d.c.y < 10);  // C2
   assert(d.z < 5);     // C3

   d.c.y = new_y;       // B2

   assert(d.c.y < 10);  // C4

   return c;  // R
}
```
In the code, we create a few bindings to subregions of root region `d` (`B1`, `B2`), a constrain on the values  (`C1`, `C2`, ….), and create a `lazyCompoundVal` for the part of the region `d` at point `L`, which is returned at point `R`.

Now, the question is which of these should remain live as long the return value of the `foo` call is live. In perfect a word we should preserve:

  # only the bindings of the subregions of `d.c`, which were created before the copy at `L`. In our example, this includes `B1`, and not `B2`.  In other words, `new_x` should be live but `new_y` shouldn’t.

  # constraints on the values of `d.c`, that are reachable through `c`. This can be created both before the point of making the copy (`L`) or after. In our case, that would be `C1` and `C2`. But not `C3` (`d.z` value is not reachable through `c`) and `C4` (the original value of`d.c.y` was overridden at `B2` after the creation of `c`).

The current code in the `RegionStore` covers the use case (1), by using the `getInterestingValues()` to extract bindings to parts of the referred region present in the store at the point of copy. This also partially covers point (2), in case when constraints are applied to a location that has binding at the point of the copy (in our case `d.c.x` in `C1` that has value `new_x`), but it fails to preserve the constraints that require creating a new symbol for location (`d.c.y` in `C2`).

We introduce the concept of //lazily copied// locations (regions) to the `SymbolReaper`, i.e. for which a program can access the value stored at that location, but not its address. These locations are constructed as a set of regions referred to by `lazyCompoundVal`. A //readable// location (region) is a location that //live// or //lazily copied// . And symbols that refer to values in regions are alive if the region is //readable//.

For simplicity, we follow the current approach to live regions and mark the base region as //lazily copied//, and consider any subregions as //readable//. This makes some symbols falsy live (`d.z` in our example) and keeps the corresponding constraints alive.

The rename `Regions` to `LiveRegions` inside  `RegionStore` is NFC change, that was done to make it clear, what is difference between regions stored in this two sets.

Regression Test: https://reviews.llvm.org/D134941
Co-authored-by: Balazs Benics <benicsbalazs@gmail.com>
Reviewed By: martong, xazax.hun

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

21 months ago[Libomptarget][NFC] clang-format the libomptarget OpenMP tests
Joseph Huber [Wed, 19 Oct 2022 13:26:35 +0000 (08:26 -0500)]
[Libomptarget][NFC] clang-format the libomptarget OpenMP tests

Summary:
Recent changes to clang-format improved the handling of OpenMP pragmas.
Clean up the existing libomptarget tests.

21 months ago[AMDGPU] V_LDEXP_F16 encoding fix and doc update.
Joe Nash [Tue, 18 Oct 2022 18:59:19 +0000 (14:59 -0400)]
[AMDGPU] V_LDEXP_F16 encoding fix and doc update.

The amdgcn.ldexp.* intrinsics take an i32 value as src1.
The V_LDEXP_F16 instruction considers src1 an f16 operand, and therefore
src1 is implicitly truncated to 16 bits when lowering to that instruction from the
intrinsic. This is unlikely to result in an error in practice
because values that large are not useful.

The operand class of src1 in the True16 version of the instruction has
been corrected to encode correctly on GFX11.

Reviewed By: foad, rampitec

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

21 months ago[Verifier] Allow undef/poison token argument to llvm.experimental.gc.result
dbakunevich [Wed, 19 Oct 2022 13:40:54 +0000 (20:40 +0700)]
[Verifier] Allow undef/poison token argument to llvm.experimental.gc.result

As part of the optimization in the unreachable code, we remove
tokens, thereby replacing them with undef/poison in intrinsics.
But the verifier falls on the assertion, within of what it sees
token poison in unreachable code, which in turn is incorrect.

bug: 57871, https://github.com/llvm/llvm-project/issues/57871
Differential Revision: https://reviews.llvm.org/D134427

21 months ago[flang] Fix missing generated includes in out of tree build
David Spickett [Wed, 19 Oct 2022 12:22:24 +0000 (12:22 +0000)]
[flang] Fix missing generated includes in out of tree build

875fd9df76ded4a88a3a44b690f290ea98f91705 added a new dialect
with some generated files.

When flang is built out of tree (build llvm/clang/mlir first, then
build flang pointing at the first build) those files were not created
at all.

I don't 100% understand why not but juding by the comment at the top
of the file, add_mlir_interface probably expects to run in an MLIR
directory, as add_mlir_dialect does.

So in the same way, I've just inlined enough of that function to
fix the out of tree build.

Reviewed By: jeanPerier

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

21 months ago[gn build] Port 8cadac41e9f6
LLVM GN Syncbot [Wed, 19 Oct 2022 12:45:01 +0000 (12:45 +0000)]
[gn build] Port 8cadac41e9f6

21 months ago[clang][dataflow] Add equivalence relation `Value` type.
Yitzhak Mandelbaum [Fri, 14 Oct 2022 12:10:52 +0000 (12:10 +0000)]
[clang][dataflow] Add equivalence relation `Value` type.

Defines an equivalence relation on the `Value` type to standardize several
places in the code where we replicate the ~same equivalence comparison.

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

21 months ago[VPlan] Add VPValue::isDefinedOutsideVectorRegions helper (NFC).
Florian Hahn [Wed, 19 Oct 2022 12:20:30 +0000 (13:20 +0100)]
[VPlan] Add VPValue::isDefinedOutsideVectorRegions helper (NFC).

@Ayal suggested a better named helper than using `!getDef()` to check if
a value is invariant across all parts.

The property we are using here is that the VPValue is defined outside
any vector loop region. There's a TODO left to handle recipes defined in
pre-header blocks.

Reviewed By: reames

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

21 months ago[clangd] consider ~^foo() to target the destructor, not the type
Sam McCall [Tue, 18 Oct 2022 23:42:31 +0000 (01:42 +0200)]
[clangd] consider ~^foo() to target the destructor, not the type

This behavior was once deliberate, but i've yet to find someone who likes it.
The reference behavior is unchanged: the `foo` within ~foo is still considered
a reference to the type. This means rename etc still works.

fixes https://github.com/clangd/clangd/issues/179

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

21 months agoRevert rG42230efccf8fe1185be5fa6c23dce0a8183d6ec9 "[DAG] Fold (sra (or (shl x, c1...
Simon Pilgrim [Wed, 19 Oct 2022 11:07:29 +0000 (12:07 +0100)]
Revert rG42230efccf8fe1185be5fa6c23dce0a8183d6ec9 "[DAG] Fold (sra (or (shl x, c1), (shl y, c2)), c1) -> (sext_inreg (or x, (shl y,c2-c1)) iff c2 >= c1"

@foad was right - this isn't actually going to help with D136042 as much as hoped, we need a better AMDGPU-specific solution as other targets are likely to make use of it

21 months ago[Attr][Doc] Fix pragma unroll documentation.
Alexey Bader [Tue, 18 Oct 2022 11:42:21 +0000 (04:42 -0700)]
[Attr][Doc] Fix pragma unroll documentation.

There is a contradiction in the #pragma unroll behavior documentation.
It says that specifying `#pragma unroll` without a parameter directs the
loop unroller to attempt to partially unroll the loop if the trip count
is not known at compile time. At the same time later it states that
`#pragma unroll` has identical semantics to `#pragma clang loop unroll(full)`,
which doesn't attempt to unroll partially if the trip count is not known
at compile time.

pragma clang loop unroll(enable):
If unroll(enable) is specified the unroller will attempt to fully unroll
the loop if the trip count is known at compile time. If the fully
unrolled code size is greater than an internal limit the loop will be
partially unrolled up to this limit. If the trip count is not known at
compile time the loop will be partially unrolled with a heuristically
chosen unroll factor.

pragma clang loop unroll(full):
If unroll(full) is specified the unroller will attempt to fully unroll
the loop if the trip count is known at compile time identically to
unroll(enable). However, with unroll(full) the loop will not be unrolled
if the loop count is not known at compile time.

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

21 months ago[mlir] Add TransposeOp to Linalg structured ops.
Oleg Shyshkov [Wed, 19 Oct 2022 09:42:25 +0000 (11:42 +0200)]
[mlir] Add TransposeOp to Linalg structured ops.

RFC: https://discourse.llvm.org/t/rfc-primitive-ops-add-mapop-reductionop-transposeop-broadcastop-to-linalg/64184

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

21 months ago[SCEV] Replace assert with returning CouldNotComp in computeMaxBECountForLT.
Florian Hahn [Wed, 19 Oct 2022 10:24:10 +0000 (11:24 +0100)]
[SCEV] Replace assert with returning CouldNotComp in computeMaxBECountForLT.

This patch removes the bail out for signed predicates and non-positive
strides in howManyLessThans and updates computeMaxBECountForLT to return
SCEVCouldNotCompute for signed predicates with negative strides.

AFAICT bail-out was only added because computeMaxBECountForLT may not
handle negative signed strides correctly. Instead of not calling
computeMaxBECountForLT at all because we bail out earlier, we can
instead return SCEVCouldNotCompute in computeMaxBECountForLT.

The max backedge taken count will be computed as the max value of the
symbolic backedge taken count.

This improves precision in cases where we can compute symbolic backedge
taken counts and also fixes a crash.

Fixes #57818.

Reviewed By: nikic

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

21 months ago[AggressiveInstCombine] Load merge the reverse load pattern of consecutive loads.
bipmis [Wed, 19 Oct 2022 10:22:58 +0000 (11:22 +0100)]
[AggressiveInstCombine] Load merge the reverse load pattern of consecutive loads.

This patch extends the load merge/widen in AggressiveInstCombine() to handle reverse load patterns.

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

21 months agoKeep configuration file search directories in ExpansionContext. NFC
Serge Pavlov [Wed, 19 Oct 2022 10:19:04 +0000 (17:19 +0700)]
Keep configuration file search directories in ExpansionContext. NFC

Class ExpansionContext encapsulates options for search and expansion of
response files, including configuration files. With this change the
directories which are searched for configuration files are also stored
in ExpansionContext.

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

21 months ago[DAG] Fold (sra (or (shl x, c1), (shl y, c2)), c1) -> (sext_inreg (or x, (shl y,c2...
Simon Pilgrim [Wed, 19 Oct 2022 10:18:39 +0000 (11:18 +0100)]
[DAG] Fold (sra (or (shl x, c1), (shl y, c2)), c1) -> (sext_inreg (or x, (shl y,c2-c1)) iff c2 >= c1

Helps with some of the AMDGPU regressions identified in D136042 where we were losing signed BFE patterns after sinking shifts behind logic ops.

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

21 months ago[AMDGPU] Assume getDefIgnoringCopies will succeed. NFC.
Jay Foad [Wed, 19 Oct 2022 09:32:08 +0000 (10:32 +0100)]
[AMDGPU] Assume getDefIgnoringCopies will succeed. NFC.

getDefIgnoringCopies and getSrcRegIgnoringCopies should not fail on
valid MIR, so don't bother to check for failure.

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