platform/upstream/llvm.git
3 years ago[clangd][ObjC] Fix issue completing a method decl by name
David Goldman [Mon, 19 Apr 2021 20:38:37 +0000 (16:38 -0400)]
[clangd][ObjC] Fix issue completing a method decl by name

When completing an Objective-C method declaration by name, we need to
preserve the leading text as a `qualifier` so we insert it properly
before the first typed text chunk.

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

3 years ago[X86FixupLEAs] Transform the sequence LEA/SUB to SUB/SUB
Guozhi Wei [Tue, 1 Jun 2021 17:31:30 +0000 (10:31 -0700)]
[X86FixupLEAs] Transform the sequence LEA/SUB to SUB/SUB

This patch transforms the sequence

    lea (reg1, reg2), reg3
    sub reg3, reg4

to two sub instructions

    sub reg1, reg4
    sub reg2, reg4

Similar optimization can also be applied to LEA/ADD sequence.
The modifications to TwoAddressInstructionPass is to ensure the operands of ADD
instruction has expected order (the dest register of LEA should be src register of ADD).

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

3 years ago[MLIR] Add missing APSInt.h include
Nikita Popov [Tue, 1 Jun 2021 17:18:19 +0000 (19:18 +0200)]
[MLIR] Add missing APSInt.h include

Since fd7e309e02fd226b0390888388ed732608e52c73 this is no longer
pulled in indirectly through DenseMapInfo.h.

3 years ago[SystemZ] Return true from hasBitPreservingFPLogic().
Jonas Paulsson [Tue, 1 Jun 2021 16:24:06 +0000 (18:24 +0200)]
[SystemZ] Return true from hasBitPreservingFPLogic().

This is currently NFC on benchmarks and tests.

Review: Ulrich Weigand

3 years ago[polly] Fix SCEVLoopAddRecRewriter to avoid invalid AddRecs.
Eli Friedman [Fri, 21 May 2021 23:58:36 +0000 (16:58 -0700)]
[polly] Fix SCEVLoopAddRecRewriter to avoid invalid AddRecs.

When we're remapping an AddRec, the AddRec constructed by a partial
rewrite might not make sense.  This triggers an assertion complaining
it's not loop-invariant.

Instead of constructing the partially rewritten AddRec, just skip
straight to calling evaluateAtIteration.

Testcase was automatically reduced using llvm-reduce, so it's a little
messy, but hopefully makes sense.

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

3 years ago[ADT] Move DenseMapInfo for APInt into APInt.h (PR50527)
Nikita Popov [Mon, 31 May 2021 16:49:34 +0000 (18:49 +0200)]
[ADT] Move DenseMapInfo for APInt into APInt.h (PR50527)

As suggested in https://bugs.llvm.org/show_bug.cgi?id=50527, this
moves the DenseMapInfo for APInt and APSInt into the respective
headers, removing the need to include APInt.h and APSInt.h from
DenseMapInfo.h.

We could probably do the same from StringRef and ArrayRef as well.

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

3 years ago[RISCV] Remove earlyclobber from vnsrl/vnsra/vnclip(u) when the source and dest are...
Craig Topper [Tue, 1 Jun 2021 16:09:01 +0000 (09:09 -0700)]
[RISCV] Remove earlyclobber from vnsrl/vnsra/vnclip(u) when the source and dest are a single vector register.

This guarantees they meet this overlap exception:

"The destination EEW is smaller than the source EEW and the overlap
is in the lowest-numbered part of the source register group"

Being a single register guarantees the overlap is always in the
lowerst-number part of the group.

Reviewed By: frasercrmck, khchen

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

3 years ago[RISCV] Remove earlyclobber from compares with LMUL<=1.
Craig Topper [Tue, 1 Jun 2021 15:50:18 +0000 (08:50 -0700)]
[RISCV] Remove earlyclobber from compares with LMUL<=1.

Compares are considered a narrowing operation for register overlap.
I believe for LMUL<=1 they meet this exception to allow overlap

"The destination EEW is smaller than the source EEW and the overlap is in the
lowest-numbered part of the source register group"

Both the result and the sources will occupy a single register for
LMUL<=1 so the overlap would always be in the "lowest-numbered part".

Reviewed By: frasercrmck, HsiangKai

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

3 years ago[lldb][NFC] Use Language plugins in Mangled::GuessLanguage
Raphael Isemann [Tue, 1 Jun 2021 15:58:12 +0000 (17:58 +0200)]
[lldb][NFC] Use Language plugins in Mangled::GuessLanguage

This removes the direct dependency to the ObjC and C++ plugins.

Reviewed By: bulbazord

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

3 years ago[lldb] Remove SBCommandReturnObject::ref
Raphael Isemann [Tue, 1 Jun 2021 15:50:26 +0000 (17:50 +0200)]
[lldb] Remove SBCommandReturnObject::ref

This function was added in D67589 and returns an internal CommandReturnObject
which isn't allowed in the SB API. This patch just makes it private as all uses
of this function are inside SBCommandReturnObject.

Reviewed By: jankratochvil

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

3 years ago[x86] add test for sext-of-setcc; NFC
Sanjay Patel [Tue, 1 Jun 2021 12:58:55 +0000 (08:58 -0400)]
[x86] add test for sext-of-setcc; NFC

3 years agoSimplify coro-zero-alloca.ll
Xun Li [Tue, 1 Jun 2021 15:12:18 +0000 (08:12 -0700)]
Simplify coro-zero-alloca.ll

D101841 added this test. It appears to generate different outcome on different platforms.
Make it to only call -coro-split instead of entire O2 pipeline to simplify the test flow.
Hope this will make  the test more robust.

Reviewed By: djtodoro

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

3 years ago[SLP]Better detection of perfect/shuffles matches for gather nodes.
Alexey Bataev [Fri, 21 May 2021 13:29:23 +0000 (06:29 -0700)]
[SLP]Better detection of perfect/shuffles matches for gather nodes.

Implemented better scheme for perfect/shuffled matches of the gather
nodes which allows to fix the performance regressions introduced by
earlier patches. Starting detecting matches for broadcast nodes and
extractelement gathering.

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

3 years ago[llvm-dwarfdump][test] Add missing dedicated tests for some options
gbreynoo [Tue, 1 Jun 2021 13:57:00 +0000 (14:57 +0100)]
[llvm-dwarfdump][test] Add missing dedicated tests for some options

This change adds tests specifically for --parent-recurse-depth, --quiet
and -o. The test for -o found a typo in an error message which is also
fixed in this change.

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

