platform/upstream/llvm.git
23 months ago[RISCV][Clang] Add tests for all supported policy functions. (NFC)
Zakk Chen [Mon, 1 Aug 2022 17:42:43 +0000 (17:42 +0000)]
[RISCV][Clang] Add tests for all supported policy functions. (NFC)

In order to make the review easier, I split a lot of tests from
https://reviews.llvm.org/D126742

Reviewed By: rogfer01

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

23 months ago[RISCV][Clang] Support RVV policy functions.
Zakk Chen [Fri, 27 May 2022 00:19:50 +0000 (17:19 -0700)]
[RISCV][Clang] Support RVV policy functions.

1. Add policy functions support and tests for vadd, vmv, vfmv and all load
   instructions except segment load. I didn't add all combination of policy
   functions in test because it seem not to make sense.
2. Rename HasUnMaskedOverloaded to SupportOverloading.
3. vmv.s.x for ta policy could not have overloaded API.
4. This patch does not support all operations, I will have other follow-up
   patches support all.

[RFC] https://github.com/riscv-non-isa/rvv-intrinsic-doc/pull/137

Reviewed By: kito-cheng, fakepaper56, fakepaper56

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

23 months agoFixed a number of typos
Gabriel Ravier [Mon, 1 Aug 2022 17:12:11 +0000 (13:12 -0400)]
Fixed a number of typos

I went over the output of the following mess of a command:

(ulimit -m 2000000; ulimit -v 2000000; git ls-files -z |
 parallel --xargs -0 cat | aspell list --mode=none --ignore-case |
 grep -E '^[A-Za-z][a-z]*$' | sort | uniq -c | sort -n |
 grep -vE '.{25}' | aspell pipe -W3 | grep : | cut -d' ' -f2 | less)

and proceeded to spend a few days looking at it to find probable typos
and fixed a few hundred of them in all of the llvm project (note, the
ones I found are not anywhere near all of them, but it seems like a
good start).

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

23 months agoclang-tidy doc: fix some typos
Sylvestre Ledru [Mon, 1 Aug 2022 16:54:10 +0000 (18:54 +0200)]
clang-tidy doc: fix some typos

23 months ago[openmp] [test] Fix prepending config.library_dir to LD_LIBRARY_PATH
Michał Górny [Sat, 30 Jul 2022 18:53:02 +0000 (20:53 +0200)]
[openmp] [test] Fix prepending config.library_dir to LD_LIBRARY_PATH

Fix the LD_LIBRARY_PATH prepending order to make sure that
config.library_path ends up before any potentially-system directories
(e.g. config.hwloc_library_dir).  This makes sure that we are testing
against the just-built openmp libraries rather than the version that is
already installed.

Also rename the function to `prepend_*` to make it clearer what it
actually does.

https://github.com/llvm/llvm-project/issues/56821
Differential Revision: https://reviews.llvm.org/D130825

23 months agomisc-const-correctness: fix the link to readability-isolate-declaration
Sylvestre Ledru [Mon, 1 Aug 2022 16:52:49 +0000 (18:52 +0200)]
misc-const-correctness: fix the link to readability-isolate-declaration

23 months ago[lldb] [llgs] Support resuming multiple processes via vCont w/ nonstop
Michał Górny [Fri, 1 Jul 2022 13:12:00 +0000 (15:12 +0200)]
[lldb] [llgs] Support resuming multiple processes via vCont w/ nonstop

Support using the vCont packet to resume multiple processes
simultaneously when in non-stop mode.  The new logic now assumes that:

- actions without a thread-id or with process id of "p-1" apply to all
  debugged processes

- actions with a thread-id without process id apply to the current
  process (m_continue_process)

As with the other continue packets, it is only possible to resume
processes that are currently stopped (or stop these that are running).
It is unsupported to resume or stop individual threads of a running
process.

Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.llvm.org/D128989

23 months ago[lldb] [test] Fix test_c_both_nonstop flakiness
Michał Górny [Mon, 1 Aug 2022 16:04:46 +0000 (18:04 +0200)]
[lldb] [test] Fix test_c_both_nonstop flakiness

Thanks to Pavel Labath for reporting this and suggesting a fix.

Sponsored by: The FreeBSD Foundation

23 months ago[RISCV] Eagerly delete instructions in MergeBaseOffset.
Craig Topper [Mon, 1 Aug 2022 16:32:46 +0000 (09:32 -0700)]
[RISCV] Eagerly delete instructions in MergeBaseOffset.

The only iterator we're holding points to HiLUI and we never
delete that so I think it is safe to delete everything else
immediately.

I want to split detectAndFoldOffset into two phases. First, combine
LUI+ADDI with any ADD/ADDI/SHXADD that comes after it. This may
open opportunities to fold the ADDI from the LUI+ADDI into a
load/store address. So the load/store folding should run as a
second phase even if the ADD/ADDI/SHXADD made changes.

In order to do this we need to eagerly delete instructions in the
first phase so that we don't have dead users of the LUI+ADDI
when we start the second phase.

Patches to split the phases will come later.

Reviewed By: asb, luismarques

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

23 months ago[RISCV][VP] Custom lower VP_STRIDED_LOAD and VP_STRIDED_STORE
Lorenzo Albano [Mon, 1 Aug 2022 16:23:45 +0000 (09:23 -0700)]
[RISCV][VP] Custom lower VP_STRIDED_LOAD and VP_STRIDED_STORE

Reviewed By: craig.topper

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

