platform/upstream/llvm.git
2 years ago[test][GlobalOpt] Regenerate some tests
Arthur Eubanks [Sun, 19 Jun 2022 04:34:11 +0000 (21:34 -0700)]
[test][GlobalOpt] Regenerate some tests

2 years ago[VE][NFC] Remove obsoleted function declaration
Kazushi (Jam) Marukawa [Sat, 26 Mar 2022 06:46:27 +0000 (15:46 +0900)]
[VE][NFC] Remove obsoleted function declaration

2 years ago[NFC][GlobalOpt] Remove unused parameters
Arthur Eubanks [Sun, 19 Jun 2022 04:23:20 +0000 (21:23 -0700)]
[NFC][GlobalOpt] Remove unused parameters

2 years ago[ADT] Add has_value, value, value_or to llvm::Optional
Kazu Hirata [Sun, 19 Jun 2022 04:21:33 +0000 (21:21 -0700)]
[ADT] Add has_value, value, value_or to llvm::Optional

This patch adds has_value, value, value_or to llvm::Optional so that
llvm::Optional looks more like std::optional.

I will keep the existing functions while migrating their callers and
then remove them later.

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

2 years agoRevert "[MCParser] Use default member initialization (NFC)"
Kazu Hirata [Sun, 19 Jun 2022 04:02:09 +0000 (21:02 -0700)]
Revert "[MCParser] Use default member initialization (NFC)"

This reverts commit 68090a014cf5af8198a06bdecea0aeedc0c23023.

The patch seems to cause a build error on ppc64le:

https://lab.llvm.org/buildbot#builders/121/builds/20536

2 years ago[MCParser] Use default member initialization (NFC)
Kazu Hirata [Sun, 19 Jun 2022 03:54:56 +0000 (20:54 -0700)]
[MCParser] Use default member initialization (NFC)

Identified with modernize-use-default-member-init.

2 years ago[ADT] Rename value to val (NFC)
Kazu Hirata [Sun, 19 Jun 2022 03:19:18 +0000 (20:19 -0700)]
[ADT] Rename value to val (NFC)

I'd like to introduce functions, such as value, value_or, has_value,
etc to make llvm::Optional look more like std::optional.  Renaming
value to val avoids name conflicts.

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

2 years ago[libc] Temporary disable environment tests for PATH variable.
Tue Ly [Sun, 19 Jun 2022 03:04:33 +0000 (23:04 -0400)]
[libc] Temporary disable environment tests for PATH variable.

This is blocking fullbuild bot.

2 years ago[libc][Obvious] Fix c++20-designator warnings for tests that use TmHelper.h.
Tue Ly [Sun, 19 Jun 2022 02:54:37 +0000 (22:54 -0400)]
[libc][Obvious] Fix c++20-designator warnings for tests that use TmHelper.h.

2 years ago[test][GlobalOpt] Precommit more tests
Arthur Eubanks [Sun, 19 Jun 2022 02:36:00 +0000 (19:36 -0700)]
[test][GlobalOpt] Precommit more tests

And fix up existing tests to not have so much UB.

2 years ago[libomptarget]Add a trap for external omptarget from LLVM
Ye Luo [Sun, 19 Jun 2022 02:08:18 +0000 (21:08 -0500)]
[libomptarget]Add a trap for external omptarget from LLVM

Old LLVM installation may expose its internal omptarget CMake target when being used by find_package(LLVM) and caused issues in the CMake of libomptarget that is being built. Trap the issue early.

Reviewed By: tianshilei1992

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

2 years ago[mlir] Update accessors to prefixed form (NFC)
Jacques Pienaar [Sun, 19 Jun 2022 00:53:22 +0000 (17:53 -0700)]
[mlir] Update accessors to prefixed form (NFC)

Follow up from flipping dialects to both, flip accessor used to prefixed
variant ahead to flipping from _Both to _Prefixed. This just flips to
the accessors introduced in the preceding change which are just prefixed
forms of the existing accessor changed from.

Mechanical change using helper script
https://github.com/jpienaar/llvm-project/blob/main/clang-tools-extra/clang-tidy/misc/AddGetterCheck.cpp and clang-format.

2 years ago[Toolchains] Use llvm::is_contained (NFC)
Kazu Hirata [Sat, 18 Jun 2022 22:57:50 +0000 (15:57 -0700)]
[Toolchains] Use llvm::is_contained (NFC)

2 years ago[Vectorize] Use llvm::is_contained (NFC)
Kazu Hirata [Sat, 18 Jun 2022 22:49:15 +0000 (15:49 -0700)]
[Vectorize] Use llvm::is_contained (NFC)

2 years ago[Support] Use default member initialization (NFC)
Kazu Hirata [Sat, 18 Jun 2022 22:46:09 +0000 (15:46 -0700)]
[Support] Use default member initialization (NFC)