3 years ago[clang][Parse] Add parsing support for C++ attributes on using-declarations
Louis Dionne [Mon, 31 May 2021 20:18:30 +0000 (16:18 -0400)]
[clang][Parse] Add parsing support for C++ attributes on using-declarations

This is a re-application of dc67299 which was reverted in f63adf5b because
it broke the build. The issue should now be fixed.

Attribution note: The original author of this patch is Erik Pilkington.
I'm only trying to land it after rebasing.

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

3 years ago[OpenCL] Fix ICE with invalid use of half
Ole Strohm [Tue, 1 Jun 2021 12:01:47 +0000 (13:01 +0100)]
[OpenCL] Fix ICE with invalid use of half

Because half is limited to the `cl_khr_fp16` extension being enabled,
`DefaultLvalueConversion` can fail when it's not enabled.
The original assumption that it will never fail is therefore wrong now.

Fixes: PR47976

Reviewed By: Anastasia

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

3 years ago[AMDGPU][Libomptarget] Remove g_atmi_machine global
Pushpinder Singh [Tue, 1 Jun 2021 09:23:10 +0000 (09:23 +0000)]
[AMDGPU][Libomptarget] Remove g_atmi_machine global

Turns out the only purpose of this class was verify if device ID
was in range or not which could be done easily by using g_atl_machine.

Still getting rid of g_atl_machine is pending which would be done in
a later patch.

Reviewed By: JonChesterfield

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

3 years ago[InstCombine] Relax constraints of uses for exp(X) * exp(Y) -> exp(X + Y)
Daniil Seredkin [Tue, 1 Jun 2021 12:31:23 +0000 (08:31 -0400)]
[InstCombine] Relax constraints of uses for exp(X) * exp(Y) -> exp(X + Y)

InstCombine didn't perform the transformations when fmul's operands were
the same instruction because it required to have one use for each of them
which is false in the case. This patch fixes this + adds tests for them
and introduces a new function isOnlyUserOfAnyOperand to check these cases
in a single place.

This patch is a result of discussion in D102574.

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

3 years ago[compiler-rt] Fix compilation when multiple architectures can be targeted
Evgeny Leviant [Tue, 1 Jun 2021 12:26:51 +0000 (15:26 +0300)]
[compiler-rt] Fix compilation when multiple architectures can be targeted

When toolchain can supports all of arm, armhf and armv6m architectures compiler-rt
libraries won't compile because architecture specific flags are appended to single
BUILTIN_CFLAGS variable.

Differential revision: https://reviews.llvm.org/D103363

3 years ago[LoopDeletion] Consider infinite loops alive, unless mustprogress.
Florian Hahn [Tue, 1 Jun 2021 11:20:46 +0000 (12:20 +0100)]
[LoopDeletion] Consider infinite loops alive, unless mustprogress.

The current loop or any of its sub-loops may be infinite. Unless the
function or the loops are marked as mustprogress, this in itself makes
the loop *not* dead.

This patch moves the logic to check whether the current loop is finite
or mustprogress to `isLoopDead` and also extends it to check the
sub-loops. This should fix PR50511.

Reviewed By: nikic

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

3 years ago[SDAG] add helper function for sext-of-setcc folds; NFC
Sanjay Patel [Tue, 1 Jun 2021 11:51:58 +0000 (07:51 -0400)]
[SDAG] add helper function for sext-of-setcc folds; NFC

Try to make this easier to read as noted in D103280

3 years ago[mlir] Use interfaces in MathToLibm
Tres Popp [Tue, 1 Jun 2021 10:17:33 +0000 (12:17 +0200)]
[mlir] Use interfaces in MathToLibm

Previously, this assumed use of ModuleOp and FuncOp. There is no need to
restrict this, and using interfaces allows these patterns to be used
during dialect conversion to LLVM.

Some assertions were removed due to inconsistent implementation of
FunctionLikeOps.

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

3 years ago[mlir][linalg] Fix signed/unsigned comparison warnings (NFC).
Tobias Gysi [Tue, 1 Jun 2021 10:55:08 +0000 (10:55 +0000)]
[mlir][linalg] Fix signed/unsigned comparison warnings (NFC).

Fix signedness warnings in Utils.cpp and LinalgInterfaces.cpp.

3 years ago[VectorCombine] Freeze index unless it is known to be non-poison.
Florian Hahn [Tue, 1 Jun 2021 09:20:42 +0000 (10:20 +0100)]
[VectorCombine] Freeze index unless it is known to be non-poison.

If the index itself is already poison, the poison propagates through
instructions clamping the index to a valid range. This still causes
introducing a load of poison, as flagged by Alive2 and pointed out
at 575e2aff5574.

This patch updates the code to freeze the index, unless it is proven to
not be poison.

Reviewed By: nlopes

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

3 years ago[RISCV] Support vector types in combination with fastcc
Fraser Cormack [Thu, 13 May 2021 16:34:41 +0000 (17:34 +0100)]
[RISCV] Support vector types in combination with fastcc

This patch extends the RISC-V lowering of the 'fastcc' calling
convention to vector types, both fixed-length and scalable. Without this
patch, any function passing or returning vector types by value would
throw a compiler error.

Vectors are handled in 'fastcc' much as they are in the default calling
convention, the noticeable difference being the extended set of scalar
GPR registers that can be used to pass vectors indirectly.

Reviewed By: HsiangKai

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

3 years ago[WebAssembly][CodeGen] IR support for WebAssembly local variables
Andy Wingo [Wed, 21 Apr 2021 13:41:48 +0000 (15:41 +0200)]
[WebAssembly][CodeGen] IR support for WebAssembly local variables

This patch adds TargetStackID::WasmLocal.  This stack holds locations of
values that are only addressable by name -- not via a pointer to memory.
For the WebAssembly target, these objects are lowered to WebAssembly
local variables, which are managed by the WebAssembly run-time and are
not addressable by linear memory.

For the WebAssembly target IR indicates that an AllocaInst should be put
on TargetStackID::WasmLocal by putting it in the non-integral address
space WASM_ADDRESS_SPACE_WASM_VAR, with value 1.  SROA will mostly lift
these allocations to SSA locals, but any alloca that reaches instruction
selection (usually in non-optimized builds) will be assigned the new
TargetStackID there.  Loads and stores to those values are transformed
to new WebAssemblyISD::LOCAL_GET / WebAssemblyISD::LOCAL_SET nodes,
which then lower to the type-specific LOCAL_GET_I32 etc instructions via
tablegen patterns.

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

