platform/upstream/llvm.git
2 years ago[X86] Fold ZERO_EXTEND_VECTOR_INREG(BUILD_VECTOR(X,Y,?,?)) -> BUILD_VECTOR(X,0,Y,0)
Simon Pilgrim [Sun, 6 Feb 2022 12:53:11 +0000 (12:53 +0000)]
[X86] Fold ZERO_EXTEND_VECTOR_INREG(BUILD_VECTOR(X,Y,?,?)) -> BUILD_VECTOR(X,0,Y,0)

Helps avoid some unnecessary shift by splat amount extensions before shuffle combining gets limited by with one use checks

2 years ago[ELF] Fix crash when an input is incompatible with a lazy object file
Fangrui Song [Sun, 6 Feb 2022 07:34:14 +0000 (23:34 -0800)]
[ELF] Fix crash when an input is incompatible with a lazy object file

The diagnostic is concise. It is ok because the case is rare.

2 years ago[mlir] Do not use an empty source file when building aggregate libraries.
Stella Laurenzo [Sun, 6 Feb 2022 06:04:19 +0000 (22:04 -0800)]
[mlir] Do not use an empty source file when building aggregate libraries.

See discussion: https://discourse.llvm.org/t/check-mlir-times-examples-standalone-testing-time/6073/7

It turns out that it has been legal since CMake 3.11 to omit sources at library creation time if they are added later via target_sources, as is done here. This side-steps the issue of having a file that changes and invalidates the build of leaves.

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

2 years ago[SampleFDO] Enable FSAFDO loading passes if --enable-fs-discriminator is enabled
Rong Xu [Fri, 4 Feb 2022 20:23:47 +0000 (12:23 -0800)]
[SampleFDO] Enable FSAFDO loading passes if --enable-fs-discriminator is enabled

FSAFDO profile loader is currently disabled even --enable-fs-discriminator is enabled.
They need to be turned on by options which makes it cumbersome for experiments.

This patch changes the FSAFDO profile loader enabled by default.  Since they are
guarded by EnableFSDiscriminator, they will only be turned on if
--enable-fs-discriminator is enabled. Note that --enable-fs-discriminator is
still disabled by default.

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

2 years ago[Transforms] Use default member initialization in SCEVFindUnsafe (NFC)
Kazu Hirata [Sun, 6 Feb 2022 05:39:27 +0000 (21:39 -0800)]
[Transforms] Use default member initialization in SCEVFindUnsafe (NFC)

2 years ago[Transforms] Use default member initialization in AAIsDeadCallSiteReturned (NFC)
Kazu Hirata [Sun, 6 Feb 2022 05:39:25 +0000 (21:39 -0800)]
[Transforms] Use default member initialization in AAIsDeadCallSiteReturned (NFC)

2 years ago[Transforms] Use default member initialization in TruncInstCombine (NFC)
Kazu Hirata [Sun, 6 Feb 2022 05:39:23 +0000 (21:39 -0800)]
[Transforms] Use default member initialization in TruncInstCombine (NFC)

2 years ago[Transforms] Use default member initialization in MaskOps (NFC)
Kazu Hirata [Sun, 6 Feb 2022 05:39:21 +0000 (21:39 -0800)]
[Transforms] Use default member initialization in MaskOps (NFC)

2 years ago[Transforms] Use default member initialization in EscapeEnumerator (NFC)
Kazu Hirata [Sun, 6 Feb 2022 05:39:19 +0000 (21:39 -0800)]
[Transforms] Use default member initialization in EscapeEnumerator (NFC)

2 years ago[IR] Use default member initialization in PMDataManager (NFC)
Kazu Hirata [Sun, 6 Feb 2022 05:39:17 +0000 (21:39 -0800)]
[IR] Use default member initialization in PMDataManager (NFC)

2 years ago[RISCV] Add signext test for llvm.abs.i32 for rv64 Zbb.
Craig Topper [Sat, 5 Feb 2022 21:54:38 +0000 (13:54 -0800)]
[RISCV] Add signext test for llvm.abs.i32 for rv64 Zbb.

This shows that we don't preserve sign bits across the
abs expansion, but I think we could if we used negw+max.

2 years ago[ELF] SharedFile::parse: move verdefIndex assignment outside of ctor. NFC
Fangrui Song [Sun, 6 Feb 2022 04:43:51 +0000 (20:43 -0800)]
[ELF] SharedFile::parse: move verdefIndex assignment outside of ctor. NFC

SharedSymbol::SharedSymbol initializes verdefIndex and Symbol::replace
copies verdefIndex.

By move verdefIndex assignment outside of ctor, Symbol::replace can be changed
to not copy verdefIndex. This can be used to decrease work for for
ObjKind/BitcodeKind.

2 years agoAMDGPU: Don't clobber source register for V_SET_INACTIVE_*
Ruiling Song [Mon, 17 Jan 2022 06:54:38 +0000 (14:54 +0800)]
AMDGPU: Don't clobber source register for V_SET_INACTIVE_*

The WWM register has unmodeled register liveness, For v_set_inactive_*,
clobberring source register is dangerous because it will overwrite the
inactive lanes. When the source vgpr is dead at v_set_inactive_lane,
the inactive lanes may be not really dead. This may make common
optimizations doing wrong.

For example in a simple if-then cfg in Machine IR:
bb.if:
  %src =

