Commit Graph

414856 Commits

Author SHA1 Message Date
Nikita Popov 4c6289c369 [InstCombine] Check source element type in gep of phi of gep fold 2022-02-11 17:10:48 +01:00
Nikolas Klauser 1e77b396ff [libc++] Add ranges::in_fun_result
Add `ranges::in_fun_result`

Reviewed By: Quuxplusone, #libc, var-const

Spies: CaseyCarter, var-const, libcxx-commits, mgorny

Differential Revision: https://reviews.llvm.org/D116974
2022-02-11 17:10:29 +01:00
OCHyams 2bd62e0b04 [dexter] Don't generate results files by default
Dexter saves various files to a new results directory each time it is run
(including when it's run by lit tests) and there isn't a way to opt-out. This
patch reconfigures the behaviour to be opt-in by removing the default
`--results-directory` location. Now results are only saved if
`--results-directory` is specified.

Reviewed By: jmorse

Differential Revision: https://reviews.llvm.org/D119545
2022-02-11 15:45:43 +00:00
Matt Arsenault 52fbb786a6 InferAddressSpaces: Fix assert on inferred source for inttoptr/ptrtoint
If we had some source value we could infer an address space from that
went through a ptrtoint/inttoptr pair, this would fail since bitcast
can't change the address space.

Fixes issue 53665.
2022-02-11 10:35:29 -05:00
Nikita Popov e9c0720010 [PHITransAddr] Check GEP source element type
It's not the same GEP if the source element type is different.
2022-02-11 16:22:48 +01:00
Simon Pilgrim 1e64590041 [clang][sema] - remove CodeCompleter nullptr checks
All paths have already dereferenced the CodeCompleter pointer in the ResultBuilder constructor
2022-02-11 15:09:44 +00:00
Simon Pilgrim 5fb180704c [clang][sema] ActOnExplicitInstantiation - remove Prev nullptr check
All paths have already dereferenced the Prev pointer
2022-02-11 15:09:44 +00:00
Simon Pilgrim f162036fcd [clang] RewriteModernObjC::SynthBlockInitExpr - remove block nullptr check
All paths have already dereferenced the block pointer
2022-02-11 15:09:44 +00:00
Jez Ng 4490a26a3e [lld-macho][nfc] Rename %no_fatal_warnings_lld in tests
... to use hyphens instead of underscores, making it consistent with
our other substitutions like %no-arg-lld and %lld-watchos.

Reviewed By: keith

Differential Revision: https://reviews.llvm.org/D119513
2022-02-11 10:06:38 -05:00
Dávid Bolvanský b2936caf77 [clang] inheritance fix for nomerge attribute
Discussed here: https://reviews.llvm.org/D119061#3310822

Reviewed By: aaron.ballman

Differential Revision: https://reviews.llvm.org/D119451
2022-02-11 15:51:08 +01:00
Anton Zabaznov bfb1a33bec [OpenCL] Adjust diagnostic for subgroup support.
OpenCL C 3.0 __opencl_c_subgroups feature is slightly different
then other equivalent features and extensions (fp64 and 3d image writes):
OpenCL C 3.0 device can support the extension but not the feature.
cl_khr_subgroups requires subgroup independent forward progress.

This patch adjusts the check which is used when translating language
builtins to check either the extension or feature is supported.

Reviewed By: Anastasia

Differential Revision: https://reviews.llvm.org/D118999
2022-02-11 17:40:24 +03:00
Haojian Wu 8fee667d31 [pseudo] NFC, fix some typos. 2022-02-11 15:35:11 +01:00
AndreyChurbanov d84dedc7d3 [OpenMP] libomp: fix bug in implementation of distribute construct.
Fixed mistaken iterations distribution between different target regions.

Differential Revision: https://reviews.llvm.org/D118393
2022-02-11 17:34:26 +03:00
Anton Afanasyev cd685f5736 [NFC][SLP] Set default parameter for Offset equal to zero 2022-02-11 17:22:33 +03:00
Marek Kurdej 23f27850b1 [clang-format] Avoid multiple calls to FormatToken::getNextNonComment(). NFC. 2022-02-11 15:20:11 +01:00
Marek Kurdej 0104f5efed [clang-format] Mark FormatToken::getNextNonComment() nodiscard. NFC. 2022-02-11 15:20:11 +01:00
Louis Dionne 6a7f6e9404 [docs] Fix missing space in the GettingStarted documentation 2022-02-11 09:17:37 -05:00
Jay Foad 9fe8a74c43 [TableGen] Dump RC.Allocatable with -register-info-debug 2022-02-11 14:07:19 +00:00
Amy Kwan db691903d2 [test-release.sh] Add option to disable building clang-tools-extra during release testing.
This patch adds an option (no-clang-tools) to disable building clang-tools-extra when
performing release testing. Prior to this patch, clang-tools-extra was built by default,
but on some platforms (such as AIX), clang-tools-extra is not supported, and so we do
not normally build it. Furthermore, this change should not change the invocation for
targets that build clang-tools-extra normally.

Differential Revision: https://reviews.llvm.org/D119520
2022-02-11 07:50:03 -06:00
Nikita Popov 5450963085 [InstCombine] Check source element type in phi of gep fold
Rather than checking that the type is the same (which is always
the case, given how these are part of the same phi) check that the
source element type is the same. With opaque pointers, this is no
longer implied.
2022-02-11 14:26:18 +01:00
Zakk Chen d224be3b99 [RISCV] Add the policy operand for some masked RVV ternary IR intrinsics.
Masked reduction intrinsics are specical cases which don't need to have policy
operand. The mask only affects which elements are read. It doesn't effect the
destination register.
The reduction intrinsics have a dedicated destination operand. If it
is undef, we use tail agnostic. If it not undef we use tail
undisturbed.

Co-Authored-by: Craig Topper <craig.topper@sifive.com>

Differential Revision: https://reviews.llvm.org/D117681
2022-02-11 05:02:03 -08:00
Adrian Kuegel 2219f9f57c [mlir][MemRef] Fix MemRefCopyOpLowering to use correct number of bytes
When lowering to memrefCopy call, the size for i1 type was calculated as 0.
Instead of using getTypeSizeInBits() and dividing by 8, we should just use getTypeSize().

Differential Revision: https://reviews.llvm.org/D119540
2022-02-11 13:59:08 +01:00
Anton Zabaznov bee4bd70f7 [OpenCL] Add support of language builtins for OpenCL C 3.0
OpenCL C 3.0 introduces optionality to some builtins, in particularly
to those which are conditionally supported with pipe, device enqueue
and generic address space features.

The idea is to conditionally support such builtins depending on the language options
being set for a certain feature. This allows users to define functions with names
of those optional builtins in OpenCL (as such names are not reserved).

Reviewed By: Anastasia

Differential Revision: https://reviews.llvm.org/D118605
2022-02-11 15:53:44 +03:00
Nathan Sidwell fbded4f42d [demangler] Adjust unqualified name parsing
The unqualified name grammar includes <ctor-dtor-name>, but we handle
that specially in parseNestedName.  This is a little awkward.  We can
pass in the current scope and have parseUnqualifiedName deal with
cdtors too.  That also allows a couple of other simplifications:

1) parseUnqualifiedName can also build up the NestedName, when the
provided scope is non-null.  Which means ...