23 months ago[HLSL] CodeGen HLSL Resource annotations
Chris Bieneman [Mon, 18 Jul 2022 15:08:08 +0000 (10:08 -0500)]
[HLSL] CodeGen HLSL Resource annotations

HLSL Resource types need special annotations that the backend will use
to build out metadata and resource annotations that are required by
DirectX and Vulkan drivers in order to provide correct data bindings
for shader exeuction.

This patch adds some of the required data for unordered-access-views
(UAV) resource binding into the module flags. This data will evolve
over time to cover all the required use cases, but this should get
things started.

Depends on D130018.

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

23 months ago[AMDGPU] Extend cases for ReadM0MovRelInterpHazard
Piotr Sobczak [Mon, 1 Aug 2022 15:36:52 +0000 (17:36 +0200)]
[AMDGPU] Extend cases for ReadM0MovRelInterpHazard

Extend hazard recognizer of ReadM0MovRelInterpHazard with
DS_READ_ADDTID and DS_WRITE_ADDTID, as they also
require a manually inserted S_NOP after SALU writing m0.

Reviewed By: rampitec

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

23 months ago[mlir][flang] Make use of the new `GEPArg` builder of GEP Op to simplify code
Markus Böck [Thu, 28 Jul 2022 23:00:22 +0000 (01:00 +0200)]
[mlir][flang] Make use of the new `GEPArg` builder of GEP Op to simplify code

This is the follow up on https://reviews.llvm.org/D130730 which goes through upstream code and removes creating constant values in favour of using the constant indices in GEP directly. This leads to less and more readable code and more compact IR as well.

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

23 months agoAST.h - fix Wdocumentation warnings. NFC.
Simon Pilgrim [Mon, 1 Aug 2022 14:38:06 +0000 (15:38 +0100)]
AST.h - fix Wdocumentation warnings. NFC.

But ObjC code examples in quotes to stop confusing the doxygen parser

23 months agoOffloadBundler.cpp - fix Wdocumentation warnings. NFC.
Simon Pilgrim [Mon, 1 Aug 2022 14:24:47 +0000 (15:24 +0100)]
OffloadBundler.cpp - fix Wdocumentation warnings. NFC.

Fix param list instead of embedding \p tag

23 months agoSelectionDAGNodes.h - fix Wdocumentation warnings. NFC.
Simon Pilgrim [Mon, 1 Aug 2022 14:09:16 +0000 (15:09 +0100)]
SelectionDAGNodes.h - fix Wdocumentation warnings. NFC.

23 months agoMisExpect.h - fix Wdocumentation warnings. NFC.
Simon Pilgrim [Mon, 1 Aug 2022 14:06:12 +0000 (15:06 +0100)]
MisExpect.h - fix Wdocumentation warnings. NFC.

23 months ago[lldb] Fix flakyness in TestProcessList
Pavel Labath [Mon, 1 Aug 2022 14:00:46 +0000 (16:00 +0200)]
[lldb] Fix flakyness in TestProcessList

If the test is too fast it can read the process list before the forked
child process actually manages to exec the process with the right
arguments.

Use our file-based synchronization primitives to ensure the child is
up-and-running before we fetch the process list.

23 months ago[AMDGPU][MC] Verify selection of LDS MUBUF opcodes
Dmitry Preobrazhensky [Mon, 1 Aug 2022 13:40:47 +0000 (16:40 +0300)]
[AMDGPU][MC] Verify selection of LDS MUBUF opcodes

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

23 months ago[AMDGPU][GFX940][DOC][NFC] Update assembler syntax description
Dmitry Preobrazhensky [Mon, 1 Aug 2022 13:10:15 +0000 (16:10 +0300)]
[AMDGPU][GFX940][DOC][NFC] Update assembler syntax description

