Commit Graph

408606 Commits

Author SHA1 Message Date
Kazu Hirata bfc8f76e60 [X86] Remove unused declaration getTileStoreShape (NFC) 2021-12-31 16:06:19 -08:00
Kazu Hirata f8f5f1b3a4 [Hexagon] Use range-based for loops (NFC) 2021-12-31 15:17:25 -08:00
Nuno Lopes 120b93e1a8 fix test so it doesn't use nonnull assumes on non-pointers
The IR verifier should probably catch this. Alive2 did, though.
2021-12-31 23:08:45 +00:00
Kazu Hirata 813f00835d [CodeGen] Remove unused forward declarations (NFC) 2021-12-31 14:10:30 -08:00
Kazu Hirata 732e8968a8 [Scalar] Remove a redundant declaration (NFC)
InitializePasses.h contains the proper declaration.

Identified with readability-redundant-declaration.
2021-12-31 14:02:29 -08:00
Kazu Hirata e47a224ccf [clang-tidy] Use nullptr instead of 0 or NULL (NFC)
Identified with modernize-use-nullptr.
2021-12-31 13:54:34 -08:00
Sanjay Patel c054402170 [InstSimplify] fold or-nand-xor
~(A & B) | (A ^ B) --> ~(A & B)

https://alive2.llvm.org/ce/z/hXQucg
2021-12-31 15:11:13 -05:00
Sanjay Patel 3bf2373d19 [InstSimplify] add tests for or-nand-xor; NFC 2021-12-31 15:11:13 -05:00
John Ericson 5c3347aa8b [flang] Use `GNUInstallDirs` to support custom installation dirs.
Extracted from D99484. My new plan is to start from the outside and work
inward.

Reviewed By: stephenneuendorffer

Differential Revision: https://reviews.llvm.org/D115569
2021-12-31 18:58:35 +00:00
John Ericson 896537048d [lld][CMake] Use `GNUInstallDirs` to support custom installation dirs
Extracted from D99484. My new plan is to start from the outside and work
inward.

Reviewed By: stephenneuendorffer

Differential Revision: https://reviews.llvm.org/D115568
2021-12-31 18:57:57 +00:00
Kazu Hirata 255ee643a8 [clang-tools-extra] Remove unused using (NFC)
Identified by misc-unused-using-decls.
2021-12-31 10:51:10 -08:00
Kazu Hirata 5ee769296e [Analysis] Remove unused forward declarations (NFC) 2021-12-31 10:25:16 -08:00
Simon Tatham d50072f74e [ARM] Introduce an empty "armv8.8-a" architecture.
This is the first commit in a series that implements support for
"armv8.8-a" architecture. This should contain all the necessary
boilerplate to make the 8.8-A architecture exist from LLVM and Clang's
point of view: it adds the new arch as a subtarget feature, a definition
in TargetParser, a name on the command line, an appropriate set of
predefined macros, and adds appropriate tests. The new architecture name
is supported in both AArch32 and AArch64.

However, in this commit, no actual _functionality_ is added as part of
the new architecture. If you specify -march=armv8.8a, the compiler
will accept it and set the right predefines, but generate no code any
differently.

Differential Revision: https://reviews.llvm.org/D115694
2021-12-31 16:43:53 +00:00
Paul Walker b8db442513 [NFC][SVE] Minor reorder of some AArch64ISD nodes and ISel patterns. 2021-12-31 15:18:40 +00:00
Florian Hahn e2f1c4c706
[LV] Turn check for unexpected VF into assertion (NFC).
VF should always be non-zero in widenIntOrFpInduction. Turn check into
assertion.
2021-12-31 13:19:03 +00:00
Random 2edcde00cb [MIPS] Add -mfix4300 flag to enable vr4300 mulmul bugfix pass
Early revisions of the VR4300 have a hardware bug where two consecutive
multiplications can produce an incorrect result in the second multiply.
This revision adds the `-mfix4300` flag to llvm (and clang) which, when
passed, provides a software fix for this issue.

More precise description of the "mulmul" bug:
```
mul.[s,d] fd,fs,ft
mul.[s,d] fd,fs,ft  or  [D]MULT[U] rs,rt
```

When the above sequence is executed by the CPU, if at least one of the
source operands of the first mul instruction happens to be `sNaN`, `0`
or `Infinity`, then the second mul instruction may produce an incorrect
result. This can happen both if the two mul instructions are next to each
other and if the first one is in a delay slot and the second is the first
instruction of the branch target.

Description of the fix:
This fix adds a backend pass to llvm which scans for mul instructions in
each basic block and inserts a nop whenever the following conditions are
met:

 - The current instruction is a single or double-precision floating-point
   mul instruction.
 - The next instruction is either a mul instruction (any kind) or a branch
   instruction.

