Commit Graph

431542 Commits

Author SHA1 Message Date
Phoebe Wang aafac4e265 [X86][FP16] Regenerate test cases. NFC. 2022-07-30 13:13:21 +08:00
Kazu Hirata e4f63cd0f7 [llvm] Use is_contained (NFC) 2022-07-29 21:18:44 -07:00
Kazu Hirata 873888c179 Use is_sorted (NFC) 2022-07-29 21:18:42 -07:00
Kazu Hirata e5a1ccbf25 Use value instead of getValue (NFC) 2022-07-29 21:18:41 -07:00
Kazu Hirata a948117088 [clang] Use has_value instead of value (NFC) 2022-07-29 21:18:39 -07:00
Emmmer f473558647 [LLDB][RISCV] Add DWARF Registers
According to [RISC-V DWARF Specification](https://github.com/riscv-non-isa/riscv-elf-psabi-doc/blob/master/riscv-dwarf.adoc) add RISCV DWARF Registers.

Don't worry about the difference between riscv32 and riscv64, they just have different bytes of registers.

Reviewed By: DavidSpickett

Differential Revision: https://reviews.llvm.org/D130686
2022-07-30 12:05:55 +08:00
Siva Chandra Reddy 12df3080fe [libc] Compile integration tests with -ffreestanding to avoid mixup with system libc. 2022-07-30 03:06:08 +00:00
Weverything fb7fa27f92 Preserve qualifiers when getting fully qualified type
15f3cd6bfc moved the handling of UsingType
to a later point in the function getFullyQualifiedType.  This moved it
after the removal of an ElaboratedType and its qualifiers.  However,
the qualifiers were not added back, causing the fully qualified type to
have a qualifier mismatch with the original type.  Make sure the
qualifers are added before continuing to fully qualify the type.
2022-07-29 19:42:54 -07:00
Carl Ritson 4c4db81630 [AMDGPU] Extend SILoadStoreOptimizer to s_load instructions
Apply merging to s_load as is done for s_buffer_load.

Reviewed By: foad

Differential Revision: https://reviews.llvm.org/D130742
2022-07-30 11:38:39 +09:00
Alexander Shaposhnikov d982f1e0c6 [InstCombine] Refactor foldICmpMulConstant
This is a follow-up to 2ebfda2417
(replace "if" with "else if" since the cases nuw/nsw
were meant to be handled separately).

Test plan:
1/ ninja check-llvm check-clang check-lld
2/ Bootstrapped LLVM/Clang pass tests
2022-07-30 02:29:15 +00:00
Shafik Yaghmour a0d6105162 [Clang] Fix handling of Max from getValueRange(...) in IntExprEvaluator::VisitCastExpr(...)
This is a follow-up to D130058 to fix how we handle the Max value we obtain from
getValueRange(...) in IntExprEvaluator::VisitCastExpr(...) which in the case of
an enum that contains an enumerator with the max integer value will overflow by
one.

The fix is to decrement the value of Max and use slt and ult for comparison Vs
sle and ule.`

Differential Revision: https://reviews.llvm.org/D130811
2022-07-29 19:17:42 -07:00
Aiden Grossman afb4efd3bc Fix lack of cc1 flag in llvmcmd sections when assertions are enabled
Currently when assertions are enabled, the cc1 flag is not
inserted into the llvmcmd section of object files with embedded
bitcode. This deviates from the normal behavior where this is
the first flag that is inserted. This error stems from incorrect
use of the function generateCC1CommandLine() which requires
manually adding in the -cc1 flag which is currently not done.

Reviewed By: jansvoboda11

Differential Revision: https://reviews.llvm.org/D130620
2022-07-29 18:51:48 -07:00
Uday Bondhugula 995e9d84f8 [MLIR] Fix getCommonBlock utility in affine analysis
Fix the hardcoded check for `FuncOp` in `getCommonBlock` utility: the
check should have been for an op that starts an affine scope. The
incorrect block returned in turn causes dependence analysis to function
incorrectly.

This change allows affine store-load forwarding to work correctly inside
any ops that start an affine scope.

Reviewed By: ftynse, dcaballe

Differential Revision: https://reviews.llvm.org/D130749
2022-07-30 07:14:54 +05:30
Phoebe Wang b17c89d151 Revert "[compiler-rt] [builtins] Detect _Float16 support at compile time"
This reverts commit ce6d40f5c2.

Revert due to it broke the sanitizer-windows buildbot: https://lab.llvm.org/buildbot/#/builders/127/builds/33583/steps/4/logs/stdio
2022-07-30 09:41:33 +08:00
Tue Ly 2ff187fbc9 [libc] Implement cosf function that is correctly rounded to all rounding modes.
Implement cosf function that is correctly rounded to all rounding
modes.

Performance benchmark using perf tool from CORE-MATH project

(https://gitlab.inria.fr/core-math/core-math/-/tree/master) on Ryzen 1700:
Before this patch (not correctly rounded):
```
$ CORE_MATH_PERF_MODE="rdtsc" ./perf.sh cosf
CORE-MATH reciprocal throughput   : 19.043
System LIBC reciprocal throughput : 26.328
LIBC reciprocal throughput        : 30.955

$ CORE_MATH_PERF_MODE="rdtsc" ./perf.sh cosf --latency
GNU libc version: 2.31
GNU libc release: stable
CORE-MATH latency   : 49.995
System LIBC latency : 59.286
LIBC latency        : 60.174

```
After this patch (correctly rounded):
```
$ CORE_MATH_PERF_MODE="rdtsc" ./perf.sh cosf
GNU libc version: 2.31
GNU libc release: stable
CORE-MATH reciprocal throughput   : 19.072
System LIBC reciprocal throughput : 26.286
LIBC reciprocal throughput        : 13.631

$ CORE_MATH_PERF_MODE="rdtsc" ./perf.sh cosf --latency
GNU libc version: 2.31
GNU libc release: stable
CORE-MATH latency   : 49.872
System LIBC latency : 59.468
LIBC latency        : 56.119
```

Reviewed By: orex, zimmermann6

Differential Revision: https://reviews.llvm.org/D130644
2022-07-29 21:08:31 -04:00
Naje George 6ee9e25fd9 [flang] Add semantics test for EVENT WAIT statement
Reviewed By: ktras

Differential Revision: https://reviews.llvm.org/D130608
2022-07-29 17:14:04 -07:00
Fangrui Song d6d4f631ac [ELF] Move addDependentLibrary/handleSectionGroup. NFC
To reduce diff for my upcoming parallel input section initialization patch.
2022-07-29 17:07:09 -07:00
Anlun Xu c01e622120 [mlir][sparse]Add more test cases for sparse reshape
Add more test cases for sparse reshape

Reviewed By: Peiming

Differential Revision: https://reviews.llvm.org/D130603
2022-07-29 16:42:48 -07:00
Sunho Kim 32f59b34b6 [clang-repl] Add missing link component.
OrcJIT was missing in LLVM_LINK_COMPONENTS.
2022-07-30 08:00:15 +09:00
tlattner a140f43431 Update references to mailing lists that have moved to Discourse. 2022-07-29 15:55:38 -07:00
Fangrui Song ce6dd4e835 Revert D130458 "[llvm-objcopy] Support --{,de}compress-debug-sections for zstd"
This reverts commit c26dc2904b.

The new Zstd dispatch has an ongoing design discussion related to https://reviews.llvm.org/D130516#3688123 .
Revert for now before it is resolved.
2022-07-29 15:46:51 -07:00
Argyrios Kyrtzidis 944a86de7c [ASTWriter] Provide capability to output a PCM/PCH file that does not write out information about its output path
This is useful to enable sharing of the same PCH file even when it's intended for a different output path.

The only information this option disables writing is for `ORIGINAL_PCH_DIR` record which is treated as optional and (when present) used as fallback for resolving input file paths relative to it.

Differential Revision: https://reviews.llvm.org/D130710
2022-07-29 15:21:54 -07:00
Sunho Kim 65c9265f41 [clang-repl] Disable exectuion unitests on unsupported platform by lljit instance test.
The method used in 4191d661c7 was fragile because it didn't consider cross-platform builds and rely on enlisting unsupported targets. Uses the host-supports-jit mechanism to make an escape path. This should fix buildbot failures happening in upstream as well as out-of-tree.
2022-07-30 07:18:04 +09:00
Luís Marques 383bc7210e [RISCV] Precommit test for D123265
Differential Revision: https://reviews.llvm.org/D128562
2022-07-30 00:13:42 +02:00
Rafael Auler fc0ced73dc Add BAT testing framework
This patch refactors BAT to be testable as a library, so we
can have open-source tests on it. This further fixes an issue with
basic blocks that lack a valid input offset, making BAT omit those
when writing translation tables.

Test Plan: new testcases added, new testing tool added (llvm-bat-dump)

Differential Revision: https://reviews.llvm.org/D129382
2022-07-29 14:55:04 -07:00
Sanjay Patel d4940c0f3d [InstCombine] fix miscompile from urem/udiv transform with constant expression
The isa<Constant> check could misfire on an instruction with 2 constant
operands. This bug was introduced with bb789381fc (D36988).

See issue #56810 for a C source example that exposed the bug.
2022-07-29 17:14:30 -04:00
Craig Topper e637feee80 [RISCV] Add isel pattern for (setne/eq GPR, -2048)
For constants in the range [-2047, 2048] we use addi. If the constant
is -2048 we can use xori. If we don't match this explicitly, we'll
emit an LI for the -2048 followed by an XOR.
2022-07-29 14:07:38 -07:00
Sam Clegg b0f18af30b [lld][WebAssemby] Demote LazySymbols back to undefined symbols if they are not loaded
A LazySymbol is one that lives in `.a` archive and gets pulled in by a
strong reference.  However, weak references to such symbols do not
result in them be loaded from the archive.  In this case we want to
treat such symbols at undefined rather then lazy, once symbols
resolution is complete.

This fixes a crash bug in the linker when weakly referenced symbol that
lives in an archive file is live at the end of the link.  In the case of
dynamic linking this is expected to turn into an import with (in the
case of a function symbol) a function index.

Differential Revision: https://reviews.llvm.org/D130736
2022-07-29 13:53:54 -07:00
Sam Clegg 48129cf0ed [lld][WebAsssembly] Convert more tests from IR to assembly. NFC
Differential Revision: https://reviews.llvm.org/D130738
2022-07-29 13:52:52 -07:00
Sanjay Patel 2af4f1a479 [InstCombine] add tests for udiv/urem miscompile; NFC
See issue #56810
2022-07-29 16:35:04 -04:00
Sanjay Patel 33901acd4a [InstCombine] add test for icmp with zext-bool logic; NFC 2022-07-29 16:35:04 -04:00
Slava Gurevich f7c961cc6b [LLDB][NFC][Reliability] Fixes for int overflow and uninitialized state
Fixing potential int overflow and uninitialized variables.
These were found by Coverity static code inspection.

Differential Revision: https://reviews.llvm.org/D130795
2022-07-29 13:31:17 -07:00
Jay Foad 9436a85eb6 [IRBuilder] Make createCallHelper a member function. NFC.
This just avoids explicitly passing in 'this' as an argument in a bunch
of places.

Differential Revision: https://reviews.llvm.org/D130752
2022-07-29 21:17:26 +01:00
Jay Foad fe07161a18 [LangRef] Reduce depth of table of contents
The table of contents in the HTML version of this doc takes up 25 pages
(in my browser, on my 4K monitor) and is too long for me to navigate
comfortably. And most of it is irrelevant detail like this:

- Bitwise Binary Operations
  - 'shl' Instruction
    - Syntax:
    - Overview:
    - Arguments:
    - Semantics:
    - Example:
  - 'lshr' Instruction
    - Syntax:
    - Overview:
    - Arguments:
    - Semantics:
    - Example:

Reducing the contents depth from 4 to 3 removes most of this detail,
leaving just a list of instructions, which only takes up 7 pages and I
find it much easier to navigate.

Incidentally the depth was set to 3 when this document was first
converted to reST and was only increased to 4 in what looks like an
accidental change: 080133453b

Differential Revision: https://reviews.llvm.org/D130635
2022-07-29 21:15:00 +01:00
Sam Estep a6ddc68487 [clang][dataflow] Handle multiple context-sensitive calls to the same function
This patch enables context-sensitive analysis of multiple different calls to the same function (see the `ContextSensitiveSetBothTrueAndFalse` example in the `TransferTest` suite) by replacing the `Environment` copy-assignment with a call to the new `popCall` method, which  `std::move`s some fields but specifically does not move `DeclToLoc` and `ExprToLoc` from the callee back to the caller.

To enable this, the `StorageLocation` for a given parameter needs to be stable across different calls to the same function, so this patch also improves the modeling of parameter initialization, using `ReferenceValue` when necessary (for arguments passed by reference).

This approach explicitly does not work for recursive calls, because we currently only plan to use this context-sensitive machinery to support specialized analysis models we write, not analysis of arbitrary callees.

Reviewed By: ymandel, xazax.hun

Differential Revision: https://reviews.llvm.org/D130726
2022-07-29 19:40:19 +00:00
skc7 09c4121123 Revert "Revert "[Clang][Attribute] Introduce maybe_undef attribute for function arguments which accepts undef values""
This reverts commit 4e1fe96.

Reverting this commit and fix the tests that caused failures due to
a35c64c.
2022-07-29 19:07:07 +00:00
Dimitry Andric ce6d40f5c2 [compiler-rt] [builtins] Detect _Float16 support at compile time
Instead of detecting `_Float16` support at CMake configuration time,
detect it at compile time by checking for the predefined (by the
compiler) macro `__FLT16_MAX__` instead.

This solves the issue where compiler-rt is built simultaneously for both
x86_64 and i386 targets, and the CMake configuration uses x86_64
compilation to detect `_Float16` support, while it may not be supported
by the i386 target (if it does not have SSE2).

While here, rename `COMPILERT_RT_HAS_FLOAT16` to `CRT_HAS_FLOAT16`, to
conform more to the naming style used in `int_lib.h` and `int_types.h`.

Reviewed By: MaskRay

Differential Revision: https://reviews.llvm.org/D130718
2022-07-29 20:58:52 +02:00
Amy Kwan 4e1fe968c9 Revert "[Clang][Attribute] Introduce maybe_undef attribute for function arguments which accepts undef values"
This reverts commit a35c64ce23.

Reverting this commit as it causes various failures on LE and BE PPC bots.
2022-07-29 13:28:48 -05:00
Blue Gaston cea1b790f6 [TSan][Darwin] Additional TSAN test requiring weak symbol for dyld64
Tests require a weak symbol for dyld weak-def coalescing.

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

Adding additional weak attribute
2022-07-29 11:24:40 -07:00
Austin Kerbow 2c82a126d7 [AMDGPU] Omit unnecessary waitcnt before barriers
It is not necessary to wait for all outstanding memory operations before
barriers on hardware that can back off of the barrier in the event of an
exception when traps are enabled. Add a new subtarget feature which
tracks which HW has this ability.

Reviewed By: #amdgpu, rampitec

Differential Revision: https://reviews.llvm.org/D130722
2022-07-29 11:12:36 -07:00
Nico Weber 2063b5ed24 [gn build] (manually) port 507125af3d more 2022-07-29 14:06:10 -04:00
Nico Weber 72d0db596c [gn build] (manually) port 507125af3d 2022-07-29 14:03:32 -04:00
Fangrui Song 7430894a65 Replace Optional::hasValue with has_value or operator bool. NFC 2022-07-29 10:57:25 -07:00
Louis Dionne 507125af3d [libc++] Rename __libcpp_assertion_handler to __libcpp_verbose_abort
With the goal of reusing that handler to do other things besides
handling assertions (such as terminating when an exception is thrown
under -fno-exceptions), the name `__libcpp_assertion_handler` doesn't
really make sense anymore.

Furthermore, I didn't want to use the name `__libcpp_abort_handler`,
since that would give the impression that the handler is called
whenever `std::abort()` is called, which is not the case at all.

Differential Revision: https://reviews.llvm.org/D130562
2022-07-29 13:52:42 -04:00
Sunho Kim 4191d661c7 [clang-repl] Disable execution unittests on unsupported platforms.
After the intoduction of global destructor support, there is a possiblity to run invalid instructions in the destructor of Interpreter class. Completely disable tests in platforms with failing test cases.

Differential Revision: https://reviews.llvm.org/D130786
2022-07-30 02:28:03 +09:00
Aaron Ballman d8352abd3a Diagnose use of _Noreturn on a struct/union field
C99 6.7.4p2 clarifies that a function specifier can only be used in the
declaration of a function. _Noreturn is a function specifier, so it is
a constraint violation to write it on a structure or union field, but
we missed that case.

Fixes #56800
2022-07-29 13:18:44 -04:00
Tom Stellard b9a6629193 workflows: Pass phab token to github-automation.py when creating a pull request
The script needs this in order to automatically assign a reviewer.
2022-07-29 09:59:55 -07:00
Nico Weber 2681c9e065 [lld/mac] Comment changes requested on https://reviews.llvm.org/D130725
No behavior change.
2022-07-29 12:55:48 -04:00
Markus Böck 37da2a141c [mlir][LLVM] Rework the API of GEPOp
The implementation and API of GEP Op has gotten a bit convoluted over the time. Issues with it are:
* Misleading naming: `indices` actually only contains the dynamic indices, not all of them. To get the amount of indices you need to query the size of `structIndices`
* Very difficult to iterate over all indices properly: One had to iterate over `structIndices`, check whether it contains the magic constant `kDynamicIndex`, if it does, access the next value in `index` etc.
* Inconvenient to build: One either has create lots of constant ops for every index or have an odd split of passing both a `ValueRange` as well as a `ArrayRef<int32_t>` filled with `kDynamicIndex` at the correct places.
* Implementation doing verification in the build method
and more.

This patch attempts to address all these issues via convenience classes and reworking the way GEP Op works:
* Adds `GEPArg` class which is a sum type of a `int32_t` and `Value` and is used to have a single convenient easy to use `ArrayRef<GEPArg>` in the builders instead of the previous `ValueRange` + `ArrayRef<int32_t>` builders.
* Adds `GEPIndicesAdapter` which is a class used for easy random access and iteration over the indices of a GEP. It is generic and flexible enough to also instead return eg. a corresponding `Attribute` for an operand inside of `fold`.
*  Rename `structIndices` to `rawConstantIndices` and `indices` to `dynamicIndices`: `rawConstantIndices` signifies one shouldn't access it directly as it is encoded, and `dynamicIndices` is more accurate and also frees up the `indices` name.
* Add `getIndices` returning a `GEPIndicesAdapter` to easily iterate over the GEP Ops indices.
* Move the verification/asserts out of the build method and into the `verify` method emitting op error messages.
* Add convenient builder methods making use of `GEPArg`.
* Add canonicalizer turning dynamic indices with constant values into constant indices to have a canonical representation.

The only breaking change is for any users building GEPOps that have so far used the old `ValueRange` + `ArrayRef<int32_t>` builder as well as those using the generic syntax.

Another follow up patch then goes through upstream and makes use of the new `ArrayRef<GEPArg>` builder to remove a lot of code building constants for GEP indices.

Differential Revision: https://reviews.llvm.org/D130730
2022-07-29 18:22:54 +02:00
Alex Brachet 7baf1db392 [ELF] Strip directories for -Map when emitting reproducer rsp
Similarly to -o output directories will not be created so -Map being
copied verbatim will likely cause ld.lld @response.txt to fail.

Differential Revision: https://reviews.llvm.org/D130681
2022-07-29 16:17:33 +00:00