bb.then:
  %src1 = COPY %src
  %dst = V_SET_INACTIVE %src1(tied-def 0), %inactive

bb.end
  ... = PHI [0, %bb.then] [%src, %bb.if]

The register coalescer will think it is safe to optimize "%src1 = COPY %src"
in bb.then. And at the same time, there is no interference for the PHI in
bb.end. The source and destination values of the PHI will be assigned
the same register. The single PHI register will be overwritten by the
v_set_inactive, then we would get wrong value in bb.end.

With this change, we will copy the content of the source register before
setting inactive lanes after register allocation. Yes, this will sacrifice
the WWM code generation a little, but I don't have any better idea to do things
correctly.

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

2 years agoAMDGPU: add test to show wwm register overwrite issue
Ruiling Song [Tue, 18 Jan 2022 00:29:10 +0000 (08:29 +0800)]
AMDGPU: add test to show wwm register overwrite issue

Pre-commit the test to make the diff easy to read later.

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

2 years ago[clang-format][docs] Fix incorrect 'clang-format 14' option markers
Krystian Kuzniarek [Sun, 6 Feb 2022 03:51:53 +0000 (19:51 -0800)]
[clang-format][docs] Fix incorrect 'clang-format 14' option markers

Introduced by 23a5090c6, some style option markers indicated 'clang-format 14',
though their respective options were available in earlier releases.

Note: Even though the value type of 'SpacesInAngles' option changed,
this option has been already present since version 3.4.

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

2 years ago[ELF] Symbol::replace: use the old nameData/nameSize. NFC
Fangrui Song [Sun, 6 Feb 2022 00:34:02 +0000 (16:34 -0800)]
[ELF] Symbol::replace: use the old nameData/nameSize. NFC

Currently `this->getName() == newSym.getName()`.
By keeping the old nameData/nameSize, newSym's nameData/nameSize will be
ignored. The call sites can avoid calling getName().

printTraceSymbol needs to take the symbol name since `other`'s name is empty.

2 years agofix module build failure
Adrian Prantl [Sun, 6 Feb 2022 00:27:47 +0000 (16:27 -0800)]
fix module build failure

2 years agofix module build failure
Adrian Prantl [Sun, 6 Feb 2022 00:23:12 +0000 (16:23 -0800)]
fix module build failure

2 years agofix module build failure
Adrian Prantl [Sun, 6 Feb 2022 00:20:15 +0000 (16:20 -0800)]
fix module build failure

2 years ago[Support] Use default member initialization in ScopedPrinter (NFC)
Kazu Hirata [Sun, 6 Feb 2022 00:29:28 +0000 (16:29 -0800)]
[Support] Use default member initialization in ScopedPrinter (NFC)

2 years ago[IR] Use default member initialization in GlobalObject (NFC)
Kazu Hirata [Sun, 6 Feb 2022 00:29:26 +0000 (16:29 -0800)]
[IR] Use default member initialization in GlobalObject (NFC)

2 years ago[ADT] Use default member initialization in OptionalStorage (NFC)
Kazu Hirata [Sun, 6 Feb 2022 00:29:24 +0000 (16:29 -0800)]
[ADT] Use default member initialization in OptionalStorage (NFC)

2 years ago[Transforms] Use default member initialization in SimplifyIndvar (NFC)
Kazu Hirata [Sun, 6 Feb 2022 00:29:22 +0000 (16:29 -0800)]
[Transforms] Use default member initialization in SimplifyIndvar (NFC)

2 years ago[ADT] Use default member initialization in DebugEpochBase (NFC)
Kazu Hirata [Sun, 6 Feb 2022 00:29:20 +0000 (16:29 -0800)]
[ADT] Use default member initialization in DebugEpochBase (NFC)

2 years ago[MC] Use default member initialization in WasmCustomSection (NFC)
Kazu Hirata [Sun, 6 Feb 2022 00:29:18 +0000 (16:29 -0800)]
[MC] Use default member initialization in WasmCustomSection (NFC)

2 years ago[SLP] Skip a DenseSet<unsigned> -> bit vector conversion. NFCI.
Benjamin Kramer [Sat, 5 Feb 2022 23:48:05 +0000 (00:48 +0100)]
[SLP] Skip a DenseSet<unsigned> -> bit vector conversion. NFCI.

2 years ago[ELF] Don't access other eSym members it st_shndx == SHN_UNDEF. NFC
Fangrui Song [Sat, 5 Feb 2022 23:25:23 +0000 (15:25 -0800)]
[ELF] Don't access other eSym members it st_shndx == SHN_UNDEF. NFC

2 years ago[ELF] De-template reportUndefinedSymbols. NFC
Fangrui Song [Sat, 5 Feb 2022 23:03:55 +0000 (15:03 -0800)]
[ELF] De-template reportUndefinedSymbols. NFC

My x86-64 lld executable is 16KiB smaller.

2 years agoRevert "Disable TestLldbGdbServer on Dwarf2 and clang versions below 14"
Adrian Prantl [Sat, 5 Feb 2022 22:54:41 +0000 (14:54 -0800)]
Revert "Disable TestLldbGdbServer on Dwarf2 and clang versions below 14"

This reverts commit 867fdec1945df3c1031d3cefdc97903131a3482b.

2 years agoRevert "Fixed typos in TestLldbGdbServer.py"
Adrian Prantl [Sat, 5 Feb 2022 22:54:37 +0000 (14:54 -0800)]
Revert "Fixed typos in TestLldbGdbServer.py"