2) parseUnscopedName can pass a "std" scope in (and tailcall).

3) ... and also parseNestedName need not construct the nestedname itself.

4) also parseNestedName's detection of a cdtor-name doesn't have to
rule out a decomposition name anymore.

This change also makes adding module demangling more
straight-forwards, btw.

Reviewed By: ChuanqiXu

Differential Revision: https://reviews.llvm.org/D119154
2022-02-11 04:22:06 -08:00
Nikita Popov 2a1b1f1b1b [GVN] Store source element type for GEP expressions
To avoid incorrectly merging GEPs with different source types
under opaque pointers.

To avoid increasing the Expression structure size, this reuses the
existing type member. The code does not rely on this to be the
expression result type, it's only used as a disambiguator.
2022-02-11 13:03:30 +01:00
Bradley Smith c53ad72aa9 [AArch64][SVE] Fix selection failure caused by fp/int convert using non-Neon types
Fixes: #53679

Differential Revision: https://reviews.llvm.org/D119428
2022-02-11 11:46:59 +00:00
Adrian Kuegel 5b02a48085 [mlir][MemRef] Fix MemRefCastOpLowering for 32 bit index type.
The lowering creates llvm.insertvalue with the rank value, so it needs to use
index type instead of 64 bit integer type. Otherwise, we get an error:

llvm.insertvalue' op Type mismatch: cannot insert 'i64' into '!llvm.struct<(i32, ptr<i8>)>'

Differential Revision: https://reviews.llvm.org/D119534
2022-02-11 12:37:15 +01:00
Arjun P 855cd847f7 [MLIR][Presburger] normalizeDivisionByGCD: fix bug when constant term is negative
Reviewed By: Groverkss

