platform/upstream/llvm.git
2 years ago[lld] Wrap rst file to 80 cols and fix "precense" typo
Nico Weber [Sun, 19 Jun 2022 22:24:52 +0000 (18:24 -0400)]
[lld] Wrap rst file to 80 cols and fix "precense" typo

2 years agoRename parallelForEachN to just parallelFor
Nico Weber [Sun, 19 Jun 2022 16:30:06 +0000 (12:30 -0400)]
Rename parallelForEachN to just parallelFor

Patch created by running:

  rg -l parallelForEachN | xargs sed -i '' -c 's/parallelForEachN/parallelFor/'

No behavior change.

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

2 years ago[libc] Revert: Temporary disable environment tests for PATH variable.
Siva Chandra Reddy [Sun, 19 Jun 2022 21:38:16 +0000 (21:38 +0000)]
[libc] Revert: Temporary disable environment tests for PATH variable.

This reverts commit 2846c2bb4fa4e50b2eb4ff4231825d73840c8c1c. The reason
for the disable is not relevant anymore.

2 years ago[InstCombine] Optimize test for same-sign of values
Eric Gullufsen [Sun, 19 Jun 2022 20:12:57 +0000 (16:12 -0400)]
[InstCombine] Optimize test for same-sign of values

(icmp slt (X & Y), 0) | (icmp sgt (X | Y), -1) -> (icmp sgt (X ^ Y), -1)
(icmp slt (X | Y), 0) & (icmp sgt (X & Y), -1) -> (icmp slt (X ^ Y), 0)