This reverts commit cf93a085754e221f73a2877c946dcb2beb6039d7.

2 years ago[ELF] Move Symbol::needsTlsLd to config->needsTlsLd. NFC
Fangrui Song [Sat, 5 Feb 2022 22:40:15 +0000 (14:40 -0800)]
[ELF] Move Symbol::needsTlsLd to config->needsTlsLd. NFC

to decrease sizeof(SymbolUnion) from 72 to 64 on ELF64 platforms.

2 years agoSimplify mask creation with llvm::seq. NFCI.
Benjamin Kramer [Sat, 5 Feb 2022 22:33:06 +0000 (23:33 +0100)]
Simplify mask creation with llvm::seq. NFCI.

2 years ago[HIPSPV] Fix literals are mapped to Generic address space
Yaxun (Sam) Liu [Fri, 4 Feb 2022 23:18:14 +0000 (18:18 -0500)]
[HIPSPV] Fix literals are mapped to Generic address space

This issue is an oversight in D108621.

Literals in HIP are emitted as global constant variables with default
address space which maps to Generic address space for HIPSPV. In
SPIR-V such variables translate to OpVariable instructions with
Generic storage class which are not legal. Fix by mapping literals
to CrossWorkGroup address space.

The literals are not mapped to UniformConstant because the “flat”
pointers in HIP may reference them and “flat” pointers are modeled
as Generic pointers in SPIR-V. In SPIR-V/OpenCL UniformConstant
pointers may not be casted to Generic.

Patch by: Henry Linjamäki

Reviewed by: Yaxun Liu

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

2 years ago[ELF] Reorder Symbol members to improve access locality. NFC
Fangrui Song [Sat, 5 Feb 2022 22:11:37 +0000 (14:11 -0800)]
[ELF] Reorder Symbol members to improve access locality. NFC

* partition and isPreemptible are frequently used. Move it to the front
* move used beside isUsedInRegularObj. They are similar and accessed together in .symtab finalizing
* move auxIdx/dynsymIndex/verdefIndex to the end.

This decreases code size.

2 years ago[libunwind] [sparc] Add SPARCv9 support
Koakuma [Sat, 5 Feb 2022 21:08:26 +0000 (13:08 -0800)]
[libunwind] [sparc] Add SPARCv9 support

Adds libunwind support for SPARCv9 (aka sparc64). This is a rebase of @kettenis' patch D32450, which I created (with his permission) because the original review has become inactive.
The changes are of a cosmetic nature to make it fit better with the new code style, and to reuse the existing SPARCv8 code, whenever possible.

Please let me know if I posted this on the wrong place. Also, the summary of the original review is reproduced below:

> This adds unwinder support for 64-bit SPARC (aka SPARCv9). The implementation was done on OpenBSD/sparc64, so it takes StackGhost into account:
>
> https://www.usenix.org/legacy/publications/library/proceedings/sec01/full_papers/frantzen/frantzen_html/index.html
>
> Since StackGhost xor's return addresses with a random cookie before storing them on the stack, the unwinder has to do some extra work to recover those. This is done by introducing a new kRegisterInCFADecrypt "location" type that is used to implement the DW_CFA_GNU_window_save opcode. That implementation is SPARC-specific, but should work for 32-bit SPARC as well. DW_CFA_GNU_window_save is only ever generated on SPARC as far as I know.

Co-authored-by: Mark Kettenis
Reviewed By: #libunwind, thesamesam, MaskRay, Arfrever

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

2 years ago[libunwind] Attempt to fix broken sphinx doc link
Simon Pilgrim [Sat, 5 Feb 2022 21:03:51 +0000 (21:03 +0000)]
[libunwind] Attempt to fix broken sphinx doc link

bbce75e352be0637305a1b59ac5eca7175bceece replaced `LLVM Bugzilla` with `LLVM bug tracker`

2 years agoRevert "[RISCV] Fold (sext_inreg (fmv_x_anyexth X), i16) -> (fmv_x_signexth X)."
Craig Topper [Sat, 5 Feb 2022 20:51:01 +0000 (12:51 -0800)]
Revert "[RISCV] Fold (sext_inreg (fmv_x_anyexth X), i16) -> (fmv_x_signexth X)."

This reverts commit 673d68cd923a9daa5065b929453bf4a4b8d39650.

This hadn't been reviewed yet.

2 years ago[RISCV] Add more tests for rotate idioms. Add more RUN lines. NFC
Craig Topper [Sat, 5 Feb 2022 20:39:23 +0000 (12:39 -0800)]
[RISCV] Add more tests for rotate idioms. Add more RUN lines. NFC

We were only testing rotate idioms on rv32i. DAGCombiner won't
form ISD::ROTL/ROTR unless those operations are Legal or Custom.
They aren't for rv32 so we were only testing shift lowering.

This commit adds i64 idioms and the idioms that mask the shift
amount to avoid UB for a rotate of 0. I've added riscv64 and Zbb
RUN lines to show that we do match rotate for XLen types when
available. We currently miss i32 on rv64izbb.

2 years ago[RISCV] Fold (sext_inreg (fmv_x_anyexth X), i16) -> (fmv_x_signexth X).
Craig Topper [Fri, 4 Feb 2022 07:28:47 +0000 (23:28 -0800)]
[RISCV] Fold (sext_inreg (fmv_x_anyexth X), i16) -> (fmv_x_signexth X).

