platform/upstream/llvm.git
2 years ago[Attributor][FIX] Deal with implicit `undef` in AAPotentialConstantValues.
Johannes Doerfert [Thu, 4 Aug 2022 18:13:40 +0000 (13:13 -0500)]
[Attributor][FIX] Deal with implicit `undef` in AAPotentialConstantValues.

In contrast to AAPotentialValues, the constant values version can
contain implicit `undef` in the set. We had an assertion that could
misfire before. Handle it properly now.

2 years ago[mlir][AMDGPU] Explicitly truncate memory addresses in buffer ops
Krzysztof Drewniak [Wed, 6 Jul 2022 20:37:30 +0000 (20:37 +0000)]
[mlir][AMDGPU] Explicitly truncate memory addresses in buffer ops

As a percaution, truncate memory addresses passed to kernels to 48 bits,
since bits 48-63 of the buffer descriptor are used for the stride field
and, on gfx10, to control swizzling.

Reviewed By: ThomasRaoux

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

2 years ago[gn build] port 976f37050dbd more
Nico Weber [Thu, 4 Aug 2022 19:33:26 +0000 (15:33 -0400)]
[gn build] port 976f37050dbd more

Follow-up to commit 51d84737b5a.

2 years ago[Docs] Fix missing docs strings for CallingConv.h
Marc Auberer [Thu, 4 Aug 2022 19:14:12 +0000 (19:14 +0000)]
[Docs] Fix missing docs strings for CallingConv.h

Replaces
```
//
```
with
```
///
```
for some code lines to make it visible in the auto-generated documentation.

Reviewed By: dblaikie, MaskRay

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

2 years ago[libc] Prevent overflow from intermediate results when adding UInt<N> values.
Tue Ly [Wed, 3 Aug 2022 19:42:05 +0000 (15:42 -0400)]
[libc] Prevent overflow from intermediate results when adding UInt<N> values.

Prevent overflow from intermediate results when adding UInt<N> values.

Reviewed By: orex

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

2 years ago[InstSimplify] add tests for or-of-icmps; NFC
Sanjay Patel [Sun, 31 Jul 2022 21:42:58 +0000 (17:42 -0400)]
[InstSimplify] add tests for or-of-icmps; NFC

2 years agoRevert "[lldb] Filter DIEs based on qualified name where possible"
Alex Langford [Thu, 4 Aug 2022 18:51:47 +0000 (11:51 -0700)]
Revert "[lldb] Filter DIEs based on qualified name where possible"

This reverts commit befa77e59a7760d8c4fdd177b234e4a59500f61c.

Looks like this broke a SymbolFileNativePDB test. I'll investigate and
resubmit with a fix soon.

2 years ago[OpenMP] Fix the test case issue that printf cannot be used in target region for...
Shilei Tian [Thu, 4 Aug 2022 18:48:07 +0000 (14:48 -0400)]
[OpenMP] Fix the test case issue that printf cannot be used in target region for AMDGPU

2 years agoRevert "[mlir][test] Fix IR/AttributeTest.cpp compilation on Solaris"
Mehdi Amini [Thu, 4 Aug 2022 18:47:28 +0000 (18:47 +0000)]
Revert "[mlir][test] Fix IR/AttributeTest.cpp compilation on Solaris"

This reverts commit 07aaa35f74d845a20d48e644671dce150ebf7748.

This breaks the Windows bot, and while the fix addressed the
`char`/`int8_t` case, it does not make sense for other cases like
`float`.

2 years ago[ELF] Parallelize input section initialization
Fangrui Song [Thu, 4 Aug 2022 18:47:52 +0000 (11:47 -0700)]
[ELF] Parallelize input section initialization

This implements the last step of
https://discourse.llvm.org/t/parallel-input-file-parsing/60164 for the ELF port.

For an ELF object file, we previously did: parse, (parallel) initializeLocalSymbols, (parallel) postParseObjectFile.
Now we do: parse, (parallel) initSectionsAndLocalSyms, (parallel) postParseObjectFile.

initSectionsAndLocalSyms does most of input section initialization.
The sequential `parse` does SHT_ARM_ATTRIBUTES/SHT_RISCV_ATTRIBUTES/SHT_GROUP initialization for now.

Performance linking some programs with --threads=8 (glibc 2.33 malloc and mimalloc):

* clang: 1.05x as fast with glibc malloc, 1.03x as fast with mimalloc
* chrome: 1.04x as fast with glibc malloc, 1.03x as fast with mimalloc
* internal search program: 1.08x as fast with glibc malloc, 1.05x as fast with mimalloc

Reviewed By: peter.smith

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

2 years ago[OpenMP][DeviceRTL] Implement libc function `memcmp`
Shilei Tian [Thu, 4 Aug 2022 18:37:47 +0000 (14:37 -0400)]
[OpenMP][DeviceRTL] Implement libc function `memcmp`

We will add some simple implementation of libc functions starting from
this patch, and the first one is `memcmp`, which is reported in #56929. Note that
`malloc` and `free` are not included in this patch because of the use of
`declare variant`. In the near future we will implement the two functions w/o
using any vendor provided function.

This fixes #56929.

Reviewed By: jhuber6

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

2 years ago[gn build] Port 4038c859e58c
LLVM GN Syncbot [Thu, 4 Aug 2022 18:26:38 +0000 (18:26 +0000)]
[gn build] Port 4038c859e58c

2 years ago[RISCV] Relax a one use restriction performSRACombine
Craig Topper [Thu, 4 Aug 2022 18:16:27 +0000 (11:16 -0700)]
[RISCV] Relax a one use restriction performSRACombine

