Commit Graph

422733 Commits

Author SHA1 Message Date
Nathan Sidwell ed2d4da732 [demangler] Fold expressions of .* and ->*
(Exitingly) a fold expression's operators include .* and ->*, but we
failed to demangle them as we categorize those as MemberExprs, not
BinaryExprs.

Reviewed By: dblaikie

Differential Revision: https://reviews.llvm.org/D123305
2022-05-03 06:45:25 -07:00
Sam McCall eac22d0754 [pseudo] Implement the GLR parsing algorithm.
This patch implements a standard GLR parsing algorithm, the
core piece of the pseudoparser.

- it parses preprocessed C++ code, currently it supports correct code
  only and parse them as a translation-unit;
- it produces a forest which stores all possible trees in an efficient
  manner (only a single node being build for per (SymbolID, Token Range));
  no disambiguation yet;

Differential Revision: https://reviews.llvm.org/D121150
2022-05-03 15:42:07 +02:00
David Spickett ca0b416659 [lldb][NFC] Add more tests for GenerateOptionsUsage
This adds a few targeted tests to make sure that when refactoring
this function later I don't break these properties.

Some are tested in passing elsewhere but this makes it more
obvious what went wrong when it fails.

This doesn't cover everything the function does, I couldn't
find any examples that would exercise some of the code.

Reviewed By: jingham

Differential Revision: https://reviews.llvm.org/D123500
2022-05-03 13:40:14 +00:00
David Spickett 7667d80594 Revert "[lldb] Fix ppc64 detection in lldb"
This reverts commit f114f00948.

Due to hitting an assert on our lldb bots:
https://lab.llvm.org/buildbot/#/builders/96/builds/22715