Identified with modernize-use-default-member-init.

2 years ago[test][GlobalOpt] Precommit test
Arthur Eubanks [Sat, 18 Jun 2022 22:44:09 +0000 (15:44 -0700)]
[test][GlobalOpt] Precommit test

2 years ago[IPO] Use default member initialization (NFC)
Kazu Hirata [Sat, 18 Jun 2022 22:41:20 +0000 (15:41 -0700)]
[IPO] Use default member initialization (NFC)

Identified with modernize-use-default-member-init.

2 years ago[Driver][OpenBSD] Use Arch reference instead of getArch(). NFC
Brad Smith [Sat, 18 Jun 2022 22:11:15 +0000 (18:11 -0400)]
[Driver][OpenBSD] Use Arch reference instead of getArch(). NFC

2 years ago[Driver] Pass -X to ld for riscv64-openbsd
Brad Smith [Sat, 18 Jun 2022 21:56:02 +0000 (17:56 -0400)]
[Driver] Pass -X to ld for riscv64-openbsd

Noticing D127826, add support for OpenBSD which uses lld on riscv64.

Reviewed By: MaskRay

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

2 years ago[Concepts] Implement overload resolution for destructors (P0848)
Roy Jacobson [Thu, 16 Jun 2022 17:52:12 +0000 (20:52 +0300)]
[Concepts] Implement overload resolution for destructors (P0848)

This patch implements a necessary part of P0848, the overload resolution for destructors.
It is now possible to overload destructors based on constraints, and the eligible destructor
will be selected at the end of the class.

The approach this patch takes is to perform the overload resolution in Sema::ActOnFields
and to mark the selected destructor using a new property in FunctionDeclBitfields.

CXXRecordDecl::getDestructor is then modified to use this property to return the correct
destructor.

This closes https://github.com/llvm/llvm-project/issues/45614.

Reviewed By: #clang-language-wg, erichkeane

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

2 years ago[X86] Add missing common AVX2 check prefix
Simon Pilgrim [Sat, 18 Jun 2022 19:19:24 +0000 (20:19 +0100)]
[X86] Add missing common AVX2 check prefix

2 years ago[RPOFuncAttrs] Fix norecurse detection
Arthur Eubanks [Fri, 17 Jun 2022 22:59:53 +0000 (15:59 -0700)]
[RPOFuncAttrs] Fix norecurse detection

We wanted to check if all uses of the function are direct calls, but the
code didn't account for passing the function as a parameter.

Reviewed By: nikic

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

2 years ago[IPO] Use default member initialization (NFC)
Kazu Hirata [Sat, 18 Jun 2022 19:17:09 +0000 (12:17 -0700)]
[IPO] Use default member initialization (NFC)

Identified with modernize-use-default-member-init.

2 years ago[X86] Use default member initialization (NFC)
Kazu Hirata [Sat, 18 Jun 2022 19:11:58 +0000 (12:11 -0700)]
[X86] Use default member initialization (NFC)

Identified with modernize-use-default-member-init.

2 years ago[X86] Use default member initialization (NFC)
Kazu Hirata [Sat, 18 Jun 2022 19:08:07 +0000 (12:08 -0700)]
[X86] Use default member initialization (NFC)

Identified with modernize-use-default-member-init.

2 years ago[X86] Use default member initialization (NFC)
Kazu Hirata [Sat, 18 Jun 2022 19:05:34 +0000 (12:05 -0700)]
[X86] Use default member initialization (NFC)

Identified with modernize-use-default-member-init.

2 years ago[CodeGen] Use default member initialization (NFC)
Kazu Hirata [Sat, 18 Jun 2022 19:01:34 +0000 (12:01 -0700)]
[CodeGen] Use default member initialization (NFC)

Identified with modernize-use-default-member-init.

2 years ago[BOLT] Allow function entry to be a cold fragment
Huan Nguyen [Sat, 18 Jun 2022 18:38:37 +0000 (11:38 -0700)]
[BOLT] Allow function entry to be a cold fragment

Allow cold fragment to get new address.

Our previous assumption is that a fragment (.cold) is only reached
through the main fragment of same function. In addition, .cold fragment
must be reached through either (a) direct transfer, or (b) split jump
table. For (a), we perform a simple fix-up. For (b), we currently mark
all relevant fragments as non-simple. Therefore, there is no need to
get new address for .cold fragment.

This is not always the case, as function entry can be rarely executed,
and is placed in .text.cold segment. Essentially we cannot tell which
the source-level function entry is based on hot and cold segments,
so we must treat each fragment a function on its own. Therfore, we
remove the assertion that a function entry cannot be cold fragment.

Test Plan:
```
ninja check-bolt
```

Reviewed By: Amir

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