Add a new ISD opcode to represent the sign extending behavior of
vmv.x.h. Keep the previous anyext opcode to allow the existing
(fmv_x_anyexth (fmv_h_x X)) combine to keep working without needing
to generate a sign extend.

For fmv.x.w we are able to match the sext_inreg in an isel pattern,
but a 16-bit sext_inreg is lowered to a shift pair before isel. This
seemed like a larger match than we should do in isel.

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

2 years ago[ELF] Merge canInline into scriptDefined
Fangrui Song [Sat, 5 Feb 2022 20:00:34 +0000 (12:00 -0800)]
[ELF] Merge canInline into scriptDefined

They perform similar tasks and are essentially the same after
d28c26bbdd9e6e55cc0a6156e9879f7e0ca36329.

2 years ago[llvm-remark-size-diff] Don't use enum name as auto variable name
Simon Pilgrim [Sat, 5 Feb 2022 19:30:03 +0000 (19:30 +0000)]
[llvm-remark-size-diff] Don't use enum name as auto variable name

This was confusing the clang-cmake-x86_64-avx2-linux buildbot (gcc version 5.4.0).

2 years ago[ELF] Simplify shouldKeepInSymtab after Symbol::used is false by default. NFC
Fangrui Song [Sat, 5 Feb 2022 19:21:44 +0000 (11:21 -0800)]
[ELF] Simplify shouldKeepInSymtab after Symbol::used is false by default. NFC

2 years ago[ELF] Simplify includeInSymtab. NFC
Fangrui Song [Sat, 5 Feb 2022 19:18:08 +0000 (11:18 -0800)]
[ELF] Simplify includeInSymtab. NFC

2 years ago[ELF] Refactor how Symbol::used is set. NFC
Fangrui Song [Sat, 5 Feb 2022 19:09:39 +0000 (11:09 -0800)]
[ELF] Refactor how Symbol::used is set. NFC

2 years ago[X86] Add some better common check-prefixes to slow-pmulld.ll
Simon Pilgrim [Sat, 5 Feb 2022 18:56:38 +0000 (18:56 +0000)]
[X86] Add some better common check-prefixes to slow-pmulld.ll

Try to reduce at least some of the duplication

2 years ago[ELF] Refactor how exportDynamic is set. NFC
Fangrui Song [Sat, 5 Feb 2022 18:25:25 +0000 (10:25 -0800)]
[ELF] Refactor how exportDynamic is set. NFC

2 years ago[ELF] --wrap: don't copy exportDynamic
Fangrui Song [Sat, 5 Feb 2022 17:56:29 +0000 (09:56 -0800)]
[ELF] --wrap: don't copy exportDynamic

For -no-pie/-pie, when `__real_foo` is interposable in a shared object, `foo` is
exported. This rule does not match GNU ld and is unneeded because:

* the exported `foo` does not interpose `__real_foo` at run-time
* the similar `__wrap_foo` <-> `foo` relation does not have the rule

2 years ago[lldb] Use mangled symbol name to look for __asan::AsanDie()
Jonas Devlieghere [Sat, 5 Feb 2022 17:48:14 +0000 (09:48 -0800)]
[lldb] Use mangled symbol name to look for __asan::AsanDie()

After aed965d we no longer demangle full symbol names while indexing the
symbol table which means we have to use the mangled name instead of the
demangled name to find the symbol for __asan::AsanDie().

This fixes the following two tests:

  lldb-api :: functionalities/asan/TestMemoryHistory.py
  lldb-api :: functionalities/asan/TestReportData.py

2 years ago[PowerPC] Fix SSE translation on FreeBSD
Piotr Kubaj [Sat, 5 Feb 2022 17:13:42 +0000 (01:13 +0800)]
[PowerPC] Fix SSE translation on FreeBSD

This patch drops throws specifier in posix_memalign declaration because
that's different between glibc and other libc, and Clang has a hack.

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

2 years ago[InstCombine] Add PR34063 test coverage
Simon Pilgrim [Sat, 5 Feb 2022 15:21:51 +0000 (15:21 +0000)]
[InstCombine] Add PR34063 test coverage

2 years ago[InstCombine] SimplifyDemandedBits - mul(x,x) - if only demand bit[1] then fold to...
Sanjay Patel [Sat, 5 Feb 2022 14:05:21 +0000 (09:05 -0500)]
[InstCombine] SimplifyDemandedBits - mul(x,x) - if only demand bit[1] then fold to zero

This is a translation of the fold added to codegen with:
2d1390efbe61

Part of solving issue #48027

2 years ago[libc++] Add Unstable ABI CI run
Nikolas Klauser [Sat, 5 Feb 2022 13:09:45 +0000 (14:09 +0100)]
[libc++] Add Unstable ABI CI run

Reviewed By: ldionne, #libc, Mordante

Spies: mgorny, Mordante, libcxx-commits, arichardson

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

2 years ago[DAGCombiner] Fold vecreduce_or/and if operand is insert_subvector.
Sander de Smalen [Sat, 5 Feb 2022 14:07:44 +0000 (14:07 +0000)]
[DAGCombiner] Fold vecreduce_or/and if operand is insert_subvector.