3 years ago[VectorCombine] Add tests with multiple noundef indices for scalarization.
Florian Hahn [Sun, 30 May 2021 11:45:55 +0000 (12:45 +0100)]
[VectorCombine] Add tests with multiple noundef indices for scalarization.

3 years agoMark test as requiring asserts.
Douglas Yung [Tue, 1 Jun 2021 09:01:01 +0000 (02:01 -0700)]
Mark test as requiring asserts.

3 years ago[mlir][linalg] Cleanup LinalgOp usage in dependence analysis (NFC).
Tobias Gysi [Tue, 1 Jun 2021 08:43:43 +0000 (08:43 +0000)]
[mlir][linalg] Cleanup LinalgOp usage in dependence analysis (NFC).

Replace the uses of deprecated Structured Op Interface methods in DependenceAnalysis.cpp and DependenceAnalysis.h. This patch is based on https://reviews.llvm.org/D103394.

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

3 years ago[mlir][linalg] Cleanup LinalgOp usage in fusion (NFC).
Tobias Gysi [Tue, 1 Jun 2021 08:20:58 +0000 (08:20 +0000)]
[mlir][linalg] Cleanup LinalgOp usage in fusion (NFC).

Replace the uses of deprecated Structured Op Interface methods in Fusion.cpp. This patch is based on https://reviews.llvm.org/D103394.

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

3 years ago[mlir][linalg] Cleanup LinalgOp usage in tiling (NFC).
Tobias Gysi [Tue, 1 Jun 2021 08:10:59 +0000 (08:10 +0000)]
[mlir][linalg] Cleanup LinalgOp usage in tiling (NFC).

Replace the uses of deprecated Structured Op Interface methods in Tiling.cpp and Utils.cpp. This patch is based on https://reviews.llvm.org/D103394.

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

3 years ago[clangd] Fix -Wunused-variable warning (NFC)
Yang Fan [Tue, 1 Jun 2021 08:15:09 +0000 (16:15 +0800)]
[clangd] Fix -Wunused-variable warning (NFC)

GCC warning:
```
/llvm-project/clang-tools-extra/clangd/InlayHints.cpp: In member function ‘bool clang::clangd::InlayHintVisitor::VisitVarDecl(clang::VarDecl*)’:
/llvm-project/clang-tools-extra/clangd/InlayHints.cpp:81:15: warning: unused variable ‘AT’ [-Wunused-variable]
   81 |     if (auto *AT = D->getType()->getContainedAutoType()) {
      |               ^~

```

3 years ago[mlir][linalg] Cleanup LinalgOp usage in vectorization (NFC).
Tobias Gysi [Tue, 1 Jun 2021 07:48:03 +0000 (07:48 +0000)]
[mlir][linalg] Cleanup LinalgOp usage in vectorization (NFC).

Replace the uses of deprecated Structured Op Interface methods in Vectorization.cpp. This patch is based on https://reviews.llvm.org/D103394.

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

3 years ago[X86] AMD Zen 3 has fast variable per-lane shuffles
Roman Lebedev [Tue, 1 Jun 2021 07:46:05 +0000 (10:46 +0300)]
[X86] AMD Zen 3 has fast variable per-lane shuffles

... but lane-crossing shuffles are slow.

3 years ago[X86] Split FeatureFastVariableShuffle tuning into Lane-Crossing and Per-Lane variants
Roman Lebedev [Tue, 1 Jun 2021 07:39:36 +0000 (10:39 +0300)]
[X86] Split FeatureFastVariableShuffle tuning into Lane-Crossing and Per-Lane variants

Currently, X86 backend only has a global one-size-fits-all `FeatureFastVariableShuffle` feature,
which controls profitability of both the cross-lane and per-lane variable shuffles.
I guess, this has been fine so far.

But at least on AMD Zen 3, while per-line variable shuffles (e.g. `VPSHUFB`)
are as fast as as shuffles with fixed/immediate mask,
while lane-crossing shuffles, e.g. `VPERMPS` is performing worse.

So to get the benefits of variable-mask shuffles, but not the drawbacks of lane-crossing shuffles,
as suggested by @RKSimon, split the feature flag into two.

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

3 years ago[libcxx] [test] Fix the _supportsVerify check on Windows by fixing quoting
Martin Storsjö [Fri, 28 May 2021 09:57:21 +0000 (09:57 +0000)]
[libcxx] [test] Fix the _supportsVerify check on Windows by fixing quoting

The pipes.quote function quotes using single quotes, the same goes
for the newer shlex.quote (which is the preferred form in Python 3).
This isn't suitable for quoting in command lines on Windows (and the
documentation for shlex.quote even says it's only usable for Unix
shells).

In general, the python subprocess.list2cmdline function should do
proper quoting for the platform's current shell. However, it doesn't
quote the ';' char, which we pass within some arguments to run.py.
Therefore use the custom reimplementation from lit.TestRunner which
is amended to quote ';' too.

The fact that arguemnts were quoted with single quotes didn't matter
for command lines that were executed by either bash or the lit internal
shell, but if executing things directly using subprocess.call, as in
_supportsVerify, the quoted path to %{cxx} fails to be resolved by the
Windows shell.

This unlocks 114 tests that previously were skipped on Windows.

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

3 years ago[clangd] Type hints for variables with 'auto' type
Nathan Ridge [Sun, 9 May 2021 06:59:57 +0000 (02:59 -0400)]
[clangd] Type hints for variables with 'auto' type

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

3 years ago[PowerPC] Split tests for constrained intrinsics
Serge Pavlov [Tue, 1 Jun 2021 05:30:17 +0000 (12:30 +0700)]
[PowerPC] Split tests for constrained intrinsics

The test CodeGen/PowerPC/vector-constrained-fp-intrinsics.ll checks code
generation for constrained floating point intrinsics. Many test cases in
it were implemented using operations on constants. Constant folding of
constrained intrinsics would make these test cases almost useless,
because they would check only constant loading.

To keep the tests useful, operations on constants were replaced with
operations on function parameters.

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

3 years ago[Test] Add one more loop deletion irreducible CFG test
Max Kazantsev [Tue, 1 Jun 2021 04:11:15 +0000 (11:11 +0700)]
[Test] Add one more loop deletion irreducible CFG test

3 years agoFix invalid math formulas in quantization doc
Lewuathe [Tue, 1 Jun 2021 03:47:42 +0000 (03:47 +0000)]
Fix invalid math formulas in quantization doc