Summary of changes:
- Add bf8/fp8 VOP opcodes (see https://reviews.llvm.org/D129902).
- Add bf8/fp8 MFMA opcodes (see https://reviews.llvm.org/D129906).
- Add bf8/fp8 SMFMAC opcodes (see https://reviews.llvm.org/D129908).

23 months ago[clang-tools-extra] Fixed a number of typos
Gabriel Ravier [Mon, 1 Aug 2022 13:31:59 +0000 (15:31 +0200)]
[clang-tools-extra] Fixed a number of typos

I went over the output of the following mess of a command:

`(ulimit -m 2000000; ulimit -v 2000000; git ls-files -z | parallel --xargs -0 cat | aspell list --mode=none --ignore-case | grep -E '^[A-Za-z][a-z]*$' | sort | uniq -c | sort -n | grep -vE '.{25}' | aspell pipe -W3 | grep : | cut -d' ' -f2 | less)`

and proceeded to spend a few days looking at it to find probable typos
and fixed a few hundred of them in all of the llvm project (note, the
ones I found are not anywhere near all of them, but it seems like a
good start).

Reviewed By: kadircet

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

23 months ago[Orc] Disable use of shared memory on Android
Anubhab Ghosh [Sat, 30 Jul 2022 01:13:05 +0000 (06:43 +0530)]
[Orc] Disable use of shared memory on Android

shm_open and shm_unlink are not available on Android. This commit
disables SharedMemoryMapper on Android until a better solution is
available.

https://android.googlesource.com/platform/bionic/+/refs/heads/master/docs/status.md
https://github.com/llvm/llvm-project/issues/56812

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

23 months ago[clangd] Upgrade vlog() to log() for preamble build stats
Adam Czachorowski [Wed, 27 Jul 2022 14:36:06 +0000 (16:36 +0200)]
[clangd] Upgrade vlog() to log() for preamble build stats

This is very useful information for better understanding performance and
preamble builds don't happen that often, so it's not that spammy.

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

23 months ago[AMDGPU][MC][GFX940] Correct disassembly of MFMA opcodes
Dmitry Preobrazhensky [Mon, 1 Aug 2022 12:59:20 +0000 (15:59 +0300)]
[AMDGPU][MC][GFX940] Correct disassembly of MFMA opcodes

Add a decoder table for GFX940 MFMA opcodes.

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

23 months ago[X86] Fix updating LiveVariables in convertToThreeAddress
Jay Foad [Tue, 12 Jul 2022 15:44:08 +0000 (16:44 +0100)]
[X86] Fix updating LiveVariables in convertToThreeAddress

Fix all instances of:
*** Bad machine code: Kill missing from LiveVariables ***
in the X86 CodeGen tests with D129213 applied, which adds verification
of LiveIntervals after the TwoAddressInstruction pass runs.

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

23 months ago[Arm] Fix parsing and emission of Tag_also_compatible_with eabi attribute
Lucas Prates [Mon, 11 Jul 2022 16:33:48 +0000 (17:33 +0100)]
[Arm] Fix parsing and emission of Tag_also_compatible_with eabi attribute

According to the ABI for the Arm Architecture, the value for the
Tag_also_compatible_with eabi attribute is represented by an NTBS entry.
This string value, in turn, is composed of a pair of tag+value encoded
in one of two formats:
- ULEB128: tag, ULEB128: value, 0.
- ULEB128: tag, NBTS: data.
(See [[ https://github.com/ARM-software/abi-aa/blob/60a8eb8c55e999d74dac5e368fc9d7e36e38dda4/addenda32/addenda32.rst#3373secondary-compatibility-tag | section 3.3.7.3 on the Addenda to, and Errata in, the ABI for the Arm Architecture ]].)

Currently the Arm assembly parser and streamer ignore the encoding of
the attribute's NTBS value, which can result in incorrect attributes
being emitted in both assembly and object file outputs.

This patch fixes these issues by properly handing the value's encoding.
An update to llvm-readobj to properly handle the attribute's value will be
covered by a separate patch.

Patch by Victor Campos and Lucas Prates.

Reviewed By: vhscampos

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

23 months ago[mlir] Make BuiltinTypeInterfaces.h self-contained.
Adrian Kuegel [Mon, 1 Aug 2022 12:18:56 +0000 (14:18 +0200)]
[mlir] Make BuiltinTypeInterfaces.h self-contained.

23 months agoAvoid comparison of integers of different signs
Marius Brehler [Mon, 1 Aug 2022 11:16:03 +0000 (11:16 +0000)]
Avoid comparison of integers of different signs

Otherwiese a warning is emitted when compiling with `-Wsign-compare`.

23 months ago[NFC][AMDGPU] Fix typo in SIRegisterInfo.cpp
Pierre van Houtryve [Mon, 1 Aug 2022 11:01:33 +0000 (07:01 -0400)]
[NFC][AMDGPU] Fix typo in SIRegisterInfo.cpp

23 months ago[LV] Add variation of test cases with order of phis flipped.
Florian Hahn [Mon, 1 Aug 2022 10:38:16 +0000 (11:38 +0100)]
[LV] Add variation of test cases with order of phis flipped.

Additional tests with integer and pointer inductions for
D119661.

23 months ago[DAG] visitINSERT_VECTOR_ELT - extend folding to BUILD_VECTOR if all missing elements...
Simon Pilgrim [Mon, 1 Aug 2022 10:32:23 +0000 (11:32 +0100)]
[DAG] visitINSERT_VECTOR_ELT - extend folding to BUILD_VECTOR if all missing elements from an insertion chain are known zero

23 months ago[AMDGPU] gfx11 allow dlc for MUBUF atomics
Petar Avramovic [Mon, 1 Aug 2022 08:37:20 +0000 (10:37 +0200)]
[AMDGPU] gfx11 allow dlc for MUBUF atomics

Add MC support for dlc in gfx11 MUBUF atomic instructions.

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

23 months ago[mlir][bazel] Fix bazel build files
Stephan Herhut [Mon, 1 Aug 2022 09:40:39 +0000 (11:40 +0200)]
[mlir][bazel] Fix bazel build files

This adds a missing dependency on builtin dialect td files.

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

23 months agoAdd support for lowering simd if clause to LLVM IR
Dominik Adamski [Thu, 28 Jul 2022 08:57:40 +0000 (03:57 -0500)]
Add support for lowering simd if clause to LLVM IR

Scope of changes:
  1) Added new function to generate loop versioning
  2) Added support for if clause to applySimd function
  2) Added tests which confirm that lowering is successful

If ifCond is specified, then collapsed loop is duplicated and if branch
is added. Duplicated loop is executed if simd ifCond is evaluated to false.

Reviewed By: Meinersbur

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

Signed-off-by: Dominik Adamski <dominik.adamski@amd.com>
23 months ago[DAGCombiner] Extend visitAND to include EXTRACT_SUBVECTOR
David Sherwood [Fri, 29 Jul 2022 15:31:18 +0000 (16:31 +0100)]
[DAGCombiner] Extend visitAND to include EXTRACT_SUBVECTOR

Eliminate an AND by redefining an anyext|sext|zext.

     (and (extract_subvector (anyext|sext|zext v) _) iN_mask)
  => (extract_subvector (zeroext_iN v))

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

23 months ago[RISCV] Extend the Merge Base Offset pass to handle AUIPC+ADDI
Luís Marques [Mon, 1 Aug 2022 09:27:09 +0000 (11:27 +0200)]
[RISCV] Extend the Merge Base Offset pass to handle AUIPC+ADDI

Builds upon D123264, adding support for merging the low part of the LLA
address into the load/store instruction offsets.

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

23 months ago[libc][NFC] Use STL case for utility
Guillaume Chatelet [Fri, 29 Jul 2022 13:23:58 +0000 (13:23 +0000)]
[libc][NFC] Use STL case for utility

Migrating all private STL code to the standard STL case but keeping it under the CPP namespace to avoid confusion.

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

23 months ago[libc][NFC] Use STL case for limits
Guillaume Chatelet [Fri, 29 Jul 2022 12:22:41 +0000 (12:22 +0000)]
[libc][NFC] Use STL case for limits

Migrating all private STL code to the standard STL case but keeping it under the CPP namespace to avoid confusion.

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

23 months agoRemove empty AffineExpr stride canonicalization in makeCanonicalStridedLayoutExpr
Tres Popp [Fri, 29 Jul 2022 13:04:29 +0000 (15:04 +0200)]
Remove empty AffineExpr stride canonicalization in makeCanonicalStridedLayoutExpr

The "optimization" would replace the AffineMap for an empty shape with a 0 to represent its indexing (stride * dimension) logic. Meanwhile other pieces of core logic (such as getStridesAndOffset and makeStridedLinearLayoutMap) require strides for all dimensions to ensure no aliasing can occur which would occur if the shape was not empty. For now, this optimization is removed as different pieces of core types disagree on this, so the optimization should be caller supplied or should be consistent throughout the infrastructure.

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

23 months ago[GlobalISel][DebugInfo] salvageDebugInfo analogue for gMIR
Vladislav Dzhidzhoev [Mon, 1 Aug 2022 07:55:27 +0000 (09:55 +0200)]
[GlobalISel][DebugInfo] salvageDebugInfo analogue for gMIR

Salvage debug info of instruction that is about to be deleted as dead in
Combiner pass. Currently supported instructions are COPY and G_TRUNC.

It allows to salvage debug info of some dead arguments of functions, by putting
DWARF expression corresponding to the instruction being deleted into related
DBG_VALUE instruction.

Here is an example of missing variables location https://godbolt.org/z/K48osb9dK.
We see that arguments x, y of function foo are not available in debugger, and
corresponding DBG_VALUE instructions have undefined register operand instead of
variables locaton after Aarch64PreLegalizerCombiner pass. The reason is that
registers where variables are located are removed as dead (with instruction
G_TRUNC). We can use salvageDebugInfo analogue for gMIR to preserve debug
locations of dead variables.

Statistics of llvm object files built with vs without this commit on -O2
optimization level (CMAKE_BUILD_TYPE=RelWithDebInfo, -fglobal-isel) on Aarch64 (macOS):

Number of variables with 100% of parent scope covered by DW_AT_location has been increased by 7,9%.
Number of variables with 0% coverage of parent scope has been decreased by 1,2%.
Number of variables processed by location statistics has been increased by 2,9%.
Average PC ranges coverage has been increased by 1,8 percentage points.

Coverage can be improved by supporting more instructions, or by calling
salvageDebugInfo for instructions that are deleted during Combiner rules exection.

Reviewed By: aprantl

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

23 months ago[NFC] Use AllocaInst's getAddressSpace helper
Alex Bradbury [Mon, 1 Aug 2022 09:08:17 +0000 (10:08 +0100)]
[NFC] Use AllocaInst's getAddressSpace helper

23 months ago[libc][NFC] Use STL case for functional
Guillaume Chatelet [Fri, 29 Jul 2022 12:11:35 +0000 (12:11 +0000)]
[libc][NFC] Use STL case for functional

Migrating all private STL code to the standard STL case but keeping it under the CPP namespace to avoid confusion.

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

23 months agoFix MLIR Python binding for arith.constant after argument has been changed to an...
Mehdi Amini [Mon, 1 Aug 2022 08:52:41 +0000 (08:52 +0000)]
Fix MLIR Python binding for arith.constant after argument has been changed to an interface

e1795322844c removed the Type field from attributes and
arith::ConstantOp argument is now a TypedAttrInterface which isn't
supported by the python generator.
This patch temporarily restore the functionality for arith.constant but
won't generalize: we need to work on the generator instead.

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

23 months ago[LV] Add additional tests with multiple chained recurrences.
Florian Hahn [Mon, 1 Aug 2022 09:01:18 +0000 (10:01 +0100)]
[LV] Add additional tests with multiple chained recurrences.

Adds more extra tests for D119661.

Also update the test to use opaque pointers.

23 months agoReland [libc][NFC] Use STL case for array
Guillaume Chatelet [Mon, 1 Aug 2022 08:46:01 +0000 (08:46 +0000)]
Reland [libc][NFC] Use STL case for array

This is a reland of https://reviews.llvm.org/D130773

23 months agoRevert "[libc][NFC] Use STL case for array"
Guillaume Chatelet [Mon, 1 Aug 2022 08:44:52 +0000 (08:44 +0000)]
Revert "[libc][NFC] Use STL case for array"

This reverts commit 7add0e5fdc5c7cb6f59f60cd436bf161cf9f9eb7.

23 months ago[libc][NFC] Use STL case for array
Guillaume Chatelet [Fri, 29 Jul 2022 13:40:08 +0000 (13:40 +0000)]
[libc][NFC] Use STL case for array

Migrating all private STL code to the standard STL case but keeping it under the CPP namespace to avoid confusion.

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

23 months ago[clang] Update Clang version from 15 to 16 in scan-build.1.
Frederic Cambus [Mon, 1 Aug 2022 08:34:55 +0000 (10:34 +0200)]
[clang] Update Clang version from 15 to 16 in scan-build.1.

Similar to D110763.

23 months ago[ELF] EhInputSection::getParentOffset: fix out-of-bounds access for symbols relative...
Fangrui Song [Mon, 1 Aug 2022 08:10:51 +0000 (01:10 -0700)]
[ELF] EhInputSection::getParentOffset: fix out-of-bounds access for symbols relative to a non-empty .eh_frame

This has unclear semantics and can be considered invalid. Return an arbitrary value.

23 months ago[C++2b] [Modules] Handle HaveModules with C++2b
Chuanqi Xu [Mon, 1 Aug 2022 08:02:27 +0000 (16:02 +0800)]
[C++2b] [Modules] Handle HaveModules with C++2b

Closing https://github.com/llvm/llvm-project/issues/56803. The root
cause for this bug is that we lack a good method to detect the language
mdoe when parsing the command line. There is a FIXME too. Dut to we lack
a good solution now, keep the workaround.

23 months ago[Clang] Remove unused parameter. NFC
Serge Pavlov [Mon, 1 Aug 2022 07:52:40 +0000 (14:52 +0700)]
[Clang] Remove unused parameter. NFC

BinaryOperator::getFPFeatures get parameter, which is not used. Similar
methods of other AST nodes do not have any parameter.

23 months agoRevert "[SimplifyCFG] Allow SimplifyCFG hoisting to skip over non-matching instructions"
Nikita Popov [Mon, 1 Aug 2022 07:19:20 +0000 (09:19 +0200)]
Revert "[SimplifyCFG] Allow SimplifyCFG hoisting to skip over non-matching instructions"

This reverts commit 7b0f6378e211e881c574748090a86beeab264ab3.

As commented on the review, this patch has a correctness issue
regarding the modelling of memory effects.

23 months ago[ARM] Simplify ArchGuard predicates in arm_neon.h.
David Green [Mon, 1 Aug 2022 07:20:23 +0000 (08:20 +0100)]
[ARM] Simplify ArchGuard predicates in arm_neon.h.

__ARM_ARCH >= 8 is implied by defined(__aarch64__), so we don't need to
guard against both together.

23 months ago[libc][NFC] Mark a constructor of StringView to be constexpr.
Siva Chandra Reddy [Mon, 1 Aug 2022 07:13:20 +0000 (07:13 +0000)]
[libc][NFC] Mark a constructor of StringView to be constexpr.

23 months ago[cmake] Support native LoongArch builds
WANG Xuerui [Mon, 1 Aug 2022 07:09:51 +0000 (15:09 +0800)]
[cmake] Support native LoongArch builds

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

23 months ago[cmake] Add LoongArch to config.guess
WANG Xuerui [Mon, 1 Aug 2022 07:04:54 +0000 (15:04 +0800)]
[cmake] Add LoongArch to config.guess

Necessary for native builds on LoongArch. Only Linux is added for now,
matching upstream config.git changes.

Unfortunately, the upstream config.guess is GPLv3+ since 2012, and
LLVM is without autoconf support for a long time, so the script's
licensing exception no longer works and a bump could not be trivially
done.

This is the same as the [upstream commit adding LoongArch](https://git.savannah.gnu.org/gitweb/?p=config.git;a=commitdiff;h=c8ddc8472f8efcadafc1ef53ca1d863415fddd5f),
but rewritten to match the 2011 style that our script is holding on
to.

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

23 months ago[SimplifyCFG] Allow SimplifyCFG hoisting to skip over non-matching instructions
Momchil Velikov [Mon, 1 Aug 2022 05:48:22 +0000 (06:48 +0100)]
[SimplifyCFG] Allow SimplifyCFG hoisting to skip over non-matching instructions

SimplifyCFG does some common code hoisting, which is limited to hoisting a
sequence of identical instruction in identical order and stops at the first
non-identical instruction.

This patch allows hoisting instruction pairs over same-length sequences of
non-matching instructions. The linear asymptotic complexity of the algorithm
stays the same, there's an extra parameter `simplifycfg-hoist-common-skip-limit`
serving to limit compilation time and/or the size of the hoisted live ranges.

The patch improves SPECv6/525.x264_r by about 10%.

Reviewed By: dmgreen

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

23 months ago[libc][NFC] Make the buffer size of the integer to string converter public.
Siva Chandra Reddy [Mon, 1 Aug 2022 06:43:11 +0000 (06:43 +0000)]
[libc][NFC] Make the buffer size of the integer to string converter public.

This allows users of the IntegerToString class to size their buffers
appropriately at compile time.

23 months ago[test] Fix threadlocal_address.cpp after D129833
Fangrui Song [Mon, 1 Aug 2022 06:49:33 +0000 (23:49 -0700)]
[test] Fix threadlocal_address.cpp after D129833

Older Darwin does not support thread_local:

error: thread-local storage is not supported for the current target
  thread_local int j = 0;

23 months ago[mlir][Math] Add constant folder for ExpM1Op.
jacquesguan [Tue, 26 Jul 2022 13:56:43 +0000 (21:56 +0800)]
[mlir][Math] Add constant folder for ExpM1Op.

This patch adds constant folder for ExpM1Op which only supports single and double precision floating-point.

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

23 months ago[ELF] .eh_frame: remove config->wordsize padding
Fangrui Song [Mon, 1 Aug 2022 06:35:44 +0000 (23:35 -0700)]
[ELF] .eh_frame: remove config->wordsize padding

Linux Standard Base Core Specification says that CIE/FDE is padded to an
addressing unit size boundary, but in practice GNU assembler/LLVM integrated
assembler pad FDE/CIE to 4 and the last FDE to 8 on 64-bit systems.

In addition, GNU ld doesn't pad to 8, so let's drop excess padding, too.
If the assembler provides aligned pieces, the output will be aligned.

Noticed .eh_frame size reduction for 3 executables: 0.3% (chrome), 4.7% (clang),
7.6% (an internal program).

23 months ago[GlobalsAA] Remove unnecessary AAResultBase fallback (NFC)
Nikita Popov [Mon, 1 Aug 2022 06:34:12 +0000 (08:34 +0200)]
[GlobalsAA] Remove unnecessary AAResultBase fallback (NFC)

This is unnecessary, as AA result chaining is implemented at a
higher level now.

23 months ago[ARMParallelDSP] Remove unnecessary ModRef intersection (NFC)
Nikita Popov [Mon, 1 Aug 2022 06:32:47 +0000 (08:32 +0200)]
[ARMParallelDSP] Remove unnecessary ModRef intersection (NFC)

Intersecting with ModRef is a no-op, as these are the only two
possible values.

23 months ago[NFC] Fix test failure in windows
Chuanqi Xu [Mon, 1 Aug 2022 06:13:49 +0000 (14:13 +0800)]
[NFC] Fix test failure in windows

23 months ago[libc][NFC] Mark a few methods of StringView to constexpr.
Siva Chandra Reddy [Mon, 1 Aug 2022 06:06:49 +0000 (06:06 +0000)]
[libc][NFC] Mark a few methods of StringView to constexpr.

23 months ago[AA] Drop setModAndRef() function (NFC)
Nikita Popov [Mon, 1 Aug 2022 05:55:39 +0000 (07:55 +0200)]
[AA] Drop setModAndRef() function (NFC)

Without the "must" state, this function is pointless, because we
can just directly create a ModRef instead.

23 months ago[MSSA] Fix expensive checks build
Nikita Popov [Mon, 1 Aug 2022 05:28:36 +0000 (07:28 +0200)]
[MSSA] Fix expensive checks build

23 months ago[Examples] Fix SimplifyCFG example
Nikita Popov [Mon, 1 Aug 2022 05:22:35 +0000 (07:22 +0200)]
[Examples] Fix SimplifyCFG example

After fffabd53482f34f96ab9273486538f587e3d91fc, the v2 and v3
versions produce poison instead of undef. Also adjust the v1
version, as well as the test expectations, to make the example
pass again.

23 months ago[AA] Do not track Must in ModRefInfo
Nikita Popov [Thu, 28 Jul 2022 15:23:36 +0000 (17:23 +0200)]
[AA] Do not track Must in ModRefInfo

getModRefInfo() queries currently track whether the result is a
MustAlias on a best-effort basis. The only user of this functionality
is the optimized memory access type in MemorySSA -- which in turn
has no users. Given that this functionality has not found a user
since it was introduced five years ago (in D38862), I think we
should drop it again.

The context is that I'm working to separate FunctionModRefBehavior
to track mod/ref for different location kinds (like argmem or
inaccessiblemem) separately, and the fact that ModRefInfo also has
an unrelated Must flag makes this quite awkward, especially as this
means that NoModRef is not a zero value. If we want to retain the
functionality, I would probably split getModRefInfo() results into
a part that just contains the ModRef information, and a separate
part containing a (best-effort) AliasResult.

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

23 months ago[NFC] Fill up the title underline in rst file
Chuanqi Xu [Mon, 1 Aug 2022 03:07:13 +0000 (11:07 +0800)]
[NFC] Fill up the title underline in rst file

Fill up the title underline in rst file to avoid the CI error.

23 months agoUse @llvm.threadlocal.address intrinsic to access TLS variable
Chuanqi Xu [Mon, 1 Aug 2022 03:03:28 +0000 (11:03 +0800)]
Use @llvm.threadlocal.address intrinsic to access TLS variable

This is successor for D125291. This revision would try to use
@llvm.threadlocal.address in clang to access TLS variable. The reason
why the OpenMP tests contains a lot of change is that they uses
utils/update_cc_test_checks.py to update their tests.

Reviewed By: nikic

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

23 months ago[ELF] Remove EhFrameSection::addSection. NFC
Fangrui Song [Mon, 1 Aug 2022 02:55:05 +0000 (19:55 -0700)]
[ELF] Remove EhFrameSection::addSection. NFC

23 months agoIntroduce @llvm.threadlocal.address intrinsic to access TLS variable
Chuanqi Xu [Mon, 1 Aug 2022 02:51:30 +0000 (10:51 +0800)]
Introduce @llvm.threadlocal.address intrinsic to access TLS variable

This belongs to a series of patches which try to solve the thread
identification problem in coroutines. See
https://discourse.llvm.org/t/address-thread-identification-problems-with-coroutine/62015
for a full background.

The problem consists of two concrete problems: TLS variable and readnone
functions. This patch tries to convert the TLS problem to readnone
problem by converting the access of TLS variable to an intrinsic which
is marked as readnone.

The readnone problem would be addressed in following patches.

Reviewed By: nikic, jyknight, nhaehnle, ychen

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

23 months ago[ELF] redirectSymbols: skip versioned symbol combine if config->versionDefinitions...
Fangrui Song [Mon, 1 Aug 2022 00:47:09 +0000 (17:47 -0700)]
[ELF] redirectSymbols: skip versioned symbol combine if config->versionDefinitions.size() == 2

23 months ago[lld-macho] Support EH frame pointer encodings that use sdata4
Jez Ng [Mon, 1 Aug 2022 00:16:08 +0000 (20:16 -0400)]
[lld-macho] Support EH frame pointer encodings that use sdata4

Previously we only supporting using the system pointer size (aka the
`absptr` encoding) because `llvm-mc`'s CFI directives always generate EH
frames with that encoding. But libffi uses 4-byte-encoded, hand-rolled
EH frames, so this patch adds support for it.

Fixes #56576.

Reviewed By: #lld-macho, oontvoo

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

23 months ago[clang-repl] XFAIL windows properly in simple-exception test case.
Sunho Kim [Mon, 1 Aug 2022 00:06:35 +0000 (09:06 +0900)]
[clang-repl] XFAIL windows properly in simple-exception test case.

We don't have proper exception support in LLJIT on windows yet. We have to xfail windows machine, but the previous check missed out some targets.

23 months ago[mlir] Remove types from attributes
Jeff Niu [Tue, 19 Jul 2022 04:32:38 +0000 (21:32 -0700)]
[mlir] Remove types from attributes

This patch removes the `type` field from `Attribute` along with the
`Attribute::getType` accessor.

Going forward, this means that attributes in MLIR will no longer have
types as a first-class concept. This patch lays the groundwork to
incrementally remove or refactor code that relies on generic attributes
being typed. The immediate impact will be on attributes that rely on
`Attribute` containing a type, such as `IntegerAttr`,
`DenseElementsAttr`, and `ml_program::ExternAttr`, which will now need
to define a type parameter on their storage classes. This will save
memory as all other attribute kinds will no longer contain a type.

Moreover, it will not be possible to generically query the type of an
attribute directly. This patch provides an attribute interface
`TypedAttr` that implements only one method, `getType`, which can be
used to generically query the types of attributes that implement the
interface. This interface can be used to retain the concept of a "typed
attribute". The ODS-generated accessor for a `type` parameter
automatically implements this method.

Next steps will be to refactor the assembly formats of certain operations
that rely on `parseAttribute(type)` and `printAttributeWithoutType` to
remove special handling of type elision until `type` can be removed from
the dialect parsing hook entirely; and incrementally remove uses of
`TypedAttr`.

Reviewed By: lattner, rriddle, jpienaar

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

23 months ago[ELF] Simplify EhInputSection::split. NFC
Fangrui Song [Sun, 31 Jul 2022 23:59:57 +0000 (16:59 -0700)]
[ELF] Simplify EhInputSection::split. NFC

* Inline getReloc
* Fold the UINT32_MAX length check into the section size check.
  This transformation is valid because we don't support .eh_frame input sections
  larger than 32-bit (unrealistic even for large code models).

23 months ago[ELF] Split EhInputSection::pieces into cies and fdes
Fangrui Song [Sun, 31 Jul 2022 23:16:10 +0000 (16:16 -0700)]
[ELF] Split EhInputSection::pieces into cies and fdes

This simplifies code, removes a read32 (for id==0 check), and makes it feasible
to combine some operations in EhInputSection::split and EhFrameSection::addRecords.

Mostly NFC, but fixes "Relocation not in any piece" assertion failure in an
erroneous case when a relocation offset precedes all CIE/FDE pices.

23 months agoUse drop_begin (NFC)
Kazu Hirata [Sun, 31 Jul 2022 22:17:09 +0000 (15:17 -0700)]
Use drop_begin (NFC)

23 months agoUse llvm::any_of (NFC)
Kazu Hirata [Sun, 31 Jul 2022 22:17:08 +0000 (15:17 -0700)]
Use llvm::any_of (NFC)

23 months ago[Hexagon] Remove unused declaration adjustForCalleeSavedRegsSpillCall (NFC)
Kazu Hirata [Sun, 31 Jul 2022 22:17:06 +0000 (15:17 -0700)]
[Hexagon] Remove unused declaration adjustForCalleeSavedRegsSpillCall (NFC)

The function definition was removed on Apr 23, 2015 in commit
876a19d8554510e6689b0a990e5e62af81506d80, but the declaration has
remained since.

23 months ago[BOLT] Remove redundaunt string initialization (NFC)
Kazu Hirata [Sun, 31 Jul 2022 22:17:05 +0000 (15:17 -0700)]
[BOLT] Remove redundaunt string initialization (NFC)

Identified with readability-redundant-string-init.

23 months ago[BOLT] Remove redundant const from return types (NFC)
Kazu Hirata [Sun, 31 Jul 2022 22:17:03 +0000 (15:17 -0700)]
[BOLT] Remove redundant const from return types (NFC)

Identified with readability-const-return-type.

23 months ago[BOLT] Use boolean literals (NFC)
Kazu Hirata [Sun, 31 Jul 2022 22:17:01 +0000 (15:17 -0700)]
[BOLT] Use boolean literals (NFC)

Identified with modernize-use-bool-literals.

23 months ago[Sema] Remove an unused forward declaration (NFC)
Kazu Hirata [Sun, 31 Jul 2022 22:17:00 +0000 (15:17 -0700)]
[Sema] Remove an unused forward declaration (NFC)

23 months ago[ExecutionEngine] Ensure newlines at the end of files (NFC)
Kazu Hirata [Sun, 31 Jul 2022 22:16:58 +0000 (15:16 -0700)]
[ExecutionEngine] Ensure newlines at the end of files (NFC)

23 months ago[Bazel] Add JITLink/COFFOptions.td (llvmorg-16-init-398-g88181375a3db)
NAKAMURA Takumi [Sun, 31 Jul 2022 22:03:30 +0000 (07:03 +0900)]
[Bazel] Add JITLink/COFFOptions.td (llvmorg-16-init-398-g88181375a3db)

23 months ago[ELF][test] Merge .eh_frame tests
Fangrui Song [Sun, 31 Jul 2022 21:52:20 +0000 (14:52 -0700)]
[ELF][test] Merge .eh_frame tests

23 months ago[RISCV] Pre-RA expand pseudos pass
Luís Marques [Fri, 29 Jul 2022 23:07:44 +0000 (01:07 +0200)]
[RISCV] Pre-RA expand pseudos pass

Expand load address pseudo-instructions earlier (pre-ra) to allow follow-up
patches to fold the addi of PseudoLLA instructions into the immediate
operand of load/store instructions.

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

23 months ago[mlir][tosa] Switch missed accessors to prefixed form (NFC)
Jacques Pienaar [Sun, 31 Jul 2022 18:33:42 +0000 (11:33 -0700)]
[mlir][tosa] Switch missed accessors to prefixed form (NFC)

23 months ago[ELF][test] Test identical CIE content with different personality
Fangrui Song [Sun, 31 Jul 2022 20:43:07 +0000 (13:43 -0700)]
[ELF][test] Test identical CIE content with different personality

If we change
CieRecord *&rec = cieMap[{cie.data(), personality}];
to
CieRecord *&rec = cieMap[{cie.data(), nullptr}];

The new test can catch the failure.

23 months ago[libc][doc] Update implementation status of exp2f, sinhf, and coshf.
Tue Ly [Sun, 31 Jul 2022 20:32:21 +0000 (16:32 -0400)]
[libc][doc] Update implementation status of exp2f, sinhf, and coshf.

23 months ago[mlir][DCA] Fix visiting call ops when run at function scopes
Jeff Niu [Sun, 31 Jul 2022 02:20:08 +0000 (22:20 -0400)]
[mlir][DCA] Fix visiting call ops when run at function scopes

When dead-code analysis is run at the scope of a function, call ops to
other functions at the same level were being marked as unreachable,
since the analysis optimistically assumes the call op to have no known
predecessors and that all predecessors are known, but the callee would
never get visited.

This patch fixes the bug by checking if a referenced function is above
the top-level op of the analysis, and is thus considered an external
callable.

Fixes #56830

Reviewed By: zero9178

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

23 months agoRevert "Revert "[mlir] Reuse the code between `getMixed*s()` funcs in ViewLikeInterfa...
Alexander Belyaev [Sun, 31 Jul 2022 19:44:24 +0000 (21:44 +0200)]
Revert "Revert "[mlir] Reuse the code between `getMixed*s()` funcs in ViewLikeInterface.cpp.""

This reverts commit e78d7637fbb08ec2c2e59939c015faadd47e32e7.

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

23 months agoRevert "[mlir] Reuse the code between `getMixed*s()` funcs in ViewLikeInterface.cpp."
Alexander Belyaev [Sun, 31 Jul 2022 19:25:20 +0000 (21:25 +0200)]
Revert "[mlir] Reuse the code between `getMixed*s()` funcs in ViewLikeInterface.cpp."

This reverts commit e8c2877565149587fd66fbee591b7d44eecd667d.

23 months ago[mlir] Reuse the code between `getMixed*s()` funcs in ViewLikeInterface.cpp.
Alexander Belyaev [Sun, 31 Jul 2022 16:04:46 +0000 (18:04 +0200)]
[mlir] Reuse the code between `getMixed*s()` funcs in ViewLikeInterface.cpp.

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

23 months ago[ELF] Move EhInputSection out of inputSections. NFC
Fangrui Song [Sun, 31 Jul 2022 18:58:08 +0000 (11:58 -0700)]
[ELF] Move EhInputSection out of inputSections. NFC

inputSections temporarily contains EhInputSection objects mainly for
combineEhSections. Place EhInputSection objects into a new vector
ehInputSections instead of inputSections.

23 months ago[InstSimplify] fold FP rounding intrinsic with rounded operand
Sanjay Patel [Sat, 30 Jul 2022 19:37:00 +0000 (15:37 -0400)]
[InstSimplify] fold FP rounding intrinsic with rounded operand

issue #56775

I rearranged the Thumb2 codegen test to avoid simplifying the chain
of rounding instructions. I'm assuming the intent of the test is
to verify lowering of each of those intrinsics.

23 months ago[InstSimplify] add tests for FP rounding intrinsics; NFC
Sanjay Patel [Sat, 30 Jul 2022 19:24:09 +0000 (15:24 -0400)]
[InstSimplify] add tests for FP rounding intrinsics; NFC

See issue #56775