platform/upstream/llvm.git
3 years ago[lldb] [Host/Terminal] Fix warnings with termios disabled
Michał Górny [Thu, 28 Oct 2021 19:03:49 +0000 (21:03 +0200)]
[lldb] [Host/Terminal] Fix warnings with termios disabled

Thanks to Nico Weber for the suggestion.

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

3 years ago[mlir][docs] Fix obvious spelling mistakes in documentation
Markus Böck [Fri, 29 Oct 2021 07:19:11 +0000 (09:19 +0200)]
[mlir][docs] Fix obvious spelling mistakes in documentation

3 years ago[mlir][NFC] Fix typo in comment
Markus Böck [Fri, 29 Oct 2021 07:00:19 +0000 (09:00 +0200)]
[mlir][NFC] Fix typo in comment

3 years ago[mlir][NFC] Make InsertionGuard properly move constructible
Markus Böck [Fri, 29 Oct 2021 06:56:38 +0000 (08:56 +0200)]
[mlir][NFC] Make InsertionGuard properly move constructible

InsertionGuards move constructor is currently the compiler synthesized implementation which is very bug prone. A move constructed InsertionGuard will get the same builder and insertion point as the one it is constructed from, leading to insertion point being restored twice. This can even happen in non obvious situations on some compilers, such as when returning a move constructible struct from a function.

This patch fixes the issue by properly implementing the move constructor. An InsertionGuard that was used to move construct another InsertionGuard is simply inactive and will not restore the insertion point.

I chose to explicitly delete the move assign operator as its semantics are not clear cut. If one were to strictly follow the rule of 5, you'd have to restore the insertion point before then taking ownership of the others guards fields. I believe that to be rather confusing and/or surprising however. One may still get such semantics using llvm::Optional or std::optional and the emplace method if really needed.

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

3 years ago[mlir][linalg] Adapt hoistPaddingOnTensors signature to support patterns (NFC).
Tobias Gysi [Fri, 29 Oct 2021 06:42:32 +0000 (06:42 +0000)]
[mlir][linalg] Adapt hoistPaddingOnTensors signature to support patterns (NFC).

Adapt hoistPaddingOnTensors to leave replacing and erasing the old pad tensor operation to the caller. This change makes the function pattern friendly.

Depends On D112003

Reviewed By: nicolasvasilache

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

3 years ago[clang] Partially revert d8cd7806310c51af912a647a6ca46de62ff13214.
Brad Smith [Fri, 29 Oct 2021 06:34:38 +0000 (02:34 -0400)]
[clang] Partially revert d8cd7806310c51af912a647a6ca46de62ff13214.

The C11 atomics part was wrong.

3 years ago[clang-tidy]performance-unnecessary-copy-initialization: fix false negative
Clement Courbet [Thu, 28 Oct 2021 14:48:53 +0000 (16:48 +0200)]
[clang-tidy]performance-unnecessary-copy-initialization: fix false negative

We're missing all cases where the return value is a type alias.

Unfortunately, this includes things we care about, such as
`std::vector<T>::operator[]` (return value is `const_reference`,
not `const T&`).

Match the canonical type instead.

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

3 years ago[libcxx] [test] Change LIBCXX-WINDOWS-FIXME into XFAIL: msvc for cases that succeed...
Martin Storsjö [Mon, 17 May 2021 20:53:10 +0000 (20:53 +0000)]
[libcxx] [test] Change LIBCXX-WINDOWS-FIXME into XFAIL: msvc for cases that succeed in mingw configurations

Add comments about the reasons for the XFAILs where there was none before.

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

3 years ago[clang] [MinGW] Guess the right ix86 arch name spelling as sysroot
Martin Storsjö [Sat, 16 Oct 2021 14:30:28 +0000 (17:30 +0300)]
[clang] [MinGW] Guess the right ix86 arch name spelling as sysroot

For x86, most contempory mingw toolchains use i686 as 32 bit
x86 arch target.

As long as the target triple is set to the right form, this works
fine, either as the compiler's default target, or via e.g.
a triple prefix like i686-w64-mingw32-clang.

However, if the unprefixed toolchain targets x86_64, but the user
tries to switch it to target 32 bit by adding the -m32 option, the
computeTargetTriple function in Clang, together with
Triple::get32BitArchVariant, sets the arch to i386. This causes
the right sysroot to not be found.

When targeting an arch where there are potential spelling ambiguities
with respect to the sysroots (i386 and arm), check if the driver can
find a sysroot with the arch name - if not, try a couple other
candidates.

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

3 years ago[mlir][linalg] Use OpBuilder in rewriteAsPaddedOp (NFC).
Tobias Gysi [Thu, 28 Oct 2021 18:54:57 +0000 (18:54 +0000)]
[mlir][linalg] Use OpBuilder in rewriteAsPaddedOp (NFC).

Adapt the rewriteAsPaddedOp method to use the OpBuilder instead of the PatterRewriter.

Reviewed By: nicolasvasilache

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

3 years ago[llvm-objcopy] Fix misaligned access to load command data.
Daniel Rodríguez Troitiño [Thu, 28 Oct 2021 18:33:53 +0000 (11:33 -0700)]
[llvm-objcopy] Fix misaligned access to load command data.

It seems that llvm-objcopy stores data temporarily misaligned with the
requirements of the underlaying struct from libBinaryFormat, and UBSan
generates a runtime error.

Instead of trying to reinterpret the memory as the struct itself, simply
access the `char *` pointer that we are interested in, and that do not
have alignment restrictions.

This problem was pointed out in a comment of D111164.

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

3 years ago[lld-macho] Internalize createFiles. NFC
Fangrui Song [Fri, 29 Oct 2021 05:14:36 +0000 (22:14 -0700)]
[lld-macho] Internalize createFiles. NFC

3 years ago[AMDGPU] Fix cvt_f32_ubyte combine with shl
Vang Thao [Thu, 28 Oct 2021 16:55:54 +0000 (09:55 -0700)]
[AMDGPU] Fix cvt_f32_ubyte combine with shl

Shift node is still needed to check if the shift is shr or shl to increment/decrement offset. Do not override the node.

Reviewed By: arsenm

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

3 years ago[NFC] [Coroutines] Use llvm::make_scope_exit to replace self-defined RTTIHelper
Chuanqi Xu [Fri, 29 Oct 2021 04:14:04 +0000 (12:14 +0800)]
[NFC] [Coroutines] Use llvm::make_scope_exit to replace self-defined RTTIHelper

