Commit Graph

432037 Commits

Author SHA1 Message Date
Petr Hosek ea50901aa9 [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
2022-08-04 17:43:16 +00:00
Sam Estep 0eaecbbc23 [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
2022-08-04 17:42:19 +00:00
David Green 8c30f4a5ab [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
2022-08-04 18:35:27 +01:00
Fangrui Song 88501dc749 [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
2022-08-04 10:26:31 -07:00
Daniel Thornburgh 22df238d4a [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
2022-08-04 10:20:29 -07:00
Mark de Wever 3818b4df1e [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
2022-08-04 19:13:47 +02:00
Eric Li 5659908f4c [clang][dataflow][NFC] Resize vector directly with ctor
Differential Revision: https://reviews.llvm.org/D131177
2022-08-04 13:12:37 -04:00
Eric Li 18034aee63 [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`.
2022-08-04 13:12:37 -04:00
Nico Weber 0eb7d86f58 Revert "[InstrProf] Add new format for -fprofile-list="
This reverts commit b692312ca4.
Breaks tests on Windows, see https://reviews.llvm.org/D130808#3699952
2022-08-04 13:04:59 -04:00
Rainer Orth 07aaa35f74 [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
2022-08-04 18:56:05 +02:00
Aart Bik c7bb69bc75 [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
2022-08-04 09:33:57 -07:00
John Regehr 213c21fe10 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
2022-08-04 10:21:20 -06:00
Jim Ingham b06da9c183 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.
2022-08-04 09:19:55 -07:00
Dawid Jurczak 7d7a712c98 [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
2022-08-04 18:15:48 +02:00
Frederik Gossen f98d73f4e0 [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
2022-08-04 11:58:15 -04:00
Igor Zhukov 1915c1c01e [libc++][NFC] Remove rebase artifact
I found it in this commit: a203acb9dd

Reviewed By: Mordante

Differential Revision: https://reviews.llvm.org/D131163
2022-08-04 22:53:32 +07:00
Ellis Hoag b692312ca4 [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
2022-08-04 08:49:43 -07:00
Chelsea Cassanova bcf6ffb87e Reland "[lldb/Fuzzer] Add fuzzer for expression evaluator"
This reverts commit d959324e1e.

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.
2022-08-04 11:47:06 -04:00
Ellis Hoag 12e78ff881 [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
2022-08-04 08:45:27 -07:00
Eugene Zhulenev ec7f4a7c5d [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
2022-08-04 08:42:38 -07:00
Mark de Wever d1d799b696 [libc++][doc] Updates format status page.
Adds the details for P2286 and its status.
2022-08-04 17:40:38 +02:00
Eric Li 54d24eae98 [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
2022-08-04 11:15:14 -04:00
LLVM GN Syncbot 2d47e0fd27 [gn build] Port 2138c90645 2022-08-04 14:49:27 +00:00
Nikolas Klauser 648d99e7dd [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
2022-08-04 16:42:42 +02:00
Joshua Cranmer 2138c90645 [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
2022-08-04 10:41:11 -04:00
Tres Popp 448adfee05 [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
2022-08-04 16:36:27 +02:00
Jeff Niu d0541b4700 [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
2022-08-04 10:24:45 -04:00
Lorenzo Albano 74940d2668 [VP] Add widening for VP_STRIDED_LOAD and VP_STRIDED_STORE
Reviewed By: frasercrmck, craig.topper

Differential Revision: https://reviews.llvm.org/D121114
2022-08-04 16:12:01 +02:00
Michal Paszkowski ff1d471964 [Docs] Added my office hours 2022-08-04 15:20:06 +02:00
YingChi Long 282d4755c3
[clang] change `auto` to `Expr` in last commit [NFC] 2022-08-04 21:15:45 +08:00
YingChi Long f417583f31
[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
2022-08-04 21:07:30 +08:00
Pavel Labath b8985ba0ad [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.
2022-08-04 13:55:35 +02:00
Kadir Cetinkaya df48e3fbcc
Revert "[clang] Pass FoundDecl to DeclRefExpr creator for operator overloads"
This reverts commit 4e94f66531.
See https://reviews.llvm.org/D129973#3698969 for reasoning.
2022-08-04 12:14:43 +02:00
LLVM GN Syncbot 2b0d5e9e79 [gn build] Port a203acb9dd 2022-08-04 09:46:03 +00:00
Nikolas Klauser a203acb9dd [libc++][ranges] Implement `ranges::clamp`
Differential Revision: https://reviews.llvm.org/D126193
2022-08-04 02:45:32 -07:00
Matt Jacobson c8b2f3f51b [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
2022-08-04 05:40:32 -04:00
Alexander Belyaev 56d94b3b90 [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
2022-08-04 11:23:58 +02:00
Nikita Popov 57a9bccec7 [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
2022-08-04 11:10:08 +02:00
David Spickett 7ce321e5b0 [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
2022-08-04 08:51:47 +00:00
Martin Storsjö 46bc1b5689 [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
2022-08-04 11:14:52 +03:00
Martin Storsjö 46196db4d3 [ORC] Fix a warning about an unused variable on Windows. NFC.
Differential Revision: https://reviews.llvm.org/D131055
2022-08-04 11:14:52 +03:00
Corentin Jabot 127bf44385 [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
2022-08-04 10:12:53 +02:00
wanglian b6b0690355 [LegalizeTypes][VP] Add split operand support for VP float and integer casting
Reviewed By: frasercrmck

Differential Revision: https://reviews.llvm.org/D130685
2022-08-04 15:41:50 +08:00
jacquesguan b61cfc91ea [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
2022-08-04 15:31:31 +08:00
Phoebe Wang 6f867f9102 [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
2022-08-04 15:12:15 +08:00
jacquesguan 45bae1be90 [RISCV][test] Add inloop reduction vectorize test. NFC 2022-08-04 15:06:44 +08:00
Adrian Kuegel bc32896e9f [llvm][Bazel] Exclude TrainingLoggerTest.cpp from build.
It requires a google protobuf dependency.
2022-08-04 08:48:17 +02:00
Adrian Kuegel 84d4bb78e0 [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
2022-08-04 08:39:41 +02:00
Thomas Lively b19de814ad [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
2022-08-03 23:28:37 -07:00
Siva Chandra c9e1ecd46d [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
2022-08-03 23:12:02 -07:00