Commit Graph

409520 Commits

Author SHA1 Message Date
ksyx ee25a327aa [clang-format] Fix SeparateDefinitionBlocks issues
Fixes https://github.com/llvm/llvm-project/issues/52976.

- Make no formatting for macros
- Attach comment with definition headers
- Make no change on use of empty lines at block start/end
- Fix misrecognition of keyword namespace

Differential Revision: https://reviews.llvm.org/D116663
Reviewed By: MyDeveloperDay, HazardyKnusperkeks, curdeius
2022-01-11 12:25:39 -05:00
Philip Reames 8f553da492 [instsimplify] Add a comment and test for a highly confusing case 2022-01-11 09:24:10 -08:00
LLVM GN Syncbot 1088376630 [gn build] Port f77d115cc1 2022-01-11 17:12:28 +00:00
Matthias Braun ad25f8a556 X86InstrInfo: Support immediates that are +1/-1 different in optimizeCompareInstr
This is a re-commit of e2c7ee0743 which
was reverted in a2a58d91e8 and
ea81cea816. This includes a fix to
consistently check for EFLAGS being live-out. See phabricator
review.

Original Summary:

This extends `optimizeCompareInstr` to re-use previous comparison
results if the previous comparison was with an immediate that was 1
bigger or smaller. Example:

    CMP x, 13
    ...
    CMP x, 12   ; can be removed if we change the SETg
    SETg ...    ; x > 12  changed to `SETge` (x >= 13) removing CMP

Motivation: This often happens because SelectionDAG canonicalization
tends to add/subtract 1 often when optimizing for fallthrough blocks.
Example for `x > C` the fallthrough optimization switches true/false
blocks with `!(x > C)` --> `x <= C` and canonicalization turns this into
`x < C + 1`.

Differential Revision: https://reviews.llvm.org/D110867
2022-01-11 09:07:29 -08:00
Craig Topper be1cc64cc1 [RISCV] Add DAG combine to fold (fp_to_int (ffloor X)) -> (fcvt X, rdn)
Similar for ceil, trunc, round, and roundeven. This allows us to use
static rounding modes to avoid a libcall.

This optimization is done for AArch64 as isel patterns.
RISCV doesn't have instructions for ceil/floor/trunc/round/roundeven
so the operations don't stick around until isel to enable a pattern
match. Thus I've implemented a DAG combine.

We only handle XLen types except i32 on RV64. i32 will be type
legalized to a RISCVISD node. All other types will be type legalized
to XLen and maintain the FP_TO_SINT/UINT ISD opcode.

Reviewed By: asb

