platform/upstream/llvm.git
17 months agoBump the MLIR bytecode current revision (version 5) to match the implementation
Mehdi Amini [Fri, 26 May 2023 03:39:26 +0000 (20:39 -0700)]
Bump the MLIR bytecode current revision (version 5) to match the implementation

17 months agoFix MLIR Bytecode backward deployment
Mehdi Amini [Fri, 26 May 2023 03:38:32 +0000 (20:38 -0700)]
Fix MLIR Bytecode backward deployment

The condition for guarding the properties section was reversed.

17 months agoFix MLIR back-deployment to version < 5 ; properties section should not be emitted.
Eugene Burmako [Fri, 26 May 2023 03:17:00 +0000 (20:17 -0700)]
Fix MLIR back-deployment to version < 5 ; properties section should not be emitted.

This was an oversight in the development of bytecode version 5, which was
caught by downstream StableHLO compatibility tests.

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

17 months ago[fuzzer] Don't hard-code page size in FuzzerUtil.h
zhanglimin [Fri, 26 May 2023 02:59:39 +0000 (19:59 -0700)]
[fuzzer] Don't hard-code page size in FuzzerUtil.h

Don't hard code the page in FuzzerUtil.h, this breaks on
e.g. LoongArch which defaults to a 16KiB page size.

Reviewed By: #sanitizers, vitalybuka

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

17 months ago[NFC][CLANG] Fix static code analyzer concerns
Manna, Soumi [Fri, 26 May 2023 03:00:19 +0000 (20:00 -0700)]
[NFC][CLANG] Fix static code analyzer concerns

Reported by Static Code Analyzer Tool:

Inside "CGExprConstant.cpp" file, VisitObjCEncodeExpr() returns null value which is dereferenced without checking.

This patch adds an assert.

Reviewed By: erichkeane

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

17 months agoTestStackCoreScriptedProcess.py is timing out, skip it
Jason Molenda [Fri, 26 May 2023 02:12:04 +0000 (19:12 -0700)]
TestStackCoreScriptedProcess.py is timing out, skip it

The x86_64 macOS CI bot is failing because this test
times out.  It was marked as expectedFail earlier today,
but that's not considered a fail so the CI runs are
red.  Skipping it on Darwin for now until Ismail can
look into it.

17 months ago[Clang] Simplify test `clang/test/OpenMP/bug59160.c`
Shilei Tian [Fri, 26 May 2023 02:12:16 +0000 (22:12 -0400)]
[Clang] Simplify test `clang/test/OpenMP/bug59160.c`

17 months agoFix test by marking it x86 specific
David Blaikie [Fri, 26 May 2023 02:07:08 +0000 (02:07 +0000)]
Fix test by marking it x86 specific

17 months ago[mlir] Fix non-const lvalue reference to type 'uint64_t' cannot bind to type 'size_t...
Jie Fu [Fri, 26 May 2023 02:02:21 +0000 (10:02 +0800)]
[mlir] Fix non-const lvalue reference to type 'uint64_t' cannot bind to type 'size_t' error (NFC)

/Users/jiefu/llvm-project/mlir/lib/Bytecode/Reader/BytecodeReader.cpp:1007:39: error: non-const lvalue reference to type 'uint64_t' (aka 'unsigned long long') cannot bind to a value of unrelated type 'size_t' (aka 'unsigned long')
    if (failed(propReader.parseVarInt(count)))
                                      ^~~~~