Differential Revision: https://reviews.llvm.org/D119531
2022-02-11 17:02:52 +05:30
Nikita Popov 8f1350e03a [IR] Check GEP source type when comparing instructions
Two GEPs with same indices but different source type are not the
same.

Worth noting that FunctionComparator already handles this correctly.
2022-02-11 12:32:04 +01:00
Stanislav Gatev 87c32be023 [clang][dataflow] Include terminator statements in buildStmtToBasicBlockMap
This will be necessary later when we add support for evaluating logic
expressions such as && and ||.

This is part of the implementation of the dataflow analysis framework.
See "[RFC] A dataflow analysis framework for Clang AST" on cfe-dev.

Reviewed-by: xazax.hun

Differential Revision: https://reviews.llvm.org/D119447
2022-02-11 11:15:29 +00:00
David Spickett ef4d1119cc [compiler-rt][xray] Disable fdr-reinit test on AArch64
We run bots on a shared machine and under high load
this test sometimes segfaults.

https://lab.llvm.org/buildbot/#/builders/185/builds/1368

==1952234==XRay FDR init successful.
==1952234==XRay FDR: Not flushing to file, 'no_file_flush=true'.
<...>fdr-reinit.cpp.script: line 4: 1952234 Segmentation fault
XRAY_OPTIONS="verbosity=1" <...>/fdr-reinit.cpp.tmp

Looking at the printed output I think it's happening at:
// Finally, we should signal the sibling thread to stop.
keep_going.clear(std::memory_order_release);

Disabling the test while I try to reproduce.
2022-02-11 11:13:04 +00:00
Mirko Brkusanin 5ff35ba8ae [AMDGPU][GlobalISel] Fix insert point in FoldableFneg combine
Newly created fneg was built after some of it's uses in some cases.
Now it will be built immediately after instruction whose dst it negates.

Differential Revision: https://reviews.llvm.org/D119459
2022-02-11 12:09:40 +01:00
Marek Kurdej fd16eeea9d [clang-format] Assert default style instead of commenting. NFC. 2022-02-11 12:01:25 +01:00
Marek Kurdej 326cb51b14 [clang-format] Simplify conditions in spaceRequiredBetween. NFC. 2022-02-11 12:01:24 +01:00
Konrad Kleine 32a0482a65 Add cmake to source release tarballs
I've split the git archive generation into three steps:

1. generate pure tarball
2. append top-level cmake directory to all tarballs
3. compress the archive

This was inspired by D118252 and can be considered an alternative
approach for all projects to have access to the shared cmake
directory when building in standalone mode.

When generating source tarballs on my local laptop it takes 9 minutes and 45 seconds WITH this patch applied. When this patch is not applied, it takes 9minutes and 38 seconds. That means, this patch introduces a slowdown of 7 seconds, which seems fair.

Reviewed By: tstellar

Differential Revision: https://reviews.llvm.org/D118481
2022-02-11 11:54:44 +01:00
Simon Pilgrim 9ece72c159 [clang] VisitCastExpr - use cast<> instead of dyn_cast<> to avoid dereference of nullptr
The pointer is always dereferenced, so assert the cast is correct (which it should be as we just created that ScalableVectorType) instead of returning nullptr
2022-02-11 10:51:34 +00:00
Simon Pilgrim a5d6851489 LoopReroll::isLoopControlIV - use cast<> instead of dyn_cast<> to avoid dereference of nullptr
The pointer is always dereferenced by isCompareUsedByBranch, so assert the cast is correct instead of returning nullptr
2022-02-11 10:19:25 +00:00
Simon Pilgrim 37bd80cd98 [M68k] Add missing include
Fixup for experimental m68k target after D119359
2022-02-11 10:17:39 +00:00
Sven van Haastregt 50f8abb9f4 [OpenCL] Add OpenCL 3.0 atomics to -fdeclare-opencl-builtins
Add the atomic overloads for the `global` and `local` address spaces,
which are new in OpenCL 3.0.  Ensure the preexisting `generic`
overloads are guarded by the generic address space feature macro.

Ensure a subset of the atomic builtins are guarded by the
`__opencl_c_atomic_order_seq_cst` and `__opencl_c_atomic_scope_device`
feature macros, and enable those macros for SPIR/SPIR-V targets in
`opencl-c-base.h`.

Also guard the `cl_ext_float_atomics` builtins with the atomic order
and scope feature macros.

