platform/upstream/llvm.git
23 months 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

23 months 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.

23 months 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

23 months 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

23 months 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.

23 months 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

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

23 months 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

23 months 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

23 months 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

23 months 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

23 months 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

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

23 months 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]

23 months 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

23 months 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.

23 months 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.

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

23 months 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

23 months 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

23 months 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

23 months 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

23 months 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

23 months 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

23 months 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

23 months 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

23 months 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

23 months 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

23 months 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

23 months 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

23 months 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.

23 months 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

23 months 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

23 months 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

23 months 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

23 months 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.

23 months 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

23 months 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.

23 months 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

23 months 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

23 months 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.

23 months 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

23 months 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

23 months 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

23 months 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

23 months 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.

23 months 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

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

23 months 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

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

23 months 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

23 months 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

23 months 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

23 months 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

23 months 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

23 months 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

23 months 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

23 months 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.

23 months 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.

23 months 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.

23 months ago[lldb] Make TestModuleLoadedNotifys work with dyld from the shared cache
Jonas Devlieghere [Wed, 3 Aug 2022 20:41:33 +0000 (13:41 -0700)]
[lldb] Make TestModuleLoadedNotifys work with dyld from the shared cache

Make TestModuleLoadedNotifys work with a dyld from the expanded shared
cache in the DeviceSupport directory. In that case the module path is:

  ~/Library/Developer/Xcode/iOS DeviceSupport/<...>/Symbols/usr/lib/dyld

instead of just:

  /usr/lib/dyld

This makes the test pass when running against an embedded Darwin device.

23 months ago[lldb] Mark TestRosetta as skipIfDarwinEmbedded
Jonas Devlieghere [Wed, 3 Aug 2022 20:39:31 +0000 (13:39 -0700)]
[lldb] Mark TestRosetta as skipIfDarwinEmbedded

This test only makes sense on the host.

23 months agoNFC. Require DirectX backend for these tests
Chris Bieneman [Wed, 3 Aug 2022 20:54:14 +0000 (15:54 -0500)]
NFC. Require DirectX backend for these tests

Should have added this when I added the test directory. This just
requires the DirectX target for running these tests.

23 months ago[DX] [NFC] Move hasSection check up
Chris Bieneman [Wed, 3 Aug 2022 17:09:07 +0000 (12:09 -0500)]
[DX] [NFC] Move hasSection check up

Juming out earlier if the global doesn't have a section is just a
cleaner early out.

23 months ago[NFC][inline] Add const to an argument
Vitaly Buka [Tue, 2 Aug 2022 02:24:52 +0000 (19:24 -0700)]
[NFC][inline] Add const to an argument

23 months ago[X86] Promote i16 CTTZ/CTTZ_ZERO_UNDEF always.
Craig Topper [Wed, 3 Aug 2022 16:37:33 +0000 (09:37 -0700)]
[X86] Promote i16 CTTZ/CTTZ_ZERO_UNDEF always.

If we're going to emit a rep prefix before bsf as proposed in
D130956, it makes sense to promote i16 operations to i32 to avoid
the false depedency of tzcntw.

Reviewed By: skan, pengfei

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

23 months ago[BOLT] Remove always true if statement
Rafael Auler [Wed, 3 Aug 2022 02:04:29 +0000 (19:04 -0700)]
[BOLT] Remove always true if statement

Got a warning from GCC when building this.

Reviewed By: Amir

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

23 months agoDocument why test is disabled on macOS Ventura
Adrian Prantl [Wed, 3 Aug 2022 20:05:21 +0000 (13:05 -0700)]
Document why test is disabled on macOS Ventura

Starting with macOS 13 CoreFoundation pulls in Foundation, so we
always get the Foundation object description.

rdar://96224141

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

23 months agoFix LDV InstrRefBasedImpl to not crash when encountering unreachable MBBs.
Adrian Prantl [Tue, 2 Aug 2022 17:27:45 +0000 (10:27 -0700)]
Fix LDV InstrRefBasedImpl to not crash when encountering unreachable MBBs.

The testcase was delta-reduced from an LTO build with sanitizer
coverage and the MIR tail duplication pass caused a machine basic
block to become unreachable in MIR. This caused the MBB to be invisible
to the reverse post-order traversal used to initialize the MBB <->
RPONumber lookup tables.