Fold:
  vecreduce_or(insert_subvec(zeroinitializer, vec))
  -> vecreduce_or(vec)

  vecreduce_and(insert_subvec(allones, vec))
  -> vecreduce_and(vec)

  vecreduce_and/or(insert_subvec(undef, vec))
  -> vecreduce_and/or(vec)

This is useful for SVE which uses insert/extract subvector
to convert fixed-width to/from scalable vectors.

Reviewed By: bsmith

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

2 years ago[ConstraintElimination] Add test with trivially false condition in and.
Florian Hahn [Sat, 5 Feb 2022 14:17:07 +0000 (14:17 +0000)]
[ConstraintElimination] Add test with trivially false condition in and.

2 years ago[MLIR][Presburger] MaybeLocalRepr: add explicit bool() for convenience
Arjun P [Wed, 2 Feb 2022 15:01:22 +0000 (20:31 +0530)]
[MLIR][Presburger] MaybeLocalRepr: add explicit bool() for convenience

This also slightly simplifies some code.

Reviewed By: Groverkss

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

2 years ago[clang] added allocsize attribute to allocation functions
Dávid Bolvanský [Sat, 5 Feb 2022 13:26:17 +0000 (14:26 +0100)]
[clang] added allocsize attribute to allocation functions

2 years ago[MLIR][Presburger][NFC] Use getters for IntegerPolyhedron members
Groverkss [Sat, 5 Feb 2022 12:38:08 +0000 (18:08 +0530)]
[MLIR][Presburger][NFC] Use getters for IntegerPolyhedron members

This patch makes IntegerPolyhedron and derived classes use of getters to access
IntegerPolyhedron space information (`numIds, numDims, numSymbols`) instead of
directly accessing them.

This patch makes it easier to change the underlying implementation of the way
identifiers are stored, making it easier to extend/modify existing implementation.

Reviewed By: arjunp

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

2 years ago[AIX][PowerPC][PGO] Generate .ref for some PGO sections
Wael Yehia [Sat, 5 Feb 2022 05:08:21 +0000 (00:08 -0500)]
[AIX][PowerPC][PGO] Generate .ref for some PGO sections

For PGO on AIX, when we switch to the linux-style PGO variable access
(via _start and _stop labels), we need the compiler to generate a .ref
assembly for each of the three csects:

 -   __llvm_prf_data[RW]
 -   __llvm_prf_names[RO]
 -   __llvm_prf_vnds[RW]

We insert the .ref inside the __llvm_prf_cnts[RW] csect so that if it's
live then the 3 csects are live.

For example, for a testcase with at least one function definition, when
compiled with -fprofile-generate we should generate:

        .csect __llvm_prf_cnts[RW],3
        .ref __llvm_prf_data[RW]   <<============ needs to be inserted
        .ref __llvm_prf_names[RO]  <<===========

the __llvm_prf_vnds is not always present, so we reference it only when
it's present.

Reviewed By: sfertile, daltenty

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

2 years ago[libc++] __config cleanup; _LIBCPP_ABI_UNSTABLE should set _LIBCPP_ABI_VERSION
Nikolas Klauser [Fri, 4 Feb 2022 13:28:19 +0000 (14:28 +0100)]
[libc++] __config cleanup; _LIBCPP_ABI_UNSTABLE should set _LIBCPP_ABI_VERSION

Some `__config` cleanup and `_LIBCPP_ABI_UNSTABLE` should set `_LIBCPP_ABI_VERSION`, since the latest ABI version //is// the unstable ABI.

Reviewed By: ldionne, #libc

Spies: libcxx-commits

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

2 years ago[clang] added alloc allign attr to memalign
Dávid Bolvanský [Sat, 5 Feb 2022 10:44:32 +0000 (11:44 +0100)]
[clang] added alloc allign attr to memalign

2 years ago[ELF] Allow STV_PROTECTED shared definition to set exportDynamic
Fangrui Song [Sat, 5 Feb 2022 09:10:43 +0000 (01:10 -0800)]
[ELF] Allow STV_PROTECTED shared definition to set exportDynamic

A STV_PROTECTED shared definition does not set exportDynamic of a defined
symbol. This is on the basis that a protected definition cannot be preempted so
the export is unnecessary. However, the condition is imperfect because we don't
know whether the shared object was built with a symbolic option. Since dropping
the condition simplifies code and matches GNU ld, let's do it.

2 years agoIncrease memory buffer for scanning objc classes on darwin systems
Jason Molenda [Sat, 5 Feb 2022 07:53:27 +0000 (23:53 -0800)]
Increase memory buffer for scanning objc classes on darwin systems

iOS systems are getting near this limit; double itfrom a 150kb
buffer to a 300kb buffer, which is freed after processing the
list of classes.

rdar://88454594
Differential Revision: https://reviews.llvm.org/D118972

2 years ago[RISCV] Remove a ComputeNumSignBits call from an isel special case.
Craig Topper [Sat, 5 Feb 2022 07:16:36 +0000 (23:16 -0800)]
[RISCV] Remove a ComputeNumSignBits call from an isel special case.

Only isel (and (srl (sexti32 Y), c2), c1) -> (srliw (sraiw Y, 31), c3 - 32)
when there is a sext_inreg present. Don't both checking for Y
having 32 sign bits.

2 years ago[MLIR][Presburger][NFC] Fix clang-tidy warnings
Groverkss [Sat, 5 Feb 2022 06:25:09 +0000 (11:55 +0530)]
[MLIR][Presburger][NFC] Fix clang-tidy warnings