Differential Revision: https://reviews.llvm.org/D119420
2022-02-11 10:14:14 +00:00
Tim Northover 7605ca85f1 StackProtector: ignore debug insts when splitting blocks.
When deciding where to split a block to insert stack guard checks, we should
move past any debug instructions we see that might (e.g.) be separating a tail
call from its frame wrangling.
2022-02-11 10:13:50 +00:00
Nikita Popov 5d63903465 [SCCP] Check that load/store and global type match
SCCP requires that the load/store type and global type are the
same (it does not support bitcasts of tracked globals). With
typed pointers this was implicitly enforced.
2022-02-11 11:01:18 +01:00
Marek Kurdej a218706cba [clang-format] Add tests for spacing between ref-qualifier and `noexcept`. NFC.
Cf. https://github.com/llvm/llvm-project/issues/44542.
Cf. ae1b7859cb.
2022-02-11 10:50:05 +01:00
Balazs Benics abc873694f [analyzer] Restrict CallDescription fuzzy builtin matching
`CallDescriptions` for builtin functions relaxes the match rules
somewhat, so that the `CallDescription` will match for calls that have
some prefix or suffix. This was achieved by doing a `StringRef::contains()`.
However, this is somewhat problematic for builtins that are substrings
of each other.

Consider the following:

`CallDescription{ builtin, "memcpy"}` will match for
`__builtin_wmemcpy()` calls, which is unfortunate.

This patch addresses/works around the issue by checking if the
characters around the function's name are not part of the 'name'
semantically. In other words, to accept a match for `"memcpy"` the call
should not have alphanumeric (`[a-zA-Z]`) characters around the 'match'.

So, `CallDescription{ builtin, "memcpy"}` will not match on:

 - `__builtin_wmemcpy: there is a `w` alphanumeric character before the match.
 - `__builtin_memcpyFOoBar_inline`: there is a `F` character after the match.
 - `__builtin_memcpyX_inline`: there is an `X` character after the match.

But it will still match for:
 - `memcpy`: exact match
 - `__builtin_memcpy`: there is an _ before the match
 - `__builtin_memcpy_inline`: there is an _ after the match
 - `memcpy_inline_builtinFooBar`: there is an _ after the match

Reviewed By: NoQ

Differential Revision: https://reviews.llvm.org/D118388
2022-02-11 10:45:18 +01:00
serge-sans-paille 06943537d9 Cleanup MCParser headers
As usual with that header cleanup series, some implicit dependencies now need to
be explicit:

llvm/MC/MCParser/MCAsmParser.h no longer includes llvm/MC/MCParser/MCAsmLexer.h

Preprocessed lines to build llvm on my setup:
after:  1068185081
before: 1068324320

So no compile time benefit to expect, but we still get the looser coupling
between files which is great.

Discourse thread: https://discourse.llvm.org/t/include-what-you-use-include-cleanup
Differential Revision: https://reviews.llvm.org/D119359
2022-02-11 10:39:29 +01:00
Markus Böck 1bf7921374 [mlir][LLVM] Add support for adding a garbage collector to a LLVM function
This patch simply adds an optional garbage collector attribute to LLVMFuncOp which maps 1:1 to the "gc" property of functions in LLVM.

Differential Revision: https://reviews.llvm.org/D119492
2022-02-11 10:23:51 +01:00
Nikita Popov e714b98fff [InstCombine] Check type compatibility in indexed load fold
This fold could use a rewrite to an offset-based implementation,
but for now make sure it doesn't crash with opaque pointers.
2022-02-11 10:16:27 +01:00
Florian Hahn 9474c3009e
[LV] Move unrelated tests from first-order-recurrence-chains.ll 2022-02-11 09:15:42 +00:00
Sander de Smalen 0b41238ae7 [AArch64] Emit TBAA metadata for SVE load/store intrinsics
In Clang we can attach TBAA metadata based on the load/store intrinsics
based on the operation's element type.

This also contains changes to InstCombine where the AArch64-specific
intrinsics are transformed into generic LLVM load/store operations,
to ensure that all metadata is transferred to the new instruction.

There will be some further work after this patch to also emit TBAA
metadata for SVE's gather/scatter- and struct load/store intrinsics.

Reviewed By: paulwalker-arm

Differential Revision: https://reviews.llvm.org/D119319
2022-02-11 09:00:29 +00:00
Mehdi Amini b055e6d313 Add a new interface method `getAsmBlockName()` on OpAsmOpInterface to control block names
This allows operations to control the block ids used by the printer in nested regions.

Reviewed By: Mogball

Differential Revision: https://reviews.llvm.org/D115849
2022-02-11 08:46:08 +00:00
Nikita Popov 3571bdb4f3 [InstCombine] Require equal source element type in icmp of gep fold
Without opaque pointers, this is implicitly enforced. This previously
resulted in a miscompile.
2022-02-11 09:38:28 +01:00