/Users/jiefu/llvm-project/mlir/lib/Bytecode/Reader/BytecodeReader.cpp:191:39: note: passing argument to parameter 'result' here
  LogicalResult parseVarInt(uint64_t &result) {
                                      ^
/Users/jiefu/llvm-project/mlir/lib/Bytecode/Reader/BytecodeReader.cpp:1033:41: error: non-const lvalue reference to type 'uint64_t' (aka 'unsigned long long') cannot bind to a value of unrelated type 'size_t' (aka 'unsigned long')
    if (failed(dialectReader.readVarInt(propertiesIdx)))
                                        ^~~~~~~~~~~~~
/Users/jiefu/llvm-project/mlir/lib/Bytecode/Reader/BytecodeReader.cpp:926:38: note: passing argument to parameter 'result' here
  LogicalResult readVarInt(uint64_t &result) override {
                                     ^
2 errors generated.

/Users/jiefu/llvm-project/mlir/lib/Bytecode/Reader/BytecodeReader.cpp:1033:41: error: non-const lvalue reference to type 'uint64_t' (aka 'unsigned long long') cannot bind to a value of unrelated type 'size_t' (aka 'unsigned long')
    if (failed(dialectReader.readVarInt(propertiesIdx)))
                                        ^~~~~~~~~~~~~
/Users/jiefu/llvm-project/mlir/lib/Bytecode/Reader/BytecodeReader.cpp:926:38: note: passing argument to parameter 'result' here
  LogicalResult readVarInt(uint64_t &result) override {
                                     ^
1 error generated.

17 months agoRevert "[fuzzer] Don't hard-code page size in FuzzerUtil.h"
Jason Molenda [Fri, 26 May 2023 01:05:10 +0000 (18:05 -0700)]
Revert "[fuzzer] Don't hard-code page size in FuzzerUtil.h"

This reverts commit a2b677e8153758997a9043360cf51333eecc3c44.

reverting

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

because <sys/auxv.h> and getauxval() are not available on macOS;
this change is breaking the mac CI bots.

17 months agollvm-symbolizer: access the base address from the skeleton CU, not the split unit
David Blaikie [Fri, 26 May 2023 00:59:40 +0000 (00:59 +0000)]
llvm-symbolizer: access the base address from the skeleton CU, not the split unit

In Split DWARF, if the unit had a non-trivial base address (a real
low_pc, rather than one with fixed value 0) then computing addresses
needs to access that base address to add to any base address-relative
values. But the code was trying to access the base address in the split
unit, when it's actually in the skeleton unit. So delegate to the
skeleton if it's available.

Fixes #62941

17 months ago[Clang] Fix test case issue introduced by D141627
Shilei Tian [Fri, 26 May 2023 00:40:57 +0000 (20:40 -0400)]
[Clang] Fix test case issue introduced by D141627

17 months ago[sanitizer] Implement __sanitizer_get_allocated_size_fast
Jin Xin Ng [Wed, 24 May 2023 00:04:53 +0000 (00:04 +0000)]
[sanitizer] Implement __sanitizer_get_allocated_size_fast

The primary motivation for this change is to allow FreeHooks to obtain
the allocated size of the pointer being freed in a fast, efficient manner.

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

17 months ago[Clang][OpenMP] Fix the issue that list items in `has_device_addr` are still mapped...
Shilei Tian [Fri, 26 May 2023 00:18:47 +0000 (20:18 -0400)]
[Clang][OpenMP] Fix the issue that list items in `has_device_addr` are still mapped to the target device

This patch fixes the issue that list items in `has_device_addr` are still mapped
to the target device because front end emits map type `OMP_MAP_TO`.

Fix #59160.

Reviewed By: jyu2

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

17 months agoRevert "[libc] Enable hermetic floating point tests"
Joseph Huber [Fri, 26 May 2023 00:15:02 +0000 (19:15 -0500)]
Revert "[libc] Enable hermetic floating point tests"

This passed locally but unfortauntely it seems some tests are not ready
to be made hermetic. Revert for now until we can investigate
specifically which tests are failing and mark those as `UNIT_TEST_ONLY`.

This reverts commit 417ea79e792a87d53f5ac4f5388af4b25aa04d7d.

17 months ago[libc] Enable hermetic floating point tests
Joseph Huber [Wed, 24 May 2023 23:07:39 +0000 (18:07 -0500)]
[libc] Enable hermetic floating point tests

This patch enables us to run the floating point tests as hermetic.
Importantly we now use the internal versions of the `fesetround` and
`fegetround` functions.

Reviewed By: michaelrj

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

17 months ago[mlir][tosa] Add type checking traits to the appropriate ops
TatWai Chong [Thu, 25 May 2023 23:47:23 +0000 (23:47 +0000)]
[mlir][tosa] Add type checking traits to the appropriate ops

Add the trait `SameOperandsAndResultElementType` and
`SameOperandsElementType` to verify ops that are known
to have the same input and output type rather than generate
an invalid tosa IR with mixed data types like:

  "tosa.add"(%0, %1) : (tensor<nxbf16>, tensor<nxf32>) -> tensor<nxf32>

Thus apply tosa.cast prior if needed.

Change-Id: Ie866b84e371e3b571ec04f7abb090c216dd39c33

Reviewed By: jpienaar

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

17 months ago[Clang][Attribute] Improve the AST/diagnoses fidelity of alignas and _Alignas
yronglin [Thu, 25 May 2023 23:40:51 +0000 (07:40 +0800)]
[Clang][Attribute] Improve the AST/diagnoses fidelity of alignas and _Alignas

- Fix diagnoses when the argument to `alignas` or `_Alignas` is an incomplete type.

Before:
```
./alignas.cpp:1:15: error: invalid application of 'alignof' to an incomplete type 'void'
class alignas(void) Foo {};
             ~^~~~~
1 error generated.
```
Now:
```
./alignas.cpp:1:15: error: invalid application of 'alignas' to an incomplete type 'void'
class alignas(void) Foo {};
             ~^~~~~
1 error generated.
```

- Improve the AST fidelity of `alignas` and `_Alignas` attribute.

Before:
```
AlignedAttr 0x13f07f278 <col:7> alignas
    `-ConstantExpr 0x13f07f258 <col:15, col:21> 'unsigned long'
      |-value: Int 8
      `-UnaryExprOrTypeTraitExpr 0x13f07f118 <col:15, col:21> 'unsigned long' alignof 'void *'
```

Now:
```
AlignedAttr 0x14288c608 <col:7> alignas 'void *'
```

Reviewed By: erichkeane

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

17 months ago[fuzzer] Don't hard-code page size in FuzzerUtil.h
zhanglimin [Thu, 25 May 2023 23:10:42 +0000 (16:10 -0700)]
[fuzzer] Don't hard-code page size in FuzzerUtil.h

Don't hard code the page in FuzzerUtil.h, this breaks on
e.g. LoongArch which defaults to a 16KiB page size.

Reviewed By: #sanitizers, vitalybuka

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

17 months ago[tosa] Improve inferred shapes of TOSA operations
Spenser Bauman [Thu, 25 May 2023 23:06:50 +0000 (16:06 -0700)]
[tosa] Improve inferred shapes of TOSA operations

The TosaInferShapes pass avoids updating the shapes of tensor operators
when the consumers are not TOSA operations, limiting the efficacy of
TosaInferShapes when the IR is a mix of TOSA and other operations.
This change attempts to update the result shapes when the consumers
themselves have reasonable type/shape inference methods.

Reviewed By: eric-k256

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

17 months ago[libc][darwin] Add OSUtil for darwin arm64 target so that unit tests can be run.
Tue Ly [Wed, 24 May 2023 21:26:55 +0000 (17:26 -0400)]
[libc][darwin] Add OSUtil for darwin arm64 target so that unit tests can be run.

Currently unit tests cannot be run on macOS due to missing OSUtil.

Reviewed By: michaelrj

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

17 months ago[libc][doc] Update math function status page to show more targets.
Tue Ly [Thu, 25 May 2023 19:54:00 +0000 (15:54 -0400)]
[libc][doc] Update math function status page to show more targets.

Show availability of math functions on each target.

Reviewed By: jeffbailey

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

17 months ago[mlir][sparse][gpu] end to end test for matmul
Aart Bik [Thu, 25 May 2023 21:30:58 +0000 (14:30 -0700)]
[mlir][sparse][gpu] end to end test for matmul

(1) minor bug fix in copy back [always nice to run stuff ;-)]
(2) run with and without lib (even though some fall back to CPU)

Reviewed By: wrengr

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

17 months ago[MLIR] Add native Bytecode support for properties
Mehdi Amini [Mon, 1 May 2023 15:43:50 +0000 (08:43 -0700)]
[MLIR] Add native Bytecode support for properties

This is adding a new interface (`BytecodeOpInterface`) to allow operations to
opt-in skipping conversion to attribute and serializing properties to native
bytecode.

The scheme relies on a new section where properties are stored in sequence

  { size, serialize_properties }, ...

The operations are storing the index of a properties, a table of offset is
built when loading the properties section the first time.

Back-deployment to version prior to 4 are relying on getAttrDictionnary() which
we intend to deprecate and remove: that is putting a de-factor end-of-support
horizon for supporting deployments to version older than 4.

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

17 months agoAdd a `-verify-roundtrip` option to `mlir-opt` intended to validate custom printer...
Mehdi Amini [Tue, 23 May 2023 10:04:21 +0000 (03:04 -0700)]
Add a `-verify-roundtrip` option to `mlir-opt` intended to validate custom printer/parser completeness

Running:

  MLIR_OPT_CHECK_IR_ROUNDTRIP=1 ninja check-mlir

will now exercises all of our test with a round-trip to bytecode and a comparison for equality.

Reviewed By: rriddle, ftynse, jpienaar

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

17 months ago[lldb] Disable variable watchpoints when going out of scope
Med Ismail Bennani [Thu, 25 May 2023 22:06:44 +0000 (15:06 -0700)]
[lldb] Disable variable watchpoints when going out of scope

If we use a variable watchpoint with a condition using a scope variable,
if we go out-of-scope, the watpoint remains active which can the
expression evaluator to fail to parse the watchpoint condition (because
of the missing varible bindings).

This was discovered after `watchpoint_callback.test` started failing on
the green dragon bot.

This patch should address that issue by setting an internal breakpoint
on the return addresss of the current frame when creating a variable
watchpoint. The breakpoint has a callback that will disable the watchpoint
if the the breakpoint execution context matches the watchpoint execution
context.

This is only enabled for local variables.

This patch also re-enables the failing test following e1086384e584.

rdar://109574319

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

Signed-off-by: Med Ismail Bennani <ismail@bennani.ma>
17 months ago[mlir][gpu] Add i64 & f64 support to gpu.shuffle
Fabian Mora [Thu, 25 May 2023 20:31:57 +0000 (20:31 +0000)]
[mlir][gpu] Add i64 & f64 support to gpu.shuffle

This patch adds support for i64, f64 values in `gpu.shuffle`, rewriting 64bit shuffles into two 32bit shuffles.
The reason behind this change is that both CUDA & HIP support this kind of shuffling.
The implementation provided by this patch is based on the LLVM IR emitted by clang for 64bit shuffles when using `-O3`.

Reviewed By: makslevental

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

17 months ago[Demangle] avoid more std::string_view::substr
Nick Desaulniers [Thu, 25 May 2023 21:29:12 +0000 (14:29 -0700)]
[Demangle] avoid more std::string_view::substr

In D148959, I removed usage of std::string_view::substr because it may
throw, and libcxxabi cannot use such code.  I missed one instance in
llvm::starts_with.  That is blocking copying the code back upstream in
D148566.

Mark these helpers noexcept (as they are in C++20) as well, to remind
future travelers.

Make these changes upstream, and copy them back downstream using
libcxxabi/src/demangle/cp-to-llvm.sh.

Reviewed By: #libc_abi, MaskRay, ldionne

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

17 months ago[MLIR] Fixup Bazel build for Add a pattern for transforming gpu.global_id to thread...
Eugene Burmako [Thu, 25 May 2023 21:24:51 +0000 (14:24 -0700)]
[MLIR] Fixup Bazel build for Add a pattern for transforming gpu.global_id to thread + blockId * blockDim

This patch updates the Bazel build to catch up with changes in https://reviews.llvm.org/D148978.

Reviewed By: aartbik

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

17 months ago[libcxxabi] link abort_message into unittest_demangle
Nick Desaulniers [Thu, 25 May 2023 21:22:47 +0000 (14:22 -0700)]
[libcxxabi] link abort_message into unittest_demangle

unittest_demangle.pass.cpp uses the preprocessor to #include
cxa_demangle.cpp. D148566 will make more use of std::string_view in
libcxxabi rather than the home-grown StringView, but as a result of
D149092, a definition of abort_message needs to be provided.

Otherwise builds of check-cxxabi with -DLLVM_ENABLE_ASSERTIONS=ON will
fail to link with the errors:
/usr/bin/ld: /tmp/lit-tmp-0akcq37p/cc6DLdvw.o: in function `(anonymous namespace)::itanium_demangle::starts_with(std::__1::basic_string_view<char, std::__1::char_traits<char> >, char)':
unittest_demangle.pass.cpp:(.text+0x81): undefined reference to `abort_message'
/usr/bin/ld: /tmp/lit-tmp-0akcq37p/cc6DLdvw.o: in function `(anonymous namespace)::itanium_demangle::starts_with(std::__1::basic_string_view<char, std::__1::char_traits<char> >, std::__1::basic_string_view<char, std::__1::char_traits<char> >)':
unittest_demangle.pass.cpp:(.text+0x2aa): undefined reference to `abort_message'
/usr/bin/ld: unittest_demangle.pass.cpp:(.text+0x312): undefined reference to `abort_message'
/usr/bin/ld: /tmp/lit-tmp-0akcq37p/cc6DLdvw.o: in function `(anonymous namespace)::itanium_demangle::OutputBuffer::writeUnsigned(unsigned long, bool)':
unittest_demangle.pass.cpp:(.text+0x54f): undefined reference to `abort_message'
/usr/bin/ld: unittest_demangle.pass.cpp:(.text+0x5b7): undefined reference to `abort_message'
/usr/bin/ld: /tmp/lit-tmp-0akcq37p/cc6DLdvw.o:unittest_demangle.pass.cpp:(.text+0xe6e): more undefined references to `abort_message' follow
/usr/bin/ld: /home/libcxx-builder/.buildkite-agent/builds/google-libcxx-builder-f0560ea595b1-1/llvm-project/libcxx-ci/build/generic-gcc/test/Output/unittest_demangle.pass.cpp.dir/t.tmp.exe: hidden symbol `abort_message' isn't defined

Use the preprocessor further to provide the definition of abort_message
for this unittest.

Reviewed By: #libc_abi, phosek

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

17 months ago[libc++] Add support for generated tests in the libc++ test format
Louis Dionne [Tue, 23 May 2023 18:50:05 +0000 (11:50 -0700)]
[libc++] Add support for generated tests in the libc++ test format

A recurring problem recently has been that libc++ has several generated
tests which all need to be re-generated before committing a change. This
creates noise during code reviews and friction for contributors.

Furthermore, the way we generated most of these tests resulted in
extremely bad compilation times when using modules, because we defined
a macro before compiling each file.

This commit introduces a new kind of test called a '.gen' test. These
tests are normal shell tests, however the Lit test format will run the
test to discover the actual Lit tests it should run. This basically
allows generating a Lit test suite on the fly using arbitrary code,
which can be used in the future to generate tests like our __verbose_abort
tests and several others.

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

17 months ago[libc] Support LIBC_COPT_USE_C_ASSERT build flag
Roland McGrath [Thu, 25 May 2023 21:07:24 +0000 (14:07 -0700)]
[libc] Support LIBC_COPT_USE_C_ASSERT build flag

In this mode, LIBC_ASSERT is just standard C assert.

Reviewed By: abrachet

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

17 months ago[libc] Fix compilation issues in memory_check_utils.h
Roland McGrath [Thu, 25 May 2023 20:57:47 +0000 (13:57 -0700)]
[libc] Fix compilation issues in memory_check_utils.h

Strict warnings require explicit static_cast to counteract
default widening of types narrower than int.

Functions in header files should have vague linkage (inline
keyword), not internal linkage (static) or external linkage
(no inline keyword) even for template functions.  Note these
don't use the LIBC_INLINE macro since this is only for test code.

Reviewed By: abrachet

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

17 months agoRe-revert "[lldb] Move PassthroughScriptedProcess to `lldb.scripted_process` module"
Med Ismail Bennani [Thu, 25 May 2023 20:59:26 +0000 (13:59 -0700)]
Re-revert "[lldb] Move PassthroughScriptedProcess to `lldb.scripted_process` module"

This reverts commit 429e74839506ea8ba962d24647264ed81f680bbf since it
didn't address the test failures on GreenDragon.

This patch will mark the tests as expected to fail until I can reproduce
the issue and find a solution.

Signed-off-by: Med Ismail Bennani <ismail@bennani.ma>
17 months agoDon't disable loop unroll for vectorized loops on AMDGPU target
Alexander Timofeev [Wed, 26 Apr 2023 18:58:17 +0000 (20:58 +0200)]
Don't disable loop unroll for vectorized loops on AMDGPU target

We've got a performance regression after the https://reviews.llvm.org/D115261.
Despite the loop being vectorized unroll is still required.

Reviewed By: rampitec

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

17 months ago[mlir][gpu] Add a pattern for transforming gpu.global_id to thread + blockId * blockDim
Fabian Mora [Thu, 25 May 2023 20:23:46 +0000 (20:23 +0000)]
[mlir][gpu] Add a pattern for transforming gpu.global_id to thread + blockId * blockDim

This patch implements a rewrite pattern for transforming gpu.global_id x
to gpu.thread_id + gpu.block_id * gpu.block_dim.

Reviewed By: makslevental

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

17 months ago[Sema] cast to CXXRecordDecl correctly when diag a default comparison method
Congcong Cai [Thu, 25 May 2023 20:07:48 +0000 (22:07 +0200)]
[Sema] cast to CXXRecordDecl correctly when diag a default comparison method

Fixed: https://github.com/llvm/llvm-project/issues/62791
Fixed: https://github.com/llvm/llvm-project/issues/62102
in c++20, default comparison is supported. `getLexicalDeclContext` maybe cannot
get the `CXXRecord` if default comparison defined out of `CXXRecord`.
This patch want to get these information from the first function argument.

Reviewed By: #clang-language-wg, erichkeane

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

17 months ago[ELF][test] Add -NEXT and -NOT after D150644 (–-print-memory-usage)
Fangrui Song [Thu, 25 May 2023 20:05:43 +0000 (13:05 -0700)]
[ELF][test] Add -NEXT and -NOT after D150644 (–-print-memory-usage)

17 months agoReapply: [clang][diagnostics] Adding -Wpacked-non-pod to -Wall
Zenong Zhang [Thu, 25 May 2023 19:40:56 +0000 (12:40 -0700)]
Reapply: [clang][diagnostics] Adding -Wpacked-non-pod to -Wall

Users will be informed when non-POD is not packed using -Wall. This
is also consistent with GCC.

Fixes PR#60832.

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

17 months ago[NFC] Add more lldb python reformat SHA to .git-blame-ignore-revs
Jonas Devlieghere [Thu, 25 May 2023 19:54:56 +0000 (12:54 -0700)]
[NFC] Add more lldb python reformat SHA to .git-blame-ignore-revs

17 months ago[NFC][Py Reformat] Reformat python files in lldb
Jonas Devlieghere [Thu, 25 May 2023 15:48:57 +0000 (08:48 -0700)]
[NFC][Py Reformat] Reformat python files in lldb

This is an ongoing series of commits that are reformatting our Python
code. Reformatting is done with `black` (23.1.0).

If you end up having problems merging this commit because you have made
changes to a python file, the best way to handle that is to run `git
checkout --ours <yourfile>` and then reformat it with black.

RFC: https://discourse.llvm.org/t/rfc-document-and-standardize-python-code-style

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

17 months ago[libc] Add macro LIBC_THREAD_LOCAL.
Siva Chandra Reddy [Thu, 25 May 2023 19:29:19 +0000 (19:29 +0000)]
[libc] Add macro LIBC_THREAD_LOCAL.

It resolves to thread_local on all platform except for the GPUs on which
it resolves to nothing. The use of thread_local in the source code has been
replaced with the new macro.

Reviewed By: jhuber6

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

17 months ago[CUDA] Explicitly construct dim3() return values.
Artem Belevich [Thu, 25 May 2023 19:39:37 +0000 (12:39 -0700)]
[CUDA] Explicitly construct dim3() return values.

Fixes CUDA build break caused by 5c082e7e15e38a2eea1f506725ef

17 months ago[clang] Make `FileEntryRef::getDir()` return the as-requested `DirectoryEntryRef`
Jan Svoboda [Thu, 25 May 2023 16:22:38 +0000 (09:22 -0700)]
[clang] Make `FileEntryRef::getDir()` return the as-requested `DirectoryEntryRef`

For redirected file entries, `FileEntryRef::getDir()` returns the parent directory entry of the target file entry. This differs from `FileEntry::getDir()` that always returns the parent directory that was last used to look up that file.

After switching from `FileEntry` to `FileEntryRef` for umbrella headers in D142113, this discrepancy became observable and caused Clang to emit incorrect diagnostics.

This patch changes Clang so that it always associates `FileEntryRef` with the parent directory that was used to look it up. This brings its behavior closer to `FileEntry`, but without the hacky mutation.

This also ensures that `llvm::sys::path::parent_path(FileRef->getNameAsRequested()) == FileRef->getDir()->getName()`. Previously, `FileRef->getDir()` would fall underneath the redirecting VFS into the world of on-disk paths.

Reviewed By: benlangmuir, rmaz

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

17 months ago[sanitizer] Add new symbolizer symbol
Thurston Dang [Thu, 25 May 2023 19:16:38 +0000 (19:16 +0000)]
[sanitizer] Add new symbolizer symbol

wmemchr symbol is required after https://reviews.llvm.org/D144394
(see https://lab.llvm.org/buildbot/#/builders/37/builds/22340 for error message)

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

17 months ago[mlir][sparse] fix bugs when computing the memory size when lowering pack op.
Peiming Liu [Thu, 25 May 2023 18:35:28 +0000 (18:35 +0000)]
[mlir][sparse] fix bugs when computing the memory size when lowering pack op.

Reviewed By: aartbik

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

17 months ago[CUDA] Add CUDA wrappers over clang builtins for sm_90.
Artem Belevich [Mon, 22 May 2023 23:32:50 +0000 (16:32 -0700)]
[CUDA] Add CUDA wrappers over clang builtins for sm_90.

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

17 months ago[NVPTX, CUDA] barrier intrinsics and builtins for sm_90
Artem Belevich [Wed, 24 May 2023 00:05:30 +0000 (17:05 -0700)]
[NVPTX, CUDA] barrier intrinsics and builtins for sm_90

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

17 months ago[CUDA] plumb through new sm_90-specific builtins.
Artem Belevich [Mon, 22 May 2023 22:14:40 +0000 (15:14 -0700)]
[CUDA] plumb through new sm_90-specific builtins.

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

17 months ago[NVPTX] add new sm90-specific intrinsics.
Artem Belevich [Fri, 19 May 2023 20:21:28 +0000 (13:21 -0700)]
[NVPTX] add new sm90-specific intrinsics.

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

17 months ago[CUDA] bump supported CUDA version to 12.1/11.8
Artem Belevich [Wed, 24 May 2023 00:51:09 +0000 (17:51 -0700)]
[CUDA] bump supported CUDA version to 12.1/11.8

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

17 months ago[CUDA] Relax restrictions on variadics in host-side compilation.
Artem Belevich [Wed, 24 May 2023 19:13:41 +0000 (12:13 -0700)]
[CUDA] Relax restrictions on variadics in host-side compilation.

D150718 allows variadics during GPU compilation, but we also need to do it for
the host compilation as well, as it will see the same code.

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

17 months ago[compiler-rt] Use ZLIB_FOUND not LLVM_ENABLE_ZLIB
Alex Brachet [Thu, 25 May 2023 18:55:47 +0000 (18:55 +0000)]
[compiler-rt] Use ZLIB_FOUND not LLVM_ENABLE_ZLIB

LLVM_ENABLE_ZLIB is set to On by default and does not imply that ZLIB
was actually found, only being set to FORCE_ON would imply that it was
found before control reached compiler-rt/test/CMakeLists.txt. Instead,
use ZLIB_FOUND which guarantees that zlib is available.

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

17 months agoRevert "[clang][diagnostics] Add -Wpacked-non-pod to -Wall"
Aaron Ballman [Thu, 25 May 2023 18:50:51 +0000 (14:50 -0400)]
Revert "[clang][diagnostics] Add -Wpacked-non-pod to -Wall"

This reverts commit 9ed3d85e26d8594440bca84fe868a62ac6560ac8.

It broke some bots:
https://lab.llvm.org/buildbot/#/builders/245/builds/8876

17 months ago[InstCombine] Improve bitreverse optimization
Austin Chang [Thu, 25 May 2023 17:10:31 +0000 (12:10 -0500)]
[InstCombine] Improve bitreverse optimization

This patch utilizes the helper function implemented in D149699 and thus folds the following cases:

```
bitreverse(logic_op(x, bitreverse(y))) -> logic_op(bitreverse(x), y)
bitreverse(logic_op(bitreverse(x), y)) -> logic_op(x, bitreverse(y))
bitreverse(logic_op(bitreverse(x), bitreverse(y))) -> logic_op(x, y) in multiuse case
```

Reviewed By: goldstein.w.n, RKSimon

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

17 months ago[InstCombine] Add regression test cases for bitreverse optimization; NFC
Austin Chang [Thu, 25 May 2023 17:10:31 +0000 (12:10 -0500)]
[InstCombine] Add regression test cases for bitreverse optimization; NFC

Fold the following case on IR InstCombine pass. This patch includes the new test cases for this optimization

```
bitreverse(logic_op(x, bitreverse(y))) -> logic_op(bitreverse(x), y)
bitreverse(logic_op(bitreverse(x), y)) -> logic_op(x, bitreverse(y))
bitreverse(logic_op(bitreverse(x), bitreverse(y))) -> logic_op(x, y) with multi-use
```

Reviewed By: goldstein.w.n

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

17 months ago[-Wunsafe-buffer-usage] Group variables associated by pointer assignments
Rashmi Mudduluru [Thu, 25 May 2023 18:28:03 +0000 (11:28 -0700)]
[-Wunsafe-buffer-usage] Group variables associated by pointer assignments

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

17 months ago[clang][diagnostics] Add -Wpacked-non-pod to -Wall
Zenong Zhang [Thu, 25 May 2023 18:17:29 +0000 (14:17 -0400)]
[clang][diagnostics] Add -Wpacked-non-pod to -Wall

Users will be informed when non-POD is not packed using -Wall. This is
also consistent with GCC.

Fixes https://github.com/llvm/llvm-project/issues/60832
Differential Revision: https://reviews.llvm.org/D151162

17 months ago[scudo] releaseToOSMaybe can fail if it can't allocate PageMap
Chia-hung Duan [Thu, 25 May 2023 17:36:10 +0000 (17:36 +0000)]
[scudo] releaseToOSMaybe can fail if it can't allocate PageMap

PageMap is allocated with MAP_ALLOWNOMEM if there's no static buffer
left. So it can be failed and return nullptr without any assertion
triggered. Instead of crashing in the releaseToOSMaybe in the middle,
just return and let the program handles the page failure.

Reviewed By: cferris

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

17 months ago[SelectionDAG][AArch64][ARM] Remove setFlags call from DAGTypeLegalizer::SetPromotedI...
Craig Topper [Thu, 25 May 2023 18:01:19 +0000 (11:01 -0700)]
[SelectionDAG][AArch64][ARM] Remove setFlags call from DAGTypeLegalizer::SetPromotedInteger.

This was originally added to preserve FMF on SETCC. Unfortunately,
it also incorrectly preserves nuw/nsw on ADD/SUB in some cases.

There's also no guarantee the new opcode is even the same opcode
as the original node.

This patch removes the code and adds code to explicitly preserve
FMF flags in the SETCC promotion function.

The other test changes are from nuw/nsw not being preserved. I
believe for all these tests it was correct to preserve the flags,
so we need new code to preserve the flags when possible. I'll post
another patch for that since it's a riskier change.

This should unblock D150769.

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

17 months ago[CodeGen] Make __clang_call_terminate have an unwind table entry
Shoaib Meenai [Thu, 25 May 2023 01:32:38 +0000 (18:32 -0700)]
[CodeGen] Make __clang_call_terminate have an unwind table entry

This enables unwinders to step past that frame on architectures that
don't use DWARF unwinding (such as armv7), e.g. when debugging. The
problem should theoretically be architecture-agnostic, but according to
https://discourse.llvm.org/t/51633/2 it gets masked on architectures
that use DWARF unwind info.

Fixes https://github.com/llvm/llvm-project/issues/40696

Reviewed By: efriedma, rnk

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

17 months agoAdd missing dependency for tests.
Sterling Augustine [Thu, 25 May 2023 17:51:59 +0000 (10:51 -0700)]
Add missing dependency for tests.

17 months ago[libc++][test] Mark throw_format_error as noreturn.
Mark de Wever [Thu, 25 May 2023 17:45:50 +0000 (19:45 +0200)]
[libc++][test] Mark throw_format_error as noreturn.

This fixes and GCC error. This was tested in D135787.

17 months ago[lldb][nfc] Refactor methods with out parameter
Felipe de Azevedo Piovezan [Thu, 25 May 2023 11:24:30 +0000 (07:24 -0400)]
[lldb][nfc] Refactor methods with out parameter

Currently, the method `GetAttributeAddressRanges` takes a DWARFRangeList as a
parameter, just to immediately clear it. The method also returns the size of
this list. Such an API was obfuscating the intent of the call sites (it's not
clear from the method name what it returns) and it was obfuscating redundant
checks on the size of the list.

This commit refactors the method to return the list and to also make the call
sites use the more explicit `IsEmpty` method.

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

17 months agoFix "[sanitizer_common] Support stripping interceptor prefixes in RenderFrame()"
Marco Elver [Thu, 25 May 2023 17:36:50 +0000 (19:36 +0200)]
Fix "[sanitizer_common] Support stripping interceptor prefixes in RenderFrame()"

RenderFrame() has several implementations, which was missed in
01cea39f8e11012ac96b36ef60bfaf2f3b64320b.

Fix the one in sanitizer_symbolizer_markup.cpp.

Reported-by: gulfem
17 months ago[flang] Don't convert actual argument if IGNORE_TKR is present for the corresponding...
Kelvin Li [Thu, 25 May 2023 16:47:56 +0000 (12:47 -0400)]
[flang] Don't convert actual argument if IGNORE_TKR is present for the corresponding dummy

This patch is to remove the conversion of the actual argument that
is associated with the dummy argument specified with the IGNORE_TKR
directive.

Commit on behalf of @danielcchen

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

17 months ago[mlir][tensor] TrackingListener: Support cast-like InsertSliceOps with dynamic shape
Matthias Springer [Thu, 25 May 2023 17:10:05 +0000 (19:10 +0200)]
[mlir][tensor] TrackingListener: Support cast-like InsertSliceOps with dynamic shape

When looking for payload op replacements, rank-expanding InsertSliceOps of dynamically-typed tensors are now supported.

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

17 months ago[MLIR][sparse][GPU] fixing windows build break caused by D151014
Kun Wu [Thu, 25 May 2023 17:12:03 +0000 (17:12 +0000)]
[MLIR][sparse][GPU] fixing windows build break caused by D151014

Reviewed By: aartbik

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

17 months ago[mlir][Interfaces] ValueBoundsOpInterface: Check if two values are equal
Matthias Springer [Thu, 25 May 2023 17:03:17 +0000 (19:03 +0200)]
[mlir][Interfaces] ValueBoundsOpInterface: Check if two values are equal

Add a helper function that computes if two SSA values have the same value, utilizing the `ValueBoundsOpInterface` infrastructure. Two SSA values have the same value, an equality bound of 0 can be derived for their subtraction.

The helper function can also be used to determine if two tensor dimension sizes are equal.

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

17 months ago[mlir][openacc][NFC] Fix verifier message
Valentin Clement [Thu, 25 May 2023 17:03:50 +0000 (10:03 -0700)]
[mlir][openacc][NFC] Fix verifier message

Reviewed By: vzakhari, jeanPerier

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

17 months ago[mlir][Interfaces][NFC] ValueBoundsConstraintSet: Simplify constructor
Matthias Springer [Thu, 25 May 2023 16:50:27 +0000 (18:50 +0200)]
[mlir][Interfaces][NFC] ValueBoundsConstraintSet: Simplify constructor

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

17 months ago[Inliner] Mark inlinings stopped with inlining history as noinline
Arthur Eubanks [Fri, 19 May 2023 19:35:01 +0000 (12:35 -0700)]
[Inliner] Mark inlinings stopped with inlining history as noinline

The inline history makes sure that we don't keep inlining due to mutual devirtualization. But this gets forgotten between inliner invocations.

So mark the inlined calls as noinline so we respect previous inline history decisions.

This overlaps with D121084, but they're not redundant since we may not inline completely through a child SCC, but we still want a cost multiplier when that happens.

See discussions in D145516.

Reviewed By: jmorse

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

17 months ago[lldb][nfc] Place comment in the right place
Felipe de Azevedo Piovezan [Thu, 25 May 2023 11:23:06 +0000 (07:23 -0400)]
[lldb][nfc] Place comment in the right place

This line has been misplaced since it was introduced in 2011 by
c26e4454035a4160cffc3c865cf83be194ca38c4.

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

17 months ago[AST] Initialized data after TypeSourceInfo
Vitaly Buka [Sat, 13 May 2023 00:06:27 +0000 (17:06 -0700)]
[AST] Initialized data after TypeSourceInfo

There is no initialization of the data between allocation
and first getBeginLoc call.

allocation: llvm-project/clang/lib/AST/ASTContext.cpp:3022
use: llvm-project/clang/lib/AST/TypeLoc.cpp:222

Msan report https://reviews.llvm.org/P8306

Reviewed By: thurston

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

17 months agoFix nested block constructs for SELECT CASE
Carlos Eduardo Seo [Sat, 20 May 2023 05:16:50 +0000 (05:16 +0000)]
Fix nested block constructs for SELECT CASE

In some scenarios, a SELECT CASE could cause an error while lowering to FIR.
This was caused by a spurious extra branch added after the end statement.

Fixes #62726

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

17 months ago[Clang] Switch from TransformExpr to TransformInitializer in places we need to revert...
Shafik Yaghmour [Thu, 25 May 2023 16:44:10 +0000 (09:44 -0700)]
[Clang] Switch from TransformExpr to TransformInitializer in places we need to revert initializer to it syntactic form for Sema

In some cases we are using TransformExpr instead of
TransformInitializer, this results in ExprWithCleanups being dropped and
we are not emitting a destructor as a result.

This fixes: https://github.com/llvm/llvm-project/issues/62818

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

17 months ago[mlir][tensor] TrackingListener: Find replacement ops through cast-like InsertSliceOps
Matthias Springer [Thu, 25 May 2023 16:06:02 +0000 (18:06 +0200)]
[mlir][tensor] TrackingListener: Find replacement ops through cast-like InsertSliceOps

Certain InsertSliceOps, that do not use elements from the destination, are treated like casts when looking for replacement ops. Such InsertSliceOps are typically rank expansions.

Tensors with dynamic shape are not supported at the moment.

Also adds test cases for the TrackingListener.

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

17 months ago[mlir] Return new scf.forall handle in fuse_into_containing_op
Harsh Menon [Thu, 25 May 2023 10:32:59 +0000 (03:32 -0700)]
[mlir] Return new scf.forall handle in fuse_into_containing_op

Since the scf.forall is now consumed by the fuse into
containing op, we need to return a handle to the new scf.forall.
This patch does that and also ensures that the new bbArg
added to the scf.forall is used in its body.

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

17 months ago[Pipeline] Don't run EarlyFPM in LTO post link
Arthur Eubanks [Mon, 22 May 2023 18:07:51 +0000 (11:07 -0700)]
[Pipeline] Don't run EarlyFPM in LTO post link

EarlyFPM cleans up the output of the frontend. This isn't necessary in post link pipelines as the pre link pipeline already ran this.

~0.4% savings in ThinLTO builds:
https://llvm-compile-time-tracker.com/compare.php?from=8a5d4eb775c644d8683f24817d44c510d2b853b7&to=3580252a2162eadca0da99f1eeaa112f74a0353d&stat=instructions:u

Reviewed By: tejohnson

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

17 months ago[unittest][codegen] Avoid memory leak in recently added FindDebugLocTest unittest
Bjorn Pettersson [Thu, 25 May 2023 16:15:11 +0000 (18:15 +0200)]
[unittest][codegen] Avoid memory leak in recently added FindDebugLocTest unittest

Need to finalize the DIBuilder to avoid leak sanitizer errors
like this:

Direct leak of 48 byte(s) in 1 object(s) allocated from:
    #0 0x55c99ea1761d in operator new(unsigned long)
    #1 0x55c9a518ae49 in operator new
    #2 0x55c9a518ae49 in llvm::MDTuple::getImpl(...)
    #3 0x55c9a4f1b1ec in getTemporary
    #4 0x55c9a4f1b1ec in llvm::DIBuilder::createFunction(...)

17 months ago[mlir][bytecode] Avoid recording null arglocs & realloc opnames.
Jacques Pienaar [Thu, 25 May 2023 16:24:50 +0000 (09:24 -0700)]
[mlir][bytecode] Avoid recording null arglocs & realloc opnames.

For block arg locs a common case is no/uknown location (where the producer
signifies they don't care about blockarg location). Also avoid needing to
dynamically resize opnames during parsing.

Assumed to be post lazy loading change, so chose version 3.

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

17 months ago[mlir] Change the order of members in MLIRContext to ensure dialects are destroyed...
Laszlo Kindrat [Thu, 25 May 2023 13:23:49 +0000 (09:23 -0400)]
[mlir] Change the order of members in MLIRContext to ensure dialects are destroyed first

Currently, the dialects precede the registered operations in the context object, which means that the latter is destroyed first. At the same time, Operation::~Operation dereferences the registered operation when destroying properties, which can cause use-after-free (e.g. if a dialect owns an op). This patch fixes that by changing the order of the members so that dialects come after registered operations.

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

17 months ago[StandardInstrumentations] Add option to dump IR to a file on crash
Arthur Eubanks [Mon, 22 May 2023 23:00:18 +0000 (16:00 -0700)]
[StandardInstrumentations] Add option to dump IR to a file on crash

We already have -print-on-crash which dumps the IR to stderr on a crash, but it's more useful to dump to a file.

Introduce -print-on-crash-path to dump the IR to a file.

Making -print-on-crash a string option is confusing if you only pass -print-on-crash and it swallows up the next command line arg, which is why this is a new option.

Perhaps we could retire the dump to stderr version if people don't use it, but not sure how much people find that useful.

Reviewed By: jamieschmeiser

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

17 months agoDiscussion: Darwin Sanitizers Stable ABI
Roy Sundahl [Thu, 9 Feb 2023 20:43:54 +0000 (12:43 -0800)]
Discussion: Darwin Sanitizers Stable ABI

# Darwin Sanitizers Stable ABI

We wish to make it possible to include the AddressSanitizer (ASan) runtime implementation in OSes and for this we need a stable ASan ABI. Based on previous discussions about this topic, our understanding is that freezing the present ABI would impose an excessive burden on other sanitizer developers and for unrelated platforms. Therefore, we propose adding a secondary stable ABI for our use and anyone else in the community seeking the same. We believe that we can define a stable ABI with minimal burden on the community, expecting only to keep existing tests running and implementing stubs when new features are added. We are okay with trading performance for stability with no impact for existing users of ASan while minimizing the maintenance burden for ASan maintainers. We wish to commit this functionality to the LLVM project to maintain it there. This new and stable ABI will abstract away the implementation details allowing new and novel approaches to ASan for developers, researchers and others.

## Details

Rather than adding a lot of conditional code to the LLVM instrumentation phase, which would incur excessive complexity and maintenance cost of adding conditional code into all places that emit a runtime call, we propose a “shim” layer which will map the unstable ABI to the stable ABI:

* A static library (.a library) shim that maps the existing ASan ABI to a generalized, smaller and stable ABI. The library would implement the __asan functions and call into the new ABI. For example:
    * `void __asan_load1(uptr p) { __asan_abi_loadn(p, 1, true); }`
    * `void __asan_load2(uptr p) { __asan_abi_loadn(p, 2, true); }`
    * `void __asan_noabort_load16(uptr p) { __asan_abi_loadn(p, 16, false); }`
    * `void __asan_poison_cxx_array_cookie(uptr p) { __asan_abi_pac(p); }`
* This “shim” library would only be used by people who opt in: A compilation flag in the Clang driver will be used to gate the use of the stable ABI workflow.
* Utilize the existing ability for the ASan instrumentation to prefer runtime calls instead of inlined direct shadow memory accesses.
* Pursue (under the new driver flag) a better separation of abstraction and implementation with:
    * LLVM instrumentation: Calling out for all poisoning, checking and unpoisoning.
    * Runtime: Implementing the stable ABI and being responsible of implementation details of the shadow memory.

## Maintenance

Our aim is that the maintenance burden on the sanitizer developer community be negligible. Stable ABI tests will always pass for non-Darwin platforms. Changes to the existing ABI which would require a change to the shim have been infrequent as the ASan ABI is already relatively stable. Rarely, a change that impacts the contract between LLVM and the shim will occur. Among such foreseeable changes are: 1) changes to a function signature, 2) additions of new functions, or 3) deprecation of an existing function. Following are some examples of reasonable responses to those changes:

* Example: An existing ABI function is changed to return the input parameter on success or NULL on failure. In this scenario, a reasonable change to the shim would be to modify the function signature appropriately and to simply guess at a common-sense implementation.
    * `uptr __asan_load1(uptr p) { __asan_abi_loadn(p, 1, true); return p; }`
* Example: An additional function is added for performance reasons. It has a very similar function signature to other similarly named functions and logically is an extension of that same pattern. In this case it would make sense to apply the same logic as the existing entry points:
    * `void __asan_load128(uptr p) { __asan_abi_loadn(p, 128, true); }`
* Example: An entry point is added to the existing ABI for which there is no obvious stable ABI implementation: In this case, doing nothing in a no-op stub would be acceptable, assuming existing features of ASan can still work without an actual implementation of this new function.
    * `void __asan_prefetch(uptr p) { }`
* Example: An entrypoint in the existing ABI is deprecated and/or deleted:
    * (Delete the entrypoint from the shim.)

We’re looking for buy-in for this level of support.

(Note: Upon acceptance of the general concepts herein, we will add a controlling clang flag, cmake integration, contract for the stable ABI, and the appropriate test infrastructure.)

Reviewed By: eugenis, vitalybuka, MaskRay

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

17 months ago[asan] Fix Windows tests after StripFunctionName() improvements
Marco Elver [Thu, 25 May 2023 15:52:33 +0000 (17:52 +0200)]
[asan] Fix Windows tests after StripFunctionName() improvements

Stacktraces should no longer show __asan_wrap_, but the "normal"
function name.

Reflect that in tests.

17 months ago[flang][hlfir] Use actual type when copying an actual argument variable
Jean Perier [Thu, 25 May 2023 15:42:04 +0000 (17:42 +0200)]
[flang][hlfir] Use actual type when copying an actual argument variable

The copy must made according to the actual type, not the dummy type. In
case the dummy is polymorphic, these types will be different and the
dynamic type of the copy passed in the call should be the one of the
actual.

There is no support for "class(t), value" yet (it is hitting a TODO in
CallInterface that is moot for HLFIR but has not been lifted for lack of
proper testing) so the bug was dormant, but D151271 created a situation
where a copy is needed with polymorphic dummies and exposed the bug.
This led to a compile time assert
"value.isScalar() && fir::isa_trivial(value.getType())" in "hlfir::genAssociateExpr".

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

17 months ago[InlineCost] Consider branches with !make.implicit metadata as free.
Denis Antrushin [Tue, 2 May 2023 17:16:42 +0000 (00:16 +0700)]
[InlineCost] Consider branches with !make.implicit metadata as free.

!make.implicit metadata attached to branch means it will very likely
be eliminated (together with associated cmp instruction).

Reviewed By: apilipenko

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

17 months agosanitizer-common: temporarily disable release_to_os test for powerpc64
Thurston Dang [Thu, 25 May 2023 15:36:37 +0000 (15:36 +0000)]
sanitizer-common: temporarily disable release_to_os test for powerpc64

release_to_os has been failing on powerpc64 since yesterday. Temporarily disabling the test to prevent this error from
hiding other potential problems.

17 months ago[ADT] Allow specifying the size of resulting `SmallVector` in `map_to_vector`
Laszlo Kindrat [Mon, 15 May 2023 19:04:19 +0000 (15:04 -0400)]
[ADT] Allow specifying the size of resulting `SmallVector` in `map_to_vector`

This patch adds an overload for the `map_to_vector` helper template, exposing a parameter to control the size of the resulting `SmallVector`. A few call sites in mlir are updated to illustrate and test the change.

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

17 months ago[ThinLTO] Disable partial sample profile scaling by default
Teresa Johnson [Tue, 23 May 2023 20:02:48 +0000 (13:02 -0700)]
[ThinLTO] Disable partial sample profile scaling by default

As pointed out in
https://discourse.llvm.org/t/undeterministic-thin-index-file/69985, the
block count added to distributed ThinLTO index files breaks incremental
builds on ThinLTO - if any linked file has a different number of BBs,
then the accumulated sum placed in the index files will change, causing
all ThinLTO backend compiles to be redone.

This was only used for partial sample profiles, and was therefore
removed for other cases (3adc6e03080c6d38a51f5c5b6744b7c0d9c7541b).

Subsequent testing did not show a performance effect of disabling this
feature even for partial sample profiles. Therefore, switch the default
to false. If this does not cause a noticeable performance degradation
after the default flip, we can remove this support completely.

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

17 months agoAvoid pointless canonicalize when using Dwarf names
Mark Santaniello [Thu, 25 May 2023 15:11:40 +0000 (08:11 -0700)]
Avoid pointless canonicalize when using Dwarf names

CPU profile indicated memcmp was hot due to the two rfind calls in
getCanonicalFnName. If UseSymbolTable is false, we can avoid the cost entirely.

For CSSPGO profiles I've measured ~5% speedup with this change.

Profile similarity before/after matches 100%.

Reviewed By: wenlei

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

17 months ago[mlir] Enable folding memref alias for`vector.load`
Guray Ozen [Thu, 25 May 2023 14:10:38 +0000 (16:10 +0200)]
[mlir] Enable folding memref alias for`vector.load`

This work enables  folding memref alias pass for`vector.load`

Reviewed By: qcolombet

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

17 months ago[KnownBits] Simplify shl. NFCI.
Jay Foad [Thu, 25 May 2023 10:02:50 +0000 (11:02 +0100)]
[KnownBits] Simplify shl. NFCI.

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

17 months ago[APInt] Add unsigned overloads of shift functions
Jay Foad [Thu, 25 May 2023 10:56:06 +0000 (11:56 +0100)]
[APInt] Add unsigned overloads of shift functions

Add overloads of sshl_ov, ushl_ov, sshl_sat and ushl_sat that take the
shift amount as unsigned instead of APInt. This matches what we do for
the normal shift operators and can help to avoid creating temporary
APInts in some cases.

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

17 months ago[libc][test] Drastically reduce mem test runtime
Guillaume Chatelet [Thu, 25 May 2023 14:29:26 +0000 (14:29 +0000)]
[libc][test] Drastically reduce mem test runtime

Reviewed By: lntue

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

17 months ago[KnownBits] Check functions that return zero for poison results
Jay Foad [Thu, 25 May 2023 14:51:00 +0000 (15:51 +0100)]
[KnownBits] Check functions that return zero for poison results

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

17 months ago[libc++][PSTL] Make sure that -fexperimental-library enables the PSTL
Nikolas Klauser [Tue, 23 May 2023 19:06:53 +0000 (12:06 -0700)]
[libc++][PSTL] Make sure that -fexperimental-library enables the PSTL

@Mordante noticed that this was missing while making `<format>` non-experimental.

Reviewed By: ldionne, Mordante, #libc

Spies: libcxx-commits, Mordante

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

17 months ago[libc++] Forward to std::{,w}memchr in std::find
Nikolas Klauser [Wed, 24 May 2023 21:37:22 +0000 (14:37 -0700)]
[libc++] Forward to std::{,w}memchr in std::find

Reviewed By: #libc, ldionne

Spies: Mordante, libcxx-commits, ldionne, mikhail.ramalho

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

17 months ago[RISCV] Add test coverage for shuffle/insert idioms which can become v(f)slide1ups
Philip Reames [Thu, 25 May 2023 14:51:14 +0000 (07:51 -0700)]
[RISCV] Add test coverage for shuffle/insert idioms which can become v(f)slide1ups

17 months ago[clang][dataflow] Fix a crash in `getLogicOperatorSubExprValue()`.
Martin Braenne [Thu, 25 May 2023 09:22:37 +0000 (09:22 +0000)]
[clang][dataflow] Fix a crash in `getLogicOperatorSubExprValue()`.

This patch adds a test that crashes without the fix.

Reviewed By: ymandel

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