This patch changes variable naming to lowerCamelCase to remove
clang-tidy warning in Presburger/Utils.cpp.

2 years agogithub: Fix automated PR creation for backports
Tom Stellard [Sat, 5 Feb 2022 06:22:01 +0000 (22:22 -0800)]
github: Fix automated PR creation for backports

GitHub Actions stores the token used for checking out a git repo in
the git configuration and then uses that token for pushes from that
repo too.  We need to use a different token for push because we
are pushing to the llvmbot/llvm-project repo and not the upstream repo,
so we need to disable persist-credentials when checking out the source.

2 years ago[NFC] Remove unnecessary #includes
Bill Wendling [Sat, 5 Feb 2022 05:16:20 +0000 (21:16 -0800)]
[NFC] Remove unnecessary #includes

An attempt to reduce the number of files that are recompiled due to a change.

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

2 years agoDon't assume that a new cleanup was added to InnermostEHScope.
James Y Knight [Sat, 5 Feb 2022 04:39:18 +0000 (23:39 -0500)]
Don't assume that a new cleanup was added to InnermostEHScope.

After fa87fa97fb79, this was no longer guaranteed to be the cleanup
just added by this code, if IsEHCleanup got disabled. Instead, use
stable_begin(), which _is_ guaranteed to be the cleanup just added.

This caused a crash when a object that is callee destroyed (e.g. with the MS ABI) was passed in a call from a noexcept function.

Added a test to verify.

Fixes: fa87fa97fb79

2 years ago[CSSPGO] Turn on ext-tsp by default for CSSPGO.
Hongtao Yu [Sat, 5 Feb 2022 01:17:35 +0000 (17:17 -0800)]
[CSSPGO] Turn on ext-tsp by default for CSSPGO.

I'm seeing ext-tsp helps CSSPGO for our intern large benchmarks so I'm turning on it for CSSPGO. For non-CS AutoFDO, ext-tsp doesn't seem to help, probably because of lower profile counts quality.

Reviewed By: wenlei

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

2 years ago[Driver] Default to -fno-math-errno for musl
Alex Xu (Hello71) [Sat, 5 Feb 2022 03:20:30 +0000 (19:20 -0800)]
[Driver] Default to -fno-math-errno for musl

musl does not set errno in math functions: https://wiki.musl-libc.org/mathematical-library.html, https://git.musl-libc.org/cgit/musl/tree/include/math.h?id=cfdfd5ea3ce14c6abf7fb22a531f3d99518b5a1b#n26.

Reviewed By: srhines, MaskRay

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

2 years ago[OpenMP] Add search path for llvm-strip
Kelvin Li [Sat, 5 Feb 2022 03:15:14 +0000 (22:15 -0500)]
[OpenMP] Add search path for llvm-strip

Add the build directory to the search path for llvm-strip instead
of solely relying on the PATH environment variable setting.

Reviewed By: jhuber6

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

2 years ago[X86] Introduce more common modern tunings into `generic`
Phoebe Wang [Sat, 5 Feb 2022 01:49:54 +0000 (09:49 +0800)]
[X86] Introduce more common modern tunings into `generic`

GCC has updated its generic `-mtune` to haswell. https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81616
Update it to match with GCC.

Reviewed By: spatel

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

2 years ago[ELF] Avoid wrapping unreferenced lazy symbols
Shoaib Meenai [Wed, 2 Feb 2022 07:59:50 +0000 (23:59 -0800)]
[ELF] Avoid wrapping unreferenced lazy symbols

There's a couple of motivations here:
* LLD 12 (which I was originally testing with) was adding an undefined
  symbol to the symbol table if you attempted to wrap an unreferenced
  lazy symbol, which would later break `--no-allow-shlib-undefined`. LLD
  on main actually produces a weak undefined symbol, so this doesn't
  break anyway, but it's cleaner to not have the weak undefined symbol
  as well. The new behavior also matches bfd and gold.
* PROVIDE in a linker script referencing a wrapped symbol would think
  that an otherwise-unreferenced lazy symbol which was wrapped was
  actually referenced, and therefore proceed with the definition, which
  goes against expectations. The new behavior also matches bfd and gold.

Reviewed By: MaskRay

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

2 years ago[test] Remove unnecessary require<> in LoopAccessAnalysis tests
Arthur Eubanks [Sat, 5 Feb 2022 02:02:48 +0000 (18:02 -0800)]
[test] Remove unnecessary require<> in LoopAccessAnalysis tests

These function analyses are always available in loop passes.

2 years ago[BOLT] Add nfc-check-setup script
Amir Ayupov [Sat, 5 Feb 2022 02:02:50 +0000 (18:02 -0800)]
[BOLT] Add nfc-check-setup script

Add the script to set up llvm-bolt-wrapper. The intended use is to run NFC
checks manually and automatically on a buildbot.

Reviewed By: rafauler

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

2 years ago[flang] Debugging of ACCESS='STREAM' I/O (take 2)
Peter Klausler [Fri, 28 Jan 2022 23:34:28 +0000 (15:34 -0800)]
[flang] Debugging of ACCESS='STREAM' I/O (take 2)