A single backslash is not properly escaped in the web documentation. We can make sure to escape for rendering subscripts.

Additionally, it also fixed the mal-formed equations in //"Affine to fixed point"// and //"Fixed point to affine"// sections. With this fix, the page is rendered as follows.

Reviewed By: mehdi_amini

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

3 years agoRevert "[InstCombine] Fix miscompile on GEP+load to icmp fold (PR45210)"
Nathan Chancellor [Tue, 1 Jun 2021 03:11:46 +0000 (20:11 -0700)]
Revert "[InstCombine] Fix miscompile on GEP+load to icmp fold (PR45210)"

This reverts commit 4f2fd3818b0eb26806f366bc37369349aeedcaf9.

The Linux kernel fails to build after this commit. See
https://reviews.llvm.org/D99481 for a reproducer.

Signed-off-by: Nathan Chancellor <nathan@kernel.org>
3 years ago[OpaquePtr] Remove some uses of PointerType::getElementType()
Arthur Eubanks [Mon, 31 May 2021 23:11:03 +0000 (16:11 -0700)]
[OpaquePtr] Remove some uses of PointerType::getElementType()

3 years ago[PowerPC] Improve f32 to i32 bitcast code gen
Albion Fung [Mon, 31 May 2021 20:58:05 +0000 (15:58 -0500)]
[PowerPC] Improve f32 to i32 bitcast code gen

The code gen for f32 to i32 bitcast is not currently the most efficient;
this patch removes some unneccessary instructions gerneated.

Differential revision: https://reviews.llvm.org/D100782

3 years ago[HIP] Relax checks in hip-include-path.hip test case again
Bjorn Pettersson [Mon, 31 May 2021 20:35:09 +0000 (22:35 +0200)]
[HIP] Relax checks in hip-include-path.hip test case again

The tightened checks from commit 722c39fef5ab6 did not work
fully for buildbots using symlinks in repo paths. This patch
is not fully reverting 722c39fef5ab6, as we still match that
there is a "/lib" somewhere in the path before "/clang/".

So this is once again a bit fragile in case someone would put
their repo in a base directory, for example, named
 "/scratch/lib/foo/clang/llvm-project/". But it is atleast a
bit better than the original checks (avoiding the problem that
commit 722c39fef5ab6 was solving).

3 years ago[LoopInterhcange] Handle movement of reduction phis appropriately
Congzhe Cao [Mon, 31 May 2021 20:11:04 +0000 (16:11 -0400)]
[LoopInterhcange] Handle movement of reduction phis appropriately

This patch fixes pr43326 and pr48212.

Currently when we move reduction phis to the right place,
loop interchange assumes the first phi in loop headers is
an induction phi, skips the first phi and assumes the rest
of phis are candidate reduction phis to move. However, it
may not always be the case.

This patch loops over all phis in loop headers and considers
a phi node as a candidate reduction phi to move only when it
is indeed a reduction phi across outer and inner loop.

Reviewed By: Whitney

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

3 years ago[LoopDeletion] Add additional test cases with more nested loops.
Florian Hahn [Mon, 31 May 2021 19:23:43 +0000 (20:23 +0100)]
[LoopDeletion] Add additional test cases with more nested loops.

Also remove mustprogress function attribute from one of the tests

Extends test coverage for D103382.

3 years ago[libcxx] [test] Fix the include_as_c.sh.cpp test in MSVC configurations
Martin Storsjö [Mon, 31 May 2021 08:35:01 +0000 (08:35 +0000)]
[libcxx] [test] Fix the include_as_c.sh.cpp test in MSVC configurations

Avoid including a header that is known not to work with clang in MSVC
mode when compiling as C.

(Alternatively, this could be something like "XFAIL: clang && msvc",
but I think it's more useful to actually check the rest of the test
instead of expecting the whole test to fail.)

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

3 years ago[libcxx] [test] Remove an incorrect TEST_HAS_ALIGNED_ALLOC define from test_macros.h
Martin Storsjö [Mon, 31 May 2021 10:01:59 +0000 (10:01 +0000)]
[libcxx] [test] Remove an incorrect TEST_HAS_ALIGNED_ALLOC define from test_macros.h

This was added inconsistently in
19fd9039ca242f408493b5c662f9d908eab8555e; Windows doesn't have the
aligned_alloc function (neither MSVC nor MinGW toolchains) and we don't
define _LIBCPP_HAS_ALIGNED_ALLOC while building libcxx.

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

3 years ago[libcxx] Define LIBCPP_HAS_TIMESPEC_GET for MSVC configurations
Martin Storsjö [Mon, 31 May 2021 09:32:51 +0000 (09:32 +0000)]
[libcxx] Define LIBCPP_HAS_TIMESPEC_GET for MSVC configurations

This define was out of sync with the corresponding define in tests, it
was added inconsistently in 171c77b7dad4a050aca23ff7ca1b75f87560fefb.

Modern MSVC environments do have these typedefs and functions.

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

3 years ago[libcxx] [test] Don't look for the literal spelling __mbstate_t in warnings
Martin Storsjö [Fri, 28 May 2021 09:55:44 +0000 (09:55 +0000)]
[libcxx] [test] Don't look for the literal spelling __mbstate_t in warnings

While the code uses the type name `std::mbstate_t`, the warning message
mentions the original underlying type, which is a C library internal
type name.

On Windows this type is called `_Mbstatet` instead of `__mbstate_t`. Use
expect-warning-re to avoid spelling out the literal name of the type.

Due to issues with the detection of the clang-verify feature, these
tests have been skipped in the Windows CI configuration so far.

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

3 years ago[LV] Try to sink users recursively for first-order recurrences.
Florian Hahn [Mon, 31 May 2021 11:06:28 +0000 (12:06 +0100)]
[LV] Try to sink users recursively for first-order recurrences.

Update isFirstOrderRecurrence to  explore all uses of a recurrence phi
and check if we can sink them. If there are multiple users to sink, they
are all mapped to the previous instruction.

Fixes PR44286 (and another PR or two).

Reviewed By: Ayal

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

3 years ago[MLIR] Add dialect prefix to all operations from Math
Andi Drebes [Mon, 31 May 2021 17:14:48 +0000 (22:44 +0530)]
[MLIR] Add dialect prefix to all operations from Math

Prefix all operations from the ODS of the `Math` dialect with `Math_`
in order to avoid name clashes when including `MathOps.td` in other
TableGen files (e.g., for `FloatUnaryOp`, which also exists in
`Standard`).