2 years ago[RISCV] Pre-promote v1i1/v2i1/v4i1->i1/i2/i4 bitcasts before type legalization
Craig Topper [Sat, 18 Jun 2022 03:58:21 +0000 (20:58 -0700)]
[RISCV] Pre-promote v1i1/v2i1/v4i1->i1/i2/i4 bitcasts before type legalization

Type legalization will convert the bitcast into a vector store and
scalar load.

Instead this patch widens the vector to v8i1 with undef, and bitcasts
it to i8. v8i1->i8 has custom handling for type legalization already to
bitcast to a v1i8 vector and use an extract_element.

The code here was lifted from X86's avx512 support.

Reviewed By: reames

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

2 years ago[docs] Re-generate ClangCommandLineReference.rst
Fangrui Song [Sat, 18 Jun 2022 18:01:54 +0000 (11:01 -0700)]
[docs] Re-generate ClangCommandLineReference.rst

2 years ago[clang] Call *set::insert without checking membership first (NFC)
Kazu Hirata [Sat, 18 Jun 2022 17:41:26 +0000 (10:41 -0700)]
[clang] Call *set::insert without checking membership first (NFC)

2 years ago[IPO] Call *set::insert without checking membership first (NFC)
Kazu Hirata [Sat, 18 Jun 2022 17:37:04 +0000 (10:37 -0700)]
[IPO] Call *set::insert without checking membership first (NFC)

2 years ago[llvm] Call *set::insert without checking membership first (NFC)
Kazu Hirata [Sat, 18 Jun 2022 17:22:05 +0000 (10:22 -0700)]
[llvm] Call *set::insert without checking membership first (NFC)

2 years ago[llvm] Call *set::insert without checking membership first (NFC)
Kazu Hirata [Sat, 18 Jun 2022 17:17:22 +0000 (10:17 -0700)]
[llvm] Call *set::insert without checking membership first (NFC)

2 years ago[mlir] Start migrating more dialects to prefixed form
Jacques Pienaar [Sat, 18 Jun 2022 17:10:31 +0000 (10:10 -0700)]
[mlir] Start migrating more dialects to prefixed form

Marked all dialects that could be (reasonably) easily flipped to _Both
prefix. Updating the accessors to prefixed form will happen in follow
up, this was to flush out conflicts and to mark all dialects explicitly
as I plan to flip OpBase default to _Prefixed to avoid needing to
migrate new dialects.

Except for Standalone example which got flipped to _Prefixed.

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

2 years ago[Object] Make IsLittleEndian check constexpr to silence static analyzer dead code...
Simon Pilgrim [Sat, 18 Jun 2022 16:35:54 +0000 (17:35 +0100)]
[Object] Make IsLittleEndian check constexpr to silence static analyzer dead code warnings.

The "ELFT::TargetEndianness == support::little" check is known at compile time

2 years ago[X86] canonicalizeShuffleWithBinOps - merge shuffles across binops if either source...
Simon Pilgrim [Sat, 18 Jun 2022 16:14:00 +0000 (17:14 +0100)]
[X86] canonicalizeShuffleWithBinOps - merge shuffles across binops if either source op is a known splat

The shuffle of a splat (with no undefs) should always be removed

2 years ago[llvm] Call *set::insert without checking membership first (NFC)
Kazu Hirata [Sat, 18 Jun 2022 15:32:54 +0000 (08:32 -0700)]
[llvm] Call *set::insert without checking membership first (NFC)

2 years ago[libc++] Add Implemented Papers section
Nikolas Klauser [Fri, 17 Jun 2022 18:20:48 +0000 (20:20 +0200)]
[libc++] Add Implemented Papers section

Reviewed By: ldionne, Mordante, #libc

Spies: libcxx-commits

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

2 years ago[libc++] Enable -Wweak-vtables
Nikolas Klauser [Wed, 15 Jun 2022 23:47:54 +0000 (01:47 +0200)]
[libc++] Enable -Wweak-vtables

This makes Clang scream at us if there is a class without a key function.

Reviewed By: ldionne, #libc

Spies: libcxx-commits, arichardson

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

2 years ago[NFC][Alignment] Remove dead code
Guillaume Chatelet [Sat, 18 Jun 2022 14:59:22 +0000 (14:59 +0000)]
[NFC][Alignment] Remove dead code

2 years ago[X86] canonicalizeShuffleWithBinOps - merge unary shuffles across binops if either...
Simon Pilgrim [Sat, 18 Jun 2022 14:38:54 +0000 (15:38 +0100)]
[X86] canonicalizeShuffleWithBinOps - merge unary shuffles across binops if either source op is a foldable load

This mostly handles folding of constants that have already become loads, but we expose some generic load cases as well.

This also exposes the chance to merge unary shuffles across X86ISD::ANDNP nodes with different scalar widths

2 years agoPrefer `getCurrentFileOrBufferName` in `FrontendAction::EndSourceFile`
Yuki Okushi [Fri, 10 Jun 2022 16:36:55 +0000 (01:36 +0900)]
Prefer `getCurrentFileOrBufferName` in `FrontendAction::EndSourceFile`