Corrects the runtime implementation of I/O on files with
the access mode ACCESS='STREAM'.  This is a collection
of edge-case tweaks to ensure that the distinctions between
stream and direct/sequential files, unformatted or formatted,
are respected where appropriate.

Moves NextInField() from io-stmt.h to io-stmt.cpp --
it was getting too big to keep in a header.

This patch exposed a problem with the I/O runtime
on Windows and it was reverted.  This version also
fixes that problem; files are now opened on Windows
in binary mode to prevent inadvertent insertions of
carriage returns before line feeds, and those line
endings (CR+LF) are now explicitly generated.

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

2 years ago[BOLT-UnitTests] Fix shared libraries build
Amir Ayupov [Fri, 4 Feb 2022 23:04:01 +0000 (15:04 -0800)]
[BOLT-UnitTests] Fix shared libraries build

Fix build with `-DBUILD_SHARED_LIBS=ON` (add explicit deps).

Reviewed By: yota9

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

2 years ago[gn build] Port 679f8a885b65
LLVM GN Syncbot [Sat, 5 Feb 2022 01:52:05 +0000 (01:52 +0000)]
[gn build] Port 679f8a885b65

2 years ago[OpenMP] Change amdgcn to amdgpu in device library handling
Joseph Huber [Sat, 5 Feb 2022 01:44:06 +0000 (20:44 -0500)]
[OpenMP] Change amdgcn to amdgpu in device library handling

Summary:
The name of the AMDGPU device library was changes. Previously it was
called 'libomptarget-amdgcn'. This patch changes fixes the tests to use
the new name of the library and adds a new flag with the same name.

2 years ago[Debuginfod][test] Fix debuginfod.test to use %python instead of python after D112759
Fangrui Song [Sat, 5 Feb 2022 01:32:00 +0000 (17:32 -0800)]
[Debuginfod][test] Fix debuginfod.test to use %python instead of python after D112759

2 years ago[Debuginfod] Fix curl_easy_init in -DLLVM_ENABLE_ASSERTIONS=off build after D112753
Fangrui Song [Sat, 5 Feb 2022 01:29:19 +0000 (17:29 -0800)]
[Debuginfod] Fix curl_easy_init in -DLLVM_ENABLE_ASSERTIONS=off build after D112753

2 years ago[RISCV] Remove exclusions for zext.h/zext.w from our (and (srl X, C1), C2) selection...
Craig Topper [Sat, 5 Feb 2022 01:10:43 +0000 (17:10 -0800)]
[RISCV] Remove exclusions for zext.h/zext.w from our (and (srl X, C1), C2) selection code.

This code tries to replace the pattern with a pair of shifts, but
we were excluding if the And could be a zext.h or zext.w. The SLLI/SRL
pair is more compressible and doesn't come with much down side.

We do regress one test case in rv64i-exhaustive-w-insts.ll but we
can probably add a narrower exclusion for that case.

2 years agoReland [SimplifyCFG] `markAliveBlocks()`: recognize that normal dest of `invoke`d...
Roman Lebedev [Fri, 4 Feb 2022 23:39:22 +0000 (02:39 +0300)]
Reland [SimplifyCFG] `markAliveBlocks()`: recognize that normal dest of `invoke`d `noreturn` function is `unreachable`

As per LangRef's definition of `noreturn` attribute:
```
noreturn
  This function attribute indicates that the function never returns
  normally, hence through a return instruction.
  This produces undefined behavior at runtime if the function
  ever does dynamically return. nnotated functions may still
  raise an exception, i.a., nounwind is not implied.
```

So if we `invoke` a `noreturn` function, and the normal destination
of an invoke is not an `unreachable`, point it at the new `unreachable`
block.

The change/fix from the original commit is that we now actually create
the new block, and don't just repurpose the original block,
because said normal destination block could have other users.

This reverts commit db1176ce66cf276b45ac3b90ea6b5ce62de56be7,
relanding commit 598833c987593ce192fa827f162cae8c867c9d43.

2 years ago[NFC][SimplifyCFG] Add test w/ shared normal dest of a `noreturn` `invoke`d function
Roman Lebedev [Fri, 4 Feb 2022 23:38:48 +0000 (02:38 +0300)]
[NFC][SimplifyCFG] Add test w/ shared normal dest of a `noreturn` `invoke`d function

2 years ago[BOLT][NFC] Fix compiler warnings
Amir Ayupov [Tue, 1 Feb 2022 06:07:46 +0000 (22:07 -0800)]
[BOLT][NFC] Fix compiler warnings

Summary:
- variable 'TotalSize' set but not used
- variable 'TotalCallsTopN' set but not used
- use of bitwise '|' with boolean operands

Reviewed By: maksfb

FBD33911129

2 years ago[mlir][NFC] Fully qualify call to `mlir::success` in auto generated C++
Markus Böck [Fri, 4 Feb 2022 23:40:04 +0000 (00:40 +0100)]
[mlir][NFC] Fully qualify call to `mlir::success` in auto generated C++

2 years agoRevert "[SimplifyCFG] `markAliveBlocks()`: recognize that normal dest of `invoke...
Roman Lebedev [Fri, 4 Feb 2022 23:29:28 +0000 (02:29 +0300)]
Revert "[SimplifyCFG] `markAliveBlocks()`: recognize that normal dest of `invoke`d `noreturn` function is `unreachable`"

The normal destination may have other uses.

This reverts commit 598833c987593ce192fa827f162cae8c867c9d43.