Reviewed By: jpienaar, mehdi_amini

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

3 years ago[PowerPC] Fix x86 vector intrinsics wrapper compilation under C++
Qiu Chaofan [Mon, 31 May 2021 17:15:49 +0000 (01:15 +0800)]
[PowerPC] Fix x86 vector intrinsics wrapper compilation under C++

Reviewed By: nemanjai

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

3 years ago[gn build] make libunwind build on macOS
Nico Weber [Mon, 31 May 2021 17:17:10 +0000 (13:17 -0400)]
[gn build] make libunwind build on macOS

3 years ago[libcxx][nfc] moves std `advance`, `next`, and `prev` into their headers
Christopher Di Bella [Fri, 28 May 2021 17:53:54 +0000 (17:53 +0000)]
[libcxx][nfc] moves std `advance`, `next`, and `prev` into their headers

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

3 years ago[MLIR] Specify namespace for standard dialect using cppNamespace field
Andi Drebes [Mon, 31 May 2021 15:53:32 +0000 (21:23 +0530)]
[MLIR] Specify namespace for standard dialect using cppNamespace field

The `::mlir` namespace for operations from standard is currently
defined by enclosing the header file generated from the ODS in
`Ops.td` in a namespace in `Ops.h`. However, when referencing
operations from `Ops.td` in other TableGen files, this causes the
generated C++ code to refer to classes from the global namespace
instead of `::mlir`.

By defining the namespace through the `cppNamespace` field for
`StandardOps_Dialect` directly in `Ops.td` instead, the ODS
becomes reusable in other TableGen files through simple
inclusion.

Reviewed By: mehdi_amini

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

3 years ago[OpaquePtr] Clean up some uses of Type::getPointerElementType()
Arthur Eubanks [Thu, 27 May 2021 03:32:04 +0000 (20:32 -0700)]
[OpaquePtr] Clean up some uses of Type::getPointerElementType()

These depend on pointee types.

3 years agoRe-commit [clang] Add support for the "abstract" contextual keyword of MSVC
Abbas Sabra [Mon, 31 May 2021 08:38:17 +0000 (10:38 +0200)]
Re-commit [clang] Add support for the "abstract" contextual keyword of MSVC

https://docs.microsoft.com/en-us/cpp/extensions/abstract-cpp-component-extensions?view=msvc-160
Note: like the already supported "sealed" keyword, the "abstract"
keyword is supported by MSVC by default.

This re-commits 818338add77411f5e9713247ea66142f332ef350 with added
initialization of Parser::Ident_abstract.

Differential revision: https://reviews.llvm.org/D102517

3 years ago[libc++] [test] Fix a few tests for 32-bit x86
Harald van Dijk [Mon, 31 May 2021 16:36:57 +0000 (12:36 -0400)]
[libc++] [test] Fix a few tests for 32-bit x86

Fixes bug https://llvm.org/PR48939.

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

3 years ago[test] Properly match parameter/argument ABI attributes
Arthur Eubanks [Mon, 31 May 2021 16:00:33 +0000 (09:00 -0700)]
[test] Properly match parameter/argument ABI attributes

These were found with D103412.

3 years ago[MCA][NFCI] Minor changes to InstrBuilder and Instruction.
Andrea Di Biagio [Mon, 31 May 2021 15:39:35 +0000 (16:39 +0100)]
[MCA][NFCI] Minor changes to InstrBuilder and Instruction.

This is based on the assumption that most simulated instructions don't define
more than one or two registers. This is true for example on x86, where
most instruction definitions don't declare more than one register write.

The default code region size has been increased from 8 to 16. This is based on
the assumption that, for small microbenchmarks, the typical code snippet size is
often less than 16 instructions.

mca::Instruction now uses bitfields to pack flags.
No functional change intended.

3 years ago[test] Fix addr-label.ll after D99707
Arthur Eubanks [Mon, 31 May 2021 16:02:07 +0000 (09:02 -0700)]
[test] Fix addr-label.ll after D99707

Needs REQUIRES.

3 years ago[libc++] Update all the pre-defined iterator types for C++20
Louis Dionne [Thu, 27 May 2021 16:56:12 +0000 (12:56 -0400)]
[libc++] Update all the pre-defined iterator types for C++20

Make sure we provide the correct It::difference_type member and update
the tests and synopses to be accurate.

Supersedes D102657 and D103101 (thanks to the original authors).

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

3 years agoRemove "Rewrite Symbols" from codegen pipeline
Arthur Eubanks [Thu, 1 Apr 2021 06:12:36 +0000 (23:12 -0700)]
Remove "Rewrite Symbols" from codegen pipeline

It breaks up the function pass manager in the codegen pipeline.

With empty parameters, it looks at the -mllvm flag -rewrite-map-file.
This is likely not in use.

Add a check that we only have one function pass manager in the codegen
pipeline.

Some tests relied on the fact that we had a module pass somewhere in the
codegen pipeline.

addr-label.ll crashes on ARM due to this change. This is because a
ARMConstantPoolConstant containing a BasicBlock to represent a
blockaddress may hold an invalid pointer to a BasicBlock if the
blockaddress is invalidated by its BasicBlock getting removed. In that
case all referencing blockaddresses are RAUW a constant int. Making
ARMConstantPoolConstant::CVal a WeakVH fixes the crash, but I'm not sure
that's the right fix. As a workaround, create a barrier right before
ISel so that IR optimizations can't happen while a
ARMConstantPoolConstant has been created.

Reviewed By: rnk, MaskRay, compnerd

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

3 years ago[libc++] Avoid `result_type` and `unary/binary_function` in <valarray>.
Arthur O'Dwyer [Sat, 29 May 2021 17:09:07 +0000 (13:09 -0400)]
[libc++] Avoid `result_type` and `unary/binary_function` in <valarray>.

Give each of the relevant functional operators a `__result_type`
instead, so that we can keep using those typedefs in <valarray>
even when the public binder typedefs are removed in C++20.

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

3 years ago[AsmParser][SystemZ][z/OS] Introducing HLASM Parser support to AsmParser - Part 2
Anirudh Prasad [Mon, 31 May 2021 15:26:26 +0000 (11:26 -0400)]
[AsmParser][SystemZ][z/OS] Introducing HLASM Parser support to AsmParser - Part 2