rdar://97226240

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

23 months ago[clang][Darwin] Always set the default C++ Standard Library to libc++
Louis Dionne [Wed, 3 Aug 2022 18:20:02 +0000 (14:20 -0400)]
[clang][Darwin] Always set the default C++ Standard Library to libc++

Newer SDKs don't even provide libstdc++ headers, so it's effectively
never valid to build for libstdc++ unless the user explicitly asks
for it (in which case they will need to provide include paths and more).

23 months ago[Libomptarget][NFC] Clang format the AMDGPU plugin
Joseph Huber [Wed, 3 Aug 2022 19:17:30 +0000 (15:17 -0400)]
[Libomptarget][NFC] Clang format the AMDGPU plugin

Summary:
A previous patch did not format the plugin again after making changes.
Ensure that libomptarget stays formatted.

23 months ago[libc] Disable the loader init_fini_array_test for non-x86_64 targets.
Siva Chandra [Wed, 3 Aug 2022 19:04:21 +0000 (12:04 -0700)]
[libc] Disable the loader init_fini_array_test for non-x86_64 targets.

Loader for aarch64 will be extended in a future pass and this test will
be enabled back again.

23 months agoRevert "[Clang][C++20] Support capturing structured bindings in lambdas"
Corentin Jabot [Wed, 3 Aug 2022 18:59:36 +0000 (20:59 +0200)]
Revert "[Clang][C++20] Support capturing structured bindings in lambdas"

This reverts commit 44f2baa3804a62ca793f0ff3e43aa71cea91a795.

Breaks self builds and seems to have conformance issues.

23 months ago[lldb] Fix 'FileCheck' spelling on symtab regex tests
Augusto Noronha [Wed, 3 Aug 2022 18:57:33 +0000 (11:57 -0700)]
[lldb] Fix 'FileCheck' spelling on symtab regex tests

23 months ago[lldb] Add assertStopReason helper function
Jonas Devlieghere [Wed, 3 Aug 2022 18:42:12 +0000 (11:42 -0700)]
[lldb] Add assertStopReason helper function

Add a function to make it easier to debug a test failure caused by an
unexpected stop reason. This is similar to the assertState helper that
was added in ce825e46743b.

Before:

  self.assertEqual(stop_reason, lldb.eStopReasonInstrumentation)
  AssertionError: 5 != 10

After:

  self.assertStopReason(stop_reason, lldb.eStopReasonInstrumentation)
  AssertionError: signal (5) != instrumentation (10)

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

23 months ago[NFC][intel pt] Improve troubleshooting message
Walter Erquinigo [Wed, 3 Aug 2022 18:33:40 +0000 (11:33 -0700)]
[NFC][intel pt] Improve troubleshooting message

23 months ago[RISCV][test] Add test for ability to tailcall libcalls
Alex Bradbury [Wed, 3 Aug 2022 18:27:59 +0000 (19:27 +0100)]
[RISCV][test] Add test for ability to tailcall libcalls

Although there's good coverage of the libcalls within llvm/test/CodeGen,
it's useful to have tests for all ABI and hard/soft-float combinations
in order to properly test the logic that enables libcall tail calls
(which will be implemented in a follow-up patch).

23 months ago[CMake] Fix runtimes cross-compilation when using LLVM_USE_LINKER
Vincent Lee [Wed, 3 Aug 2022 07:00:02 +0000 (00:00 -0700)]
[CMake] Fix runtimes cross-compilation when using LLVM_USE_LINKER

This is motivated by https://reviews.llvm.org/D115852#3226050 where passing
`LLVM_USE_LINKER` in PASSTHROUGH_PREFIXES breaks cross-compilation
(e.g. targeting Windows on a Linux host). As suggested on that diff, implement
an override for it by allowing users to pass `RUNTIMES_${target}_LLVM_USE_LINKER`
to specify the linker for runtimes. Defaults to host linker if not specified.

Reviewed By: phosek, smeenai

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

23 months ago[SelectionDAG] Handle IntToPtr constants in dbg.value
Felipe de Azevedo Piovezan [Wed, 3 Aug 2022 18:09:04 +0000 (14:09 -0400)]
[SelectionDAG] Handle IntToPtr constants in dbg.value