`getCurrentFile` here causes an assertion on some condition.
`getCurrentFileOrBufferName` is preferrable instead.

llvm#55950

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

2 years ago[AsmParser] Use default member initialization (NFC)
Kazu Hirata [Sat, 18 Jun 2022 14:46:03 +0000 (07:46 -0700)]
[AsmParser] Use default member initialization (NFC)

Identified with modernize-use-default-member-init.

2 years ago[Target, CodeGen] Use isImm(), isReg(), etc (NFC)
Kazu Hirata [Sat, 18 Jun 2022 14:41:04 +0000 (07:41 -0700)]
[Target, CodeGen] Use isImm(), isReg(), etc (NFC)

2 years ago[X86] Regenerate sar_fold.ll to show all instructions
Simon Pilgrim [Sat, 18 Jun 2022 14:21:41 +0000 (15:21 +0100)]
[X86] Regenerate sar_fold.ll to show all instructions

2 years ago[X86] Use X86 instead of X32 for i686 check prefixes
Simon Pilgrim [Sat, 18 Jun 2022 14:16:15 +0000 (15:16 +0100)]
[X86] Use X86 instead of X32 for i686 check prefixes

We try to reserve X32 check prefixes for gnux32 triple tests

2 years ago[X86] isShuffleFoldableLoad - ensure the load has one use.
Simon Pilgrim [Sat, 18 Jun 2022 13:51:55 +0000 (14:51 +0100)]
[X86] isShuffleFoldableLoad - ensure the load has one use.

We'll only fold the load if has one use. Makes no difference to existing tests but will be necessary for an upcoming patch to improve load folding as part of canonicalizeShuffleWithBinOps.

2 years agoReland "[CodeGen] Keep track info of lazy-emitted symbols in ModuleBuilder"
Jun Zhang [Sat, 18 Jun 2022 11:53:11 +0000 (19:53 +0800)]
Reland "[CodeGen] Keep track info of lazy-emitted symbols in ModuleBuilder"

This reverts commits:
d3ddc251acae631bf5ab4da13878f7e8b5b5a451
d90eecff5c9e7e9f8263de6cd72d70322400829f

It turned out there're some options turned on that leaks the memory
intentionally, which fires the asan builds after the patch being
applied. The issue has been fixed in
7bc00ce5cd41aad5fd0775f58c8e85a0a8d9ee56, so reland it.

Below is the original commit message:

The intent of this patch is to selectively carry some states over to
the Builder so we won't lose the information of the previous symbols.

This used to be several downstream patches of Cling, it aims to fix
errors in Clang Interpreter when trying to use inline functions.
Before this patch:

clang-repl> inline int foo() { return 42;}
clang-repl> int x = foo();

JIT session error: Symbols not found: [ _Z3foov ]
error: Failed to materialize symbols:
{ (main, { x, $.incr_module_1.__inits.0, __orc_init_func.incr_module_1 }) }

Co-authored-by: Axel Naumann <Axel.Naumann@cern.ch>
Signed-off-by: Jun Zhang <jun@junz.org>
2 years ago[CodeGen] Add back setOperationAction/setLoadExtAction/setLibcallName single opcode...
Simon Pilgrim [Sat, 18 Jun 2022 12:01:59 +0000 (13:01 +0100)]
[CodeGen] Add back setOperationAction/setLoadExtAction/setLibcallName single opcode variants

The work to add ArrayRef helpers (D122557, D123467 etc.) to the TargetLowering::set* methods resulted in all the single opcode calls to these methods being cast to single element ArrayRef on the fly - resulting in a scary >5x increase in build time (identified with vcperf) on MSVC release builds of most of the TargetLowering/ISelLowering files.

This patch adds the back the single opcode variants to various set*Action calls to avoid this issue for now, and updates the ArrayRef helpers to wrap them - I'm still investigating whether the single element ArrayRef build times can be improved.

2 years ago[NFC] Specifing clang namespace for builtins.
Pavel Iliin [Fri, 17 Jun 2022 22:12:03 +0000 (23:12 +0100)]
[NFC] Specifing clang namespace for builtins.

2 years ago[libc++][ranges][NFC] Fix a format error on the ranges status page.
Konstantin Varlamov [Sat, 18 Jun 2022 09:22:26 +0000 (02:22 -0700)]
[libc++][ranges][NFC] Fix a format error on the ranges status page.

2 years ago[mlir][bufferization] Set emitAccessorPrefix dialect flag
Matthias Springer [Sat, 18 Jun 2022 08:23:31 +0000 (10:23 +0200)]
[mlir][bufferization] Set emitAccessorPrefix dialect flag

Generate get/set accessors on all bufferization ops. Also update all internal uses.

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