- This patch is the second (and hopefully final) part of providing HLASM syntax for inline asm statements for z/OS to LLVM (continuing on from https://reviews.llvm.org/D98276)
- This second part deals with providing label support
- As mentioned in https://reviews.llvm.org/D98276, if the first token is not a space we process the first token as a label, and the remaining tokens as a possible machine instruction
- To achieve this, a new `parseAsHLASMLabel` function is introduced. This function processes the first token, validates whether it is an "acceptable" label according to HLASM standards, and then emits it
- After handling and emitting the label, call the `parseAsMachineInstruction` instruction to process the remaining tokens as a machine instruction.

Reviewed By: uweigand

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

3 years ago[NFC] MemoryDependenceAnalysis cleanup.
Daniil Fukalov [Wed, 12 May 2021 19:43:16 +0000 (22:43 +0300)]
[NFC] MemoryDependenceAnalysis cleanup.

1. Removed redundant includes,
2. Removed never defined and used `releaseMemory()`.
3. Fixed member functions names first letter case.
4. Renamed duplicate (in nested struct `NonLocalPointerInfo`) name
   `NonLocalDeps` to `NonLocalDepsMap`.

Reviewed By: nikic

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

3 years ago[mlir][linalg] Cleanup LinalgOp usage in verification (NFC).
Tobias Gysi [Mon, 31 May 2021 13:30:56 +0000 (13:30 +0000)]
[mlir][linalg] Cleanup LinalgOp usage in verification (NFC).

Replace the uses of deprecated Structured Op Interface methods in LinalgInterfaces.cpp. This patch is based on https://reviews.llvm.org/D103394.

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

3 years agoRevert "[clang] Add support for the "abstract" contextual keyword of MSVC"
Mikhail Goncharov [Mon, 31 May 2021 13:33:15 +0000 (15:33 +0200)]
Revert "[clang] Add support for the "abstract" contextual keyword of MSVC"

This reverts commit 818338add77411f5e9713247ea66142f332ef350.

Tests fail under sanitizer: https://lab.llvm.org/buildbot/#/builders/5/builds/8150

3 years ago[mlir][linalg] Update Structured Op Interface (NFC).
Tobias Gysi [Mon, 31 May 2021 12:46:32 +0000 (12:46 +0000)]
[mlir][linalg] Update Structured Op Interface (NFC).

Adding methods to access operand properties via OpOperands and mark outdated methods as deprecated.

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

3 years ago[SDAG] add check to sext-of-setcc fold to bypass changing a legal op
Sanjay Patel [Mon, 31 May 2021 12:53:09 +0000 (08:53 -0400)]
[SDAG] add check to sext-of-setcc fold to bypass changing a legal op

I accidentaly pushed a draft of D103280 that was discussed
during the review, but it was not supposed to be the final
version.

Rather than revert and recommit, I'm updating the existing
code. This way we have a record of the codegen diff that
would result if we decide to remove this predicate in the
future.

3 years ago[libunwind] fix -Wc++98-compat-extra-semi without _LIBUNWIND_HIDE_SYMBOLS
Nico Weber [Mon, 31 May 2021 12:53:07 +0000 (08:53 -0400)]
[libunwind] fix -Wc++98-compat-extra-semi without _LIBUNWIND_HIDE_SYMBOLS

3 years ago[MLIR][Shape] Remove duplicate operands of `shape.assuming_all` op
Frederik Gossen [Mon, 31 May 2021 11:51:20 +0000 (13:51 +0200)]
[MLIR][Shape] Remove duplicate operands of `shape.assuming_all` op

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

3 years ago[NFC] ScalarEvolution: apply SSO to the ExprValueMap value
Roman Lebedev [Mon, 31 May 2021 11:38:26 +0000 (14:38 +0300)]
[NFC] ScalarEvolution: apply SSO to the ExprValueMap value

ExprValueMap is a map from SCEV * to a set-vector of (Value *, ConstantInt *) pair,
and while the map itself will likely be big-ish (have many keys),
it is a reasonable assumption that each key will refer to a small-ish
number of pairs.

In particular looking at n=512 case from
https://bugs.llvm.org/show_bug.cgi?id=50384,
the small-size of 4 appears to be the sweet spot,
it results in the least allocations while minimizing memory footprint.
```
$ for i in $(ls heaptrack.opt.*.gz); do echo $i; heaptrack_print $i | tail -n 6; echo ""; done
heaptrack.opt.0-orig.gz
total runtime: 14.32s.
calls to allocation functions: 8222442 (574192/s)
temporary memory allocations: 2419000 (168924/s)
peak heap memory consumption: 190.98MB
peak RSS (including heaptrack overhead): 239.65MB
total memory leaked: 67.58KB

heaptrack.opt.1-n1.gz
total runtime: 13.72s.
calls to allocation functions: 7184188 (523705/s)
temporary memory allocations: 2419017 (176338/s)
peak heap memory consumption: 191.38MB
peak RSS (including heaptrack overhead): 239.64MB
total memory leaked: 67.58KB

heaptrack.opt.2-n2.gz
total runtime: 12.24s.
calls to allocation functions: 6146827 (502355/s)
temporary memory allocations: 2418997 (197695/s)
peak heap memory consumption: 163.31MB
peak RSS (including heaptrack overhead): 211.01MB
total memory leaked: 67.58KB

heaptrack.opt.3-n4.gz
total runtime: 12.28s.
calls to allocation functions: 6068532 (494260/s)
temporary memory allocations: 2418985 (197017/s)
peak heap memory consumption: 155.43MB
peak RSS (including heaptrack overhead): 201.77MB
total memory leaked: 67.58KB

heaptrack.opt.4-n8.gz
total runtime: 12.06s.
calls to allocation functions: 6068042 (503321/s)
temporary memory allocations: 2418992 (200646/s)
peak heap memory consumption: 166.03MB
peak RSS (including heaptrack overhead): 213.55MB
total memory leaked: 67.58KB

heaptrack.opt.5-n16.gz
total runtime: 12.14s.
calls to allocation functions: 6067993 (499958/s)
temporary memory allocations: 2418999 (199307/s)
peak heap memory consumption: 187.24MB
peak RSS (including heaptrack overhead): 233.69MB
total memory leaked: 67.58KB
```

While that test may be an edge worst-case scenario,
https://llvm-compile-time-tracker.com/compare.php?from=dee85d47d9f15fc268f7b18f279dac2774836615&to=98a57e31b1947d5bcdf4a5605ac2ab32b4bd5f63&stat=instructions
agrees that this also results in improvements in the usual situations.

3 years ago[MLIR] Fix warnings in AffineOps.cpp
Uday Bondhugula [Mon, 31 May 2021 12:27:22 +0000 (17:57 +0530)]
[MLIR] Fix warnings in AffineOps.cpp

Fix warnings in AffineOps.cpp.

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

3 years ago[AMDGPU][Libomptarget][NFC] Split host and device malloc
Pushpinder Singh [Mon, 31 May 2021 07:19:41 +0000 (07:19 +0000)]
[AMDGPU][Libomptarget][NFC] Split host and device malloc

This patch splits the code path for host and device malloc.

Reviewed By: JonChesterfield

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

3 years ago[llvm-objcopy][NFC] Refactor CopyConfig structure - remove lazy options processing.
Alexey Lapshin [Thu, 27 May 2021 11:07:35 +0000 (14:07 +0300)]
[llvm-objcopy][NFC] Refactor CopyConfig structure - remove lazy options processing.

During reviewing D102277 it was decided to remove lazy options processing
from llvm-objcopy CopyConfig structure. This patch transforms processing of ELF
lazy options into the in-place processing.

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

3 years agofix test for symlinked clang c1ee4fb5af49a
Mikhail Goncharov [Mon, 31 May 2021 11:29:33 +0000 (13:29 +0200)]
fix test for symlinked clang c1ee4fb5af49a

3 years ago[SDAG] try harder to fold casts into vector compare
Sanjay Patel [Mon, 31 May 2021 11:14:01 +0000 (07:14 -0400)]
[SDAG] try harder to fold casts into vector compare

sext (vsetcc X, Y) --> vsetcc (zext X), (zext Y) --
(when the zexts are free and a bunch of other conditions)

We have a couple of similar folds to this already for vector selects,
but this pattern slips through because it is only a setcc.

The tests are based on the motivating case from:
https://llvm.org/PR50055
...but we need extra logic to get that example, so I've left that as
a TODO for now.

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

3 years agofix broken clang tests after 7161bb87c914
Juneyoung Lee [Mon, 31 May 2021 10:25:06 +0000 (19:25 +0900)]
fix broken clang tests after  7161bb87c914

3 years ago[LiveDebugVariables] Stop trimming locations of non-inlined vars
Djordje Todorovic [Fri, 21 May 2021 12:29:23 +0000 (05:29 -0700)]
[LiveDebugVariables] Stop trimming locations of non-inlined vars

The D35953, D62650 and D73691 introduced trimming of variables locations
in LiveDebugVariables pass, since there are some cases where after
the virtregrewrite we have exploded number of DBG_VALUEs created for some
inlined variables. As it looks, all problematic cases were regarding
inlined variables, so it seems reasonable to stop trimming the location
ranges for non-inlined variables.
It has very good impact on the llvm-locstats report.

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

3 years ago[RISCV] Scale scalably-typed split argument offsets by VSCALE
Fraser Cormack [Thu, 27 May 2021 15:47:36 +0000 (16:47 +0100)]
[RISCV] Scale scalably-typed split argument offsets by VSCALE

This patch fixes a bug in lowering scalable-vector types in RISC-V's
main calling convention. When scalable-vector types are split and passed
indirectly, the target is responsible for scaling the offset --
initially set to the known-minimum store size -- by the scalable factor.

Before this we were issuing overlapping loads or stores to the different
parts, leading to incorrect codegen.

Credit to @HsiangKai for spotting this.

Reviewed By: HsiangKai

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

3 years ago[InsCombine] Fix a few remaining vec transforms to use poison instead of undef
Juneyoung Lee [Mon, 31 May 2021 09:40:40 +0000 (18:40 +0900)]
[InsCombine] Fix a few remaining vec transforms to use poison instead of undef

This is a patch that replaces shufflevector and insertelement's placeholder value with poison.

Underlying motivation is to fix the semantics of shufflevector with undef mask to return poison instead
(D93818)
The consensus has been made in the late 2020 via mailing list as well as the thread in https://bugs.llvm.org/show_bug.cgi?id=44185 .

This patch is a simple syntactic change to the existing code, hence directly pushed as a commit.

3 years ago[DSE] Remove stores in the same loop iteration
David Green [Mon, 31 May 2021 09:22:37 +0000 (10:22 +0100)]
[DSE] Remove stores in the same loop iteration

DSE will currently only remove stores in the same block unless they can
be guaranteed to be loop invariant. This expands that to any stores that
are in the same Loop, at the same loop level. This should still account
for where AA/MSSA will not handle aliasing between loops, but allow the
dead stores to be removed where they overlap in the same loop iteration.
It requires adding loop info to DSE, but that looks fairly harmless.

The test case this helps is from code like this, which can come up in
certain matrix operations:
  for(i=..)
    dst[i] = 0;
    for(j=..)
      dst[i] += src[i*n+j];

After LICM, this becomes:
for(i=..)
  dst[i] = 0;
  sum = 0;
  for(j=..)
    sum += src[i*n+j];
  dst[i] = sum;

The first store is dead, and with this patch is now removed.

Differntial Revision: https://reviews.llvm.org/D100464

3 years ago[lldb][NFC] Remove unused var in SBDebugger::GetInternalVariableValue
Raphael Isemann [Mon, 31 May 2021 09:06:55 +0000 (11:06 +0200)]
[lldb][NFC] Remove unused var in SBDebugger::GetInternalVariableValue

This variable was originally just the default return value but got unused
in 6920b52be6f8731692a9bff4fe6a7b596cda00c5 .

3 years ago[RISCV] Support vector conversions between fp and i1
Fraser Cormack [Fri, 28 May 2021 11:06:15 +0000 (12:06 +0100)]
[RISCV] Support vector conversions between fp and i1

This patch custom lowers FP_TO_[US]INT and [US]INT_TO_FP conversions
between floating-point and boolean vectors. As the default action is
scalarization, this patch both supports scalable-vector conversions and
improves the code generation for fixed-length vectors.

The lowering for these conversions can piggy-back on the existing
lowering, which lowers the operations to a supported narrowing/widening
conversion and then either an extension or truncation.

Reviewed By: craig.topper

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

3 years ago[clang] NFC: split HeaderMapTest to have re-usable header map implementation for...
Dmitry Polukhin [Thu, 27 May 2021 07:57:26 +0000 (00:57 -0700)]
[clang] NFC: split HeaderMapTest to have re-usable header map implementation for testing

NFC changes required for https://reviews.llvm.org/D103142

Test Plan: check-clang

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

3 years agoRevert "[WebAssembly][CodeGen] IR support for WebAssembly local variables"
Andy Wingo [Mon, 31 May 2021 08:55:15 +0000 (10:55 +0200)]
Revert "[WebAssembly][CodeGen] IR support for WebAssembly local variables"

This reverts commit bf35f4af51cddd743435bb6b94a45592c967891a.  There was
an error in a shared-library build.

3 years ago[clang] Add support for the "abstract" contextual keyword of MSVC
Abbas Sabra [Mon, 31 May 2021 08:38:17 +0000 (10:38 +0200)]
[clang] Add support for the "abstract" contextual keyword of MSVC

https://docs.microsoft.com/en-us/cpp/extensions/abstract-cpp-component-extensions?view=msvc-160
Note: like the already supported "sealed" keyword, the "abstract"
keyword is supported by MSVC by default.

Differential revision: https://reviews.llvm.org/D102517

3 years ago[WebAssembly][CodeGen] IR support for WebAssembly local variables
Andy Wingo [Wed, 21 Apr 2021 13:41:48 +0000 (15:41 +0200)]
[WebAssembly][CodeGen] IR support for WebAssembly local variables

This patch adds TargetStackID::WasmLocal.  This stack holds locations of
values that are only addressable by name -- not via a pointer to memory.
For the WebAssembly target, these objects are lowered to WebAssembly
local variables, which are managed by the WebAssembly run-time and are
not addressable by linear memory.

For the WebAssembly target IR indicates that an AllocaInst should be put
on TargetStackID::WasmLocal by putting it in the non-integral address
space WASM_ADDRESS_SPACE_WASM_VAR, with value 1.  SROA will mostly lift
these allocations to SSA locals, but any alloca that reaches instruction
selection (usually in non-optimized builds) will be assigned the new
TargetStackID there.  Loads and stores to those values are transformed
to new WebAssemblyISD::LOCAL_GET / WebAssemblyISD::LOCAL_SET nodes,
which then lower to the type-specific LOCAL_GET_I32 etc instructions via
tablegen patterns.

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

3 years ago[mlir][NFC] Remove illegal TanhOp in LLVMConversionTarget
Tres Popp [Sun, 30 May 2021 17:50:54 +0000 (19:50 +0200)]
[mlir][NFC] Remove illegal TanhOp in LLVMConversionTarget

No tests fail and this seems to be technical debt from when the math
dialect was created. This should not be there as it prevents users from
configuring their converion target freely and results in unexpected
behavior on seemingly unrelated ops.

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

3 years ago[mlir] Support permutation maps in vector transfer op folder
Matthias Springer [Mon, 31 May 2021 08:22:35 +0000 (17:22 +0900)]
[mlir] Support permutation maps in vector transfer op folder

Fold away in_bounds attribute even if the transfer op has a non-identity permutation map.

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

3 years ago[LangRef] update according to unwinding support in inline asm
cynecx [Mon, 31 May 2021 08:00:35 +0000 (09:00 +0100)]
[LangRef] update according to unwinding support in inline asm

https://reviews.llvm.org/D95745 introduced a new `unwind` keyword for inline assembler expressions. Inline asms marked with the `unwind` keyword allows stack unwinding from inline assembly because the compiler emits unwinding information ("around" the inline asm) as it would for calls/invokes. Unwinding the stack from within non-unwind inline asm may cause UB.

Reviewed By: Amanieu

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

3 years ago[libcxx] [test] Add UNSUPPORTED: msvc in a couple verify.cpp tests
Martin Storsjö [Fri, 28 May 2021 09:53:27 +0000 (09:53 +0000)]
[libcxx] [test] Add UNSUPPORTED: msvc in a couple verify.cpp tests

Due to issues with the detection of the clang-verify feature, these
tests have been skipped in the Windows CI configuration so far.

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

3 years ago[mlir][NFC] Rename MathToLLVM->MathToLibm
Tres Popp [Sun, 30 May 2021 17:43:27 +0000 (19:43 +0200)]
[mlir][NFC] Rename MathToLLVM->MathToLibm

3 years ago[clangd] Move gtest include to TestTU.cpp from TestTU.h
Kadir Cetinkaya [Mon, 31 May 2021 05:42:15 +0000 (07:42 +0200)]
[clangd] Move gtest include to TestTU.cpp from TestTU.h

3 years ago[InstCombine] Fix miscompile on GEP+load to icmp fold (PR45210)
Hyeongyu Kim [Mon, 31 May 2021 05:05:29 +0000 (14:05 +0900)]
[InstCombine] Fix miscompile on GEP+load to icmp fold (PR45210)

As noted in PR45210: https://bugs.llvm.org/show_bug.cgi?id=45210
...the bug is triggered as Eli say when sext(idx) * ElementSize overflows.

```
   // assume that GV is an array of 4-byte elements
   GEP = gep GV, 0, Idx // this is accessing Idx * 4
   L = load GEP
   ICI = icmp eq L, value
 =>
   ICI = icmp eq Idx, NewIdx
```

The foldCmpLoadFromIndexedGlobal function simplifies GEP+load operation to icmp.
And there is a problem because Idx * ElementSize can overflow.

Let's assume that the wanted value is at offset 0.
Then, there are actually four possible values for Idx to match offset 0: 0x00..00, 0x40..00, 0x80..00, 0xC0..00.
We should return true for all these values, but currently, the new icmp only returns true for 0x00..00.

This problem can be solved by masking off (trailing zeros of ElementSize) bits from Idx.

```
   ...
 =>
   Idx' = and Idx, 0x3F..FF
   ICI = icmp eq Idx', NewIdx
```

Reviewed By: efriedma

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

3 years ago[AVR][NFC] Refactor 8-bit & 16-bit shifts
Ben Shi [Mon, 31 May 2021 02:30:46 +0000 (10:30 +0800)]
[AVR][NFC] Refactor 8-bit & 16-bit shifts

Reviewed By: dylanmckay

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

3 years ago[lldb] Fix typos. NFC.
Bruce Mitchener [Sun, 30 May 2021 14:14:17 +0000 (21:14 +0700)]
[lldb] Fix typos. NFC.

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

3 years ago[CSE] Make domInfo a stored property, cut use of DominanceInfo::hasDominanceInfo...
Chris Lattner [Sun, 30 May 2021 19:22:08 +0000 (12:22 -0700)]
[CSE] Make domInfo a stored property, cut use of DominanceInfo::hasDominanceInfo. NFC.

CSE is the only client of this API, refactor it a bit to pull the query
internally to make changes to DominanceInfo a bit easier.  This commit
also improves comments a bit.