../llvm-project/lldb/source/Plugins/Process/elf-core/ThreadElfCore.cpp:170:
virtual lldb::RegisterContextSP ThreadElfCore::CreateRegisterContextForFrame(
lldb_private::StackFrame *): Assertion `false && "Architecture or OS not supported"' failed.
2022-05-03 13:24:10 +00:00
David Truby 8bc29d1427 [clang][AArch64][SVE] Implement conditional operator for SVE vectors
This patch adds support for the conditional (ternary) operator on SVE
scalable vector types in C++, matching the behaviour for NEON vector
types. Like the conditional operator for NEON types, this is disabled in
C mode.

Differential Revision: https://reviews.llvm.org/D124091
2022-05-03 13:10:32 +00:00
Nicolai Hähnle 8b42e6d057 AMDGPU: Remove redundant call to MachineInstrBuilder::setMBB
setInstrAndDebugLoc also sets the basic block automatically.

Differential Revision: https://reviews.llvm.org/D124809
2022-05-03 07:49:20 -05:00
Serge Pavlov d9b5544e0f [Doc] Refine description of llvm.is_fpclass 2022-05-03 19:28:47 +07:00
Haojian Wu b18abde8ad [pseudo] Simplify the forest dump, NFC.
The code was written to handle nullable grammar, and we disallow
nullable grammar, so it is not necessary to keep it around.

Differential Revision: https://reviews.llvm.org/D124827
2022-05-03 14:14:57 +02:00
Hanhan Wang 919e459f1b [Linalg] Remove Optional from getStaticLoopRanges interface method.
It is very wrong if the ranges can't be infered. It's also checked in
verifyStructuredOpInterface, so we don't need the Optional return type.

Reviewed By: springerm

Differential Revision: https://reviews.llvm.org/D124596
2022-05-03 05:12:54 -07:00
Nicolai Hähnle cdc5b64ed6 AMDGPU/GISel: Update some MIR tests to reduce future churn
The default output format of the update_mir_test_checks.py script has
changed since some of these tests were generated.

Also, an upcoming commit will introduce differences between GFX9 and
GFX10 in the legalization of G_MUL.
2022-05-03 07:08:56 -05:00
Ali Shuja Siddiqui cf7cd664f3 [analyzer] Check for std::__addressof for inner pointer checker
This is an extension to diff D99260. This adds an additional exception
for `std::__addressof` in `InnerPointerChecker`.

Patch By alishuja (Ali Shuja Siddiqui)!

Reviewed By: martong, alishuja

Differential Revision: https://reviews.llvm.org/D109467
2022-05-03 14:05:19 +02:00
Martin Liska 903b8845fb sanitizer: Fix fallthrough detection.
First check for clang::fallthrough attribute that resolves:

sanitizer_stack_store.cpp:258:7: error: use of the 'fallthrough'
attribute is a C++17 extension [-Werror,-Wc++17-attribute-extensions]
2022-05-03 13:55:28 +02:00
Zhiyao Ma bd606afe26 [ARM] Only update the successor edges for immediate predecessors of PrologueMBB
When adjusting the function prologue for segmented stacks, only update
the successor edges of the immediate predecessors of the original
prologue.

Differential Revision: https://reviews.llvm.org/D122959
2022-05-03 12:36:35 +01:00
Aaron Ballman 1fc208d400 Fix Clang sphinx build
It seems we don't have this option exposed via RST, so switching to use
generic backticks instead.
2022-05-03 07:14:12 -04:00
Simon Tatham 32814df442 [Windows] Fix handling of \" in program name on cmd line.
Bugzilla #47579: if you invoke clang on Windows via a pathname in
which a quoted section closes just after a backslash, e.g.

  "C:\Program Files\Whatever\"clang.exe

then cmd.exe and CreateProcess will correctly find the binary, because
when they parse the program name at the start of the command line,
they don't regard the \ before the " as having any kind of escaping
effect. This is different from the behaviour of the Windows standard C
library when it parses the rest of the command line, which would
consider that \" not to close the quoted string.

But this confuses windows::GetCommandLineArguments, because the
Windows API function GetCommandLineW() will return a command line
containing that \" sequence, and cl::TokenizeWindowsCommandLine will
tokenize the whole string according to the C library's rules. So it
will misidentify where the program name stops and the arguments start.

To fix this, I've introduced a new variant function
cl::TokenizeWindowsCommandLineFull(), intended to be applied to the
string returned from GetCommandLineW(). It parses the first word of
the command line according to CreateProcess's rules, considering \ to
never be an escaping character; thereafter, it switches over to the C
library rules for the rest of the command line.

Reviewed By: hans

Differential Revision: https://reviews.llvm.org/D122914
2022-05-03 11:57:50 +01:00
Simon Tatham 1be024ee45 [Windows] Fix cmd line tokenization of unclosed quotes.
When cl::TokenizeWindowsCommandLine received a command line with an
unterminated double-quoted string at the end, it would discard the
text within that string. That doesn't match the behavior of the
standard Windows C library, which will return the text in the unclosed
quoted string as an argv word.

Fixed, and added extra unit tests in that area.

In some cases (specifically the one in Bugzilla #47579) this could
cause TokenizeWindowsCommandLine to return a zero-length list of
arguments, leading to an array overrun at the call site in
windows::GetCommandLineArguments. Added a check there, for extra
safety: now windows::GetCommandLineArguments will return an error code
instead of failing an assertion.

(This change was written as part of https://reviews.llvm.org/D122914,
but split into a separate commit at the last minute at the code
reviewer's suggestion, because it's fixing an unrelated bug in the
same area. The rest of D122914 will follow in the next commit.)
2022-05-03 11:57:49 +01:00
Martin Liska 0a1bcab9f3 tsan: fix deadlock in libbacktrace
Fixes deadlock seen in GCC.

Fixes: #55226

Differential Revision: https://reviews.llvm.org/D124838
2022-05-03 12:51:20 +02:00
Nikita Popov e0892614b1 [SDAG] Extract commutative helper from haveNoCommonBitsSet() (NFC)
To make it easier to add additional patterns, which will generally
want to handle commuted top-level operands.
2022-05-03 12:28:35 +02:00
serge-sans-paille f114f00948 [lldb] Fix ppc64 detection in lldb
Currently, ppc64le and ppc64 (defaulting to big endian) have the same
descriptor, thus the linear scan always return ppc64le. Handle that through
subtype.

Differential Revision: https://reviews.llvm.org/D124760
2022-05-03 12:17:23 +02:00
Simon Pilgrim 74634f4b98 [SLP][X86] Add test case for Issue #48223 2022-05-03 11:10:34 +01:00
Bradley Smith 96bbd359ed [AArch64][SVE] Only fold frame indexes referencing SVE objects into SVE loads/stores
Currently we always fold frame indexes into SVE load/store instructions,
however these instructions can only encode VL scaled offests. This means
that when we are accessing a fixed length stack object with these
instructions, the folded in frame index gets pulled back out during frame
lowering. This can cause issues when we have no spare registers and no
emergency spill slot.

Rather than causing issues like this, don't fold in frame indexes that
reference fixed length objects.

Fixes: #55041

Differential Revision: https://reviews.llvm.org/D124457
2022-05-03 09:48:13 +00:00
Martin Liska f496a0eba4 sanitizer: use pragma clang conditionally
Use the pragma only when __clang__ is defined.

Fixes:
sanitizer_common_libcdep.cpp:101: warning: ignoring ‘#pragma clang diagnostic’ [-Wunknown-pragmas]

Differential Revision: https://reviews.llvm.org/D124829
2022-05-03 11:34:30 +02:00
Nikita Popov 47255834e7 [ValueTracking] A and (B & ~A) have no common bits set
This extends haveNoCommonBitsSet() to two additional cases, allowing
the following folds:

 * `A + (B & ~A)` --> `A | (B & ~A)`
    (https://alive2.llvm.org/ce/z/crxxhN)
 * `A + ((A & B) ^ B)` --> `A | ((A & B) ^ B)`
    (https://alive2.llvm.org/ce/z/A_wsH_)

These should further fold to just `A | B`, though this currently
only works in the first case.

The reason why the second fold is necessary is that we consider
this to be the canonical form if B is a constant. (I did check
whether we can change that, but it looks like a number of folds
depend on the current canonicalization, so I ended up adding both
patterns here.)

Differential Revision: https://reviews.llvm.org/D124763
2022-05-03 11:33:27 +02:00
Alex Zinenko 6c57b0debe [mlir] improve and test TransformState::Extension
Add the mechanism for TransformState extensions to update the mapping between
Transform IR values and Payload IR operations held by the state. The mechanism
is intentionally restrictive, similarly to how results of the transform op are
handled.

Introduce test ops that exercise a simple extension that maintains information
across the application of multiple transform ops.

Reviewed By: nicolasvasilache

Differential Revision: https://reviews.llvm.org/D124778
2022-05-03 11:33:00 +02:00
Fred Tingaud ad47114ad8 In MSVC compatibility mode, friend function declarations behave as function declarations
Before C++20, MSVC treated any friend function declaration as a function declaration, so the following code would compile despite funGlob being declared after its first call:

```
class Glob {
public:
  friend void funGlob();