[[ https://alive2.llvm.org/ce/z/qXxEFP | alive2 example ]]
[[ https://godbolt.org/z/aWf9c6j74 | godbolt  ]]

[[ https://godbolt.org/z/5Ydn5TehY | godbolt for inverted form ]]
[[ https://alive2.llvm.org/ce/z/93AODr | alive2 for inverted form ]]
[[ https://github.com/llvm/llvm-project/issues/55988 | issue #55988 ]]

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

2 years ago[CallGraph] Don't preserve CallGraph when function CFG analyses are preserved
Arthur Eubanks [Sun, 19 Jun 2022 19:10:45 +0000 (12:10 -0700)]
[CallGraph] Don't preserve CallGraph when function CFG analyses are preserved

The call graph has nothing to with function CFGs.

Fixes a crash in a future change that exposes this bug.

2 years ago[ValueTracking] recognize sub X, (X -nuw Y) as not overflowing
Sanjay Patel [Sun, 19 Jun 2022 18:13:27 +0000 (14:13 -0400)]
[ValueTracking] recognize sub X, (X -nuw Y) as not overflowing

This extends a similar pattern from D125500 and D127754.
If we know that operand 1 (RHS) of a subtract is itself a
non-overflowing subtract from operand 0 (LHS), then the
final/outer subtract is also non-overflowing:
https://alive2.llvm.org/ce/z/Bqan8v

InstCombine uses this analysis to trigger a narrowing
optimization, so that is what the first changed test shows.

The last test models a motivating case from issue #48013.
In that example, we determine 'nuw' on the first sub from
the urem, then we determine that the 2nd sub can be narrowed,
and that leads to eliminating both subtracts.

here are still several missing subtract narrowing optimizations
demonstrated in the tests above the diffs shown here - those
should be handled in InstCombine with another set of patches.

2 years ago[InstCombine] add tests for 'sub nuw' with zext; NFC
Sanjay Patel [Sun, 19 Jun 2022 18:10:03 +0000 (14:10 -0400)]
[InstCombine] add tests for 'sub nuw' with zext; NFC

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

This patch renames value to alt so that the parameter won't collide
with member function value().

2 years agoFix an unused-variable warning in release build, NFC.
Haojian Wu [Sun, 19 Jun 2022 18:52:00 +0000 (20:52 +0200)]
Fix an unused-variable warning in release build, NFC.

2 years ago[TableGen][X86] Add Size field to X86MemOperand class
Amir Ayupov [Sun, 19 Jun 2022 18:46:35 +0000 (11:46 -0700)]
[TableGen][X86] Add Size field to X86MemOperand class

Set Size appropriately in operand definitions and query it for dumping memory
operand size table `getMemOperandSize` (follow-up use D126116) and
`X86Disassembler::getMemOperandSize`.

Excerpt from a produced `getMemOperandSize` table for X86:

```
static int getMemOperandSize(int OpType) {
  switch (OpType) {
  default: return 0;
  case OpTypes::i8mem:
  case OpTypes::i8mem_NOREX:
    return 8;

  case OpTypes::f16mem:
  case OpTypes::i16mem:
    return 16;

  case OpTypes::f32mem:
  case OpTypes::i32mem:
    return 32;
...
```

Reviewed By: skan, pengfei

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

2 years ago[BOLT] Use 32-bit MOV to zero 64-bit register in instrumentation code
Amir Ayupov [Mon, 13 Jun 2022 21:31:06 +0000 (14:31 -0700)]
[BOLT] Use 32-bit MOV to zero 64-bit register in instrumentation code

Instead of `movabsq $0x0, %rax` emit shorter equivalent `movl $0x0, %eax`.
Intel SDM, 3.4.1.1 General-Purpose Registers in 64-Bit Mode:
>32-bit operands generate a 32-bit result, zero-extended to a 64-bit result in
> the destination general-purpose register.

Reviewed By: rafauler

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

2 years ago[MachinePipeliner] Handle failing constrainRegClass
David Green [Sun, 19 Jun 2022 17:55:19 +0000 (18:55 +0100)]
[MachinePipeliner] Handle failing constrainRegClass

The included test hits a verifier problems as one of the instructions:
```
%113:tgpreven, %114:tgprodd = MVE_VMLSLDAVas16 %12:tgpreven(tied-def 0), %11:tgprodd(tied-def 1), %7:mqpr, %8:mqpr, 0, $noreg, $noreg
```
Has two inputs that come from different PHIs with the same base reg, but
conflicting regclasses:
```
%11:tgprodd = PHI %103:gpr, %bb.1, %16:gpr, %bb.2
%12:tgpreven = PHI %103:gpr, %bb.1, %17:gpr, %bb.2
```

The MachinePipeliner would attempt to use %103 for both the %11 and %12
operands in the prolog, constraining the register class to the common
subset of both. Unfortunately there are no registers that are both odd
and even, so the second constrainRegClass fails. Fix this situation by
inserting a COPY for the second if the call to constrainRegClass fails.

The register allocation can then fold that extra copy away. The register
allocation of Q regs changed with this test, but the R regs were the
same and no new instructions are needed in the final assembly.

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

2 years agoUse value_or instead of getValueOr (NFC)
Kazu Hirata [Sun, 19 Jun 2022 17:34:41 +0000 (10:34 -0700)]
Use value_or instead of getValueOr (NFC)

2 years ago[GlobalOpt] Perform store->dominated load forwarding for stored once globals
Arthur Eubanks [Sat, 18 Jun 2022 21:14:04 +0000 (14:14 -0700)]
[GlobalOpt] Perform store->dominated load forwarding for stored once globals

Compile time tracker:
https://llvm-compile-time-tracker.com/compare.php?from=1e556f459b44dd0ca4073e932f66ecb6f40fe31a&to=6d7bed4e1e72c6a8592748626091274209740a40&stat=instructions

Reviewed By: nikic

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

2 years ago[X86] Add common CHECK prefix to nontemporal-3.ll tests
Simon Pilgrim [Sun, 19 Jun 2022 17:21:56 +0000 (18:21 +0100)]
[X86] Add common CHECK prefix to nontemporal-3.ll tests

2 years ago[flang][OpenMP][NFC] Refactor code related to OpenMP atomic memory order clause semantics
Nimish Mishra [Wed, 15 Jun 2022 09:01:41 +0000 (14:31 +0530)]
[flang][OpenMP][NFC] Refactor code related to OpenMP atomic memory order clause semantics

Reviewed By: peixin

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

2 years ago[DAG] Add MaskedVectorIsZero helper
Simon Pilgrim [Sun, 19 Jun 2022 16:56:17 +0000 (17:56 +0100)]
[DAG] Add MaskedVectorIsZero helper

Equivalent to MaskedValueIsZero, except its checking if all of the demanded vectors elements are known to be zero

2 years ago[lldb] Use value_or instead of getValueOr (NFC)
Kazu Hirata [Sun, 19 Jun 2022 16:12:01 +0000 (09:12 -0700)]
[lldb] Use value_or instead of getValueOr (NFC)

2 years ago[InstCombine] add fold for (ShiftC >> X) <u C
Sanjay Patel [Sun, 19 Jun 2022 14:59:05 +0000 (10:59 -0400)]
[InstCombine] add fold for (ShiftC >> X) <u C

https://alive2.llvm.org/ce/z/RcdzM-

This fixes a regression noted in issue #56046.

2 years ago[DAG] SimplifyDemandedBits - add DemandedElts handling to ISD::SIGN_EXTEND_INREG...
Simon Pilgrim [Sun, 19 Jun 2022 14:35:29 +0000 (15:35 +0100)]
[DAG] SimplifyDemandedBits - add DemandedElts handling to ISD::SIGN_EXTEND_INREG simplification

2 years ago[DAG] SimplifyDemandedBits - add ISD::VSELECT handling
Simon Pilgrim [Sun, 19 Jun 2022 14:11:07 +0000 (15:11 +0100)]
[DAG] SimplifyDemandedBits - add ISD::VSELECT handling

2 years ago[InstCombine] add/adjust tests for signbit tests; NFC
Sanjay Patel [Sun, 19 Jun 2022 14:09:56 +0000 (10:09 -0400)]
[InstCombine] add/adjust tests for signbit tests; NFC

Additonal coverage for D127903.

2 years ago[InstCombine] add baseline tests for signbit cmp folds; NFC
Eric Gullufsen [Sun, 19 Jun 2022 13:03:28 +0000 (09:03 -0400)]
[InstCombine] add baseline tests for signbit cmp folds; NFC

D127903 / issue #55988

2 years ago[X86] Remove isTargetShuffleSplat and just use SelectionDAG::isSplatValue
Simon Pilgrim [Sun, 19 Jun 2022 10:22:57 +0000 (11:22 +0100)]
[X86] Remove isTargetShuffleSplat and just use SelectionDAG::isSplatValue

shuffle(splat(x)) -> splat(x), it doesn't have to be a target specific broadcast

2 years ago[lld] Use value_or instead of getValueOr (NFC)
Kazu Hirata [Sun, 19 Jun 2022 07:29:41 +0000 (00:29 -0700)]
[lld] Use value_or instead of getValueOr (NFC)

2 years ago[AST] Fix an unused variable warning
Kazu Hirata [Sun, 19 Jun 2022 07:20:58 +0000 (00:20 -0700)]
[AST] Fix an unused variable warning

This paptch fixes:

  warning: unused variable ‘DD’ [-Wunused-variable]

2 years ago[clang-tools-extra] Use value_or instead of getValueOr (NFC)
Kazu Hirata [Sun, 19 Jun 2022 07:13:38 +0000 (00:13 -0700)]
[clang-tools-extra] Use value_or instead of getValueOr (NFC)

2 years ago[clang] Use value_or instead of getValueOr (NFC)
Kazu Hirata [Sun, 19 Jun 2022 06:21:34 +0000 (23:21 -0700)]
[clang] Use value_or instead of getValueOr (NFC)

2 years ago[Driver][Gnu] Don't passs --dynamic-linker in -r mode
Fangrui Song [Sun, 19 Jun 2022 06:13:19 +0000 (23:13 -0700)]
[Driver][Gnu] Don't passs --dynamic-linker in -r mode

No behavior change as GNU ld/gold/ld.lld ignore --dynamic-linker in -r mode.
This change makes the intention clearer as we already suppress --dynamic-linker
for -shared, -static, and -static-pie.

2 years ago[llvm] Use value_or instead of getValueOr (NFC)
Kazu Hirata [Sun, 19 Jun 2022 06:07:11 +0000 (23:07 -0700)]
[llvm] Use value_or instead of getValueOr (NFC)

2 years ago[test][GlobalOpt] Update precommitted test
Arthur Eubanks [Sun, 19 Jun 2022 04:58:16 +0000 (21:58 -0700)]
[test][GlobalOpt] Update precommitted test

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