Commit Graph

431965 Commits

Author SHA1 Message Date
Simon Pilgrim a14f94c20c [X86] computeKnownBitsForTargetNode - out of range X86ISD::VSRAI doesn't fold to zero
Noticed by inspection and I can't seem to make a test case, but SSE arithmetic bit shifts clamp to the max shift amount (i.e. create a sign splat) - combineVectorShiftImm already does something similar.
2022-07-30 17:55:39 +01:00
Dmitry Vassiliev adc387460d [CodeGen] Fixed undeclared MISchedCutoff in case of NDEBUG and LLVM_ENABLE_ABI_BREAKING_CHECKS
This patch fixes the error llvm/lib/CodeGen/MachineScheduler.cpp(755): error C2065: 'MISchedCutoff': undeclared identifier in case of NDEBUG and LLVM_ENABLE_ABI_BREAKING_CHECKS.
Note MISchedCutoff is declared under #ifndef NDEBUG.

Reviewed By: RKSimon

Differential Revision: https://reviews.llvm.org/D130425
2022-07-30 18:24:50 +02:00
Sanjay Patel 7073ec530e [InstCombine] canonicalize more zext-and-of-bool compare to narrow and
https://alive2.llvm.org/ce/z/vBNiiM

This matches variants of patterns that were folded with:
b5a9361c90
2022-07-30 11:22:05 -04:00
Austin Kerbow 7898426a72 [AMDGPU] Remove unused function 2022-07-30 07:47:35 -07:00
Simon Pilgrim 2f08872d81 OMPIRBuilder.h - fix Wdocumentation warning. NFC. 2022-07-30 15:43:41 +01:00
Simon Pilgrim 49c0980eac Fix Wdocumentation warning. NFC.
warning: '\returns' command used in a comment that is attached to a function returning void
2022-07-30 15:41:13 +01:00
Simon Pilgrim 813459ed2b [X86] combineSelect fold 'smin' style pattern select(pcmpgt(RHS, LHS), LHS, RHS) -> select(pcmpgt(LHS, RHS), RHS, LHS) if pcmpgt(LHS, RHS) already exists
Avoids repeated commuted comparisons when we're performing min/max and clamp patterns
2022-07-30 15:31:36 +01:00
Nuno Lopes d4b4747de5 ConstantFolding: fold OOB accesses to poison instead of undef 2022-07-30 15:20:32 +01:00
Sanjay Patel f95a6aea1b [InstCombine] avoid splitting a constant expression with div/rem fold
Follow-up to d4940c0f3d to further limit the transform
to avoid an unintended pattern/fold of a constant expression.
2022-07-30 09:45:25 -04:00
Simon Pilgrim 9ad082eb5a [DAG] Pull out repeated getOperand() calls for shuffle ops. NFC. 2022-07-30 14:02:54 +01:00
Simon Pilgrim 276480b1d3 [AMDGPU] Fix || vs && precedence warning. NFC. 2022-07-30 14:02:54 +01:00
Nuno Lopes fffabd5348 [NFC] Switch a few uses of undef to poison as placeholders for unreachable code 2022-07-30 13:55:56 +01:00
Luo, Yuanke 6b4c386b1e [X86] Add test cases for D129537 2022-07-30 19:41:00 +08:00
Simon Pilgrim caa971f216 SelectionDAGNodes.h - fix Wdocumentation warnings. NFC. 2022-07-30 11:05:33 +01:00
Simon Pilgrim 91d9b7b407 DependencyScanningTool.h - fix Wdocumentation warning. NFC. 2022-07-30 11:00:35 +01:00
Simon Pilgrim b3fd44dd6a Sema.h - fix Wdocumentation warnings. NFC. 2022-07-30 11:00:16 +01:00
Konstantin Varlamov db7d795978 [libc++][ranges] Implement `std::ranges::partial_sort_copy`.
Differential Revision: https://reviews.llvm.org/D130532
2022-07-30 02:42:18 -07:00
Alexander Shaposhnikov 4220ef2be1 [InstCombine] Add fold for redundant sign bits count comparison
For power-of-2 C:
((X s>> ShiftC) ^ X) u< C --> (X + C) u< (C << 1)
((X s>> ShiftC) ^ X) u> (C - 1) --> (X + C) u> ((C << 1) - 1)

(https://github.com/llvm/llvm-project/issues/56479)

Test plan:
0/ ninja check-llvm check-clang + bootstrap LLVM/Clang
1/ https://alive2.llvm.org/ce/z/eEUfx3

Differential revision: https://reviews.llvm.org/D130433
2022-07-30 09:06:53 +00:00
Nikolas Klauser 7912b1f8e7 [libc++] Fix reverse_iterator::iterator_concept
Fixes https://github.com/llvm/llvm-project/issues/56504

Reviewed By: ldionne, Mordante, huixie90, #libc

Spies: libcxx-commits, hewillk

Differential Revision: https://reviews.llvm.org/D129794
2022-07-30 10:53:59 +02:00
Fangrui Song efb7a71a13 [ELF] Support missing relocations in AArch64::getImplicitAddend() 2022-07-30 01:24:55 -07:00
Alexander Shaposhnikov f4aa08586a [InstCombine] Add baseline tests for redundant sign bits count folds
Add baseline tests. NFC.
(https://github.com/llvm/llvm-project/issues/56479)

Test plan:
ninja check-all

Differential revision: https://reviews.llvm.org/D130605
2022-07-30 08:23:54 +00:00
Fangrui Song c4c68b676e [ELF] Write R_AARCH64_IRELATIVE addends with -z rel 2022-07-30 01:19:59 -07:00
Dawid Jurczak 65053fbc0d [NFC] Use more appropriate SmallVectorImpl::append call in std::initializer_list SmallVector constructor
Since we are in constructor there is no need to perform redundant call to SmallVectorImpl::clear() inside assign function.
Although calling cheaper append function instead assign doesn't make any difference on optimized builds
(DSE does the job removing stores), we still save some cycles for debug binaries.

Differential Revision: https://reviews.llvm.org/D130361
2022-07-30 09:17:35 +02:00
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