2 years ago[mlir] Add canonicalizer to merge shape.assuming_all ops
Eugene Zhulenev [Fri, 4 Feb 2022 19:31:59 +0000 (11:31 -0800)]
[mlir] Add canonicalizer to merge shape.assuming_all ops

Depends On D119021

Reviewed By: frgossen

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

2 years ago[SimplifyCFG] `markAliveBlocks()`: recognize that normal dest of `invoke`d `noreturn...
Roman Lebedev [Fri, 4 Feb 2022 22:28:24 +0000 (01:28 +0300)]
[SimplifyCFG] `markAliveBlocks()`: recognize that normal dest of `invoke`d `noreturn` function is `unreachable`

As per LangRef's definition of `noreturn` attribute:
```
noreturn
  This function attribute indicates that the function never returns
  normally, hence through a return instruction.
  This produces undefined behavior at runtime if the function
  ever does dynamically return. nnotated functions may still
  raise an exception, i.a., nounwind is not implied.
```

2 years ago[NFC][SimplifyCFG] Add test showing failure to drop normal dest of noreturn invoke
Roman Lebedev [Fri, 4 Feb 2022 22:27:05 +0000 (01:27 +0300)]
[NFC][SimplifyCFG] Add test showing failure to drop normal dest of noreturn invoke

2 years ago[NFC][InstCombine] `visitCallInst()`: make comment more understandable
Roman Lebedev [Fri, 4 Feb 2022 22:03:39 +0000 (01:03 +0300)]
[NFC][InstCombine] `visitCallInst()`: make comment more understandable

2 years ago[NFC][SimplifyCFG] 'merge compatible invokes': tests for non-`unreachable` normal...
Roman Lebedev [Fri, 4 Feb 2022 21:26:01 +0000 (00:26 +0300)]
[NFC][SimplifyCFG] 'merge compatible invokes': tests for non-`unreachable` normal destination

2 years ago[ELF] Support R_PPC_NONE/R_PPC64_NONE in getImplicitAddend
Fangrui Song [Fri, 4 Feb 2022 23:13:37 +0000 (15:13 -0800)]
[ELF] Support R_PPC_NONE/R_PPC64_NONE in getImplicitAddend

Similar to f457863ae345d2635026501f5383e0e625869639

2 years ago[yaml2obj] Support R_PPC_* relocation types
Fangrui Song [Fri, 4 Feb 2022 23:11:50 +0000 (15:11 -0800)]
[yaml2obj] Support R_PPC_* relocation types

2 years agoRevert "[clangd] Properly compute framework-style include spelling"
David Goldman [Fri, 4 Feb 2022 22:57:11 +0000 (17:57 -0500)]
Revert "[clangd] Properly compute framework-style include spelling"

This reverts commit 4dfd11324eb05d167392958c0f0f273cae6386c6
due to the failures on Linux CI:
https://lab.llvm.org/buildbot/#/builders/188/builds/9296

2 years ago[GlobalISel] Don't combine instructions which are fed by memory instructions using...
Róbert Ágoston [Fri, 4 Feb 2022 22:46:27 +0000 (14:46 -0800)]
[GlobalISel] Don't combine instructions which are fed by memory instructions using different size

Memory instructions like extending loads from the same address are not equal if
their size is not equal.

This fixes https://github.com/llvm/llvm-project/issues/53524.

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

2 years ago[OpenMP] Emit remark on the captured call instead of the variable
Joseph Huber [Fri, 4 Feb 2022 21:54:59 +0000 (16:54 -0500)]
[OpenMP] Emit remark on the captured call instead of the variable

Changes the remark to emit on the function call that captures the globalized
variable instead of the globalized variable itself. The user should be able to
see which variable it was in the argument list of the function.

Reviewed By: jdoerfert

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

2 years agoAttempt forward fix after 4dfd113
David Goldman [Fri, 4 Feb 2022 22:47:38 +0000 (17:47 -0500)]
Attempt forward fix after 4dfd113

If this doesn't work will just revert the change,
can't seem to repro on macOS.

2 years ago[mlir:NFC] Move BaseOpWithOffsetSizesAndStrides out of OpBase.td
River Riddle [Fri, 4 Feb 2022 20:57:28 +0000 (12:57 -0800)]
[mlir:NFC] Move BaseOpWithOffsetSizesAndStrides out of OpBase.td

This is not a general construct, and shouldn't have been defined in OpBase.
This moves a copy to both MemRefOps+TensorOps, which are the only
users.

2 years agoAMDGPU/GlobalISel: Fix assertions on invalid addrspacecasts
Matt Arsenault [Thu, 27 Jan 2022 01:20:29 +0000 (20:20 -0500)]
AMDGPU/GlobalISel: Fix assertions on invalid addrspacecasts

Fixes some assert on invalid situations and starts directly emitting
the error.

2 years ago[libc++][Docker] Don't actually start using a newer compiler in the CI
Louis Dionne [Fri, 4 Feb 2022 22:12:38 +0000 (17:12 -0500)]
[libc++][Docker] Don't actually start using a newer compiler in the CI

To ensure a smooth transition without breaking CI, we should use explicitly
versioned Clangs in the CI jobs definition instead, since that's a change
we can actually test in the CI.

So instead of bumping the compiler version from the Docker image, use
the same version as before by default, and we can bump it from the CI
job definition once all the nodes are running the new image.