Differential Revision: https://reviews.llvm.org/D116771
2022-01-11 09:05:57 -08:00
Sven van Haastregt 4b14fc6fe5 [SPIR-V] Drop double quote from test pattern
When spirv-link is found, it won't match a leading `"`.  This fixes
the test added by commit dbb8d08637 ("[SPIR-V] Add linking using
spirv-link.", 2022-01-11).
2022-01-11 16:58:08 +00:00
Jan Svoboda f77d115cc1 [clang] Move `ApplyHeaderSearchOptions` from Frontend to Lex
In D116750, the `clangFrontend` library was added as a dependency of `LexTests` in order to make `clang::ApplyHeaderSearchOptions()` available. This increased the number of TUs the test depends on.

This patch moves the function into `clangLex` and removes dependency of `LexTests` on `clangFrontend`.

Reviewed By: thakis

Differential Revision: https://reviews.llvm.org/D117024
2022-01-11 17:57:40 +01:00
Siva Chandra Reddy 134e9d1914 [libc][NFC] Move sys/mman entrypoints to the default build configs.
Specifically, mmap and munmap have been moved to the default build list
of entrypoints. To support this, certain deps and includes have been
adjusted. The use of errno in some cases has been updated.
2022-01-11 16:51:10 +00:00
Christian Sigg d345ce65ff Mark arith.minf, arith.maxf as commutative.
Reviewed By: herhut

Differential Revision: https://reviews.llvm.org/D117010
2022-01-11 17:47:53 +01:00
Philip Reames e838949bee [GlobalsModRef] Apply indirect-global rule to all globals initialized from noalias calls
Extend the existing malloc-family specific optimization to all noalias calls.  This allows us to handle allocation wrappers, and removes a dependency on a lib-func check in favor of generic attribute usage.

Differential Revision: https://reviews.llvm.org/D116980
2022-01-11 08:44:31 -08:00
Simon Pilgrim 20404d820c [X86] Apply clang-format to X86TargetLowering::isVectorShiftByScalarCheap
Fix indentation
2022-01-11 16:41:16 +00:00
Philip Reames 3712372fa5 [DSE] Style improvements after 3cef3cf - remove redundant dyn_casts [NFC]
I'd been working on exactly the same patch when Nikita landed his, so this patch is basically the style diff between the two.  :)
2022-01-11 08:39:18 -08:00
Dimitry Andric 593b4d7a1c [Nomination] Adding Intel representatives to security group
We would like to nominate Andy Kaylor and Sergey Maslov to join the LLVM security group as a representative of Intel.  Both are members of the Intel compiler team, and would like to register as vendor contacts.  Intel packages and distributes LLVM-based toolchains as part of our compiler products.   As such, we would like to be aware of any security vulnerability found in the compiler, and would like to contribute to the resolution of such issues.

Please let us know if anything is missing from the nomination.

Reviewed By: apilipenko, dim, george.burgess.iv, kristof.beyls, mattdr, nikhgupt, probinson, peter.smith, pietroalbini, steveklabnik

Differential Revision: https://reviews.llvm.org/D115657
2022-01-11 17:30:44 +01:00
Florian Hahn 8a469e2050
[InstSimplify] Fold inbounds GEP to poison if base is undef.
D92270 updated constant expression folding to fold inbounds GEP to
poison if the base is undef. Apply the same logic to SimplifyGEPInst.

The justification is that we can choose an out-of-bounds pointer as base
pointer.

Reviewed By: nikic, lebedev.ri

Differential Revision: https://reviews.llvm.org/D117015
2022-01-11 16:11:22 +00:00
Simon Atanasyan 0199e47373 [mips][lld] Add test case to check symbol index reading on mips64el. NFC 2022-01-11 19:08:20 +03:00
Simon Atanasyan 962e8d9976 [mips] Use `push_back` to insert element at the end of a container. NFC 2022-01-11 19:08:19 +03:00
Simon Pilgrim 4eda7be15a [X86] Tag existing shuffle test case as PR53124
The poor AVX1 codegen matches the core issue raised in PR53124
2022-01-11 15:59:15 +00:00
Roman Lebedev 5ceb070bbb
[SCEV] `getSequentialMinMaxExpr()`: look into `umin` when deduplicating operands
We could just merge all umin into umin_seq, but that is likely
a pessimization, so don't do that, but pretend that we did
for the purpose of deduplication.
2022-01-11 18:51:57 +03:00
Roman Lebedev b2be7dcf5b
[NFC][SCEV] More tests with operand-wise redundant operands of umin of umin_seq 2022-01-11 18:51:56 +03:00
Alexandre Ganea ae4c643bcd [compiler-rt] Silence warnings when building with MSVC
Differential Revision: https://reviews.llvm.org/D116872
2022-01-11 10:36:57 -05:00
Louis Dionne 7c7d59a35d [libc++] Use TEST_HAS_NO_UNICODE instead of _LIBCPP_HAS_NO_UNICODE in the test suite
Differential Revision: https://reviews.llvm.org/D116973
2022-01-11 10:34:59 -05:00
Kirill Stoimenov a3b9edf8b8 [ASan] Driver changes to always link-in asan_static library.
This enables the changes from D116182.

Reviewed By: vitalybuka

Differential Revision: https://reviews.llvm.org/D116670
2022-01-11 15:31:41 +00:00
Nikita Popov 94d6263391 [GlobalStatus] Look through non-constexpr casts
analyzeGlobal() looks through non-constexpr cast instructions when
looking for users. However, this particular place only strips the
casts again if they are constexprs. We should be looking through all
casts here.
2022-01-11 16:02:35 +01:00
Roman Lebedev 138d5c750b
[NFC][SCEV] Add more tests for umin_seq with redundant operands 2022-01-11 17:51:51 +03:00
Nico Weber 5fc9abe474 [gn build] (manually) port 8503c688d5 2022-01-11 09:47:28 -05:00
Nikita Popov 3404127b4e [GlobalOpt] Regenerate test checks (NFC) 2022-01-11 15:34:34 +01:00
Jan Svoboda 8503c688d5 [clang][lex] Keep references to `DirectoryLookup` objects up-to-date
The elements of `SearchPath::SearchDirs` are being referenced to by their indices. This proved to be error-prone: `HeaderSearch::SearchDirToHSEntry` was accidentally not being updated in `HeaderSearch::AddSearchPath()`. This patch fixes that by referencing `SearchPath::SearchDirs` elements by their address instead, which is stable thanks to the bump-ptr-allocation strategy.

Reviewed By: ahoppen

Differential Revision: https://reviews.llvm.org/D116750
2022-01-11 15:24:46 +01:00
Benjamin Kramer 7f47005dcc [mlir][linalg] Use cast instead of dyn_cast that's always dereferenced
This turns a random nullptr deref into an assertion failure in case
`tensor::registerInferTypeOpInterfaceExternalModels` isn't called.
2022-01-11 15:05:45 +01:00
Roman Lebedev 5e16650792
[SCEV] `getSequentialMinMaxExpr()`: keep only the first instance of an operand
Having the same operand more than once doesn't change the outcome here,
neither reduction-wise nor poison-wise.
We must keep the first instance specifically though.
2022-01-11 16:51:53 +03:00
Roman Lebedev 36075942f9
[SCEV] Add test for umin_seq with duplicate operands 2022-01-11 16:51:52 +03:00
Anastasia Stulova 0eef65028e [SPIR-V] Remove unused variable 2022-01-11 13:45:59 +00:00
Florian Hahn 50c3bf234f
[InstSimplify] Add additional GEP tests with undef bases. 2022-01-11 13:43:53 +00:00
David Spickett 88fdce5be6 [lldb] Remove non address bits from memory read arguments
Addresses on AArch64 can have top byte tags, memory tags and pointer
authentication signatures in the upper bits.

While testing memory tagging I found that memory read couldn't
read a range if the two addresses had different tags. The same
could apply to signed pointers given the right circumstance.

(lldb) memory read mte_buf_alt_tag mte_buf+16
error: end address (0x900fffff7ff8010) must be greater than the start
address (0xa00fffff7ff8000).

Or it would try to read a lot more memory than expected.

(lldb) memory read mte_buf mte_buf_alt_tag+16
error: Normally, 'memory read' will not read over 1024 bytes of data.
error: Please use --force to override this restriction just once.
error: or set target.max-memory-read-size if you will often need a
larger limit.

Fix this by removing non address bits before we calculate the read
range. A test is added for AArch64 Linux that confirms this by using
the top byte ignore feature.

This means that if you do read with a tagged pointer the output
does not include those tags. This is potentially confusing but I think
overall it's better that we don't pretend that we're reading memory
from a range that the process is unable to map.

(lldb) p ptr1
(char *) $4 = 0x3400fffffffff140 "\x80\xf1\xff\xff\xff\xff"
(lldb) p ptr2
(char *) $5 = 0x5600fffffffff140 "\x80\xf1\xff\xff\xff\xff"
(lldb) memory read ptr1 ptr2+16
0xfffffffff140: 80 f1 ff ff ff ff 00 00 38 70 bc f7 ff ff 00 00  ........8p......

Reviewed By: omjavaid, danielkiss

Differential Revision: https://reviews.llvm.org/D103626
2022-01-11 13:24:09 +00:00
Anastasia Stulova dbb8d08637 [SPIR-V] Add linking using spirv-link.
Add support of linking files compiled into SPIR-V objects
using spirv-link.

Command line inteface examples:

clang --target=spirv64 test1.cl test2.cl

clang  --target=spirv64 test1.cl -o test1.o
clang  --target=spirv64 test1.o test2.cl -o test_app.out

This works independently from the SPIR-V generation method
(via an external tool or an internal backend) and applies
to either approach that is being used.

Differential Revision: https://reviews.llvm.org/D116266
2022-01-11 13:11:38 +00:00
Pavel Labath 6d8d1c5ea3 [lldb/qemu] Implement GetMmapArgumentList
By forwarding it to the host platform.
2022-01-11 14:08:03 +01:00
Roman Lebedev 76a0abbc13
[SCEV] Reenable umin_seq support and fix the `computeSCEVAtScope()`
This reverts commit f62f47f5e1.
2022-01-11 16:03:35 +03:00
Roman Lebedev e0772cf00f
[NFC][SCEV] Add reproducers for umin_seq crashes
As reported in https://reviews.llvm.org/D116766#3233042
2022-01-11 16:03:35 +03:00
Florian Hahn 8dba4d42f5
[LSR] Use pointer args instead of undef for uglygep*.ll tests.
Make the test more robust by replacing undef by pointer arguments. This
ensures that the GEPs cannot be folded to undef.
2022-01-11 12:35:55 +00:00
David Green 0c7f515f88 Revert "[Clang][AArch64][ARM] PMUv3.4 Option Added"
It turns out this is conflating a few different PMU extensions. And on
Arm ended up breaking M-Profile code generation. Reverting for the
moment whilst we sort out the details.

This reverts commit d17fb46e89.
2022-01-11 12:33:53 +00:00
Egor Zhdan fda47db8ee [Clang][Sema] Fix attribute mismatch warning for ObjC class properties
If a class declares an instance property, and an inheritor class declares a class property with the same name, Clang Sema currently treats the latter as an overridden property, and compares the attributes of the two properties to check for a mismatch. The resulting diagnostics might be misleading, since neither of the properties actually overrides the another one.

rdar://86018435

Differential Revision: https://reviews.llvm.org/D116412
2022-01-11 12:10:18 +00:00
Nikita Popov acc39873b7 [CodeGen] Avoid deprecated Address constructor 2022-01-11 13:07:02 +01:00
David Sherwood 3a272d1eaf [SVE][CodeGen] Use splice instruction when lowering VECTOR_SPLICE
For certain negative indices passed to the VECTOR_SPLICE operation
we can actually directly use the SVE splice instruction by creating
the appropriate predicate. The predicate needs to be constructed in
such a way that all but the last -idx elements are false. We can do
this efficiently using a combination of 'ptrue' (with the appropriate
fixed pattern, e.g. vl1, vl2, etc.) and 'rev'. The advantage of using
these instructions to generate the predicate is they do not set any
flags, unlike the whilelo instruction. This is critical when the splice
operation is in a loop, since we want MachineLICM to hoist the
predicate generation out of the loop.

Differential Revision: https://reviews.llvm.org/D115863
2022-01-11 11:58:17 +00:00
Tim Northover 0b5b35fdbd ARM: make FastISel & GISel pass -1 to ADJCALLSTACKUP to signal no callee pop.
The interface for these instructions changed with support for mandatory tail
calls, and now -1 indicates the CalleePopAmount argument is not valid.
Unfortunately I didn't realise FastISel or GISel did calls at the time so
didn't update them.
2022-01-11 11:31:13 +00:00
Simon Pilgrim fba8ad2b71 [SemaTemplateInstantiate] Use cast<> instead of dyn_cast<> to avoid dereference of nullptr
The pointer is always dereferenced immediately below, so assert the cast is correct instead of returning nullptr
2022-01-11 11:29:38 +00:00
Nikita Popov 3946095b88 [MemoryBuiltins] Remove unused isOpNewLikeFn() (NFC)
This function is no longer used since
2cafbcb560.
2022-01-11 12:27:23 +01:00
Nikita Popov b56f6f1913 [MemoryBuiltins] Remove unused isStrdupLikeFn() function (NFC)
This function is no longer used after
dcbc91f40c.
2022-01-11 12:26:20 +01:00
Nikita Popov 3cef3cf02f [DSE] Check for noalias calls rather than alloc functions
For these "visible on unwind/ret" checks we only care about the
fact that no other code has access to the pointer (unless it
escapes). A noalias call is sufficient for this, it does not
have to be a known allocation function.

This is basically the same change as D116728, but for DSE rather
than LICM.
2022-01-11 12:22:16 +01:00
Florian Hahn ec016681d3
[LSR] Remove duplicated test address-space-loop.ll.
llvm/test/Transforms/LoopStrengthReduce/uglygep-address-space.ll has
exactly the same checks and input. Remove the duplicated test.
2022-01-11 11:18:28 +00:00
Matthias Springer 2c5c5ca868 [mlir][linalg][bufferize] Fix CallOp bufferization
Previously, CallOps did not have any aliasing OpResult/OpOperand pairs. Therefore, CallOps were mostly ignored by the analysis and buffer copies were not inserted when necessary.

This commit introduces the following changes:
* Function bbArgs writable by default. A function can now be bufferized without inspecting its callers.
* Callers must introduce buffer copies of function arguments when necessary. If a function is external, the caller must conservatively assume that a function argument is modified by the callee after bufferization. If the function is not external, the caller inspects the callee to determine if a function argument is modified.

Differential Revision: https://reviews.llvm.org/D116457
2022-01-11 20:10:21 +09:00
Nikita Popov 3d5179febe [DSE] Add additional tests for noalias calls (NFC)
Currently this is special-cased to TLI alloc functions only.
2022-01-11 12:09:54 +01:00