3 years ago[ELF] Simplify R_TPREL formula after D111365
Fangrui Song [Fri, 29 Oct 2021 04:03:53 +0000 (21:03 -0700)]
[ELF] Simplify R_TPREL formula after D111365

3 years ago[mlir][sparse] fix broken asan test
Aart Bik [Fri, 29 Oct 2021 03:36:29 +0000 (20:36 -0700)]
[mlir][sparse] fix broken asan test

TBR : delete was dropped from previous approved revision (https://reviews.llvm.org/D110790), breaking asan

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

3 years ago[AMDGPU] Remove hasDefinedInitializer (NFC)
Kazu Hirata [Fri, 29 Oct 2021 03:33:34 +0000 (20:33 -0700)]
[AMDGPU] Remove hasDefinedInitializer (NFC)

The last use was removed on Sep 16, 2021 in commit
7a62a5b56d670c4e152159740cd7fc4030a9470f.

3 years ago[AMDGPU] Remove unused BBSelectRegister in AMDGPUMachineCFGStructurizer (NFC)
Kazu Hirata [Fri, 29 Oct 2021 03:33:32 +0000 (20:33 -0700)]
[AMDGPU] Remove unused BBSelectRegister in AMDGPUMachineCFGStructurizer (NFC)

This field seems to be unused for at least one year.

3 years ago[AMDGPU] Remove unused declaration eliminateDeadBranchOperands (NFC)
Kazu Hirata [Fri, 29 Oct 2021 03:33:30 +0000 (20:33 -0700)]
[AMDGPU] Remove unused declaration eliminateDeadBranchOperands (NFC)

3 years agoformat_arg attribute should allow instancetype in NSString definition
Félix Cloutier [Fri, 29 Oct 2021 03:00:08 +0000 (20:00 -0700)]
format_arg attribute should allow instancetype in NSString definition

- [[format_arg(N)]] tells Clang that a method returns a format string with
  specifiers equivalent to those passed in the string at argument #N. It
  obviously requires the argument and the return type to be strings both.
- `instancetype` is a special return type available in Objective-C class
  definitions that Clang expands to the most-derived statically known type on
  use.
- In Objective-C mode, NSString is allowed in lieu of a C string, both as input
  and output. However, _in the definition of NSString_, Clang rejects format_arg
  on methods that return NSString. This PR addresses this issue by substituting
  `instancetype` with the enclosing definition's type during the validation of
  `format_arg`.

Reviewed By: ahatanak

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

Radar-Id: rdar://84729746

3 years ago[DAGCombine][NFC] s/it's/its in the comment of hasNoInfs().
Abinav Puthan Purayil [Fri, 29 Oct 2021 02:01:55 +0000 (07:31 +0530)]
[DAGCombine][NFC] s/it's/its in the comment of hasNoInfs().

3 years agoFix a few remaining mentions of demangle's OutputString
David Blaikie [Fri, 29 Oct 2021 01:53:52 +0000 (18:53 -0700)]
Fix a few remaining mentions of demangle's OutputString

It's now called OutputBuffer

3 years ago[doc] Update a broken link in buildbot instructions
Philip Reames [Fri, 29 Oct 2021 01:45:54 +0000 (18:45 -0700)]
[doc] Update a broken link in buildbot instructions

3 years ago[clang][driver][darwin] support -target with Mac Catalyst triple without OS version
Alex Lorenz [Thu, 28 Oct 2021 22:29:24 +0000 (15:29 -0700)]
[clang][driver][darwin] support -target with Mac Catalyst triple without OS version

Some users might omit the version and assume the compiler will target the initial
Mac Catalyst version.

3 years ago[docs] Fix docs-lld-html
Fangrui Song [Fri, 29 Oct 2021 01:44:44 +0000 (18:44 -0700)]
[docs] Fix docs-lld-html

3 years agoMigrate the roundtrip tests to work similar to the llgdb tests
David Blaikie [Fri, 29 Oct 2021 01:38:05 +0000 (18:38 -0700)]
Migrate the roundtrip tests to work similar to the llgdb tests

I'm not sure if there's a way to make this a bit more general - the
property that matters is that there's /some/ itanium ABI target the
tests can use to compile - not link or run in this case. But this seems
sufficient for the llgdb tests, so it should be sufficient (though
perhaps not necessary) for this roundtrip test.

3 years agoAdjust test to only compile and not link
David Blaikie [Fri, 29 Oct 2021 01:09:40 +0000 (18:09 -0700)]
Adjust test to only compile and not link

Compilation is all that's needed here - linking helped avoid certain
false positives in llvm-dwarfdump --verify related to overlapping
functions when those functions were actually in distinct sections.
That's since been fixed, so we can adjust the test to only compile, and
not link.

3 years ago[lldb] Fix TestMacCatalyst.py
Jonas Devlieghere [Fri, 29 Oct 2021 00:57:41 +0000 (17:57 -0700)]
[lldb] Fix TestMacCatalyst.py

3 years ago[ELF] Implement TLSDESC for x86-32
Fangrui Song [Fri, 29 Oct 2021 00:52:03 +0000 (17:52 -0700)]
[ELF] Implement TLSDESC for x86-32

`-z rela` is also supported.

Tested with:

```
cat > ./a.c <<eof
#include <assert.h>
int foo();
int bar();
int main() {
  assert(foo() == 2);
  assert(foo() == 4);
  assert(bar() == 2);
  assert(bar() == 4);
}
eof

cat > ./b.c <<eof
#include <stdio.h>
__thread int tls0;
extern __thread int tls1;
int foo() { return ++tls0 + ++tls1; }
static __thread int tls2, tls3;
int bar() { return ++tls2 + ++tls3; }
eof

echo '__thread int tls1;' > ./c.c

sed 's/        /\t/' > ./Makefile <<'eof'
.MAKE.MODE = meta curDirOk=true

CC := gcc -m32 -g -fpic -mtls-dialect=gnu2
LDFLAGS := -m32 -Wl,-rpath=.

all: a0 a1 a2

run: all
        ./a0 && ./a1 && ./a2

c.so: c.o; ${LINK.c} -shared $> -o $@
bc.so: b.o c.o; ${LINK.c} -shared $> -o $@
b.so: b.o c.so; ${LINK.c} -shared $> -o $@

a0: a.o b.o c.o; ${LINK.c} $> -o $@
a1: a.o b.so; ${LINK.c} $> -o $@
a2: a.o bc.so; ${LINK.c} $> -o $@
eof
```
and glibc `elf/tst-gnu2-tls1`.

`/usr/local/bin/ld` points to the freshly built `lld`.

`bmake run && bmake CFLAGS=-O1 run` => ok.

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

3 years ago[ORC] Rename SupportFunctionCall to WrapperFunctionCall.
Lang Hames [Thu, 28 Oct 2021 22:54:31 +0000 (15:54 -0700)]
[ORC] Rename SupportFunctionCall to WrapperFunctionCall.

The new name better suits the type.

This patch also changes the signature of the run method (it now returns a
WrapperFunctionResult), and adds runWithSPSRet methods that deserialize the
function result using SPS.

Together these chages bring this type into close alignment with its ORC runtime
counterpart.

3 years agoTo avoid the obvious problem, use a different port...
Jim Ingham [Fri, 29 Oct 2021 00:43:21 +0000 (17:43 -0700)]
To avoid the obvious problem, use a different port...

There's another test that opens an hard-coded port to talk to debugserver
(TestPlatformSDK.py).  Make sure this port and the one in that other
test are different to avoid that potential conflict.

3 years ago[mlir][sparse] fix conversion bug when changing pointer/index sizes
Aart Bik [Thu, 28 Oct 2021 23:12:41 +0000 (16:12 -0700)]
[mlir][sparse] fix conversion bug when changing pointer/index sizes

Reviewed By: wrengr

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

3 years ago[lld][WebAssembly] Initialize bss segments using memory.fill
Sam Clegg [Wed, 27 Oct 2021 01:08:07 +0000 (18:08 -0700)]
[lld][WebAssembly] Initialize bss segments using memory.fill

Previously we were relying on the dynamic loader to take care of this
but it simple and correct for us to do it here instead.

Now we initialize bss segments as part of `__wasm_init_memory` at the
same time we initialize passive segments.

In addition we extent the us of `__wasm_init_memory` outside of shared
memory situations.  Specifically it is now used to initialize bss
segments when the memory is imported.

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

3 years agollvm-dwarfdump --verify: Don't diagnose functions in different sections as overlapping
David Blaikie [Fri, 29 Oct 2021 00:09:03 +0000 (17:09 -0700)]
llvm-dwarfdump --verify: Don't diagnose functions in different sections as overlapping

Functions in different sections (common in object files - inline
functions, -ffunction-sections, etc) can't overlap, so factor in the
section when diagnosing overlapping address ranges.

This removes a major false-positive when running llvm-dwarfdump on
unlinked code.

3 years ago[ORC-RT] Add a WrapperFunctionCall utility.
Lang Hames [Thu, 28 Oct 2021 18:23:06 +0000 (11:23 -0700)]
[ORC-RT] Add a WrapperFunctionCall utility.

WrapperFunctionCall represents a call to a wrapper function as a pair of a
target function (as an ExecutorAddr), and an argument buffer range (as an
ExecutorAddrRange). WrapperFunctionCall instances can be serialized via
SPS to send to remote machines (only the argument buffer address range is
copied, not any buffer content).

This utility will simplify the implementation of JITLinkMemoryManager
allocation actions in the ORC runtime.

3 years agoFix a bug in Launch when using an async debugger & remote platform.
Jim Ingham [Thu, 28 Oct 2021 19:07:42 +0000 (12:07 -0700)]
Fix a bug in Launch when using an async debugger & remote platform.

We weren't setting the listener back to the unhijacked one in this
case, so that a continue after the stop fails.  It thinks the process
is still running.  Also add tests for this behavior.

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

3 years ago[mlir][sparse] Adding dynamic-size support for sparse=>dense conversion
wren romano [Thu, 28 Oct 2021 23:43:27 +0000 (16:43 -0700)]
[mlir][sparse] Adding dynamic-size support for sparse=>dense conversion

Depends On D110790

Reviewed By: aartbik

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

3 years agoReapply e32b1eee6aa "[ORC] Change SPSExecutorAddr serialization,..." with fixes.
Lang Hames [Wed, 27 Oct 2021 23:57:21 +0000 (16:57 -0700)]
Reapply e32b1eee6aa "[ORC] Change SPSExecutorAddr serialization,..." with fixes.

This re-applies e32b1eee6aab52e2b7b75ee15e506b3e7dd30e68, which was reverted in
20675d8f7dab293172266fdde426c2173b5b3997 due to broken unit tests. This patch
includes fixes for the tests.

3 years ago[lld][WebAssemlby] Always enable mutable-globals feature in PIC mode
Sam Clegg [Thu, 28 Oct 2021 22:25:43 +0000 (15:25 -0700)]
[lld][WebAssemlby] Always enable mutable-globals feature in PIC mode

This works around an issue where the feature can be forgotten
in the case of LTO + object file with no functions.

See: https://bugs.llvm.org/show_bug.cgi?id=52339

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

3 years ago[mlir] Remove the deprecated OpConversionPattern::matchAndRewrite methods
River Riddle [Thu, 28 Oct 2021 22:25:11 +0000 (22:25 +0000)]
[mlir] Remove the deprecated OpConversionPattern::matchAndRewrite methods

These have been deprecated for a few weeks now.

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

3 years agoRemove unused ValueObjectDynamicValue::SetOwningSP & backing ivar
Jim Ingham [Thu, 28 Oct 2021 23:06:01 +0000 (16:06 -0700)]
Remove unused ValueObjectDynamicValue::SetOwningSP & backing ivar

This has no uses and the ValueObjectDynamicValue already tracks
its ownership through the parent it is passed when made.  I can't
find any vestiges of the use of this API, maybe it was from some
earlier design?

Resetting the backing ivar was the only job the destructor did, so I
set that to default as well.

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

3 years ago[mlir][sparse] Implementing sparse=>dense conversion.
wren romano [Thu, 28 Oct 2021 20:59:01 +0000 (13:59 -0700)]
[mlir][sparse] Implementing sparse=>dense conversion.

Depends On D110882, D110883, D110884

Reviewed By: aartbik

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

3 years ago[flang] Improve error message for misuse of NULL(mold) as data statement constant
peter klausler [Mon, 25 Oct 2021 20:25:34 +0000 (13:25 -0700)]
[flang] Improve error message for misuse of NULL(mold) as data statement constant

While "null()" is accepted as a data statement constant when it
corresponds to a pointer object, "null(mold=p)" and "null(p)"
are not allowed.  The current error messages simply complain
that null is not an array.  This patch adds a context-sensitive
message to the effect that a data statement constant followed
by non-empty parentheses must be an array or structure constructor.

(Note that f18 can't simply special-case the name "null" when parsing
data statement constants, since programs are free to repurpose that
name as an array or derived type.)

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

3 years ago[NFC][sanitizer] Disable a test with large stderr output
Vitaly Buka [Thu, 28 Oct 2021 22:14:50 +0000 (15:14 -0700)]
[NFC][sanitizer] Disable a test with large stderr output

3 years ago[RISCV] Add a test case showing unnecessary vsetvli for mask register instructions.
Craig Topper [Thu, 28 Oct 2021 21:42:29 +0000 (14:42 -0700)]
[RISCV] Add a test case showing unnecessary vsetvli for mask register instructions.

If the VL argument for a mask instruction comes from a vsetvli with
an SEW!=8, we will insert an extra vsetvli for the mask instruction
even if the SEW/LMUL ratio is the same. This requires at least one
instruction before the mask instruction that needs the SEW of the
explicit vsetvli. Otherwise, we'll just rewrite the explicit vsetvli.

3 years ago[docs] Expand a bit on the basics of a buildbot policy
Philip Reames [Thu, 28 Oct 2021 21:50:11 +0000 (14:50 -0700)]
[docs] Expand a bit on the basics of a buildbot policy

We don't have much publicly documented about how build bots are maintained, and who has what responsibility with regards to the bots themselves and failures they report.

This change adds some basic framing on the topic. It is intended to simplify document long standing practice, and to avoid introducing any new policy elements. I do want to propose a couple of changes, but those will happen with their own review and broader discussion.

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

3 years ago[flang] Revert new unintended runtime behavior
Peter Klausler [Wed, 27 Oct 2021 20:16:40 +0000 (13:16 -0700)]
[flang] Revert new unintended runtime behavior

A recent change caused some variable-length sequential formatted
output statements with record positioning at the end of a FORMAT
(e.g., FORMAT('hi',10X) to append blanks at the end of the completed
record when emitting it.

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

3 years ago[flang] Fold SPREAD
peter klausler [Tue, 26 Oct 2021 20:57:46 +0000 (13:57 -0700)]
[flang] Fold SPREAD

Implements constant folding of the transformational intrinsic
function SPREAD().

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

3 years ago[WebAssembly] Add prototype relaxed float to int trunc instructions
Thomas Lively [Thu, 28 Oct 2021 21:01:53 +0000 (14:01 -0700)]
[WebAssembly] Add prototype relaxed float to int trunc instructions

Add i32x4.relaxed_trunc_f32x4_s, i32x4.relaxed_trunc_f32x4_u,
i32x4.relaxed_trunc_f64x2_s_zero, i32x4.relaxed_trunc_f64x2_u_zero.

These are only exposed as builtins, and require user opt-in.

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

3 years ago[libc++] Temporarily mark tests as UNSUPPORTED to get the CI green
Louis Dionne [Thu, 28 Oct 2021 17:28:31 +0000 (13:28 -0400)]
[libc++] Temporarily mark tests as UNSUPPORTED to get the CI green

After recent changes to the Docker image, all hell broke loose and the
CI started failing. This patch marks a few tests as unsupported until
we can figure out what the issues are and fix them.

In the future, it would be ideal if the nodes could pick up the Dockerfile
present in the revision being tested, which would allow us to test changes
to the Dockerfile in the CI, like we do for all other code changes.

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

3 years ago[InstCombine] Precommit updated and-xor-or.ll tests. NFC.
Stanislav Mekhanoshin [Thu, 28 Oct 2021 20:11:39 +0000 (13:11 -0700)]
[InstCombine] Precommit updated and-xor-or.ll tests. NFC.

3 years ago[libc++] Fix buggy numerics of tanh(complex) at inf
Xiang Gao [Thu, 28 Oct 2021 20:06:11 +0000 (16:06 -0400)]
[libc++] Fix buggy numerics of tanh(complex) at inf

Because:
    lim[x->inf, tanh(x+iy)] = 1
    lim[x->-inf, tanh(x+iy)] = -1

See also https://github.com/NVIDIA/libcudacxx/pull/210

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

3 years ago[libc++] Fix numeric of exp(complex) at inf
Xiang Gao [Thu, 28 Oct 2021 19:53:59 +0000 (15:53 -0400)]
[libc++] Fix numeric of exp(complex) at inf

This fixes the bug that exp({501, 0}) returns {inf, nan} instead
of {inf, 0}.

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

3 years ago[mlir] MathApproximations: unroll virtual vectors into hardware vectors for ISA speci...
Eugene Zhulenev [Thu, 28 Oct 2021 19:37:28 +0000 (12:37 -0700)]
[mlir] MathApproximations: unroll virtual vectors into hardware vectors for ISA specific operation

Reviewed By: cota

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

3 years ago[mlir][Linalg] NFC - Make more option names consistent.
Nicolas Vasilache [Wed, 27 Oct 2021 18:11:12 +0000 (18:11 +0000)]
[mlir][Linalg] NFC - Make more option names consistent.

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

3 years agoReland "[ARM] __cxa_end_cleanup should be called instead of _UnwindResume."
Daniel Kiss [Wed, 27 Oct 2021 08:32:11 +0000 (10:32 +0200)]
Reland "[ARM] __cxa_end_cleanup should be called instead of _UnwindResume."

This is relanding commit da1d1a08694bbfe0ea7a23ea094612436e8a2dd0 .
This patch additionally addresses failures found in buildbots & post review comments.

ARM EHABI[1] specifies the __cxa_end_cleanup to be called after cleanup.
It will call the UnwindResume.
__cxa_begin_cleanup will be called from libcxxabi while __cxa_end_cleanup is never called.
This will trigger a termination when a foreign exception is processed while UnwindResume is called
because the global state will be wrong due to the missing __cxa_end_cleanup call.

Additional test here: D109856
[1] https://github.com/ARM-software/abi-aa/blob/main/ehabi32/ehabi32.rst#941compiler-helper-functions

Reviewed By: logan

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

3 years ago[libc++][ABI Break] Make is_error_condition_enum_v and is_error_code_enum_v bool...
Joe Loser [Thu, 28 Oct 2021 19:38:02 +0000 (15:38 -0400)]
[libc++][ABI Break] Make is_error_condition_enum_v and is_error_code_enum_v bool, not size_t

`is_error_condition_enum_v` and `is_error_code_enum_v` are currently of
type `size_t`, but the standard mandates they are of type `bool`.

This is an ABI break technically since the size of these variable
templates has changed. Document it as such in the release notes.

Fixes https://bugs.llvm.org/show_bug.cgi?id=50755

Reviewed By: ldionne, Quuxplusone, #libc, var-const

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

3 years ago[WebAssembly] Fix debug locations for ExplicitLocals pass
Wouter van Oortmerssen [Mon, 25 Oct 2021 21:00:42 +0000 (14:00 -0700)]
[WebAssembly] Fix debug locations for ExplicitLocals pass

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

3 years ago[InstCombine] Fixed non-determinisctic order of new instructions
Stanislav Mekhanoshin [Thu, 28 Oct 2021 19:14:02 +0000 (12:14 -0700)]
[InstCombine] Fixed non-determinisctic order of new instructions

Fixes non-determinisctic order of XOR instructions created after
5a7a458306cd. The order of call argument evaluation is not
defined, so create one Value before the call.

3 years ago[InstCombine] Fold `(c & ~(a | b)) | (b & ~(a | c))` to `~a & (b ^ c)`
Stanislav Mekhanoshin [Thu, 21 Oct 2021 22:12:12 +0000 (15:12 -0700)]
[InstCombine] Fold `(c & ~(a | b)) | (b & ~(a | c))` to `~a & (b ^ c)`

```
----------------------------------------
define i4 @src(i4 %a, i4 %b, i4 %c) {
%0:
  %or1 = or i4 %a, %b
  %not1 = xor i4 %or1, 15
  %and1 = and i4 %not1, %c
  %or2 = or i4 %a, %c
  %not2 = xor i4 %or2, 15
  %and2 = and i4 %not2, %b
  %or3 = or i4 %and1, %and2
  ret i4 %or3
}
=>
define i4 @tgt(i4 %a, i4 %b, i4 %c) {
%0:
  %xor = xor i4 %b, %c
  %not = xor i4 %a, 15
  %or3 = and i4 %xor, %not
  ret i4 %or3
}
Transformation seems to be correct!
```

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

3 years ago[lld][WebAssembly] Handle duplicate archive member names in ThinLTO
Sam Clegg [Thu, 28 Oct 2021 15:15:20 +0000 (08:15 -0700)]
[lld][WebAssembly] Handle duplicate archive member names in ThinLTO

This entire change, including the test case, comes almost verbatim
from the ELF driver.

Fixes: https://github.com/emscripten-core/emscripten/issues/12763

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

3 years ago[lld] Rename addCombinedLTOObjects to match ELF driver. NFC
Sam Clegg [Thu, 28 Oct 2021 14:33:30 +0000 (07:33 -0700)]
[lld] Rename addCombinedLTOObjects to match ELF driver. NFC

This function was renamed in https://reviews.llvm.org/D62291.
The new name seems more accurate and also its good to maintain
some consistency between these methods in the different drivers.

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

3 years ago[AArch64] Rename some timm predicates for consistency. NFC.
Ahmed Bougacha [Thu, 28 Oct 2021 17:20:11 +0000 (10:20 -0700)]
[AArch64] Rename some timm predicates for consistency. NFC.

timm isn't the common case, and TImmLeafs should make it clear what
they are.  We're adding a plain ImmLeaf for 0_65535, so rename
i64_imm0_65535 to timm64_0_65535, and imm32_0_7 to timm32_0_7.

3 years ago[IRSymTab] Mark __stack_chk_guard used
Yuanfang Chen [Thu, 28 Oct 2021 18:19:37 +0000 (11:19 -0700)]
[IRSymTab] Mark __stack_chk_guard used

`__stack_chk_guard` is a global variable that has no uses before the LLVM code generation phase (how it is defined is platform-dependent). LTO needs to preserve this symbol for that reason. Currently, legacy LTO API preserves it by hardcoding the logic in Internalizer, but this symbol is not preserved by regular LTO API in thinlink phase. This patch marks `__stack_chk_guard` used during IR symbol table writing since this is how builtin functions are preserved by thinlink by using `RuntimeLibcalls.def`.

Reviewed By: MaskRay, tejohnson

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

3 years ago[Internalize] Preserve __stack_chk_fail in Internalizer correctly
Yuanfang Chen [Thu, 28 Oct 2021 18:19:24 +0000 (11:19 -0700)]
[Internalize] Preserve __stack_chk_fail in Internalizer correctly

Move the section collecting `AlwaysPreserved` up before any
`maybeInternalize` is called. Otherwise, functions in `AlwaysPreserved` (in this case, `__stack_chk_fail`)
are not preserved.

Reviewed By: MaskRay, tejohnson

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

3 years ago[mlir][linalg] Remove unused method (NFC).
Tobias Gysi [Thu, 28 Oct 2021 17:46:35 +0000 (17:46 +0000)]
[mlir][linalg] Remove unused method (NFC).

Remove an unused method in hoist padding and format comment.

Reviewed By: nicolasvasilache

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

3 years ago[TwoAddressInstructionPass] Put all new instructions into DistanceMap
Guozhi Wei [Thu, 28 Oct 2021 18:08:36 +0000 (11:08 -0700)]
[TwoAddressInstructionPass] Put all new instructions into DistanceMap

In function convertInstTo3Addr, after converting a two address instruction into
three address instruction, only the last new instruction is inserted into
DistanceMap. This is wrong, DistanceMap should track all instructions from the
beginning of current MBB to the working instruction. When a two address
instruction is converted to three address instruction, multiple instructions may
be generated (usually an extra COPY is generated), all of them should be
inserted into DistanceMap.

Similarly when unfolding memory operand in function tryInstructionTransform
DistanceMap is not maintained correctly.

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

3 years ago[libc++] P0433R2: add the remaining deduction guides.
Konstantin Varlamov [Thu, 28 Oct 2021 07:36:19 +0000 (00:36 -0700)]
[libc++] P0433R2: add the remaining deduction guides.

Add deduction guides to `valarray` and `scoped_allocator_adaptor`. This largely
finishes implementation of the paper:

* deduction guides for other classes mentioned in the paper were
  implemented previously (see the list below);
* deduction guides for several classes contained in the proposal
  (`reference_wrapper`, `lock_guard`, `scoped_lock`, `unique_lock`,
  `shared_lock`) were removed by [LWG2981](https://wg21.link/LWG2981).

Also add deduction guides to the synopsis for the few classes (e.g. `pair`)
where they were missing.

The only part of the paper that isn't fully implemented after this patch is
making sure certain deduction guides don't participate in overload resolution
when given incorrect template parameters.

List of significant commits implementing the other parts of P0433 (omitting some
minor fixes):

* [pair](https://github.com/llvm/llvm-project/commit/af65856eec160d163c764faad250d93357be7c83)
* [basic_string](https://github.com/llvm/llvm-project/commit/6d9f750dec29e8ae5366092e64cd343dae2c7464)
* [array](https://github.com/llvm/llvm-project/commit/0ca8c0895c6034615593c295dd955f29b25bf3d4)
* [deque](https://github.com/llvm/llvm-project/commit/dbb6f8a8179b0604e25707b5c1b72be6164f62d9)
* [forward_list](https://github.com/llvm/llvm-project/commit/e076700b7786959206acef136ecf05d54078e4e1)
* [list](https://github.com/llvm/llvm-project/commit/4a227e582b2f13880ea049b29988a37a0f7c0742)
* [vector](https://github.com/llvm/llvm-project/commit/df8f75479278d5ce16eede342ceb5ba2fd71460b)
* [queue/stack/priority_queue](https://github.com/llvm/llvm-project/commit/5b8b8b5dce587f1e5a4a31cc24f09b18bd53ff9a)
* [basic_regex](https://github.com/llvm/llvm-project/commit/edd5e29cfe9f67ec8e7e0eda12eb05e616fdeebc)
* [optional](https://github.com/llvm/llvm-project/commit/f35b4bc3954f3b01051fc0848535ff784809e9e2)
* [map/multimap](https://github.com/llvm/llvm-project/commit/edfe8525de1f7278f4754f2bffd47b13ec291a17)
* [set/multiset](https://github.com/llvm/llvm-project/commit/e20865c387e09ea0ebd5add15c762cd5271ff65f)
* [unordered_set/unordered_multiset](https://github.com/llvm/llvm-project/commit/296a80102a9b72c3eda80558fb78a3ed8849b341)
* [unordered_map/unordered_multimap](https://github.com/llvm/llvm-project/commit/dfcd4384cbcac0eeb7e5cbce350f875ba4da79d5)
* [function](https://github.com/llvm/llvm-project/commit/e1eabcdfad89f67ae575b0c86aa4a72d277378b4)
* [tuple](https://github.com/llvm/llvm-project/commit/1308011e1b5c5382281a63dd4191a1784f8d2295)
* [shared_ptr/weak_ptr](https://github.com/llvm/llvm-project/commit/83564056d4b186c9fcf016cdbb388755009f7b5a)

Additional notes:
* It was revision 2 of the paper that was voted into the Standard.
  P0433R3 is a separate paper that is not part of the Standard.
* The paper also mandates removing several `make_*_searcher` functions
  (e.g. `make_boyer_moore_searcher`) which are currently not implemented
  (except in `experimental/`).
* The `__cpp_lib_deduction_guides` feature test macro from the paper was
  accidentally omitted from the Standard.

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

3 years ago[compiler-rt] fix asan buildbot failure on unit test for darwin
David CARLIER [Thu, 28 Oct 2021 17:48:54 +0000 (18:48 +0100)]
[compiler-rt] fix asan buildbot failure on unit test for darwin

3 years agoX86InstrInfo: Support immediates that are +1/-1 different in optimizeCompareInstr
Matthias Braun [Tue, 28 Sep 2021 00:57:22 +0000 (17:57 -0700)]
X86InstrInfo: Support immediates that are +1/-1 different in optimizeCompareInstr

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

3 years agoX86InstrInfo: Optimize more combinations of SUB+CMP
Matthias Braun [Mon, 27 Sep 2021 22:21:15 +0000 (15:21 -0700)]
X86InstrInfo: Optimize more combinations of SUB+CMP

`X86InstrInfo::optimizeCompareInstr` would only optimize a `SUB`
followed by a `CMP` in `isRedundantFlagInstr`. This extends the code to
also look for other combinations like `CMP`+`CMP`, `TEST`+`TEST`, `SUB
x,0`+`TEST`.

- Change `isRedundantFlagInstr` to run `analyzeCompareInstr` on the
  candidate instruction and compare the results. This normalizes things
  and gives consistent results for various comparisons (`CMP x, y`,
  `SUB x, y`) and immediate cases (`TEST x, x`, `SUB x, 0`,
  `CMP x, 0`...).
- Turn `isRedundantFlagInstr` into a member function so it can call
  `analyzeCompare`.  - We now also check `isRedundantFlagInstr` even if
  `IsCmpZero` is true, since we now have cases like `TEST`+`TEST`.

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

3 years ago[lldb] [Host/ConnectionFileDescriptor] Refactor to improve code reuse
Michał Górny [Mon, 25 Oct 2021 20:55:48 +0000 (22:55 +0200)]
[lldb] [Host/ConnectionFileDescriptor] Refactor to improve code reuse

Refactor ConnectionFileDescriptor to improve code reuse for different
types of sockets.  Unify method naming.

While at it, remove some (now-)dead code from Socket.

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

3 years ago[VPlan] Keep induction recipes in header.
Florian Hahn [Thu, 28 Oct 2021 17:01:53 +0000 (18:01 +0100)]
[VPlan] Keep induction recipes in header.

This patch updates recipe creation to ensure all
VPWidenIntOrFpInductionRecipes are in the header block. At the moment,
new induction recipes can be created in different blocks when trying to
optimize casts and induction variables.

Having all induction recipes in the header makes it easier to
analyze/transform them in VPlan.

Reviewed By: Ayal

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

3 years ago[libc++] Update the CI Docker image to Focal
Louis Dionne [Thu, 28 Oct 2021 15:35:18 +0000 (11:35 -0400)]
[libc++] Update the CI Docker image to Focal

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

3 years ago[mlir] Implement replacement of SymbolRefAttrs in Dialect attributes using SubElement...
Markus Böck [Thu, 28 Oct 2021 17:08:10 +0000 (19:08 +0200)]
[mlir] Implement replacement of SymbolRefAttrs in Dialect attributes using SubElementAttr interface

This patch extends the SubElementAttr interface to allow replacing a contained sub attribute. The attribute that should be replaced is identified by an index which denotes the n-th element returned by the accompanying walkImmediateSubElements method.

Using this addition the patch implements replacing SymbolRefAttrs contained within any dialect attributes.

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

3 years agoMachineDominators: Define MachineDomTree type alias
Nicolai Hähnle [Thu, 28 Oct 2021 05:19:34 +0000 (10:49 +0530)]
MachineDominators: Define MachineDomTree type alias

This is a (very) small move towards making the machine dominators more
aligned with the IR dominators:

* DominatorTree / MachineDomTree is the class holding the dominator tree
* DominatorTreeWrapperPass / MachineDominatorTree is the corresponding
  (machine) function pass

This alignment will be used by analyses that are designed as templates
that work with LLVM IR as well as Machine IR.

Reviewed By: critson

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

3 years ago[PowerPC][NFC] Update builtins-ppc-xlcompat-trap-64bit-only.ll and builtins-ppc-xlcom...
Victor Huang [Thu, 28 Oct 2021 16:22:15 +0000 (11:22 -0500)]
[PowerPC][NFC] Update builtins-ppc-xlcompat-trap-64bit-only.ll and builtins-ppc-xlcompat-trap.ll to show full reg names

3 years ago[ELF] Change common diagnostics to report both object file location and source file...
Fangrui Song [Thu, 28 Oct 2021 16:38:45 +0000 (09:38 -0700)]
[ELF] Change common diagnostics to report both object file location and source file location

Many diagnostics use `getErrorPlace` or `getErrorLocation` to report a location.
In the presence of line table debug information, `getErrorPlace` uses a source
file location and ignores the object file location. However, the object file
location is sometimes more useful.

This patch changes "undefined symbol" and "out of range" diagnostics to report
both object/source file locations. Other diagnostics can use similar format if
needed.

The key idea is to let `InputSectionBase::getLocation` report the object file
location and use `getSrcMsg` for source file/line information. `getSrcMsg`
doesn't leverage `STT_FILE` information yet, but I think the temporary lack of
the functionality is ok.

For the ARM "branch and link relocation" diagnostic, I arbitrarily place the
source file location at the end of the line. The diagnostic is not very common
so its formatting doesn't need to be pretty.

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

3 years ago[IR] Fix a warning
Kazu Hirata [Thu, 28 Oct 2021 16:38:25 +0000 (09:38 -0700)]
[IR] Fix a warning

This patch fixes:

  mlir/lib/IR/BuiltinAttributes.cpp:876:39: error: unused function
  'isComplexOfIntType' [-Werror,-Wunused-function]

in a release build.

3 years agoRegen some autogen tests to account for format change
Philip Reames [Thu, 28 Oct 2021 16:19:26 +0000 (09:19 -0700)]
Regen some autogen tests to account for format change

3 years ago[compiler-rt] update detect_write_exec option for apple devices.
David CARLIER [Thu, 28 Oct 2021 16:08:23 +0000 (17:08 +0100)]
[compiler-rt] update detect_write_exec option for apple devices.

Reviewed By: yln, vitalybuka

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

3 years agoAutogen a test for ease of update
Philip Reames [Thu, 28 Oct 2021 15:54:27 +0000 (08:54 -0700)]
Autogen a test for ease of update

3 years agoAdd support for Bazel builds on Windows with `clang-cl`.
Chandler Carruth [Sat, 16 Oct 2021 07:46:19 +0000 (00:46 -0700)]
Add support for Bazel builds on Windows with `clang-cl`.

Adds basic `--config=clang-cl` to set up the basic options needed, and
then fix a number of issues that surface in Windows builds for me.

With these fixes, `//llvm/...` builds cleanly. One unittest still fails,
but its just due to running out of stack space due to creating a large
number of short-lived stack variables. The test should probably be
decomposed into a set of tests (`LegalizerInfoTest::RuleSets`), but that
seemed like too invasive of a change here and with everything building
cleanly this isn't disrupting me experimenting with Windows builds.

Some parts of `//clang/...` builds, but that will require more work.

3 years ago[mlir][sparse] move conversion test back to original CHECK testing
Aart Bik [Thu, 28 Oct 2021 03:35:52 +0000 (20:35 -0700)]
[mlir][sparse] move conversion test back to original CHECK testing

Rationale:
The silent exit(1) gives little clues on where the error occurs on failure
and may even be confusing at first. The CHECK testing of all computed values
and indices may be a little bit more elaborate, but it directly pinpoints
where errors happen if they occur. This style is also consistent with
the other tests, which I actually prefer.

Reviewed By: bixia

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

3 years ago[libc][NFC] Move utils/CPP to src/__support/CPP.
Siva Chandra Reddy [Wed, 27 Oct 2021 18:49:00 +0000 (18:49 +0000)]
[libc][NFC] Move utils/CPP to src/__support/CPP.

The idea is to move all pieces related to the actual libc sources to the
"src" directory. This allows downstream users to ship and build just the
"src" directory.

Reviewed By: michaelrj

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

3 years ago[clangd] SelectionTree should prefer lexical declcontext
Kadir Cetinkaya [Thu, 28 Oct 2021 12:56:53 +0000 (14:56 +0200)]
[clangd] SelectionTree should prefer lexical declcontext

This is important especially for code that tries to traverse scopes as
written in code, which is the contract SelectionTree tries to satisfy.

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

3 years ago[libc++][ci] Update to Clang 13.
Mark de Wever [Sat, 23 Oct 2021 11:08:01 +0000 (13:08 +0200)]
[libc++][ci] Update to Clang 13.

Per our support plan we should now support Clang 12 and 13. Adjust the
documentation and the CI runners. The change indirectly moves the main
CI runners to use the Clang 14 nightly builds.

Reviewed By: ldionne, #libc

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

3 years ago[CGProfile] Don't emit call graph profile edges with zero weight
Leonard Grey [Thu, 28 Oct 2021 15:27:01 +0000 (11:27 -0400)]
[CGProfile] Don't emit call graph profile edges with zero weight

With D112160 and D112164, on a Chrome Mac build this reduces the total
size of CGProfile sections by 78% (around 25% eliminated entirely) and
total size of object files by 0.14%.

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

3 years ago[OpenMP] Initial parsing/sema for the 'omp loop' construct
Mike Rice [Thu, 28 Oct 2021 15:10:40 +0000 (08:10 -0700)]
[OpenMP] Initial parsing/sema for the 'omp loop' construct

Adds basic parsing/sema/serialization support for the #pragma omp loop
directive.

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

3 years agoRevert "Reland "[ARM] __cxa_end_cleanup should be called instead of _UnwindResume.""
Daniel Kiss [Thu, 28 Oct 2021 15:24:53 +0000 (17:24 +0200)]
Revert "Reland "[ARM] __cxa_end_cleanup should be called instead of _UnwindResume.""

This reverts commit b6420e575f3bbb6b6df848c0284d6b60eeb07350.

3 years agoReland "[ARM] __cxa_end_cleanup should be called instead of _UnwindResume."
Daniel Kiss [Wed, 27 Oct 2021 08:32:11 +0000 (10:32 +0200)]
Reland "[ARM] __cxa_end_cleanup should be called instead of _UnwindResume."

This is relanding commit da1d1a08694bbfe0ea7a23ea094612436e8a2dd0 .
This patch additionally addresses failures found in buildbots & post review comments.

ARM EHABI[1] specifies the __cxa_end_cleanup to be called after cleanup.
It will call the UnwindResume.
__cxa_begin_cleanup will be called from libcxxabi while __cxa_end_cleanup is never called.
This will trigger a termination when a foreign exception is processed while UnwindResume is called
because the global state will be wrong due to the missing __cxa_end_cleanup call.

Additional test here: D109856
[1] https://github.com/ARM-software/abi-aa/blob/main/ehabi32/ehabi32.rst#941compiler-helper-functions

Reviewed By: logan

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

3 years ago[InstCombine] Extend canonicalizeClampLike to handle truncated inputs
David Green [Thu, 28 Oct 2021 14:46:58 +0000 (15:46 +0100)]
[InstCombine] Extend canonicalizeClampLike to handle truncated inputs

This extends the canonicalizeClampLike function to allow cases where the
input is truncated, but still matching on the types of the ICmps. For
example
  %t = trunc i32 %X to i8
  %a = add i32 %X, 128
  %cmp = icmp ult i32 %a, 256
  %c = icmp sgt i32 %X, -1
  %f = select i1 %c, i8 High, i8 Low
  %r = select i1 %cmp, i8 %t, i8 %f
becomes
  %c1 = icmp slt i32 %X, -128
  %c2 = icmp sge i32 %X, 128
  %s1 = select i1 %c1, i32 sext(Low), i32 %X
  %s2 = select i1 %c2, i32 sext(High), i32 %s1
  %t = trunc i32 %s2 to i8
https://alive2.llvm.org/ce/z/vPzfxH

We limit the transform to constant High and Low values, where we know
the sext are free.

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

3 years ago[docs][NFC] Strip trailing whitespace from GettingStarted.rst
Louis Dionne [Thu, 28 Oct 2021 14:44:48 +0000 (10:44 -0400)]
[docs][NFC] Strip trailing whitespace from GettingStarted.rst

3 years agoRevert "[clang] Fortify warning for scanf calls with field width too big."
Nico Weber [Thu, 28 Oct 2021 14:41:18 +0000 (10:41 -0400)]
Revert "[clang] Fortify warning for scanf calls with field width too big."

This reverts commit 15e3d39110fa4449be4f56196af3bc81b623f3ab.
See https://reviews.llvm.org/D111833#3093629

3 years ago[lldb][NFC] Improve CppModuleConfiguration documentation a bit
Raphael Isemann [Thu, 28 Oct 2021 14:39:06 +0000 (16:39 +0200)]
[lldb][NFC] Improve CppModuleConfiguration documentation a bit

3 years ago[lld][ELF] Update name of function in comment. NFC
Sam Clegg [Thu, 28 Oct 2021 14:29:43 +0000 (07:29 -0700)]
[lld][ELF] Update name of function in comment. NFC

This function was renamed in https://reviews.llvm.org/D62291.

3 years ago[DSE] Eliminates redundant store of an exisiting value (PR16520)
Dawid Jurczak [Fri, 22 Oct 2021 12:11:12 +0000 (14:11 +0200)]
[DSE] Eliminates redundant store of an exisiting value (PR16520)

That's https://reviews.llvm.org/D90328 follow-up.

This change eliminates writes to variables where the value that is being written is already stored in the variable.
This achieves the goal by looping through all memory definitions in the current state and getting defining access from each of them.
When there is defining access where the write instruction is identical to the original instruction it will remove this redundant write.

For example:

void f() {

x = 1;
if foo() {
   x = 1;
   g();
} else {
  h();
}

}
void g();
void h();

The second x=1 will be eliminated since it is rewriting 1 to x. This pass will produce this:

void f() {

x = 1;
if foo() {
   g();
} else {
  h();
}

}
void g();
void h();

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

3 years ago[InstCombine] Fix rare condition violation in canonicalizeClampLike
David Green [Thu, 28 Oct 2021 14:03:07 +0000 (15:03 +0100)]
[InstCombine] Fix rare condition violation in canonicalizeClampLike

With a "ult x, 0", the fold in canonicalizeClampLike does not validate
with undef inputs. This condition will usually have been simplified
away, but we should ensure the code is correct in case.
https://alive2.llvm.org/ce/z/S8HQ6H vs https://alive2.llvm.org/ce/z/h2XBJ_

See: https://reviews.llvm.org/D108049

3 years ago[mlir][linalg] Fix FoldConstantTranspose execution inefficiency
Lei Zhang [Thu, 28 Oct 2021 13:45:07 +0000 (09:45 -0400)]
[mlir][linalg] Fix FoldConstantTranspose execution inefficiency

* Move SmallVectors outside of inner loops to avoid frequent
  allocations and deallocations
* Calculate linearized index and call flat range getters to
  avoid internal shape querying behind `getValue`.

Reviewed By: mravishankar

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

3 years ago[X86][AVX] Attempt to fold a scaled index into a gather/scatter scale immediate ...
Simon Pilgrim [Thu, 28 Oct 2021 13:07:17 +0000 (14:07 +0100)]
[X86][AVX] Attempt to fold a scaled index into a gather/scatter scale immediate (PR13310)

If the index operand for a gather/scatter intrinsic is being scaled (self-addition or a shl-by-immediate) then we may be able to fold that scaling into the intrinsic scale immediate value instead.

Fixes PR13310.

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