Differential Revision: https://reviews.llvm.org/D116238
2021-12-31 15:59:44 +03:00
Jay Foad 866b195cb9 [AMDGPU] Regenerate checks for waitcnt-overflow.mir 2021-12-31 11:27:15 +00:00
Pavel Labath 249a5fb005 [lldb/qemu] Support setting arg0 of the debugged program
Just what it says on the box.
2021-12-31 10:57:35 +01:00
Craig Topper 6f45fe9851 [RISCV] Use MxListW instead of MxList[0-5]. NFC
Better to use the named list instead of assuming the size of MxList.
2021-12-31 00:22:55 -08:00
Craig Topper 8811a87e8c [RISCV] Use defvar to simplify some code. NFC
Rather than wrapping a def around a list, we can just make a defvar
of the list.
2021-12-30 23:48:39 -08:00
wangpc 41454ab256 [RISCV] Use constant pool for large integers
For large integers (for example, magic numbers generated by
TargetLowering::BuildSDIV when dividing by constant), we may
need about 4~8 instructions to build them.
In the same time, it just takes two instructions to load
constants (with extra cycles to access memory), so it may be
profitable to put these integers into constant pool.

Reviewed By: asb, craig.topper

Differential Revision: https://reviews.llvm.org/D114950
2021-12-31 14:48:48 +08:00
jacquesguan 05f82dc877 [RISCV] Fix incorrect cases of vmv.s.f in the VSETVLI insert pass.
Fix incorrect cases of vmv.s.f and add test cases for it.

Differential Revision: https://reviews.llvm.org/D116432
2021-12-31 14:17:03 +08:00
Stella Laurenzo 5cd0b817e2 [mlir] Allow IntegerAttr to parse zero width integers.
https://reviews.llvm.org/D109555 added support to APInt for this, so the special case to disable it is no longer valid. It is in fact legal to construct these programmatically today, and they print properly but do not parse.

Justification: zero bit integers arise naturally in various bit reduction optimization problems, and having them defined for MLIR reduces special casing.

I think there is a solid case for i0 and ui0 being supported. I'm less convinced about si0 and opted to just allow the parser to round-trip values that already verify. The counter argument is that the proper singular value for an si0 is -1. But the counter to this counter is that the sign bit is N-1, which does not exist for si0 and it is not unreasonable to consider this non-existent bit to be 0. Various sources consider it having the singular value "0" to be the least surprising.

Reviewed By: lattner

Differential Revision: https://reviews.llvm.org/D116413
2021-12-30 20:33:00 -08:00
Alexandre Ganea 7cd109b92c [asan] Additionnal prologue decoding for WinSDK 10.0.22000
Fixes interception of atoi() entry point.
2021-12-30 20:11:45 -05:00
Sam McCall 09f8315bba [Sema] a[x] has type T when a has type T* or T[], even when T is dependent
This more precise type is useful for tools, e.g.
fixes https://github.com/clangd/clangd/issues/831

Differential Revision: https://reviews.llvm.org/D107275
2021-12-31 01:30:39 +01:00
Fangrui Song ed67d5a03a [ELF] Switch cNamedSections to SmallVector. NFC
Make it smaller
2021-12-30 16:08:26 -08:00
Craig Topper 7d659c6ac7 [LegalizeIntegerTypes] Rename NewLHS/NewRHS arguments to DAGTypeLegalizer::PromoteSetCCOperands. NFC
The 'New' only makes sense in the context of these being
output arguments, but they are also used as inputs first.
Drop the 'New' and just call them LHS/RHS.

Factored out of D116421.
2021-12-30 15:31:43 -08:00
Ellis Hoag a699b2f1c0 [InstrProf] Mark counters as used in debug correlation mode
In debug info correlation mode we do not emit the data globals so we
need to explicitly mark the counter globals as used so they don't get
stripped.

Reviewed By: kyulee

Differential Revision: https://reviews.llvm.org/D115981
2021-12-30 14:50:45 -08:00
MaheshRavishankar 59442a5460 [mlir][Linalg] Change signature of `get(Parallel/Reduce/Window)Dims` method.
These method currently takes a SmallVector<AffineExpr> & as an
argument to return the dims as AffineExpr. This creation of
AffineExpr objects is unnecessary.