  void test() {
    funGlob();
  }
};

void funGlob() {}
```
This proposed patch mimics the MSVC behavior when in MSVC compatibility mode

Reviewed By: rnk

Differential Revision: https://reviews.llvm.org/D124613
2022-05-03 11:31:50 +02:00
Martin Liska bc8e601257 sanitizer: support GCC's fallthrough attribute
Fixes:
sanitizer_stack_store.cpp:257:13: warning: this statement may fall through [-Wimplicit-fallthrough=]

when being built with GCC.

Differential Revision: https://reviews.llvm.org/D124832
2022-05-03 11:30:13 +02:00
Marco Antognini 68ee5ec07d [Analyzer] Fix assumptions about const field with member-initializer
Essentially, having a default member initializer for a constant member
does not necessarily imply the member will have the given default value.

Remove part of a2e053638b ([analyzer] Treat more const variables and
fields as known contants., 2018-05-04).

Fix #47878

Reviewed By: r.stahl, steakhal

Differential Revision: https://reviews.llvm.org/D124621
2022-05-03 11:27:45 +02:00
Igor Kirillov 4e5e042d9a [LoopVectorize] Support reductions that store intermediary result
Adds ability to vectorize loops containing a store to a loop-invariant
address as part of a reduction that isn't converted to SSA form due to
lack of aliasing info. Runtime checks are generated to ensure the store
does not alias any other accesses in the loop.

Ordered fadd reductions are not yet supported.

Differential Revision: https://reviews.llvm.org/D110235
2022-05-03 10:12:30 +01:00
Marek Kurdej c819dce2d3 [clang-format] Add a regression test for aligning macros with keywords.
Test from issue https://github.com/llvm/llvm-project/issues/54953.
2022-05-03 11:09:38 +02:00
Benjamin Kramer dccb73318a [mlir][MemRef] Return `0` for the canonical strided layout expr of a 0d memref
There can't be any strides, and the offset for the canonical expr is
always 0. Fixes #55229.

Differential Revision: https://reviews.llvm.org/D124795
2022-05-03 10:58:44 +02:00
Jeremy Morse 1d712c3818 [DebugInfo][InstrRef] Don't generate redundant DBG_PHIs
In SelectionDAG, DBG_PHI instructions are created to "read" physreg values
and give them an instruction number, when they can't be traced back to a
defining instruction. The most common scenario if arguments to a function.
Unfortunately, if you have 100 inlined methods, each of which has the same
"this" pointer, then the 100 dbg.value instructions become 100
DBG_INSTR_REFs plus 100 DBG_PHIs, where only one DBG_PHI would suffice.

This patch adds a vreg cache for MachienFunction::salvageCopySSA, if we've
already traced a value back to the start of a block and created a DBG_PHI
then it allows us to re-use the DBG_PHI, as well as reducing work.

Differential Revision: https://reviews.llvm.org/D124517
2022-05-03 09:56:12 +01:00
Markus Lavin dd8cf372c5 [NFC] Minimal refactor of TTI to avoid clangsa complaint
Differential Revision: https://reviews.llvm.org/D124754
2022-05-03 10:43:48 +02:00
David Green 6f81903e89 [LV][SLP] Mark fptosi_sat as vectorizable
This adds fptosi_sat and fptoui_sat to the list of trivially
vectorizable functions, mainly so that the loop vectorizer can vectorize
the instruction. Marking them as trivially vectorizable also allows them
to be SLP vectorized, and Scalarized.

The signature of a fptosi_sat requires two type overrides
(@llvm.fptosi.sat.v2i32.v2f32), unlike other intrinsics that often only
take a single. This patch alters hasVectorInstrinsicOverloadedScalarOpd
to isVectorIntrinsicWithOverloadTypeAtArg, so that it can mark the first
operand of the intrinsic as a overloaded (but not scalar) operand.

Differential Revision: https://reviews.llvm.org/D124358
2022-05-03 09:32:34 +01:00
Pavel Labath 51e72570d7 [lldb] Fix nondeterminism in DWARFIndexCachingTest
The entries in the input map need to be sorted as well, as there's no
guarantee that the entries (ConstStrings) will be inserted in the proper
order.
2022-05-03 10:28:47 +02:00
Ivan Murashko f6112f490c [docs] PCH usage documentation update
The documentation has an incorrect example of PCH files usage via `-include` option. The possibility has not been available since [llvm-svn: 174385](https://reviews.llvm.org/rG48b72d81c8968f3d342557582db986a60aef2c54).

Differential Revision: https://reviews.llvm.org/D124719
2022-05-03 08:26:13 +01:00
Luo, Yuanke fe7d0067bd [X86][AMX] Add mayLoad/mayStore property for AMX instructions. 2022-05-03 14:48:22 +08:00
Vitaly Buka eeccdd318d Revert "tsan: model atomic read for failing CAS"
https://lab.llvm.org/buildbot/#/builders/70/builds/21206 hangs.

This reverts commit 2fec52a402.
2022-05-02 22:26:56 -07:00
Vitaly Buka 8611909572 [mlir] Create lbOperands before op.setLowerBound
To fix msan report like https://reviews.llvm.org/P8284

Reviewed By: rriddle

Differential Revision: https://reviews.llvm.org/D124575
2022-05-02 22:23:51 -07:00
Jonas Devlieghere e53019a8ff
[lldb] Make GetSharedModuleWithLocalCache consider the device support directory
Make GetSharedModuleWithLocalCache consider the device support
directory. In the past we only needed the device support directory to
debug remote processes. Since the introduction of Apple Silicon and
Rosetta this stopped being true.

When debugging a Rosetta process on macOS we need to consider the
Rosetta expanded shared cache. This patch and it dependencies move that
logic out of PlatfromRemoteDarwinDevice into a new abstract class called
PlatfromDarwinDevice. The new platform sit in between PlatformDarwin and
PlatformMacOSX and PlatformRemoteDarwinDevice and has all the necessary
logic to deal with the device support directory.

Technically I could have moved everything in PlatfromDarwinDevice into
PlatfromDarwin but decided that this logic is sufficiently self
contained that it warrants its own abstraction.

rdar://91966349

Differential revision: https://reviews.llvm.org/D124801
2022-05-02 21:07:11 -07:00
Hsiangkai Wang 3baff80804 [RISCV] Precommit test cases for (uaddo X, C)
Differential Revision: https://reviews.llvm.org/D124602
2022-05-03 03:51:36 +00:00
Hsiangkai Wang eaaa31ff2c [RISCV][TargetLowering] Special case overflow expansion for (uaddo X, C).
Follow-up to D122933.

Differential Revision: https://reviews.llvm.org/D124374
2022-05-03 03:51:36 +00:00
Craig Topper 72a66358f6 [RISCV] Add isCommutable to FADD/FMUL/FMIN/FMAX/FEQ.
Reviewed By: arcbbb

Differential Revision: https://reviews.llvm.org/D123972
2022-05-02 20:21:16 -07:00
hsmahesha 589b9df4e1 [AMDGPU] Fix scalar_to_vector for v8i16/v8f16
so that the stack access is avoided.

Reviewed By: rampitec

Differential Revision: https://reviews.llvm.org/D124734
2022-05-03 07:28:15 +05:30
hsmahesha 3175323ce1 [AMDGPU][NFC] Make lowerINSERT_VECTOR_ELT() more readable
by moving around the code and by adding more comments, which would
later help during any required clean-up.

Differential Revision: https://reviews.llvm.org/D124733
2022-05-03 07:28:15 +05:30
Zakk Chen 5807e59a0a [RISCV] Fix incorrect codegen for masked vmsge{u}.vx with mask agnostic.
The result was totally wrong.
We could use mask undisturbed result to emulate the mask agnostic result.

Reviewed By: craig.topper

Differential Revision: https://reviews.llvm.org/D124684
2022-05-02 17:57:29 -07:00
LLVM GN Syncbot 24901ac6d0 [gn build] Port 41c0ff1e74 2022-05-03 00:35:04 +00:00
Jonas Devlieghere 322b413041
[lldb] Move GetSharedModuleWithLocalCache to PlatformDarwinDevice (NFC)
Refactoring in preparation of D124801.

Differential revision: https://reviews.llvm.org/D124800
2022-05-02 17:34:40 -07:00
Jonas Devlieghere 41c0ff1e74
[lldb] Hoist device support out of PlatformRemoteDarwinDevice (NFC)
Refactoring in preparation of D124801.

Differential revision: https://reviews.llvm.org/D124799
2022-05-02 17:34:40 -07:00
Jonas Devlieghere d0067738e0
[lldb] Remove unused PlatformRemoteDarwinDevice::FindFileInAllSDKs
As far as I can tell this function is unused both upstream and
downstream.
2022-05-02 17:34:39 -07:00
Jonas Devlieghere d75cc08593
[lldb] Remove PlatformRemoteMacOSX::GetFileWithUUID overload (NFC)
There's no reason PlatformRemoteMacOSX has to override GetFileWithUUID.
2022-05-02 17:34:36 -07:00