2 years ago[mlir] Fix an msvc warning
Benjamin Kramer [Sat, 18 Jun 2022 08:07:51 +0000 (10:07 +0200)]
[mlir] Fix an msvc warning

Float16bits.cpp(148): warning C4067: unexpected tokens following preprocessor directive - expected a newline

2 years ago[libc] Add TLS image initialization to aarch64 startup code.
Siva Chandra [Fri, 17 Jun 2022 05:58:45 +0000 (22:58 -0700)]
[libc] Add TLS image initialization to aarch64 startup code.

The TLS loader test has been enabled for aarch64.
Handling of PT_TLS' filesz and memsz for x86_64 has also been fixed.

Reviewed By: jeffbailey

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

2 years ago[MachineCopyPropagation][RISCV] Fix D125335 accidentally change control flow.
Han-Kuan Chen [Fri, 17 Jun 2022 08:34:17 +0000 (01:34 -0700)]
[MachineCopyPropagation][RISCV] Fix D125335 accidentally change control flow.

D125335 makes regsOverlap skip following control flow, which is not entended
in the original code.

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

2 years ago[MachineCopyPropagation][RISCV] Add test case showing failure for MachineCopyPropagat...
Han-Kuan Chen [Fri, 17 Jun 2022 08:34:10 +0000 (01:34 -0700)]
[MachineCopyPropagation][RISCV] Add test case showing failure for MachineCopyPropagation. NFC

This is a pre-commit test cases for D128039.

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

2 years ago[Bazel] Rename generated *_main.cpp to [tool-name]-driver.cpp which CMake uses.
NAKAMURA Takumi [Sat, 18 Jun 2022 04:15:40 +0000 (13:15 +0900)]
[Bazel] Rename generated *_main.cpp to [tool-name]-driver.cpp which CMake uses.

Fixup to llvmorg-15-init-12347-gf06abbb39380
The difference of basename affects its emitted object file.

FIXME: Each rule's name is left as origin.

2 years agobzero->memset - Fix Windows bots
Chris Bieneman [Sat, 18 Jun 2022 02:41:58 +0000 (21:41 -0500)]
bzero->memset - Fix Windows bots

How does Windows not have bzero? How did I break this while working on
a Windows-specific component of LLVM?

The world may never know...

2 years ago[DirectX] Add DirectX target object writer
Chris Bieneman [Mon, 6 Jun 2022 21:27:40 +0000 (16:27 -0500)]
[DirectX] Add DirectX target object writer

This is the last piece to bring together writing DXContainer files
containing DXIL through the DirectX backend.

While this change only has one test, all of the tests under
llvm/test/tools/dxil-dis also exercise this code. With this change the
output object file type for the dxil target is now DXContainer. Each of
the existing tests will generate DXContainer files, and the dxil-dis
tests additionally verify that the DXContainers generated are
well-formed and can be parsed by the DirectXShaderCompiler tools.

Depends on D127153 and D127165

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

2 years ago[gn build] Port 3adc908b2685
LLVM GN Syncbot [Sat, 18 Jun 2022 02:23:50 +0000 (02:23 +0000)]
[gn build] Port 3adc908b2685

2 years ago[DirectX][MC] Add MC support for DXContainer
Chris Bieneman [Mon, 6 Jun 2022 22:18:08 +0000 (17:18 -0500)]
[DirectX][MC] Add MC support for DXContainer

DXContainer files resemble traditional object files in that they are
comprised of parts which resemble sections. Adding DXContainer as an
object file format in the MC layer will allow emitting DXContainer
objects through the normal object emission pipeline.

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

2 years ago[DirectX] Add DXILAsmPrinter
Chris Bieneman [Mon, 6 Jun 2022 20:58:24 +0000 (15:58 -0500)]
[DirectX] Add DXILAsmPrinter

The DXILAsmPrinter will just write globals into sections, so the
DXILAsmPrinter only needs support for emitting global variables, and is
otherwise a stub.

Depends on D127147

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

2 years ago[DirectX] Add MC Register and Frame stubs
Chris Bieneman [Mon, 6 Jun 2022 20:34:47 +0000 (15:34 -0500)]
[DirectX] Add MC Register and Frame stubs

This patch adds no-op stubs overrides for the MCRegisterInfo and
MCFrameLowering for the DirectX/DXIL code generation path.

Since DXIL will not generate MCInstrs these stubs do nothing, but they
need to exist so that the MC layer can be used to emit DXContainer
objects.

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

2 years agollvm-dwarf-dump: include type name for AT_containing_type
Felipe de Azevedo Piovezan [Sat, 18 Jun 2022 00:48:40 +0000 (00:48 +0000)]
llvm-dwarf-dump: include type name for AT_containing_type

Type attributes are currently printed as:
  DW_AT_type    (<address> "<name>")
For example:
  DW_AT_type    (0x00000086 "double")