The function `handleDebugValue` has custom logic to handle certain kinds
constants, namely integers, floats and null pointers. However, it does
not handle constant pointers created from IntToPtr ConstantExpressions.
This patch addresses the issue by replacing the Constant with its
integer operand.

A similar bug was addressed for GlobalISel in D130642.

Reviewed By: aprantl, #debug-info

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

23 months agoError instead of assert when making a _BitInt vector
Aaron Ballman [Wed, 3 Aug 2022 18:05:09 +0000 (14:05 -0400)]
Error instead of assert when making a _BitInt vector

We already correctly rejected:
typedef __attribute__((vector_size(16))) _BitInt(4) Ty;

but we would assert with:
typedef __attribute__((ext_vector_type(4))) _BitInt(4) Ty;

Now we issue the same error in both cases.

23 months ago[ubsan] Make TypeCheckKinds const. NFC
Fangrui Song [Wed, 3 Aug 2022 18:02:22 +0000 (11:02 -0700)]
[ubsan] Make TypeCheckKinds const. NFC

Move it from .data to .data.rel.ro

23 months 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

23 months ago[lldb] Allow SymbolTable regex search functions to match mangled name
Augusto Noronha [Fri, 29 Jul 2022 22:19:17 +0000 (15:19 -0700)]
[lldb] Allow SymbolTable regex search functions to match mangled name

It may be useful to search symbol table entries by mangled instead
of demangled names. Add this optional functionality in the SymbolTable
functions.

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

23 months ago[libc] Add init and fini array iteration to the loader.
Siva Chandra Reddy [Tue, 2 Aug 2022 00:13:17 +0000 (00:13 +0000)]
[libc] Add init and fini array iteration to the loader.

Reviewed By: lntue

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

23 months ago[lldb] Add missing newlines after LLDB_INSTRUMENT_VA
Jonas Devlieghere [Wed, 3 Aug 2022 17:49:45 +0000 (10:49 -0700)]
[lldb] Add missing newlines after LLDB_INSTRUMENT_VA

Add a newline after LLDB_INSTRUMENT_VA to match the output of lldb-instr
and keep everything consistent.

23 months ago[analyzer] Fix for the crash in #56873
isuckatcs [Tue, 2 Aug 2022 09:28:15 +0000 (11:28 +0200)]
[analyzer] Fix for the crash in #56873

In ExprEngine::bindReturnValue() we cast an SVal to DefinedOrUnknownSVal,
however this SVal can also be Undefined, which leads to an assertion failure.

Fixes: #56873

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

23 months agoRevert "[lldb] [gdb-remote] Send interrupt packets from async thread"
Michał Górny [Wed, 3 Aug 2022 17:09:35 +0000 (19:09 +0200)]
Revert "[lldb] [gdb-remote] Send interrupt packets from async thread"

This reverts commit 446b61cff4ea0cb7e7fcc5e0fec7bc749d379b08.  Of course
it does not work on Windows.

23 months agoReplace pdb file used in llvm-symbolizer test with a smaller file.
Amy Huang [Tue, 2 Aug 2022 21:33:32 +0000 (14:33 -0700)]
Replace pdb file used in llvm-symbolizer test with a smaller file.

Reduce the size of the test-columns.pdb file from 6MB to 72KB by not
including standard libraries when building. Also update the instructions
for building the exe/pdb files.

context https://reviews.llvm.org/D81950#3692893

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

23 months ago[clang] Add FileEntryRef::getNameAsRequested()
Ben Langmuir [Tue, 2 Aug 2022 01:08:24 +0000 (18:08 -0700)]
[clang] Add FileEntryRef::getNameAsRequested()

As progress towards having FileManager::getFileRef() return the path
as-requested by default, return a FileEntryRef that can use
getNameAsRequested() to retrieve this path, with the ultimate goal that
this should be the behaviour of getName() and clients should explicitly
request the "external" name if they need to (see comment in
FileManager::getFileRef). For now, getName() continues to return the
external path by looking through the redirects.

For now, the new function is only used in unit tests.

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

23 months ago[lldb] [gdb-remote] Send interrupt packets from async thread
Michał Górny [Wed, 3 Aug 2022 15:39:24 +0000 (17:39 +0200)]
[lldb] [gdb-remote] Send interrupt packets from async thread