Differential Revision: https://reviews.llvm.org/D116422
2021-12-30 14:02:15 -08:00
Fangrui Song 441de75f69 [lld][docs] Update _templates/indexsidebar.html after Bugzilla->GitHub issue migration 2021-12-30 13:34:45 -08:00
Alexey Bataev e0efedd2c3 [SLP][NFC]Fix non-determinism in reordering, NFC.
Need to clear CurrentOrder order mask if it is determined that
extractelements form identity order and need to use a vector-like
construct when iterating over ordered entries in the reorderTopToBottom
function.
2021-12-30 13:10:25 -08:00
Krzysztof Parzyszek db83e3e507 [Hexagon] Generate HVX/FP arithmetic instructions
Co-authored-by: Anirudh Sundar Subramaniam <quic_sanirudh@quicinc.com>
Co-authored-by: Sumanth Gundapaneni <sgundapa@quicinc.com>
Co-authored-by: Joshua Herrera <joshherr@quicinc.com>
2021-12-30 12:47:30 -08:00
Louis Dionne ee8e81b40e [libc++][NFC] Fix incorrect synopsis in transform_view test 2021-12-30 15:43:27 -05:00
Mogball 4943cda398 [mlir][arith] fixing dependencies on memref/arith 2021-12-30 20:39:22 +00:00
Krzysztof Parzyszek 9e6afbedb0 [Hexagon] Generate HVX/FP compare instructions
Co-authored-by: Anirudh Sundar Subramaniam <quic_sanirudh@quicinc.com>
2021-12-30 12:17:22 -08:00
Fangrui Song dabac5feec [ELF][LTO] Cache symbol table of lazy BitcodeFile
Similar to D62188: a BitcodeFile's symbol table may be iterated twice, once in
--start-lib (lazy) state, and once in the non-lazy state. This patch
makes `parseLazy` save `symbols[i]` so that the non-lazy state does not need to
re-insert to the global symbol table. Avoiding a redundant `saver.save` may save
memory.

`Maximum resident set size (kbytes)` for a large --thinlto-index-only link:

* without the patch: 10164000
* with the patch: 10095716 (0.6% decrease)

Note: we can remove `saver.save` if `BitcodeCompiler::add` does not transfer the ownership
of `f.obj` in `checkError(ltoObj->add(std::move(f.obj), resols));`.

Reviewed By: tejohnson

Differential Revision: https://reviews.llvm.org/D116390
2021-12-30 12:03:29 -08:00
Craig Topper 15787ccd45 [RISCV] Add support for STRICT_LRINT/LLRINT/LROUND/LLROUND. Tests for other strict intrinsics.
This patch adds isel support for STRICT_LRINT/LLRINT/LROUND/LLROUND.

It also adds test cases for f32 and f64 constrained intrinsics that
correspond to the intrinsics in float-intrinsics.ll and
double-intrinsics.ll. Support for promoting the integer argument of
STRICT_FPOWI was added.

I've skipped adding tests for f16 intrinsics, since we don't have libcalls
for them and we have inconsistent support for promoting them in LegalizeDAG.
This will need to be examined more closely.

Reviewed By: asb

Differential Revision: https://reviews.llvm.org/D116323
2021-12-30 11:54:32 -08:00
Fangrui Song 95c25fd52a [Bazel] Make mlir:MemRefOpsTdFiles depend on :ArithmeticOpsTdFiles 2021-12-30 11:47:54 -08:00
long.chen d295dd10f2 [MLIR] Add explicit `using` to disambiguate between multiple implementations from base classes (NFC)
Both of DenseElementsAttr and ElementsAttrTrait define the method of
getElementType, this commit makes it available on
DenseIntOrFPElementsAttr and DenseStringElementsAttr.

Reviewed By: mehdi_amini

Differential Revision: https://reviews.llvm.org/D116389
2021-12-30 19:47:33 +00:00
Benjamin Kramer 4683ce2cd8 [InferAttrs] Give strnlen the same attributes as strlen
This moves the only string function out of the big list of math funcs.
And let's us CSE strnlen calls.
2021-12-30 20:43:43 +01:00
Fangrui Song a96fe1bf3b [ELF][LTO] Call madvise(MADV_DONTNEED) on MemoryBuffer instances
@tejohnson noticed that freeing MemoryBuffer instances right before
`lto->compile` can save RSS, likely because the memory can be reused by
LTO indexing (e.g. ThinLTO import/export lists).).

For ELFFileBase instances, symbol and section names are backed by MemoryBuffer,
so destroying MemoryBuffer would make some infrequent passes (parseSymbolVersion,
reportBackrefs) crash and make debugging difficult.
For a BitcodeFile, its content is completely unused, but destroying its
MemoryBuffer makes the buffer identifier inaccessible and may introduce
constraints for future changes.
This patch leverages madvise(MADV_DONTNEED) which achieves the major gain
without the latent issues.

`Maximum resident set size (kbytes): ` for a large --thinlto-index-only link:

* current behavior: 10146104KiB
* destroy MemoryBuffer instances: 8555240KiB
* madvise(MADV_DONTNEED) just bitcodeFiles  and lazyBitcodeFiles: 8737372KiB
* madvise(MADV_DONTNEED) all MemoryBuffers: 8739796KiB  (16% decrease)

Depends on D116366

Reviewed By: tejohnson

Differential Revision: https://reviews.llvm.org/D116367
2021-12-30 11:36:58 -08:00
William S. Moses a6a583dae4 [MLIR] Move AtomicRMW into MemRef dialect and enum into Arith
Per the discussion in https://reviews.llvm.org/D116345 it makes sense
to move AtomicRMWOp out of the standard dialect. This was accentuated by the
need to add a fold op with a memref::cast. The only dialect
that would permit this is the memref dialect (keeping it in the standard dialect
or moving it to the arithmetic dialect would require those dialects to have a
dependency on the memref dialect, which breaks linking).

As the AtomicRMWKind enum is used throughout, this has been moved to Arith.

Reviewed By: Mogball

Differential Revision: https://reviews.llvm.org/D116392
2021-12-30 14:31:33 -05:00
Jack Andersen 9d37d0ea34 [Support] Expand `<CFGDIR>` as the base directory in configuration files.
Extends response file expansion to recognize `<CFGDIR>` and expand to the
current file's directory. This makes it much easier to author clang config
files rooted in portable, potentially not-installed SDK directories.

A typical use case may be something like the following:

```
# sample_sdk.cfg
--target=sample
-isystem <CFGDIR>/include
-L <CFGDIR>/lib
-T <CFGDIR>/ldscripts/link.ld
```

Reviewed By: sepavloff

Differential Revision: https://reviews.llvm.org/D115604
2021-12-30 13:43:47 -05:00
Fangrui Song 890e8c8f7e [Support] Add MemoryBuffer::dontNeedIfMmap
On *NIX systems, this API calls madvise(MADV_DONTNEED) on read-only file mappings.
It should not be used on a writable buffer.
The API is used to implement ld.lld LTO memory saving trick (D116367).

Note: on read-only file mappings, Linux's MADV_DONTNEED semantics match POSIX
POSIX_MADV_DONTNEED and BSD systems' MADV_DONTNEED.

On Windows, VirtualAllocEx MEM_COMMIT/MEM_RESET have similar semantics
but are unfortunately not drop-in replacements. dontNeedIfMmap is currently a no-op.

Reviewed By: aganea

Differential Revision: https://reviews.llvm.org/D116366
2021-12-30 10:42:28 -08:00
Fangrui Song 25ff448aac [docs][llvm-profdata] Prefer double-dash long options
To match the `--help` message and most other utilities.

While here, change `option:: -output=output` to `option:: --output=<output>` and
omit the value name for the short options (convention of other utilities).

Reviewed By: snehasish

Differential Revision: https://reviews.llvm.org/D116353
2021-12-30 10:37:17 -08:00
Krzysztof Parzyszek e107374e40 [Hexagon] Explicitly use integer types when rescaling a mask 2021-12-30 10:14:00 -08:00
Krzysztof Parzyszek eb574259b6 [Hexagon] Handle HVX/FP {masked,wide} loads/stores
Co-authored-by: Rahul Utkoor <quic_rutkoor@quicinc.com>
Co-authored-by: Anirudh Sundar Subramaniam <quic_sanirudh@quicinc.com>
2021-12-30 10:14:00 -08:00
Luís Ferreira 8792cd75d0 Revert "[lld] Add support for other demanglers other than Itanium"
This reverts commit e60d6dfd5a.

clang-ppc64le-rhel buildbot failed (https://lab.llvm.org/buildbot#builders/57/builds/13424):

    tools/lld/MachO/CMakeFiles/lldMachO.dir/Symbols.cpp.o: In function `lld::demangle(llvm::StringRef, bool)':
    Symbols.cpp:(.text._ZN3lld8demangleEN4llvm9StringRefEb[_ZN3lld8demangleEN4llvm9StringRefEb]+0x90): undefined reference to `llvm::demangle(std::string const&)'
2021-12-30 18:04:21 +00:00
Krzysztof Parzyszek cd997689f2 [Hexagon] Fix isTypeForHVX to recognize floating point types
Co-authored-by: Sumanth Gundapaneni <sgundapa@quicinc.com>
2021-12-30 10:01:05 -08:00
Jacques Pienaar 4a8cef157b [mlir] Change SCF/Complex to prefixed (NFC)
See
https://llvm.discourse.group/t/psa-ods-generated-accessors-will-change-to-have-a-get-prefix-update-you-apis/4476
2021-12-30 09:57:51 -08:00