However, containing_type attributes omit the name, for example:
  DW_AT_containing_type    (0x00000086)

In order to make the dwarf dumps easier to read, and to have consistency
between the type-like attributes, this commit changes the way
DW_AT_containing_type is printed so that it includes the name of the
type it refers to:
  DW_AT_containing_type    (0x00000086 "double")

Reviewed By: dblaikie

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

2 years ago[CodeGen] Init EmptyExpr before the first use
Vitaly Buka [Sat, 18 Jun 2022 00:36:51 +0000 (17:36 -0700)]
[CodeGen] Init EmptyExpr before the first use

2 years agoAdd unit test coverage for cast<T> assertion failures on invalid cast
David Blaikie [Sat, 18 Jun 2022 00:35:32 +0000 (00:35 +0000)]
Add unit test coverage for cast<T> assertion failures on invalid cast

2 years agoStop wrapping GCCAsmStmts inside StmtExprs to destruct temporaries
Akira Hatanaka [Fri, 13 May 2022 21:24:27 +0000 (14:24 -0700)]
Stop wrapping GCCAsmStmts inside StmtExprs to destruct temporaries

Instead, just pop the cleanups at the end of the asm statement.

This fixes an assertion failure in BuildStmtExpr. It also fixes a bug
where blocks and C compound literals were destructed at the end of the
asm statement instead of at the end of the enclosing scope.

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

2 years ago[libc] add printf pointer conv
Michael Jones [Thu, 16 Jun 2022 18:24:42 +0000 (11:24 -0700)]
[libc] add printf pointer conv

The pointer converter handles the %p conversion. It uses the hex
converter for most of the conversion.

Reviewed By: sivachandra

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

2 years ago[BOLT] Allow function fragments to point to one jump table
Huan Nguyen [Fri, 17 Jun 2022 23:17:22 +0000 (16:17 -0700)]
[BOLT] Allow function fragments to point to one jump table

Resolve a crash related to split functions

Due to split function optimization, a function can be divided to two

fragments, and both fragments can access same jump table. This
violates 
the assumption that a jump table can only have one parent
function, 
which causes a crash during instrumentation.

We want to support the case: different functions cannot access same
jump tables, but different fragments of same function can!

As all fragments are from same function, we point JT::Parent to one
specific fragment. Right now it is the first disassembled fragment, but
we can point it to the function's main fragment later.

Functions are disassembled sequentially. Previously, at the end of
processing a function, JT::OffsetEntries is cleared, so other fragment
can no longer reuse JT::OffsetEntries. To extend the support for split
function, we only clear JT::OffsetEntries after all functions are
disassembled.

Let say A.hot and A.cold access JT of three targets {X, Y, Z}, where
X and Y are in A.hot, and Z is in A.cold. Suppose that A.hot is
disassembled first, JT::OffsetEntries = {X',Y',INVALID_OFFSET}. When
A.cold is disassembled, it cannot reuse JT::OffsetEntries above due to
different fragment start. A simple solution:
A.hot  = {X',Y',INVALID_OFFSET}
A.cold = {INVALID_OFFSET, INVALID_OFFSET, INVALID_OFFSET}

We update the assertion to allow different fragments of same function
to get the same JumpTable object.