Refactor the mechanism for sending interrupt packets to send them
from async thread (i.e. the same thread that sends the continue packet
preceding them and that waits for the response), rather than from
the thread requesting the interrupt.  This is going to become especially
important when using the vCtrlC packet as part of the non-stop protocol,
as -- unlike the simple ^c sent in the all-stop mode -- this packet
involves an explicit reply.

Suggested by Pavel Labath in D126614.

Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.llvm.org/D131075

23 months ago[libc++] Implement `operator<=>` for `shared_ptr`
Adrian Vogelsgesang [Wed, 3 Aug 2022 16:28:48 +0000 (18:28 +0200)]
[libc++] Implement `operator<=>` for `shared_ptr`

Implements part of:

* P1614R2 The Mothership has Landed

Fixes LWG3427

Reviewed By: #libc, Mordante

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

23 months ago[libc++] Mark -fexperimental-library test as unsupported on another AppleClang
Louis Dionne [Wed, 3 Aug 2022 16:23:53 +0000 (12:23 -0400)]
[libc++] Mark -fexperimental-library test as unsupported on another AppleClang

23 months agoFix assert during the call to getCanonicalDecl.
Jennifer Yu [Tue, 2 Aug 2022 19:23:12 +0000 (12:23 -0700)]
Fix assert during the call to getCanonicalDecl.
https://github.com/llvm/llvm-project/issues/56884

The root problem is in isOpenMPRebuildMemberExpr, it is only need to rebuild
for field expression.  No need for member function call.

The fix is to check field for member expression and skip rebuild for member
function call.

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

23 months ago[libcxx][test] Silence narrowing warning
Casey Carter [Wed, 3 Aug 2022 16:10:47 +0000 (09:10 -0700)]
[libcxx][test] Silence narrowing warning

23 months agoprevent llvm-reduce from duplicating values in switch cases when turning operands...
John Regehr [Wed, 3 Aug 2022 16:06:45 +0000 (10:06 -0600)]
prevent llvm-reduce from duplicating values in switch cases when turning operands into zero or one

23 months agoRevert "ManagedStatic: remove from DynamicLibrary"
Nicolai Hähnle [Wed, 3 Aug 2022 15:55:53 +0000 (17:55 +0200)]
Revert "ManagedStatic: remove from DynamicLibrary"

This reverts commit 38817af6a7271aee0581c56eaea44b8c4cf5ecc7.

Buildbots report a Windows build error. Revert until I can look at it
more carefully.

23 months ago[LV] Move definition of isPredicatedInst out of line and make it const [nfc]
Philip Reames [Wed, 3 Aug 2022 15:52:57 +0000 (08:52 -0700)]
[LV] Move definition of isPredicatedInst out of line and make it const [nfc]

23 months agoManagedStatic: remove from DynamicLibrary
Nicolai Hähnle [Wed, 29 Jun 2022 14:47:51 +0000 (16:47 +0200)]
ManagedStatic: remove from DynamicLibrary

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

23 months ago[clang][dataflow] Add cache of `ControlFlowContext`s for function decls.
Yitzhak Mandelbaum [Wed, 3 Aug 2022 00:46:06 +0000 (00:46 +0000)]
[clang][dataflow] Add cache of `ControlFlowContext`s for function decls.

This patch modifies context-sensitive analysis of functions to use a cache,
rather than recreate the `ControlFlowContext` from a function decl on each
encounter. However, this is just step 1 (of N) in adding support for a
configurable map of "modeled" function decls (see issue #56879). The map will go
from the actual function decl to the `ControlFlowContext` used to model it. Only
functions pre-configured in the map will be modeled in a context-sensitive way.

We start with a cache because it introduces the desired map, while retaining the
current behavior. Here, functions are mapped to their actual implementations
(when available).

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

23 months ago[LV] Use cost base decision for uniform mem op strategy [nfc-ish]
Philip Reames [Wed, 3 Aug 2022 14:44:39 +0000 (07:44 -0700)]
[LV] Use cost base decision for uniform mem op strategy [nfc-ish]

This is mostly a stylistic change to make the uniform memop widening cost
code fit more naturally with the sourounding code.  Its not strictly
speaking NFC as I added in the store with invariant value case, and we
could in theory have a target where a gather/scatter is cheaper than a
single load/store... but it's probably NFC in practice.  Note that the
scatter/gather result can still be overriden later if the result is
uniform-by-parts.