413887 Commits

Author SHA1 Message Date
Kazu Hirata
31d72f0e45 [Transforms] Use default member initialization in TruncInstCombine (NFC) 2022-02-05 21:39:23 -08:00
Kazu Hirata
9ed6800ef9 [Transforms] Use default member initialization in MaskOps (NFC) 2022-02-05 21:39:21 -08:00
Kazu Hirata
a867f32c5f [Transforms] Use default member initialization in EscapeEnumerator (NFC) 2022-02-05 21:39:19 -08:00
Kazu Hirata
bd5b279af0 [IR] Use default member initialization in PMDataManager (NFC) 2022-02-05 21:39:17 -08:00
Craig Topper
f3a725af43 [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.
2022-02-05 21:26:47 -08:00
Fangrui Song
5ad2aae244 [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.
2022-02-05 20:43:51 -08:00
Ruiling Song
0719c43735 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
2022-02-06 12:38:26 +08:00
Ruiling Song
2f4d44bcd4 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
2022-02-06 12:38:26 +08:00
Krystian Kuzniarek
6cd0015e78 [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
2022-02-05 20:04:39 -08:00
Fangrui Song
977a1a523c [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.
2022-02-05 16:34:02 -08:00
Adrian Prantl
c5699c6eb7 fix module build failure 2022-02-05 16:30:39 -08:00
Adrian Prantl
511fa14ce3 fix module build failure 2022-02-05 16:30:38 -08:00
Adrian Prantl
607c589048 fix module build failure 2022-02-05 16:30:38 -08:00
Kazu Hirata
7ae64e598a [Support] Use default member initialization in ScopedPrinter (NFC) 2022-02-05 16:29:28 -08:00
Kazu Hirata
1569252774 [IR] Use default member initialization in GlobalObject (NFC) 2022-02-05 16:29:26 -08:00
Kazu Hirata
f072603685 [ADT] Use default member initialization in OptionalStorage (NFC) 2022-02-05 16:29:24 -08:00
Kazu Hirata
e24384b506 [Transforms] Use default member initialization in SimplifyIndvar (NFC) 2022-02-05 16:29:22 -08:00
Kazu Hirata
d0f52ff12a [ADT] Use default member initialization in DebugEpochBase (NFC) 2022-02-05 16:29:20 -08:00
Kazu Hirata
70fc36d8ed [MC] Use default member initialization in WasmCustomSection (NFC) 2022-02-05 16:29:19 -08:00
Benjamin Kramer
ce9417348e [SLP] Skip a DenseSet<unsigned> -> bit vector conversion. NFCI. 2022-02-06 00:57:47 +01:00
Fangrui Song
50460b8004 [ELF] Don't access other eSym members it st_shndx == SHN_UNDEF. NFC 2022-02-05 15:25:23 -08:00
Fangrui Song
9af90e205a [ELF] De-template reportUndefinedSymbols. NFC
My x86-64 lld executable is 16KiB smaller.
2022-02-05 15:03:56 -08:00
Adrian Prantl
11d64edbf9 Revert "Disable TestLldbGdbServer on Dwarf2 and clang versions below 14"
This reverts commit 867fdec1945df3c1031d3cefdc97903131a3482b.
2022-02-05 14:54:41 -08:00
Adrian Prantl
a701dc8eda Revert "Fixed typos in TestLldbGdbServer.py"
This reverts commit cf93a085754e221f73a2877c946dcb2beb6039d7.
2022-02-05 14:54:37 -08:00
Fangrui Song
f9e3ca542e [ELF] Move Symbol::needsTlsLd to config->needsTlsLd. NFC
to decrease sizeof(SymbolUnion) from 72 to 64 on ELF64 platforms.
2022-02-05 14:40:15 -08:00
Benjamin Kramer
a40dc4eaf8 Simplify mask creation with llvm::seq. NFCI. 2022-02-05 23:35:41 +01:00
Yaxun (Sam) Liu
171da443d5 [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
2022-02-05 17:26:52 -05:00
Fangrui Song
73f55fba76 [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.
2022-02-05 14:11:37 -08:00
Koakuma
2b9554b885 [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
2022-02-05 13:08:26 -08:00
Simon Pilgrim
527654dceb [libunwind] Attempt to fix broken sphinx doc link
bbce75e352be0637305a1b59ac5eca7175bceece replaced `LLVM Bugzilla` with `LLVM bug tracker`
2022-02-05 21:05:01 +00:00
Craig Topper
c1cef111a3 Revert "[RISCV] Fold (sext_inreg (fmv_x_anyexth X), i16) -> (fmv_x_signexth X)."
This reverts commit 673d68cd923a9daa5065b929453bf4a4b8d39650.

This hadn't been reviewed yet.
2022-02-05 12:51:01 -08:00
Craig Topper
d1899da3a2 [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.
2022-02-05 12:48:22 -08:00
Craig Topper
673d68cd92 [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
2022-02-05 12:42:12 -08:00
Fangrui Song
7c675923c7 [ELF] Merge canInline into scriptDefined
They perform similar tasks and are essentially the same after
d28c26bbdd9e6e55cc0a6156e9879f7e0ca36329.
2022-02-05 12:00:34 -08:00
Simon Pilgrim
eb9ac2cc14 [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).
2022-02-05 19:30:10 +00:00
Fangrui Song
764cd491b1 [ELF] Simplify shouldKeepInSymtab after Symbol::used is false by default. NFC 2022-02-05 11:21:44 -08:00
Fangrui Song
38e6361d84 [ELF] Simplify includeInSymtab. NFC 2022-02-05 11:18:08 -08:00
Fangrui Song
bb4eacdb70 [ELF] Refactor how Symbol::used is set. NFC 2022-02-05 11:09:40 -08:00
Simon Pilgrim
6daaf5a449 [X86] Add some better common check-prefixes to slow-pmulld.ll
Try to reduce at least some of the duplication
2022-02-05 18:56:38 +00:00
Fangrui Song
ac2911e738 [ELF] Refactor how exportDynamic is set. NFC 2022-02-05 10:25:25 -08:00
Fangrui Song
7288b85cc8 [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
2022-02-05 09:56:29 -08:00
Jonas Devlieghere
ef3fade14b [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
2022-02-05 09:50:31 -08:00
Piotr Kubaj
f2f4080c10 [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
2022-02-06 01:20:31 +08:00
Simon Pilgrim
4f97aa7e1d [InstCombine] Add PR34063 test coverage 2022-02-05 15:22:13 +00:00
Sanjay Patel
5372160a18 [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
2022-02-05 09:51:38 -05:00
Nikolas Klauser
5488021f3e [libc++] Add Unstable ABI CI run
Reviewed By: ldionne, #libc, Mordante

Spies: mgorny, Mordante, libcxx-commits, arichardson

Differential Revision: https://reviews.llvm.org/D118725
2022-02-05 15:37:22 +01:00
Sander de Smalen
6452549f30 [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
2022-02-05 14:35:53 +00:00
Florian Hahn
bec1aa3069
[ConstraintElimination] Add test with trivially false condition in and. 2022-02-05 14:17:08 +00:00
Arjun P
8a98c3e07f [MLIR][Presburger] MaybeLocalRepr: add explicit bool() for convenience
This also slightly simplifies some code.

Reviewed By: Groverkss

Differential Revision: https://reviews.llvm.org/D118790
2022-02-05 19:33:01 +05:30
Dávid Bolvanský
7119f76c47 [clang] added allocsize attribute to allocation functions 2022-02-05 14:26:35 +01:00