Potential improvements:
A.hot  = {X',Y',INVALID_OFFSET}
A.cold = {INVALID_OFFSET, INVALID_OFFSET, Z'}
The main issue is A.hot and A.cold have separate CFGs, thus jump table
targets are still constrained within fragment bounds.

Future improvements:
A.hot  = {X, Y, Z}
A.cold = {X, Y, Z}

Reviewed By: Amir

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

2 years ago[mlir][sparse][taco] Support complex types.
bixia1 [Fri, 17 Jun 2022 22:35:45 +0000 (15:35 -0700)]
[mlir][sparse][taco] Support complex types.

Support complex types of float and double. See the added test for an example.

Reviewed By: aartbik

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

2 years ago[test][RPOFuncAttrs] Update norecurse.ll
Arthur Eubanks [Fri, 17 Jun 2022 22:49:48 +0000 (15:49 -0700)]
[test][RPOFuncAttrs] Update norecurse.ll

Use opaque pointers, remove obsolete FIXMEs, precommit test.
Add extra `CHECK-NOT: norecurse`s because it can appear before the checked attributes.

2 years ago[mlir][nvgpu] fix MSVC warning regarding left shift
Christopher Bate [Fri, 17 Jun 2022 19:02:47 +0000 (13:02 -0600)]
[mlir][nvgpu] fix MSVC warning regarding left shift

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

2 years ago[lldb] Fix modernize-use-equals-default warnings (NFC)
Jonas Devlieghere [Fri, 17 Jun 2022 22:03:12 +0000 (15:03 -0700)]
[lldb] Fix modernize-use-equals-default warnings (NFC)

Fix modernize-use-equals-default warnings. Because this check is listed
in LLDB's top level .clang-tidy configuration, the check is enabled by
default and the resulting warnings show up in my editor.

I've audited the modified lines. This is not a blind change.

2 years ago[lldb] Fix modernize-use-override warnings (NFC)
Jonas Devlieghere [Fri, 17 Jun 2022 21:50:32 +0000 (14:50 -0700)]
[lldb] Fix modernize-use-override warnings (NFC)

Fix modernize-use-override warnings. Because this check is listed in
LLDB's top level .clang-tidy configuration, the check is enabled by
default and the resulting warnings show up in my editor.

I've audited the modified lines. This is not a blind change.

2 years ago[clang][driver] Ensure we don't accumulate entries in -MJ files
Jan Svoboda [Fri, 17 Jun 2022 21:31:07 +0000 (23:31 +0200)]
[clang][driver] Ensure we don't accumulate entries in -MJ files

Previously, each job would overwrite the -MJ file. This didn't quite work for Clang invocations with multiple architectures, which got fixed in D121997 by always appending to the -MJ file. That's not correct either, since the file would grow indefinitely on subsequent Clang invocations. This patch ensures the driver always removes the file before jobs fill it in by appending.

Reviewed By: MaskRay

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

2 years ago[clang-repl] Remove memory leak of ASTContext/TargetMachine.
Sunho Kim [Fri, 17 Jun 2022 21:35:29 +0000 (06:35 +0900)]
[clang-repl] Remove memory leak of ASTContext/TargetMachine.

Removes memory leak of ASTContext and TargetMachine. When DisableFree is turned on, it intentionally leaks these instances as they can be trivially deallocated. This patch turns this off and delete Parser instance early so that they will not reference dangling pargma headers.

Asan shouldn't detect these as leaks normally, since burypointer is called for them. But, every invocation of incremental parser createa an additional leak of TargetMachine. If there are many invocations within a single test case, we easily reach number of leaks exceeding kGraveYardMaxSize (which is 12) and leaks start to get reported by asan buildbots.

Reviewed By: v.g.vassilev

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

2 years ago[libc++] Make sure we install libc++abi headers on Apple
Louis Dionne [Fri, 10 Jun 2022 19:10:26 +0000 (15:10 -0400)]
[libc++] Make sure we install libc++abi headers on Apple

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

2 years ago[lldb][tests] Automatically call compute_mydir (NFC)
Dave Lee [Fri, 17 Jun 2022 00:38:47 +0000 (17:38 -0700)]
[lldb][tests] Automatically call compute_mydir (NFC)

Eliminate boilerplate of having each test manually assign to `mydir` by calling
`compute_mydir` in lldbtest.py.

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

2 years ago[libc++] Don't force -O2 when building the benchmarks
Louis Dionne [Thu, 16 Jun 2022 17:39:01 +0000 (13:39 -0400)]
[libc++] Don't force -O2 when building the benchmarks

The optimization level used when building the benchmarks should
match the optimization level of the current build. Otherwise, we
can end up mixing an -O3 or -O0 optimized dylib with benchmarks
built with -O2, which is really misleading.

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

2 years ago[RISCV] Use RVVBitsPerBlock instead of hardcoding multiples of 64. NFC
Craig Topper [Fri, 17 Jun 2022 21:10:39 +0000 (14:10 -0700)]
[RISCV] Use RVVBitsPerBlock instead of hardcoding multiples of 64. NFC

2 years ago[mlir][sparse] Inline the definition of LLVM_ATTRIBUTE_WEAK
Benjamin Kramer [Fri, 17 Jun 2022 20:40:00 +0000 (22:40 +0200)]
[mlir][sparse] Inline the definition of LLVM_ATTRIBUTE_WEAK

This library is supposed not to have a dependency on LLVM, and linking
LLVMSupport into it breaks its shared library setup.

2 years ago[BOLT] Fix for missing entry offset
Rafael Auler [Fri, 17 Jun 2022 20:04:40 +0000 (13:04 -0700)]
[BOLT] Fix for missing entry offset

Temporary fix for missing entry offset when creating address
translation tables (BAT) after D127935 landed. Will later work on
assigning a more reasonable offset different than zero.

Reviewed By: Amir

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

2 years ago[bazel] Add missing dependency after 455679413
Benjamin Kramer [Fri, 17 Jun 2022 20:09:13 +0000 (22:09 +0200)]
[bazel] Add missing dependency after 455679413

This is supposed to be header-only. Don't know how to express that in
bazel.

2 years ago[mlir][sparse] Add testing for bf16 and fallback for software bf16
Benjamin Kramer [Fri, 17 Jun 2022 08:25:43 +0000 (10:25 +0200)]
[mlir][sparse] Add testing for bf16 and fallback for software bf16

This adds weak versions of the truncation libcalls in case the runtime
environment doesn't have them.

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

2 years ago[mlir][sparse] renable f16 tests
Aart Bik [Fri, 17 Jun 2022 18:56:52 +0000 (11:56 -0700)]
[mlir][sparse] renable f16 tests

Sparse library ABI issues are fixed.

https://github.com/llvm/llvm-project/issues/55992

Reviewed By: bkramer

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

2 years ago[RISCV] Remove redundant code checking for exact VTYPE match [nfc]
Philip Reames [Fri, 17 Jun 2022 19:20:20 +0000 (12:20 -0700)]
[RISCV] Remove redundant code checking for exact VTYPE match [nfc]

Should be fully covered by the generic demanded field based logic just below, and this ensures better coverage of that logic.

2 years ago[RISCV] Move store policy and mask reg ops into demanded handling in InsertVSETVLI
Philip Reames [Fri, 17 Jun 2022 19:05:58 +0000 (12:05 -0700)]
[RISCV] Move store policy and mask reg ops into demanded handling in InsertVSETVLI

Doing so let's the post-mutation pass leverage the demanded info to rewrite vsetvlis before a store/mask-op to eliminate later vsetvlis.

Sorry for the lack of store test change; all of my attempts to write something reasonable have been handled through existing logic.

2 years agoRecommit "[LAA] Initial support for runtime checks with pointer selects."
Florian Hahn [Fri, 17 Jun 2022 19:06:25 +0000 (21:06 +0200)]
Recommit "[LAA] Initial support for runtime checks with pointer selects."

This reverts commit 7aa8a678826dea86ff3e6c7df9d2a8a6ef868f5d.

This version includes fixes to address issues uncovered after
the commit landed and discussed at D11448.

Those include:

* Limit select-traversal to selects inside the loop.
* Freeze pointers resulting from looking through selects to avoid
  branch-on-poison.

2 years ago[AArch64] add tests for masked subtract; NFC
Sanjay Patel [Fri, 17 Jun 2022 18:10:13 +0000 (14:10 -0400)]
[AArch64] add tests for masked subtract; NFC

2 years ago[libc++] Mark standard-mandated includes as such
Nikolas Klauser [Thu, 16 Jun 2022 20:43:46 +0000 (22:43 +0200)]
[libc++] Mark standard-mandated includes as such

Reviewed By: ldionne, Mordante, #libc, saugustine

Spies: saugustine, MaskRay, arichardson, mstorsjo, jloser, libcxx-commits, arphaman

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

2 years ago[docs] Adding table of object file formats
Chris Bieneman [Mon, 13 Jun 2022 15:05:03 +0000 (10:05 -0500)]
[docs] Adding table of object file formats

The added section and table here list the object file formats LLVM MC
supports and which targets support each format.

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

2 years agoRevert "wip"
Chris Bieneman [Fri, 17 Jun 2022 18:36:53 +0000 (13:36 -0500)]
Revert "wip"

This reverts commit 0dd243fa8a4ec98d6cabbad16e6b485a093c6dea.

I accidentally pushed this! Oops!

2 years ago[mlir][nvgpu] Fix Bazel BUILD file
Frederik Gossen [Fri, 17 Jun 2022 18:31:44 +0000 (14:31 -0400)]
[mlir][nvgpu] Fix Bazel BUILD file

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

2 years ago[docs] Adding DirectX target usage doc
Chris Bieneman [Mon, 13 Jun 2022 14:38:07 +0000 (09:38 -0500)]
[docs] Adding DirectX target usage doc

This document is a work in progress to begin fleshing out documentation
for the DirectX backend and related changes in the LLVM project.

This is not intended to be exhaustive or complete, it is intended as a
starting
point so taht future changes have a place for documentation to land.

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

2 years agowip
Chris Bieneman [Thu, 16 Jun 2022 20:35:48 +0000 (15:35 -0500)]
wip

2 years ago[docs] Fix typo
Arthur Eubanks [Fri, 17 Jun 2022 18:29:07 +0000 (11:29 -0700)]
[docs] Fix typo

2 years ago[Static Analyzer] Structured binding to data members
isuckatcs [Mon, 13 Jun 2022 13:53:31 +0000 (15:53 +0200)]
[Static Analyzer] Structured binding to data members

Introducing structured binding to data members.

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

2 years ago[clang][dataflow] Add support for comma binary operator
Stanislav Gatev [Thu, 16 Jun 2022 21:57:28 +0000 (21:57 +0000)]
[clang][dataflow] Add support for comma binary operator

Add support for comma binary operator.

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

Reviewed-by: ymandel, xazax.hun
2 years ago[riscv] Extract isMaskRegOp helper [nfc]
Philip Reames [Fri, 17 Jun 2022 17:40:48 +0000 (10:40 -0700)]
[riscv] Extract isMaskRegOp helper [nfc]