When folding (sra (add (shl X, 32), C1), 32 - C) -> (shl (sext_inreg (add X, C1), C)
ignore the use count on the (shl X, 32).

The sext_inreg after the transform is free. So we're only making
2 new instructions, the add and the shl. So we only need to be
concerned with replacing the original sra+add. The original shl
can have other uses. This helps if there are multiple different
constants being added to the same shl.

2 years ago[lldb] Filter DIEs based on qualified name where possible
Alex Langford [Tue, 12 Jul 2022 15:51:30 +0000 (08:51 -0700)]
[lldb] Filter DIEs based on qualified name where possible

Context:
When setting a breakpoint by name, we invoke Module::FindFunctions to
find the function(s) in question. However, we use a Module::LookupInfo
to first process the user-provided name and figure out exactly what
we're looking for. When we actually perform the function lookup, we
search for the basename. After performing the search, we then filter out
the results using Module::LookupInfo::Prune. For example, given
a::b::foo we would first search for all instances of foo and then filter
out the results to just names that have a::b::foo in them. As one can
imagine, this involves a lot of debug info processing that we do not
necessarily need to be doing. Instead of doing one large post-processing
step after finding each instance of `foo`, we can filter them as we go
to save time.

Some numbers:
Debugging LLDB and placing a breakpoint on
llvm::itanium_demangle::StringView::begin without this change takes
approximately 70 seconds and resolves 31,920 DIEs. With this change,
placing the breakpoint takes around 30 seconds and resolves 8 DIEs.

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

2 years ago[MLIR][Presburger] SlowMPInt::gcd: fix crash when sizes differ
Arjun P [Thu, 4 Aug 2022 17:59:35 +0000 (18:59 +0100)]
[MLIR][Presburger] SlowMPInt::gcd: fix crash when sizes differ

Reviewed By: Groverkss

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

2 years ago[MLIR][Presburger] fourier-motzkin: check if all LCMs are 1 using a bool instead...
Arjun P [Thu, 4 Aug 2022 17:42:51 +0000 (18:42 +0100)]
[MLIR][Presburger] fourier-motzkin: check if all LCMs are 1 using a bool instead of by multiplying them

This can easily overflow and it is possible for these unsigned overflows to result in incorrect results.
For example, the two LCMs could be 641 and 6700417, which multiply to 2^32 + 1, which overflows to 1.
Unsigned overflows already occur in the existing tests.

Also, when switching to arbitrary-precision arithmetic, this results in a many
large integer multiplications resulting in a significant slowdown.

Reviewed By: Groverkss

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

2 years ago[ELF] Add makeThreadLocal/makeThreadLocalN and remove InputFile::localSymStorage
Fangrui Song [Thu, 4 Aug 2022 18:09:40 +0000 (11:09 -0700)]
[ELF] Add makeThreadLocal/makeThreadLocalN and remove InputFile::localSymStorage

makeThreadLocal/makeThreadLocalN are moved from D130810 ([ELF] Parallelize input
section initialization) here to make D130810 more focused on the refactor:

* COFF has some needs for multiple linker contexts. D108850 partially removed
  global states from lldCommon but left the global variable `lctx`.
* To the best of my knowledge, all multiple-linker-context feature requests to
  ELF are more from user convenience, with no very strong argument.
* In practice, ELF port is very difficult to remove global states without
  introducing significant performance regression/hurting code readability.
* Per-thread allocators from D122922/D123879 are too expensive and will not
  really benefit ELF.

This patch adds a simple thread_local based makeThreadLocal to
lld/Common/Memory.h. It will enable further optimization in ELF.

2 years ago[libc++] Clarify comment in CI pipeline definition
Louis Dionne [Thu, 4 Aug 2022 18:06:31 +0000 (14:06 -0400)]
[libc++] Clarify comment in CI pipeline definition

This partially reverts commit 7d855bb8e133. The comments were actually
not outdated, they were simply unclear.

2 years ago[libc++][NFC] Remove outdated comment in CI pipeline definition
Louis Dionne [Thu, 4 Aug 2022 18:03:16 +0000 (14:03 -0400)]
[libc++][NFC] Remove outdated comment in CI pipeline definition

2 years ago[libc++] Fix a hard error in `contiguous_iterator<NoOperatorArrowIter>`.
Konstantin Varlamov [Thu, 4 Aug 2022 17:57:58 +0000 (10:57 -0700)]
[libc++] Fix a hard error in `contiguous_iterator<NoOperatorArrowIter>`.

Evaluating `contiguous_iterator` on an iterator that satisfies all the
constraints except the `to_address` constraint and doesn't have
`operator->` defined results in a hard error. This is because
instantiating `to_address` ends up instantiating templates
dependent on the given type which might lead to a hard error even
in a SFINAE context.

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

2 years ago[libc++][ranges] Implement `ranges::is_permutation`
Nikolas Klauser [Thu, 4 Aug 2022 17:54:13 +0000 (10:54 -0700)]
[libc++][ranges] Implement `ranges::is_permutation`

Co-authored-by: Konstantin Varlamov <varconst@apple.com>
Differential Revision: https://reviews.llvm.org/D127194

2 years ago[RISCV][Clang] Support policy function for all vector segment load.
Zakk Chen [Thu, 4 Aug 2022 17:34:05 +0000 (17:34 +0000)]
[RISCV][Clang] Support policy function for all vector segment load.

We will switch all UndefValue to PoisonValue in follow up patches.

Reviewed By: kito-cheng

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

2 years ago[clang][dataflow] Analyze method bodies
Sam Estep [Thu, 4 Aug 2022 17:45:30 +0000 (17:45 +0000)]
[clang][dataflow] Analyze method bodies

This patch adds the ability to context-sensitively analyze method bodies, by moving `ThisPointeeLoc` from `DataflowAnalysisContext` to `Environment`, and adding code in `pushCall` to set it.

Reviewed By: ymandel, sgatev, xazax.hun

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

2 years ago[MLIR] TilingInterface: Avoid map when tile divides iteration domain
lorenzo chelini [Tue, 19 Jul 2022 14:13:22 +0000 (16:13 +0200)]
[MLIR] TilingInterface: Avoid map when tile divides iteration domain

Reviewed By: ftynse

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

2 years ago[clang-doc] Default to Standalone executor and improve documentation
Petr Hosek [Thu, 21 Jul 2022 08:12:08 +0000 (08:12 +0000)]
[clang-doc] Default to Standalone executor and improve documentation

This should provide a more intuitive usage consistent with other tools.

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

2 years ago[clang][dataflow] Handle return statements
Sam Estep [Thu, 4 Aug 2022 17:42:01 +0000 (17:42 +0000)]
[clang][dataflow] Handle return statements

This patch adds a `ReturnLoc` field to the `Environment`, serving a similar to the `ThisPointeeLoc` field in the `DataflowAnalysisContext`. It then uses that (along with a new `VisitReturnStmt` method in `TransferVisitor`) to handle non-`void`-returning functions in context-sensitive analysis.

Reviewed By: ymandel, sgatev

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

2 years ago[AArch64] Always allow the __bf16 type
David Green [Thu, 4 Aug 2022 17:35:27 +0000 (18:35 +0100)]
[AArch64] Always allow the __bf16 type

We would like to make the ACLE NEON and SVE intrinsics more useable by
gating them on the target, not by ifdef preprocessor macros. In order to
do this the types they use need to be available. This patches makes
__bf16 always available under AArch64 not just when the bf16
architecture feature is present. This bringing it in-line with GCC. In
subsequent patches the NEON bfloat16x8_t and SVE svbfloat16_t types
(along with bfloat16_t used in arm_sve.h) will be made unconditional
too.

The operations valid on the types are still very limited. They can be
used as a storage type, but the intrinsics used for convertions are
still behind an ifdef guard in arm_neon.h/arm_bf16.h.

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

2 years ago[Sema] -Wformat: support C23 format specifier %b %B
Fangrui Song [Thu, 4 Aug 2022 17:26:31 +0000 (10:26 -0700)]
[Sema] -Wformat: support C23 format specifier %b %B

Close #56885: WG14 N2630 added %b to fprintf/fscanf and recommended %B for
fprintf. This patch teaches -Wformat %b for the printf/scanf family of functions
and %B for the printf family of functions.

glibc 2.35 and latest Android bionic added %b/%B printf support. From
https://www.openwall.com/lists/libc-coord/2022/07/ no scanf support is available
yet.

Like GCC, we don't test library support.

GCC 12 -Wformat -pedantic emits a warning:

> warning: ISO C17 does not support the ‘%b’ gnu_printf format [-Wformat=]

The behavior is not ported.

Note: `freebsd_kernel_printf` uses %b differently.

Reviewed By: aaron.ballman, dim, enh

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

2 years ago[Symbolizer] Implement data symbolizer markup element.
Daniel Thornburgh [Tue, 19 Jul 2022 21:20:12 +0000 (14:20 -0700)]
[Symbolizer] Implement data symbolizer markup element.

This connects the Symbolizer to the markup filter and enables the first
working end-to-end flow using the filter.

Reviewed By: peter.smith

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

2 years ago[libc++] Uses operator<=> in string_view
Mark de Wever [Tue, 19 Jul 2022 05:56:23 +0000 (07:56 +0200)]
[libc++] Uses operator<=> in string_view

Implements:
- LWG3432 Missing requirement for comparison_category

Implements part of:
- P1614R2 The Mothership has Landed

Reviewed By: #libc, ldionne, jloser, philnik

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

2 years ago[clang][dataflow][NFC] Resize vector directly with ctor
Eric Li [Thu, 4 Aug 2022 15:57:22 +0000 (11:57 -0400)]
[clang][dataflow][NFC] Resize vector directly with ctor

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

2 years ago[clang][dataflow][NFC] Convert mutable vector references to ArrayRef
Eric Li [Thu, 4 Aug 2022 15:56:10 +0000 (11:56 -0400)]
[clang][dataflow][NFC] Convert mutable vector references to ArrayRef

`transferBlock` and `computeBlockInputState` only read the
`BlockStates` vector for the predecessor block(s), and do not need to
mutate any of the contents. Only `runTypeErasedDataflowAnalysis`
writes into the `vector`, so simply down to an `ArrayRef`.

2 years agoRevert "[InstrProf] Add new format for -fprofile-list="
Nico Weber [Thu, 4 Aug 2022 17:04:59 +0000 (13:04 -0400)]
Revert "[InstrProf] Add new format for -fprofile-list="

This reverts commit b692312ca432d9a379f67a8d83177a6f1722baaa.
Breaks tests on Windows, see https://reviews.llvm.org/D130808#3699952

2 years ago[mlir][test] Fix IR/AttributeTest.cpp compilation on Solaris
Rainer Orth [Thu, 4 Aug 2022 16:56:05 +0000 (18:56 +0200)]
[mlir][test] Fix IR/AttributeTest.cpp compilation on Solaris

The `IR/AttributeTest.cpp` test fails to compile on Solaris:

  /vol/llvm/src/llvm-project/local/mlir/unittests/IR/AttributeTest.cpp:223:36: error: no matching function for call to 'allocate'
        AttrT::get(type, "resource", UnmanagedAsmResourceBlob::allocate(data));
                                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  /vol/llvm/src/llvm-project/local/mlir/unittests/IR/AttributeTest.cpp:237:3: note: in instantiation of function template specialization 'checkNativeAccess<mlir::detail::DenseResourceElementsAttrBase<int8_t>, char>' requested here
    checkNativeAccess<AttrT, T>(builder.getContext(), llvm::makeArrayRef(data),
    ^
  /vol/llvm/src/llvm-project/local/mlir/unittests/IR/AttributeTest.cpp:258:3: note: in instantiation of function template specialization 'checkNativeIntAccess<mlir::detail::DenseResourceElementsAttrBase<int8_t>, char>' requested here
    checkNativeIntAccess<DenseI8ResourceElementsAttr, int8_t>(builder, 8);
    ^
  /vol/llvm/src/llvm-project/local/mlir/include/mlir/IR/AsmState.h:221:3: note: candidate template ignored: requirement '!std::is_same<char, char>::value' was not satisfied [with T = char]
    allocate(ArrayRef<T> data, bool dataIsMutable = false) {
    ^
  /vol/llvm/src/llvm-project/local/mlir/include/mlir/IR/AsmState.h:214:26: note: candidate function not viable: requires at least 2 arguments, but 1 was provided
    static AsmResourceBlob allocate(ArrayRef<char> data, size_t align,
                           ^

I suspect this happens because `char` is `signed` by default on Solaris.

Tested on `amd64-pc-solaris2.11` and `sparcv9-sun-solaris2.11`.

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

2 years ago[mlir][sparse] replace zero yield generic op with copy in allocation
Aart Bik [Wed, 3 Aug 2022 22:15:42 +0000 (15:15 -0700)]
[mlir][sparse] replace zero yield generic op with copy in allocation

This prepares patterns that sometimes are generated by the front-end
and would prohibit fusion of SDDMM flavored kernels.

Reviewed By: springerm

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

2 years agoearlier I fixed a bug where the BB removal pass sometimes created
John Regehr [Thu, 4 Aug 2022 16:21:20 +0000 (10:21 -0600)]
earlier I fixed a bug where the BB removal pass sometimes created
invalid IR. the fix was incomplete, this one is better and is believed
to be complete

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

2 years agoRemove the check for eStateConnected in remote testing sessions.
Jim Ingham [Thu, 4 Aug 2022 16:14:45 +0000 (09:14 -0700)]
Remove the check for eStateConnected in remote testing sessions.

This check is clearly incorrect, there's no way you should have an
eStateConnected event left on the queue if you've already launched
and hit a breakpoint in the program.  This check fails running remotely
on Darwin systems and on one remote Linux platform.  And if we do
find this failing somewhere, we should fix the bogus eStateConnected,
not the test.

2 years ago[NFC] Define NumBuiltinElts utility just once at the beginning of SmallVectorTest...
Dawid Jurczak [Thu, 4 Aug 2022 14:47:54 +0000 (16:47 +0200)]
[NFC] Define NumBuiltinElts utility just once at the beginning of SmallVectorTest file

Extracted from: https://reviews.llvm.org/D130268

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

2 years ago[MLIR] Make the implementations for getMixedOffsets/Sizes/Strides independent of...
Frederik Gossen [Wed, 3 Aug 2022 22:23:55 +0000 (18:23 -0400)]
[MLIR] Make the implementations for getMixedOffsets/Sizes/Strides independent of OffsetSizeAndStrideOpInterface

The functions are effectively independent of the interface already, however, they take it as an argument for no reason.
The current state complicates reuse outside of MLIR.

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

2 years ago[libc++][NFC] Remove rebase artifact
Igor Zhukov [Thu, 4 Aug 2022 15:50:51 +0000 (22:50 +0700)]
[libc++][NFC] Remove rebase artifact

I found it in this commit: https://github.com/llvm/llvm-project/commit/a203acb9dd7227323d6161431225189d49917744

Reviewed By: Mordante

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

2 years ago[InstrProf] Add new format for -fprofile-list=
Ellis Hoag [Fri, 29 Jul 2022 21:49:44 +0000 (14:49 -0700)]
[InstrProf] Add new format for -fprofile-list=

In D130807 we added the `skipprofile` attribute. This commit
changes the format so we can either `forbid` or `skip` profiling
functions by adding the `noprofile` or `skipprofile` attributes,
respectively. The behavior of the original format remains
unchanged.

Also, add the `skipprofile` attribute when using
`-fprofile-function-groups`.

Reviewed By: phosek

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

2 years agoReland "[lldb/Fuzzer] Add fuzzer for expression evaluator"
Chelsea Cassanova [Tue, 26 Jul 2022 19:51:58 +0000 (15:51 -0400)]
Reland "[lldb/Fuzzer] Add fuzzer for expression evaluator"

This reverts commit d959324e1efec12c3924c17b7d90db0b37eb84c3.

The target_include_directories in the clang-fuzzer CMake files
are set to PRIVATE instead of PUBLIC to prevent the clang buildbots
from breaking when symlinking clang into llvm.

The expression evaluator fuzzer itself has been modified to prevent a
bug that occurs when running it without a target.

2 years ago[InstrProf] Add the skipprofile attribute
Ellis Hoag [Fri, 29 Jul 2022 23:23:46 +0000 (16:23 -0700)]
[InstrProf] Add the skipprofile attribute

As discussed in [0], this diff adds the `skipprofile` attribute to
prevent the function from being profiled while allowing profiled
functions to be inlined into it. The `noprofile` attribute remains
unchanged.

The `noprofile` attribute is used for functions where it is
dangerous to add instrumentation to while the `skipprofile` attribute is
used to reduce code size or performance overhead.

[0] https://discourse.llvm.org/t/why-does-the-noprofile-attribute-restrict-inlining/64108

Reviewed By: phosek

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

2 years ago[mlir:LLVM] Do not lookup symbol twice in the addressof verifier
Eugene Zhulenev [Thu, 4 Aug 2022 15:41:01 +0000 (08:41 -0700)]
[mlir:LLVM] Do not lookup symbol twice in the addressof verifier

`SymbolTable::lookupSymbolIn` is an expensive operation and we do not want to do it twice

Reviewed By: ftynse

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

2 years ago[libc++][doc] Updates format status page.
Mark de Wever [Thu, 4 Aug 2022 15:40:38 +0000 (17:40 +0200)]
[libc++][doc] Updates format status page.

Adds the details for P2286 and its status.

2 years ago[clang][dataflow][NFC] Fix outdated comment on getStableStorageLocation
Eric Li [Wed, 3 Aug 2022 19:33:58 +0000 (15:33 -0400)]
[clang][dataflow][NFC] Fix outdated comment on getStableStorageLocation

Follow-up to D129097.

It is no longer a requirement that the `QualType` passed to to
`DataflowAnalysisContext::getStableStorageLocation()` is not null. A
null type pass as an argument is only applicable as the pointee type
of a `std::nullptr_t` pointer.

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

2 years ago[gn build] Port 2138c906458e
LLVM GN Syncbot [Thu, 4 Aug 2022 14:49:27 +0000 (14:49 +0000)]
[gn build] Port 2138c906458e

2 years ago[libc++] Install clang-tools in the CI container
Nikolas Klauser [Wed, 3 Aug 2022 17:35:34 +0000 (19:35 +0200)]
[libc++] Install clang-tools in the CI container

This is required for using clang-query in the CI

Reviewed By: Mordante, #libc

Spies: libcxx-commits, arichardson

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

2 years ago[IR] Move support for dxil::TypedPointerType to LLVM core IR.
Joshua Cranmer [Thu, 4 Aug 2022 14:41:11 +0000 (10:41 -0400)]
[IR] Move support for dxil::TypedPointerType to LLVM core IR.

This allows the construct to be shared between different backends. However, it
still remains illegal to use TypedPointerType in LLVM IR--the type is intended
to remain an auxiliary type, not a real LLVM type. So no support is provided for
LLVM-C, nor bitcode, nor LLVM assembly (besides the bare minimum needed to make
Type->dump() work properly).

Reviewed By: beanz, nikic, aeubanks

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

2 years ago[mlir] Only conditionally lower CF branching ops to LLVM
Tres Popp [Tue, 2 Aug 2022 08:18:52 +0000 (10:18 +0200)]
[mlir] Only conditionally lower CF branching ops to LLVM

Previously cf.br cf.cond_br and cf.switch always lowered to their LLVM
equivalents. These ops are all ops that take in some values of given
types and jump to other blocks with argument lists of the same types. If
the types are not the same, a verification failure will later occur. This led
to confusions, as everything works when func->llvm and cf->llvm lowering
both occur because func->llvm updates the blocks and argument lists
while cf->llvm updates the branching ops. Without func->llvm though,
there will potentially be a type mismatch.

This change now only lowers the CF ops if they will later pass
verification. This is possible because the parent op and its blocks will
be updated before the contained branching ops, so they can test their
new operand types against the types of the blocks they jump to.

Another plan was to have func->llvm only update the entry block
signature and to allow cf->llvm to update all other blocks, but this had
2 problems:
1. This would create a FuncOp lowering in cf->llvm lowering which is
   awkward
2. This new pattern would only be applied if the containing FuncOp is
   marked invalid. This is infeasible with the shared LLVM type
   conversion/target infrastructure.

See previous discussions at
https://discourse.llvm.org/t/lowering-cf-to-llvm/63863 and
https://github.com/llvm/llvm-project/issues/55301

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

2 years ago[mlir] Add I1 support to DenseArrayAttr
Jeff Niu [Mon, 1 Aug 2022 20:21:33 +0000 (16:21 -0400)]
[mlir] Add I1 support to DenseArrayAttr

This patch adds a DenseI1ArrayAttr to support arrays of i1. Importantly,
the implementation is as a simple `ArrayRef<bool>` instead of using bit
compression, which was problematic in DenseElementsAttr.

Reviewed By: rriddle

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

2 years ago[VP] Add widening for VP_STRIDED_LOAD and VP_STRIDED_STORE
Lorenzo Albano [Wed, 3 Aug 2022 16:08:45 +0000 (18:08 +0200)]
[VP] Add widening for VP_STRIDED_LOAD and VP_STRIDED_STORE

Reviewed By: frasercrmck, craig.topper

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

2 years ago[Docs] Added my office hours
Michal Paszkowski [Thu, 4 Aug 2022 13:20:06 +0000 (15:20 +0200)]
[Docs] Added my office hours

2 years ago[clang] change `auto` to `Expr` in last commit [NFC]
YingChi Long [Thu, 4 Aug 2022 13:15:45 +0000 (21:15 +0800)]
[clang] change `auto` to `Expr` in last commit [NFC]

2 years ago[clang] format string checking for conpile-time evaluated str literal
YingChi Long [Wed, 3 Aug 2022 02:07:31 +0000 (10:07 +0800)]
[clang] format string checking for conpile-time evaluated str literal

This patch enhances clang's ability to check compile-time determinable
string literals as format strings, and can give FixIt hints at literals
(unlike gcc). Issue https://github.com/llvm/llvm-project/issues/55805
mentiond two compile-time string cases. And this patch partially fixes
one.

```
constexpr const char* foo() {
  return "%s %d";
}
int main() {
   printf(foo(), "abc", "def");
   return 0;
}
```

This patch enables clang check format string for this:

```
<source>:4:24: warning: format specifies type 'int' but the argument has type 'const char *' [-Wformat]
  printf(foo(), "abc", "def");
         ~~~~~         ^~~~~
<source>:2:42: note: format string is defined here
constexpr const char *foo() { return "%s %d"; }
                                         ^~
                                         %s
1 warning generated.
```

Reviewed By: aaron.ballman

Signed-off-by: YingChi Long <me@inclyc.cn>
Differential Revision: https://reviews.llvm.org/D130906

2 years ago[lldb] Fix arm breakages from D130985
Pavel Labath [Thu, 4 Aug 2022 11:55:35 +0000 (13:55 +0200)]
[lldb] Fix arm breakages from D130985

The kernel was rejecting sizeof(struct GPR) as it was not a multiple of
8. Add a padding field to fix that.

One also wonders whether "cpsr" is right register name for aarch64.

2 years agoRevert "[clang] Pass FoundDecl to DeclRefExpr creator for operator overloads"
Kadir Cetinkaya [Thu, 4 Aug 2022 09:50:16 +0000 (11:50 +0200)]
Revert "[clang] Pass FoundDecl to DeclRefExpr creator for operator overloads"

This reverts commit 4e94f6653150511de434fa7e29b684ae7f0e52b6.
See https://reviews.llvm.org/D129973#3698969 for reasoning.

2 years ago[gn build] Port a203acb9dd72
LLVM GN Syncbot [Thu, 4 Aug 2022 09:46:03 +0000 (09:46 +0000)]
[gn build] Port a203acb9dd72

2 years ago[libc++][ranges] Implement `ranges::clamp`
Nikolas Klauser [Wed, 3 Aug 2022 23:30:50 +0000 (16:30 -0700)]
[libc++][ranges] Implement `ranges::clamp`

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

2 years ago[ObjC] type method metadata `_imp`, messenger routine at callsite with program addres...
Matt Jacobson [Mon, 1 Aug 2022 05:59:41 +0000 (01:59 -0400)]
[ObjC] type method metadata `_imp`, messenger routine at callsite with program address space

On targets with non-default program address space (e.g., Harvard
architectures), clang crashes when emitting Objective-C method metadata,
because the address of the method IMP cannot be bitcast to i8*. It similarly
crashes at messenger callsite with a failed bitcast.

Define the _imp field instead as i8 addrspace(1)* (or whatever the target's
program address space is). And in getMessageSendInfo(), create signatureType by
specifying the program address space.

Add a regression test using the AVR target. Test failed previously and passes
now. Checked codegen of the test for x86_64-apple-darwin19.6.0 and saw no
difference, as expected.

Reviewed By: rjmccall, dylanmckay

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

2 years ago[mlir] Extract offsets-sizes-strides computation from `makeTiledShape(s)`.
Alexander Belyaev [Thu, 4 Aug 2022 09:18:04 +0000 (11:18 +0200)]
[mlir] Extract offsets-sizes-strides computation from `makeTiledShape(s)`.

This change separates computation of the actual parameters of the subset and
the materialization of subview/extract_slice. That way the users can still use
Linalg tiling logic even if they use different operations to materialize the
subsets.

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

2 years ago[MLIR] Fix checks for native arch
Nikita Popov [Wed, 3 Aug 2022 13:28:49 +0000 (15:28 +0200)]
[MLIR] Fix checks for native arch

Using if (TARGET ${LLVM_NATIVE_ARCH}) only works if MLIR is built
together with LLVM, but not for standalone builds of MLIR. The
correct way to check this is
if (${LLVM_NATIVE_ARCH} IN_LIST LLVM_TARGETS_TO_BUILD), as the
LLVM build system exports LLVM_TARGETS_TO_BUILD.

To avoid repeating the same check many times, add a
MLIR_ENABLE_EXECUTION_ENGINE variable.

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

2 years ago[llvm-reduce] Split operands-skip.ll into serial and parallel parts
David Spickett [Thu, 28 Jul 2022 14:09:50 +0000 (14:09 +0000)]
[llvm-reduce] Split operands-skip.ll into serial and parallel parts

This fixes a test failure when building with LLVM_ENABLE_THREADS=OFF.

Reviewed By: fhahn

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

2 years ago[ORC] Actually propagate memory unmapping errors on Windows
Martin Storsjö [Wed, 3 Aug 2022 08:04:51 +0000 (11:04 +0300)]
[ORC] Actually propagate memory unmapping errors on Windows

This fixes warnings like these:

    ../lib/ExecutionEngine/Orc/MemoryMapper.cpp:364:9: warning: ignoring return value of function declared with 'warn_unused_result' attribute [-Wunused-result]
            joinErrors(std::move(Err),
            ^~~~~~~~~~ ~~~~~~~~~~~~~~~

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

2 years ago[ORC] Fix a warning about an unused variable on Windows. NFC.
Martin Storsjö [Wed, 3 Aug 2022 08:04:27 +0000 (11:04 +0300)]
[ORC] Fix a warning about an unused variable on Windows. NFC.

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

2 years ago[Clang][C++20] Support capturing structured bindings in lambdas
Corentin Jabot [Wed, 30 Mar 2022 12:27:44 +0000 (14:27 +0200)]
[Clang][C++20] Support capturing structured bindings in lambdas

This completes the implementation of P1091R3 and P1381R1.

This patch allow the capture of structured bindings
both for C++20+ and C++17, with extension/compat warning.

In addition, capturing an anonymous union member,
a bitfield, or a structured binding thereof now has a
better diagnostic.

We only support structured bindings - as opposed to other kinds
of structured statements/blocks. We still emit an error for those.

In addition, support for structured bindings capture is entirely disabled in
OpenMP mode as this needs more investigation - a specific diagnostic indicate the feature is not yet supported there.

Note that the rest of P1091R3 (static/thread_local structured bindings) was already implemented.

at the request of @shafik, i can confirm the correct behavior of lldb wit this change.

Fixes https://github.com/llvm/llvm-project/issues/54300
Fixes https://github.com/llvm/llvm-project/issues/54300
Fixes https://github.com/llvm/llvm-project/issues/52720

Reviewed By: aaron.ballman

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

2 years ago[LegalizeTypes][VP] Add split operand support for VP float and integer casting
wanglian [Thu, 28 Jul 2022 07:40:06 +0000 (15:40 +0800)]
[LegalizeTypes][VP] Add split operand support for VP float and integer casting

Reviewed By: frasercrmck

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

2 years ago[RISCV] Add cost modelling for vector widenning reduction.
jacquesguan [Mon, 18 Jul 2022 09:37:37 +0000 (17:37 +0800)]
[RISCV] Add cost modelling for vector widenning reduction.

In RVV, we use vwredsum.vs and vwredsumu.vs for vecreduce.add(ext(Ty A)) if the result type's width is twice of the input vector's SEW-width. In this situation, the cost of extended add reduction should be same as single-width add reduction. So as the vector float widenning reduction.

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

2 years ago[X86] Support ``-mindirect-branch-cs-prefix`` for call and jmp to indirect thunk
Phoebe Wang [Fri, 29 Jul 2022 09:47:49 +0000 (17:47 +0800)]
[X86] Support ``-mindirect-branch-cs-prefix`` for call and jmp to indirect thunk

This is to address feature request from https://github.com/ClangBuiltLinux/linux/issues/1665

Reviewed By: nickdesaulniers, MaskRay

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

2 years ago[RISCV][test] Add inloop reduction vectorize test. NFC
jacquesguan [Thu, 4 Aug 2022 06:16:49 +0000 (14:16 +0800)]
[RISCV][test] Add inloop reduction vectorize test. NFC

2 years ago[llvm][Bazel] Exclude TrainingLoggerTest.cpp from build.
Adrian Kuegel [Thu, 4 Aug 2022 06:48:17 +0000 (08:48 +0200)]
[llvm][Bazel] Exclude TrainingLoggerTest.cpp from build.

It requires a google protobuf dependency.

2 years ago[mlir][Linalg] Inline an interface method to its only user.
Adrian Kuegel [Tue, 2 Aug 2022 12:56:24 +0000 (14:56 +0200)]
[mlir][Linalg] Inline an interface method to its only user.

It seems only the default implementation is ever used, so it doesn't seem
necessary to include this method in the interface.

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

2 years ago[WebAssembly] Improve codegen for v128.bitselect
Thomas Lively [Thu, 4 Aug 2022 06:28:37 +0000 (23:28 -0700)]
[WebAssembly] Improve codegen for v128.bitselect

Add patterns selecting ((v1 ^ v2) & c) ^ v2 and ((v1 ^ v2) & ~c) ^ v2 to
v128.bitselect.

Resolves #56827.

Reviewed By: aheejin

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

2 years ago[libc] Adjust aarch64 startup code to reliably sniff out the start args.
Siva Chandra [Thu, 4 Aug 2022 00:37:06 +0000 (17:37 -0700)]
[libc] Adjust aarch64 startup code to reliably sniff out the start args.

Since this now allows, the init/fini array iteration has been added in
a similar fashion to x86_64 and the corresponding test enabled.

Reviewed By: jeffbailey

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

2 years ago[ELF] Remove unneeded make<InputSection>. NFC
Fangrui Song [Thu, 4 Aug 2022 04:51:39 +0000 (21:51 -0700)]
[ELF] Remove unneeded make<InputSection>. NFC

2 years ago[ELF] Move updateARMVFPArgs/updateARMVFPArgs. NFC
Fangrui Song [Thu, 4 Aug 2022 04:49:17 +0000 (21:49 -0700)]
[ELF] Move updateARMVFPArgs/updateARMVFPArgs. NFC

To reduce diff for D130810.

2 years ago[X86] Teach PostprocessISelDAG to fold ANDrm+TESTrr when chain result is used.
Craig Topper [Thu, 4 Aug 2022 04:00:21 +0000 (21:00 -0700)]
[X86] Teach PostprocessISelDAG to fold ANDrm+TESTrr when chain result is used.

The isOnlyUserOf prevented the fold if the chain result had any
users. What we really care about is the the data result from the
AND is only used by the TEST, and the flags results from the ANDs
aren't used at all. It's ok if the chain has users, we just need
to replace those users with the chain from the TESTrm.

Reviewed By: LuoYuanke

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

2 years ago[lldb] Re-enable TestCCallingConventions on Apple Silicon
Jonas Devlieghere [Thu, 4 Aug 2022 03:46:44 +0000 (20:46 -0700)]
[lldb] Re-enable TestCCallingConventions on Apple Silicon

This test was disabled because clang struggled to emit a Windows calling
convention when targeting an Apple environment. This test is now showing
up as an XPASS so someone must have fixed this.

2 years ago[clang][Headers] Avoid compiler warnings in builtin headers
Dominic Chen [Fri, 29 Jul 2022 21:28:45 +0000 (14:28 -0700)]
[clang][Headers] Avoid compiler warnings in builtin headers

While debugging module support using -Wsystem-headers, we discovered that if
-Werror, and -Wundef or -Wmacro-redefined are specified, they can cause errors
to be generated in these builtin headers.

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

2 years ago[ORC] Ensure that llvm_orc_registerJITLoaderGDBAllocAction is linked into tools.
Lang Hames [Thu, 4 Aug 2022 00:42:17 +0000 (17:42 -0700)]
[ORC] Ensure that llvm_orc_registerJITLoaderGDBAllocAction is linked into tools.

Add a reference to llvm_orc_registerJITLoaderGDBAllocAction from the
linkComponents function in the lli, llvm-jitlink, and llvm-jitlink-executor
tools. This ensures that llvm_orc_registerJITLoaderGDBAllocAction is not
dead-stripped in optimized builds, which may cause failures in these tools.

The llvm_orc_registerJITLoaderGDBAllocAction function was originally added with
MachO debugging support in 69be352a1961a, but that patch failed to update the
linkComponents functions.

http://llvm.org/PR56817

2 years ago[JITLink] Add tests for FDEs with bad CIE and PC-begin pointers.
Lang Hames [Wed, 3 Aug 2022 17:50:50 +0000 (10:50 -0700)]
[JITLink] Add tests for FDEs with bad CIE and PC-begin pointers.

2 years ago[BoundsChecking] Fix merging of sizes
Arthur Eubanks [Tue, 2 Aug 2022 17:43:30 +0000 (10:43 -0700)]
[BoundsChecking] Fix merging of sizes

BoundsChecking uses ObjectSizeOffsetEvaluator to keep track of the
underlying size/offset of pointers in allocations.  However,
ObjectSizeOffsetVisitor (something ObjectSizeOffsetEvaluator
uses to check for constant sizes/offsets)
doesn't quite treat sizes and offsets the same way as
BoundsChecking.  BoundsChecking wants to know the size of the
underlying allocation and the current pointer's offset within
it, but ObjectSizeOffsetVisitor only cares about the size
from the pointer to the end of the underlying allocation.

This only comes up when merging two size/offset pairs. Add a new mode to
ObjectSizeOffsetVisitor which cares about the underlying size/offset
rather than the size from the current pointer to the end of the
allocation.

Fixes a false positive with -fsanitize=bounds.

Reviewed By: vitalybuka, asbirlea

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

2 years ago[NFC][Inliner] Add cl::opt<int> to tune InstrCost
Vitaly Buka [Tue, 2 Aug 2022 02:59:59 +0000 (19:59 -0700)]
[NFC][Inliner] Add cl::opt<int> to tune InstrCost

The plan is tune this for sanitizers.

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

2 years ago[LoopInterchange][PR56275] Fix legality with negative dependence vectors
Congzhe Cao [Wed, 3 Aug 2022 23:37:30 +0000 (19:37 -0400)]
[LoopInterchange][PR56275] Fix legality with negative dependence vectors

This is the 2nd patch of the two-patch series (D130188, D130189) that
fix PR56275 (https://github.com/llvm/llvm-project/issues/56275) which
is a missed opportunity for loop interchange.

As follow-up on the dependence analysis (DA) patch D130188, this patch
normalizes DA results in loop interchange, such that negative dependence
vectors queried by loop interchange are reversed to be non-negative.

Now all tests in PR56275 can get interchanged. Those tests are added
in lit test as `pr56275.ll`.

Reviewed By: kawashima-fj, bmahjour, Meinersbur, #loopoptwg

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

2 years ago[DependenceAnalysis][PR56275] Normalize negative dependence analysis results
Congzhe Cao [Wed, 3 Aug 2022 23:37:30 +0000 (19:37 -0400)]
[DependenceAnalysis][PR56275] Normalize negative dependence analysis results

This patch is the first of the two-patch series (D130188, D130179) that
resolve PR56275 (https://github.com/llvm/llvm-project/issues/56275)
which is a missed opportunity, where a perfrectly valid case for loop
interchange failed interchange legality.

If the distance/direction vector produced by dependence analysis (DA) is
negative, it needs to be normalized (reversed). This patch provides helper
functions `isDirectionNegative()` and `normalize()` in DA that does the
normalization, and clients can query DA to do normalization if needed.

A pass option `<normalized-results>` is added to DependenceAnalysisPrinterPass,
and we leverage it to update DA test cases to make sure of test coverage. The
test cases added in `Banerjee.ll` shows that negative vectors are normalized
with `print<da><normalized-results>`.

Reviewed By: bmahjour, Meinersbur, #loopoptwg

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

2 years ago[CostModel][RISCV] Add test coverage of floating point rounding intrinsics
Philip Reames [Wed, 3 Aug 2022 23:27:44 +0000 (16:27 -0700)]
[CostModel][RISCV] Add test coverage of floating point rounding intrinsics

These costs are fairly bogus, but at least we have baseline coverage now.

2 years agoAdd switch to use "source_filename" instead of a hash ID for globally promoted local
Bill Wendling [Mon, 18 Jul 2022 19:05:53 +0000 (12:05 -0700)]
Add switch to use "source_filename" instead of a hash ID for globally promoted local

During LTO a local promoted to a global gets a unique suffix based on
a hash of the module IR. This means that changes in the local's module
can affect the contents in another module that imported it (because the name
of the imported promoted local is changed, but that doesn't reflect a
real change in the importing module). So any tool that's
validating changes to the importing module will see a superficial change.

Instead of using the module hash, we can use the "source_filename" if it
exists to generate a unique identifier that doesn't change due to LTO
shenanigans.

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

2 years ago[gn build] Port 0cb9746a7d85
LLVM GN Syncbot [Wed, 3 Aug 2022 23:20:59 +0000 (23:20 +0000)]
[gn build] Port 0cb9746a7d85

2 years ago[nfc][mlgo] Separate logger and training-mode model evaluator
Mircea Trofin [Wed, 3 Aug 2022 21:32:42 +0000 (14:32 -0700)]
[nfc][mlgo] Separate logger and training-mode model evaluator

This just shuffles implementations and declarations around. Now the
logger and the TF C API-based model evaluator are separate.

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

2 years ago[gn build] Port 36c746ca2d5b
LLVM GN Syncbot [Wed, 3 Aug 2022 23:08:51 +0000 (23:08 +0000)]
[gn build] Port 36c746ca2d5b

2 years ago[LLDB][NFC] Fix potential div by 0 "count" can be zero potentially causing div by 0
Slava Gurevich [Mon, 1 Aug 2022 20:53:54 +0000 (13:53 -0700)]
[LLDB][NFC] Fix potential div by 0 "count" can be zero potentially causing div by 0

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

2 years ago[libc++][ranges] Implement `ranges::rotate`.
Konstantin Varlamov [Wed, 3 Aug 2022 23:04:14 +0000 (16:04 -0700)]
[libc++][ranges] Implement `ranges::rotate`.

Also fix `ranges::stable_sort` and `ranges::inplace_merge` to support
proxy iterators now that their internal implementations can correctly
dispatch `rotate`.

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

2 years ago[TSAN][Darwin] x86_64 specific tests requiring weak symbols
Blue Gaston [Wed, 3 Aug 2022 22:09:50 +0000 (15:09 -0700)]
[TSAN][Darwin] x86_64 specific tests requiring weak symbols

Additional tests requiring weak symbol attribute work around for macOS 12.0

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

2 years ago[lldb] Make LLDB resilient against failing dyld introspection SPIs
Jonas Devlieghere [Wed, 3 Aug 2022 22:45:18 +0000 (15:45 -0700)]
[lldb] Make LLDB resilient against failing dyld introspection SPIs

Make LLDB resilient against failing dyld introspection SPIs:

 - dyld_process_create_for_current_task
 - dyld_process_snapshot_create_for_process
 - dyld_process_snapshot_get_shared_cache

These can all fail and return a nullptr. Instead of having an assert,
which doesn't really make sense, as we have no control over whether
these calls succeed or not, bail out gracefully and use the fallback
logic.

rdar://98070414

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

2 years ago[AMDGPU] Precommit test case for D130729
jeff [Wed, 3 Aug 2022 21:53:02 +0000 (14:53 -0700)]
[AMDGPU] Precommit test case for D130729

Change-Id: I23396655880b5732ad991d47e51900408f5bc5ee

2 years ago[RISCV] Prevent infinite loop after D129980.
Craig Topper [Wed, 3 Aug 2022 22:19:03 +0000 (15:19 -0700)]
[RISCV] Prevent infinite loop after D129980.

D129980 converts (seteq (i64 (and X, 0xffffffff)), C1) into
(seteq (i64 (sext_inreg X, i32)), C1). If bit 31 of X is 0, it
will be turned back into an 'and' by SimplifyDemandedBits which
can cause an infinite loop.

To prevent this, check if bit 31 is 0 with computeKnownBits before
doing the transformation.

Fixes PR56905.

Reviewed By: reames

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

2 years ago[NFC][Inliner] Simplify clamping in addCost
Vitaly Buka [Tue, 2 Aug 2022 02:53:09 +0000 (19:53 -0700)]
[NFC][Inliner] Simplify clamping in addCost

2 years agoRevert "[X86][MC] Always emit `rep` prefix for `bsf`"
Craig Topper [Wed, 3 Aug 2022 21:50:41 +0000 (14:50 -0700)]
Revert "[X86][MC] Always emit `rep` prefix for `bsf`"

This reverts commit c2066d19cda20d0e98b95da1493e6c3f26fd9618.

It's causing failures on the build bots.

2 years agoRevert "Revert "[lldb][modules] Disable Clang Modules in source/Host directory on...
Jonas Devlieghere [Wed, 3 Aug 2022 21:37:48 +0000 (14:37 -0700)]
Revert "Revert "[lldb][modules] Disable Clang Modules in source/Host directory on macOS""

This reverts commit c7bd61d4a79b88dbd97028bb0a73a73b2d6aca89 because it
breaks the underlying issue is apparently not yet resolved. This only
affects the modules build.

2 years ago[X86] Add a test for missed opportunity combine AND32rm+TEST32rr.
Craig Topper [Wed, 3 Aug 2022 21:28:24 +0000 (14:28 -0700)]
[X86] Add a test for missed opportunity combine AND32rm+TEST32rr.

If the chain output of the AND32rm is used, the post isel peephole
won't fold it. We should be able to fold it by replacing the chain
use with the chain from a TEST32rm.