platform/upstream/llvm.git
14 months ago[AsmPrinter] Use EntryValue object info to emit Dwarf
Felipe de Azevedo Piovezan [Mon, 1 May 2023 15:19:49 +0000 (11:19 -0400)]
[AsmPrinter] Use EntryValue object info to emit Dwarf

This patch consumes the EntryValueObjects in a MachineFunction's table, using
them to emit the appropriate debug information for these variables.

Depends on D149880

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

14 months ago[mlir] Add timings to mlir translate.
Tobias Gysi [Fri, 12 May 2023 11:36:28 +0000 (11:36 +0000)]
[mlir] Add timings to mlir translate.

The revision adds basic timing to the mlir-translate tool.

Reviewed By: Dinistro

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

14 months agoAMDGPU: Fix issue in shl(or) combine
Ruiling Song [Wed, 10 May 2023 03:07:00 +0000 (11:07 +0800)]
AMDGPU: Fix issue in shl(or) combine

The code is doing the optimization:
`((a | c1) << c2)` ==> `(a << c2) + (c1 << c2)`
But this is only valid if `a` and `c1` have no common bits being set.

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

14 months ago[lldb] Don't write to source directory in test
Benjamin Kramer [Fri, 12 May 2023 10:26:29 +0000 (12:26 +0200)]
[lldb] Don't write to source directory in test

14 months ago [AggressiveInstCombine] folding load for constant global patterened arrays and...
khei4 [Fri, 12 May 2023 09:41:09 +0000 (18:41 +0900)]
[AggressiveInstCombine] folding load for constant global patterened arrays and structs by GEP-indices
    Differential Revision: https://reviews.llvm.org/D146622
    Fixes https://github.com/llvm/llvm-project/issues/61615
    Reviewed By: nikic

14 months ago[mlir] Update method cast calls to function calls
Tres Popp [Thu, 11 May 2023 09:10:46 +0000 (11:10 +0200)]
[mlir] Update method cast calls to function calls

The MLIR classes Type/Attribute/Operation/Op/Value support
cast/dyn_cast/isa/dyn_cast_or_null functionality through llvm's doCast
functionality in addition to defining methods with the same name.
This change begins the migration of uses of the method to the
corresponding function call as has been decided as more consistent.

Note that there still exist classes that only define methods directly,
such as AffineExpr, and this does not include work currently to support
a functional cast/isa call.

Context:

* https://mlir.llvm.org/deprecation/ at "Use the free function variants for dyn_cast/cast/isa/…"
* Original discussion at https://discourse.llvm.org/t/preferred-casting-style-going-forward/68443

Implementation:
This follows a previous patch that updated calls
`op.cast<T>()-> cast<T>(op)`. However some cases could not handle an
unprefixed `cast` call due to occurrences of variables named cast, or
occurring inside of class definitions which would resolve to the method.
All C++ files that did not work automatically with `cast<T>()` are
updated here to `llvm::cast` and similar with the intention that they
can be easily updated after the methods are removed through a
find-replace.

See https://github.com/llvm/llvm-project/compare/main...tpopp:llvm-project:tidy-cast-check
for the clang-tidy check that is used and then update printed
occurrences of the function to include `llvm::` before.

One can then run the following:
```
ninja -C $BUILD_DIR clang-tidy

run-clang-tidy -clang-tidy-binary=$BUILD_DIR/bin/clang-tidy -checks='-*,misc-cast-functions'\
                 -export-fixes /tmp/cast/casts.yaml mlir/*\
                 -header-filter=mlir/ -fix

rm -rf $BUILD_DIR/tools/mlir/**/*.inc
```

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

14 months ago[mlir] Move casting calls from methods to function calls
Tres Popp [Mon, 8 May 2023 14:33:54 +0000 (16:33 +0200)]
[mlir] Move casting calls from methods to function calls

The MLIR classes Type/Attribute/Operation/Op/Value support
cast/dyn_cast/isa/dyn_cast_or_null functionality through llvm's doCast
functionality in addition to defining methods with the same name.
This change begins the migration of uses of the method to the
corresponding function call as has been decided as more consistent.

Note that there still exist classes that only define methods directly,
such as AffineExpr, and this does not include work currently to support
a functional cast/isa call.

Caveats include:
- This clang-tidy script probably has more problems.
- This only touches C++ code, so nothing that is being generated.

Context:
- https://mlir.llvm.org/deprecation/ at "Use the free function variants
  for dyn_cast/cast/isa/…"
- Original discussion at https://discourse.llvm.org/t/preferred-casting-style-going-forward/68443

Implementation:
This first patch was created with the following steps. The intention is
to only do automated changes at first, so I waste less time if it's
reverted, and so the first mass change is more clear as an example to
other teams that will need to follow similar steps.

Steps are described per line, as comments are removed by git:
0. Retrieve the change from the following to build clang-tidy with an
   additional check:
   https://github.com/llvm/llvm-project/compare/main...tpopp:llvm-project:tidy-cast-check
1. Build clang-tidy
2. Run clang-tidy over your entire codebase while disabling all checks
   and enabling the one relevant one. Run on all header files also.
3. Delete .inc files that were also modified, so the next build rebuilds
   them to a pure state.
4. Some changes have been deleted for the following reasons:
   - Some files had a variable also named cast
   - Some files had not included a header file that defines the cast
     functions
   - Some files are definitions of the classes that have the casting
     methods, so the code still refers to the method instead of the
     function without adding a prefix or removing the method declaration
     at the same time.

```
ninja -C $BUILD_DIR clang-tidy

run-clang-tidy -clang-tidy-binary=$BUILD_DIR/bin/clang-tidy -checks='-*,misc-cast-functions'\
               -header-filter=mlir/ mlir/* -fix

rm -rf $BUILD_DIR/tools/mlir/**/*.inc

git restore mlir/lib/IR mlir/lib/Dialect/DLTI/DLTI.cpp\
            mlir/lib/Dialect/Complex/IR/ComplexDialect.cpp\
            mlir/lib/**/IR/\
            mlir/lib/Dialect/SparseTensor/Transforms/SparseVectorization.cpp\
            mlir/lib/Dialect/Vector/Transforms/LowerVectorMultiReduction.cpp\
            mlir/test/lib/Dialect/Test/TestTypes.cpp\
            mlir/test/lib/Dialect/Transform/TestTransformDialectExtension.cpp\
            mlir/test/lib/Dialect/Test/TestAttributes.cpp\
            mlir/unittests/TableGen/EnumsGenTest.cpp\
            mlir/test/python/lib/PythonTestCAPI.cpp\
            mlir/include/mlir/IR/
```

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

14 months ago[mlir] Move casting method calls to function calls
Tres Popp [Tue, 9 May 2023 13:56:42 +0000 (15:56 +0200)]
[mlir] Move casting method calls to function calls

The MLIR classes Type/Attribute/Operation/Op/Value support
cast/dyn_cast/isa/dyn_cast_or_null functionality through llvm's doCast
functionality in addition to defining methods with the same name.
This change continues the migration of uses of the method to the
corresponding function call as has been decided as more consistent.

This commit attempts to update all occurrences of the casts in .td
files, although it is likely that a couple were missed.

Context:
- https://mlir.llvm.org/deprecation/ at "Use the free function variants for dyn_cast/cast/isa/…"
- Original discussion at https://discourse.llvm.org/t/preferred-casting-style-going-forward/68443

Implementation:
Unfortunatley, this was not automated, but was handled by mindlessly
going to next occurrences of patterns, selecting the piece of code to
be moved into the function call, and running a vim macro over the span
of around 4 hours.

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

14 months ago[AArch64][SME2/SVE2p1] Add predicate-as-counter intrinsics for while*
Sander de Smalen [Fri, 12 May 2023 08:22:21 +0000 (08:22 +0000)]
[AArch64][SME2/SVE2p1] Add predicate-as-counter intrinsics for while*

These intrinsics are used to implement the while intrinsics that result
in a predicate-as-counter value, e.g.

  __attribute__((arm_streaming))
  svcount_t svwhilelt_c8(int64_t rn, int64_t rm, uint64_t vl)

As described in https://github.com/ARM-software/acle/pull/217

Reviewed By: hassnaa-arm

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

14 months ago[AArch64][SME2/SVE2p1] Add predicate-as-counter intrinsics for ptrue/cntp
Sander de Smalen [Fri, 12 May 2023 08:21:54 +0000 (08:21 +0000)]
[AArch64][SME2/SVE2p1] Add predicate-as-counter intrinsics for ptrue/cntp

These intrinsics are used to implement:
* svptrue_c8(), svptrue_c16(), etc.
* svcntp_c8(svcount_t pnn, uint64_t vl), svcntp_c16(...), etc.

As described in https://github.com/ARM-software/acle/pull/217

Reviewed By: david-arm

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

14 months ago[RISCV][CodeGen] Support Zhinx and Zhinxmin
Qihan Cai [Fri, 12 May 2023 08:29:30 +0000 (18:29 +1000)]
[RISCV][CodeGen] Support Zhinx and Zhinxmin

This patch was split from D122918.

Co-Author: @liaolucy @sunshaoce

Reviewed By: craig.topper

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

14 months ago[mlir][Linalg] NFC - fail gracefully instead of asserting in HoistPadding
Nicolas Vasilache [Fri, 12 May 2023 08:11:20 +0000 (01:11 -0700)]
[mlir][Linalg] NFC - fail gracefully instead of asserting in HoistPadding

14 months ago[clang][analyzer] Cleanup tests of StdCLibraryFunctionsChecker (NFC)
Balázs Kéri [Fri, 12 May 2023 07:20:35 +0000 (09:20 +0200)]
[clang][analyzer] Cleanup tests of StdCLibraryFunctionsChecker (NFC)

Function declarations are moved into common header that can be reused
to avoid repetitions in different test files.
Some small problems in the tests were found and fixed.

Reviewed By: steakhal

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

14 months ago[RISCV] Fold (select setcc, setcc, setcc) into and/or instructions
Yingwei Zheng [Fri, 12 May 2023 07:06:58 +0000 (15:06 +0800)]
[RISCV] Fold (select setcc, setcc, setcc) into and/or instructions

This patch folds `(select setcc, setcc, setcc)` into and/or instructions when truev/falsev is equal to or the inverse of condv.

(select x, x, y) -> x | y https://alive2.llvm.org/ce/z/36Ud3Z
(select !x, x, y) -> x & y https://alive2.llvm.org/ce/z/mYYoGF
(select x, y, x) -> x & y https://alive2.llvm.org/ce/z/MAZ--X
(select !x, y, x) -> x | y https://alive2.llvm.org/ce/z/ct7By5

It is the follow-up improvement of D150177, which optimizes the code of signed truncation check patterns without Zbb.

Reviewed By: craig.topper

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

14 months agoRevert "[NFC][xray] Initialize XRayFileHeader"
Vitaly Buka [Fri, 12 May 2023 06:56:41 +0000 (23:56 -0700)]
Revert "[NFC][xray] Initialize XRayFileHeader"
Revert "[xray] Ignore -Wc++20-extensions in xray_records.h [NFC]"

Not needed. The fix is 3826a74fc7ad589e268b267d9323d4d416c5f6e9.

This reverts commit 231c1d4134513e5a97cfdc874e8bda488ad59699.
This reverts commit 7f191e6d2c9ec4af1819c4e80a5453583cd72f08.

14 months ago[test] Use autogenerated assertions
Serge Pavlov [Fri, 12 May 2023 06:30:36 +0000 (13:30 +0700)]
[test] Use autogenerated assertions

14 months ago[Serialization] Don't try to complete the redeclaration chain in
Chuanqi Xu [Fri, 12 May 2023 02:20:13 +0000 (10:20 +0800)]
[Serialization] Don't try to complete the redeclaration chain in
ASTReader after we start writing

This is intended to mitigate
https://github.com/llvm/llvm-project/issues/61447.

Before the patch, it takes 5s to compile test.cppm in the above
reproducer. After the patch it takes 3s to compile it. Although this
patch didn't solve the problem completely, it should mitigate the
problem for sure. Noted that the behavior of the patch is consistent
with the comment of the originally empty function
ASTReader::finalizeForWriting. So the change should be consistent with
the original design.

14 months ago[DFSAN] Add support for strnlen
Tomasz Kuchta [Fri, 12 May 2023 05:28:53 +0000 (05:28 +0000)]
[DFSAN] Add support for strnlen

This patch adds a support for the libc strnlen() function in DFSAN

Reviewed by: browneee

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

14 months ago[test] Remove Python<3.3 workaround without shlex.quote
Fangrui Song [Fri, 12 May 2023 06:06:01 +0000 (23:06 -0700)]
[test] Remove Python<3.3 workaround without shlex.quote

Python>=3.6 has been the requirement since D93097 (2020).
Remove old workarounds.

Remove unused imports from compiler-rt/test/memprof/lit.cfg.py

Reviewed By: serge-sans-paille

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

14 months ago[ASAN][LSAN] Ignore main or uninitialized thead in pthread_exit
Vitaly Buka [Fri, 12 May 2023 05:56:27 +0000 (22:56 -0700)]
[ASAN][LSAN] Ignore main or uninitialized thead in pthread_exit

Fix crash on CHECK in ThreadArgRetval::Finish().

14 months ago[NFC][xray] Initialize XRayFileHeader
Vitaly Buka [Fri, 12 May 2023 03:38:08 +0000 (20:38 -0700)]
[NFC][xray] Initialize XRayFileHeader

Avoids reports with msan -fno-inline.

14 months ago[lli] Add new testcases for lli.
Lang Hames [Fri, 12 May 2023 00:41:30 +0000 (10:41 +1000)]
[lli] Add new testcases for lli.

These are an attempt to more systematically test the features covered by the
MCJIT regression tests (though these tests apply to lli's default mode, which
is now -jit-kind=orc).

This first batch of tests includes a basic smoke test (trivial-return-zero),
tests for single function calls and data references, and alignment handling.

14 months ago[NFC] SuffixTree: Move advance() into SuffixTree.cpp + more cleanup
Jessica Paquette [Fri, 12 May 2023 05:24:29 +0000 (22:24 -0700)]
[NFC] SuffixTree: Move advance() into SuffixTree.cpp + more cleanup

Allows us to knock out a couple more includes from the header file.

Also clang-format SuffixTree.cpp while we're here.

Also use SuffixTreeNode::EmptyIdx in a couple more places.

14 months ago[SimpleLoopUnswitch][reland 2] unswitch selects
Joshua Cao [Thu, 11 May 2023 05:38:02 +0000 (22:38 -0700)]
[SimpleLoopUnswitch][reland 2] unswitch selects

The old LoopUnswitch pass unswitched selects, but the changes were
never ported to the new SimpleLoopUnswitch.

We unswitch by turning:

``` S = select %cond, %a, %b ```

into:

``` head: br %cond, label %then, label %tail

then: br label %tail

tail: S = phi [ %a, %then ], [ %b, %head ] ```

Unswitch selects are always nontrivial, since the successors do not
exit the loop and the loop body always needs to be cloned.

Unswitch selects always need to freeze the conditional if the
conditional could be poison or undef. Selects don't propagate
poison/undef, and branches on poison/undef causes UB.

Reland 1 - Fix the insertion of freeze instructions. The original
implementation inserts a dead freeze instruction that is not used by the
unswitched branch.

Reland 2 - Include https://reviews.llvm.org/D149560 in the same patch,
which was originally reverted along with this patch. The patch prevents
unswitching of selects with a vector conditional. This could have been
caught in SimpleLoopUnswitch/crash.ll if it included tests for
nontrivial unswitching. This reland also adds a run for the test file
with nontrivial unswitching.

Reviewed By: nikic, kachkov98, vitalybuka

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

14 months agoSuffixTree: Don't save entire leaf nodes in advance()
Jessica Paquette [Fri, 12 May 2023 05:11:05 +0000 (22:11 -0700)]
SuffixTree: Don't save entire leaf nodes in advance()

All we need is the suffix indices.

Just store those instead.

Also improve code readability a little while we're here.

14 months ago[NFC] Tidy SuffixTree.h
Jessica Paquette [Fri, 12 May 2023 04:35:26 +0000 (21:35 -0700)]
[NFC] Tidy SuffixTree.h

- Move comment to top of file
- Remove unused vector include

14 months ago[gn build] Port 6cf993e59bd2
LLVM GN Syncbot [Fri, 12 May 2023 04:34:40 +0000 (04:34 +0000)]
[gn build] Port 6cf993e59bd2

14 months ago[NFC] SuffixTree: Split out SuffixTreeNodes into their own files
Jessica Paquette [Fri, 12 May 2023 04:32:12 +0000 (21:32 -0700)]
[NFC] SuffixTree: Split out SuffixTreeNodes into their own files

Add:

- SuffixTreeNode.h
- SuffixTreeNode.cpp

The SuffixTree file was getting too long.

14 months ago[NFC] SuffixTree: Move EmptyIdx into SuffixTreeNode and add a root allocator
Jessica Paquette [Fri, 12 May 2023 03:41:00 +0000 (20:41 -0700)]
[NFC] SuffixTree: Move EmptyIdx into SuffixTreeNode and add a root allocator

This makes it clearer that EmptyIdx is related to the node.

Also add an allocator for the root so that in the main SuffixTree code we don't
see gross stuff like a nullptr parent etc.

14 months ago[xray] Ignore -Wc++20-extensions in xray_records.h [NFC]
Jie Fu [Fri, 12 May 2023 03:10:08 +0000 (11:10 +0800)]
[xray] Ignore -Wc++20-extensions in xray_records.h [NFC]

/data/llvm-project/compiler-rt/lib/xray/../../include/xray/xray_records.h:48:24: error: default member initializer for bit-field is a C++20 extension [
-Werror,-Wc++20-extensions]
  bool ConstantTSC : 1 = false;
                       ^
/data/llvm-project/compiler-rt/lib/xray/../../include/xray/xray_records.h:49:23: error: default member initializer for bit-field is a C++20 extension [
-Werror,-Wc++20-extensions]
  bool NonstopTSC : 1 = false;
                      ^
2 errors generated.

14 months ago[mlir][tosa] Fold exp(log) operation into no-op
Kai Sasaki [Fri, 12 May 2023 02:40:00 +0000 (11:40 +0900)]
[mlir][tosa] Fold exp(log) operation into no-op

Element-wise exp(log) can be canonicalized as no-op.

Reviewed By: eric-k256

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

14 months agoThis patch adds doc for __builtin_flt_rounds and __builtin_set_flt_rounds
jinge90 [Fri, 12 May 2023 03:12:36 +0000 (11:12 +0800)]
This patch adds doc for __builtin_flt_rounds and __builtin_set_flt_rounds
and also adds description for default fp environment.

Reviewed By:rjmccall, sepavloff
Differential Revision: https://reviews.llvm.org/D146188

14 months ago[MLIR][Memref] Remove unnecessary #include
John Demme [Fri, 12 May 2023 02:43:29 +0000 (02:43 +0000)]
[MLIR][Memref] Remove unnecessary #include

MemRefMem2Ref was unnecessarily including a header from Complex and not
including it as a cmake dep (causing some builds to fail).

14 months ago[NFC][LiveDebugValues] Clang-format b135df08
Vitaly Buka [Fri, 12 May 2023 02:42:08 +0000 (19:42 -0700)]
[NFC][LiveDebugValues] Clang-format b135df08

14 months ago[LiveDebugValues] Temporarily initialize MLocTracker::CurBB
Vitaly Buka [Fri, 12 May 2023 02:35:12 +0000 (19:35 -0700)]
[LiveDebugValues] Temporarily initialize MLocTracker::CurBB

Looks like code assumes that it will be always set, but it's not true:
https://reviews.llvm.org/D150420. This is temporarily suppression to enabled
stricter msan on a bot.

14 months agoRevert "[SystemZ][z/OS] Save (and restore) R3 to avoid clobbering parameter when...
Neumann Hon [Fri, 12 May 2023 02:32:16 +0000 (22:32 -0400)]
Revert "[SystemZ][z/OS] Save (and restore) R3 to avoid clobbering parameter when call stack frame extension is invoked"

This reverts commit 1aec3d15aaa25c39fae026688708d7353d488974.

14 months ago[LoongArch] clang-format LoongArchISelLowering.cpp. NFC
Weining Lu [Fri, 12 May 2023 02:09:39 +0000 (10:09 +0800)]
[LoongArch] clang-format LoongArchISelLowering.cpp. NFC

14 months ago[NFC][LLLexer] Consistently initialize *Val fields
Vitaly Buka [Fri, 12 May 2023 02:07:29 +0000 (19:07 -0700)]
[NFC][LLLexer] Consistently initialize *Val fields

LLParser::parseInstruction speculatively getUIntVal()
but uses that only in some branches.

APFloatVal, TyVal and StrVal were already initialized, when
UIntVal and APSIntVal were not.

14 months ago[RISCV][NFC] Remove unused class defination.
Jianjian GUAN [Thu, 11 May 2023 09:30:30 +0000 (17:30 +0800)]
[RISCV][NFC] Remove unused class defination.

Reviewed By: craig.topper

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

14 months ago[NFC][xray] Initialize XRayFileHeader
Vitaly Buka [Fri, 12 May 2023 01:49:39 +0000 (18:49 -0700)]
[NFC][xray] Initialize XRayFileHeader

Avoids reports with msan -fno-inline.

14 months ago[CMake][fuzzer] Add riscv64 to fuzzer supported arch list
Eli Kobrin [Fri, 12 May 2023 01:33:44 +0000 (18:33 -0700)]
[CMake][fuzzer] Add riscv64 to fuzzer supported arch list

I tried to build libFuzzer for RISC-V and succeeded. All the libFuzzer
targets were successfully built. I tested this on the small hello world code
with a few branches to check the instrumentation; all of them were covered by
libFuzzer on RISC-V arch. So I suppose it makes sense to enable libFuzzer
build for RISC-V.

Reviewed By: phosek, thetruestblue, MaskRay

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

14 months ago[SystemZ][z/OS] Save (and restore) R3 to avoid clobbering parameter when call stack...
Neumann Hon [Fri, 12 May 2023 01:25:05 +0000 (21:25 -0400)]
[SystemZ][z/OS] Save (and restore) R3 to avoid clobbering parameter when call stack frame extension is invoked

When the stack frame extension routine is used, the contents of r3 is
overwritten. However, if r3 is live in the prologue (ie. one of the
function's parameters resides in r3), it needs to be saved. We save
r3 in r0 if r0 is available (ie. r0 is not used as temporary storage
for r4), and in the corresponding stack slot for the third parameter otherwise.

Reviewed By: uweigand

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

14 months ago[NFC] Refactor SuffixTree to use LLVM-style RTTI
Jessica Paquette [Thu, 11 May 2023 21:52:53 +0000 (14:52 -0700)]
[NFC] Refactor SuffixTree to use LLVM-style RTTI

Following guidelines in

https://llvm.org/docs/HowToSetUpLLVMStyleRTTI.html

This allows us to

* Quickly discern between leaf and internal nodes
* Be more idiomatic with the rest of LLVM
* Save some size on node structs
* Reduce the number of allocations (because end indices for internal nodes no
  longer need to be pointers to be compatible with leaf nodes)

Also object orientify the code some more. This allows for more asserts and
checks.

This shouldn't impact code size on the MachineOutliner.

- All unit tests pass (outliner lit + llvm-unit)
- No code size changes on CTMark @ -Oz for AArch64

14 months ago[gn] port c45ee7c0fba8
Nico Weber [Fri, 12 May 2023 00:31:52 +0000 (02:31 +0200)]
[gn] port c45ee7c0fba8

14 months agoDeclare _availability_version_check as weak_import instead of looking it
Akira Hatanaka [Fri, 12 May 2023 00:22:49 +0000 (17:22 -0700)]
Declare _availability_version_check as weak_import instead of looking it
up at runtime using dlsym

Calling dlsym with RTLD_DEFAULT can be very slow as all images in the
process are searched for the symbol.

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

14 months ago[NFC][AST] Return void from setUseQualifiedLookup
Vitaly Buka [Fri, 12 May 2023 00:11:49 +0000 (17:11 -0700)]
[NFC][AST] Return void from setUseQualifiedLookup

It uses to initialize the class. If so, it returns uninitalized value.
This is UB and msan with -fno-inline will complain.

14 months ago[RISCV] Fix crash if you use an immediate as part of a vtype operand list.
Craig Topper [Thu, 11 May 2023 23:49:55 +0000 (16:49 -0700)]
[RISCV] Fix crash if you use an immediate as part of a vtype operand list.

14 months ago[SelectionDAG] Correct AddNodeIDCustom for MemIntrinsicSDNodes.
Craig Topper [Thu, 11 May 2023 23:28:47 +0000 (16:28 -0700)]
[SelectionDAG] Correct AddNodeIDCustom for MemIntrinsicSDNodes.

We were missing any support for ISD::INTRINSIC_W_CHAIN/INTRINSIC_VOID
used for memory operations.

For ISD::PREFETCH and target memory nodes we didn't add the subclass
data.

This patch handles all MemIntrinsicSDNode in one place and adds the
missing subclass data.

Note. Unlike load/stores we don't add the memory VT in AddNodeIDCustom or getMemIntrinsicNode. Not sure why.

Reviewed By: efriedma

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

14 months ago[NFC][LSAN] Move ThreadCreate into child thread
Vitaly Buka [Mon, 8 May 2023 21:57:03 +0000 (14:57 -0700)]
[NFC][LSAN] Move ThreadCreate into child thread

14 months ago[HWASAN] Prevent crashes on thread exit
Vitaly Buka [Thu, 11 May 2023 17:30:20 +0000 (10:30 -0700)]
[HWASAN] Prevent crashes on thread exit

I can't figure out how to reproduce this for test, but I see the case on
random binaries.

The known issue is with GLIBC, others may have a workaround, e.g. Bionic,
https://cs.android.com/android/platform/superproject/+/master:bionic/libc/bionic/pthread_exit.cpp;l=149
see signals blocked above.

Reviewed By: eugenis

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

14 months ago[LSAN] Use ThreadArgRetval in LSAN
Vitaly Buka [Mon, 8 May 2023 19:42:50 +0000 (12:42 -0700)]
[LSAN] Use ThreadArgRetval in LSAN

Fixes false leaks on thread retval.

Reviewed By: thurston

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

14 months ago[IPO] Opt-in local clones for thinlto imports
Mircea Trofin [Mon, 8 May 2023 22:31:27 +0000 (15:31 -0700)]
[IPO] Opt-in local clones for thinlto imports

ThinLTO imports (which appear as `available_externally`) that survive
inlining get deleted. With today's inliner that's reasonable, because
the way the function would be inlined into in other modules would be the
same - because of the bottom-up traversal assumption, and the fact that
the inliner doesn't take into account surrounding context [*]. The
ModuleInliner invalidates the first assumption, and the ML inliner the
second.

This patch adds a way to opt-in a module to keep its variant of an
imported function, even if it survived past inlining.

[*] Almost. Deferred inlining is an exception which can lead to
(empirically) infrequent discrepancies.

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

14 months ago[ASAN] Use ThreadArgRetval in ASAN
Vitaly Buka [Mon, 8 May 2023 07:50:26 +0000 (00:50 -0700)]
[ASAN] Use ThreadArgRetval in ASAN

Fixes false leaks on thread retval.

Reviewed By: thurston

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

14 months ago[bazel] fix bazel
Peiming Liu [Thu, 11 May 2023 22:31:09 +0000 (22:31 +0000)]
[bazel] fix bazel

Reviewed By: wrengr

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

14 months ago[ADT][NFC] Fix compilation of headers under C++23
Adrian Vogelsgesang [Thu, 4 May 2023 12:20:29 +0000 (12:20 +0000)]
[ADT][NFC] Fix compilation of headers under C++23

`DoubleAPFloat` has a `unique_ptr<APFloat[]>` member. In
`DoubleAPFloat::operator=` and `DoubleAPFloat::get{First,Second}`,
the methods of this unique_ptr are getting instantiated. At that
point `APFloat` is still only a forward declaration.

This triggers undefined behavior. So far, we were probaly just
lucky and the code compiled fine. However, with C++23
`std::unique_ptr` became constexpr, and clang (and other compilers) are
now diagnosing this latent bug as an error.

This commit fixes the issue by moving the function definitions
out of the class definition of `DoubleAPFloat`, after the declaration
of `APFloat`.

A similar issue exists in `ModuleSummaryIndex.h`, the fix is pretty
much identical.

Fixes #59784

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

14 months ago[flang][openacc][NFC] Update _OPENACC definition to 202011
Valentin Clement [Thu, 11 May 2023 22:14:46 +0000 (15:14 -0700)]
[flang][openacc][NFC] Update _OPENACC definition to 202011

Update _OPENACC definition to be consistent with the flang-new
driver. Currently set to 202011 which is OpenACC 3.1 specification and
is the current parser/semantic status.

Reviewed By: razvanlupusoru

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

14 months ago[HWSAN] Use ThreadArgRetval in HWSAN
Vitaly Buka [Mon, 8 May 2023 23:18:32 +0000 (16:18 -0700)]
[HWSAN] Use ThreadArgRetval in HWSAN

Fixes false leaks on thread arg, retval.

Reviewed By: Enna1

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

14 months ago[mlir][spirv] Support sub-byte integer types in type conversion
Lei Zhang [Thu, 11 May 2023 22:13:19 +0000 (22:13 +0000)]
[mlir][spirv] Support sub-byte integer types in type conversion

Typically GPUs cannot access memory in sub-byte manner. So for
sub-byte integer type values, we need to either expand them to
full bytes or tightly pack them. This commit adds support for
tightly packed power-of-two sub-byte types.

Sub-byte types aren't allowed in SPIR-V spec, so there are no
compute/storage capability for them like other supported integer
types. So we don't recognize sub-byte types in `spirv::ScalarType`.
We just special case them in type converter and always convert
to use i32 under the hood.

Reviewed By: kuhar

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

14 months ago[flang][hlfir] Fixed invalid fir.convert generated by AssociateOp codegen.
Slava Zakharin [Thu, 11 May 2023 18:54:51 +0000 (11:54 -0700)]
[flang][hlfir] Fixed invalid fir.convert generated by AssociateOp codegen.
Differential Revision: https://reviews.llvm.org/D150393

14 months ago[mlir][openacc] Add host_data operation
Valentin Clement [Thu, 11 May 2023 21:53:19 +0000 (14:53 -0700)]
[mlir][openacc] Add host_data operation

The acc.host_data operation models the OpenACC
host_data construct (2.8). The host_data construct
defines a region where the address of data in device memory
available on the host. The operation is modeled in a similar way
than acc.data operation.

Reviewed By: razvanlupusoru, jeanPerier

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

14 months ago[flang] Inline array size call when dim is compile time constant
Razvan Lupusoru [Thu, 11 May 2023 17:42:37 +0000 (10:42 -0700)]
[flang] Inline array size call when dim is compile time constant

Instead of calling _FortranASizeDim, we can instead load extent
directly from descriptor. Add this support for cases where dim
is a known constant at compile time.

Reviewed By: clementval

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

14 months agoWe can't let GetStackFrameCount get interrupted or it will give the
Jim Ingham [Thu, 11 May 2023 00:48:48 +0000 (17:48 -0700)]
We can't let GetStackFrameCount get interrupted or it will give the
wrong answer. Plus, it's useful in some places to have a way to force
the full stack to be created even in the face of
interruption. Moreover, most of the time when you're just getting
frames, you don't need to know the number of frames in the stack to
start with. You just keep calling
Thread::GetStackFrameAtIndex(index++) and when you get a null
StackFrameSP back, you're done. That's also more amenable to
interruption if you are doing some work frame by frame.

So this patch makes GetStackFrameCount always return the full count,
suspending interruption. I also went through all the places that use
GetStackFrameCount to make sure that they really needed the full stack
walk. In many cases, they did not. For instance frame select -r 10 was
getting the number of frames just to check whether cur_frame_idx + 10
was within the stack. It's better in that case to see if that frame
exists first, since that doesn't force a full stack walk, and only
deal with walking off the end of the stack if it doesn't...

I also added a test for some of these behaviors.

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

14 months ago[NFC][sanitizer] Add class to track thread arg and retval
Vitaly Buka [Mon, 8 May 2023 07:10:03 +0000 (00:10 -0700)]
[NFC][sanitizer] Add class to track thread arg and retval

We need something to keep arg and retval pointers for leak checking.
Pointers should keept alive even after thread exited, until the thread
is detached or joined.
We should not put this logic into ThreadRegistry as we need the the
same for the ThreadList of HWASAN.

Reviewed By: thurston

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

14 months ago[gn build] Port 8e2d09c33938
LLVM GN Syncbot [Thu, 11 May 2023 21:33:57 +0000 (21:33 +0000)]
[gn build] Port 8e2d09c33938

14 months ago[NFC][sanitizers] Extract BlockSignals function
Vitaly Buka [Thu, 11 May 2023 17:13:08 +0000 (10:13 -0700)]
[NFC][sanitizers] Extract BlockSignals function

14 months ago[MLIR] Add InferShapedTypeOpInterface bindings
Arash Taheri-Dezfouli [Thu, 11 May 2023 19:29:16 +0000 (14:29 -0500)]
[MLIR] Add InferShapedTypeOpInterface bindings

Add C and python bindings for InferShapedTypeOpInterface
and ShapedTypeComponents. This allows users to invoke
InferShapedTypeOpInterface for ops that implement it.

Reviewed By: ftynse

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

14 months agoRemove outdated sentence in SourceBasedCodeCoverage.rst
Zequan Wu [Thu, 11 May 2023 21:16:16 +0000 (17:16 -0400)]
Remove outdated sentence in SourceBasedCodeCoverage.rst

https://reviews.llvm.org/rGc5b94ea265133a4a28006929643155fc8fbeafe6 allows N >= 10.

14 months ago[VPlan] Remove dangling comment and newlines (NFC).
Florian Hahn [Thu, 11 May 2023 21:04:56 +0000 (22:04 +0100)]
[VPlan] Remove dangling comment and newlines (NFC).

Apply missed cleanups.

14 months ago[mlir][spirv] NFC: Clean up MemRefToSPIRV tests with CSE
Lei Zhang [Thu, 11 May 2023 20:59:25 +0000 (20:59 +0000)]
[mlir][spirv] NFC: Clean up MemRefToSPIRV tests with CSE

Reviewed By: kuhar

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

14 months ago[Clang] Respect `-L` options when compiling directly for AMDGPU
Joseph Huber [Sat, 6 May 2023 01:50:49 +0000 (20:50 -0500)]
[Clang] Respect `-L` options when compiling directly for AMDGPU

The AMDGPU linker is `lld`, which has full support for standard features
like static libraries. Previously the AMDGPU toolchain did not forward
`-L` arguments so we could not tell it where to find certain libraries.
This patch simply forwards it like the other toolchains.

Reviewed By: yaxunl, MaskRay

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

14 months ago[LV] Reuse SCEV expansion results for epilogue vectorization.
Florian Hahn [Thu, 11 May 2023 21:00:06 +0000 (22:00 +0100)]
[LV] Reuse SCEV expansion results for epilogue vectorization.

When generating code for the epilogue vector loop, we need to re-use the
expansion results for induction steps generated for the main vector
loop, as the pre-header of the epilogue vector loop may not dominate the
vector preheader of the epilogue.

This fixes a reported crash. Note that this is a workaround which should
be removed soon once induction resume value creation is handled in VPlan
directly.

14 months ago[mlir][spirv] Remove duplicated tests in MemRefToSPIRV conversions
Lei Zhang [Thu, 11 May 2023 20:42:55 +0000 (20:42 +0000)]
[mlir][spirv] Remove duplicated tests in MemRefToSPIRV conversions

Reviewed By: kuhar

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

14 months ago[libc++][PSTL] Add more specialized backend customization points
Louis Dionne [Tue, 9 May 2023 14:54:59 +0000 (07:54 -0700)]
[libc++][PSTL] Add more specialized backend customization points

This allows backends to customize arbitrary parallel algorithms, which was requested pretty often.

Reviewed By: #libc, ldionne

Spies: arichardson, miyuki, crtrott, dalg24, __simt__, philnik, libcxx-commits

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

14 months ago[RISCV] RISCVELFTargetObjectFile: use 2-byte alignment for .text if RVC
Fangrui Song [Thu, 11 May 2023 20:44:37 +0000 (13:44 -0700)]
[RISCV] RISCVELFTargetObjectFile: use 2-byte alignment for .text if RVC

For the "C" Standard Extension/Zca, D45560 enabled 2-byte alignment for
assembly output (e.g. `clang -S a.c`) and D102052 enabled 2-byte alignment for
assembly input and object file output (e.g. `clang -c a.s`).

This patch ports the behavior for code generation and object file output by
adding RISCVELFTargetObjectFile::getTextSectionAlignment (e.g. `clang -c a.c`).

Reviewed By: craig.topper

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

14 months ago[ObjC][ARC] Fix non-deterministic behavior in ProvenanceAnalysis
Akira Hatanaka [Thu, 11 May 2023 20:40:43 +0000 (13:40 -0700)]
[ObjC][ARC] Fix non-deterministic behavior in ProvenanceAnalysis

Stop reordering the pointers passed in ProvenanceAnalysis::related based
on their values. That was causing non-determinism as the call to
relatedCheck(A, B) isn't guaranteed to return the same result as
relatedCheck(B, A).

Revert the following three commits (except the original test case in
related-check.ll):

665e47777df17db406c698d57b4f3c28d67c432e
295861514e0d1e48df2918b630dd692ac27ee0de
d877e3fe71676b0ff10410d80456b35cdd5bf796

These changes shouldn't be necessary once the call to std::swap is
removed.

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

14 months agoRelax test to not rely on the variable being optimized out
Adrian Prantl [Thu, 11 May 2023 20:37:30 +0000 (13:37 -0700)]
Relax test to not rely on the variable being optimized out

14 months ago[lldb] Correct elision of line zero in mixed disassembly
Dave Lee [Thu, 11 May 2023 17:04:55 +0000 (10:04 -0700)]
[lldb] Correct elision of line zero in mixed disassembly

When `disassemble --mixed` is run, do not show source for line zero, as intended.

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

14 months ago[lldb-vscode] Fix handling of RestartRequest arguments.
Jorge Gorbe Moya [Thu, 11 May 2023 19:06:32 +0000 (12:06 -0700)]
[lldb-vscode] Fix handling of RestartRequest arguments.

According to the spec, RestartRequest has an optional "arguments" field, which
is a RestartArguments object. RestartArguments has its own optional "arguments"
field, which is a (LaunchRequestArguments | AttachRequestArguments) object. So
we need to to the "arguments" lookup twice to get to the actual launch
arguments.

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

14 months ago[bazel][NFC] Add missing dep after 5ac48ef51393e6d8392182ad439a22002571d554
Jordan Rupprecht [Thu, 11 May 2023 19:40:51 +0000 (12:40 -0700)]
[bazel][NFC] Add missing dep after 5ac48ef51393e6d8392182ad439a22002571d554

14 months ago[AArch64] Update Changed status in AArch64MIPeepholeOpt
David Green [Thu, 11 May 2023 18:55:44 +0000 (19:55 +0100)]
[AArch64] Update Changed status in AArch64MIPeepholeOpt

I have not seen this be a problem, but the Changed status should be updated not
reset on new instruction to get the total Changed status overall.

14 months ago[clang] Document extensions from later standards
Nikolas Klauser [Wed, 10 May 2023 22:40:22 +0000 (15:40 -0700)]
[clang] Document extensions from later standards

Reviewed By: aaron.ballman

Spies: H-G-Hristov, cfe-commits

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

14 months ago[BOLT] Fix flush pending relocs
Rafael Auler [Thu, 11 May 2023 00:56:43 +0000 (17:56 -0700)]
[BOLT] Fix flush pending relocs

https://github.com/facebookincubator/BOLT/pull/255 accidentally
omitted a relocation type when refactoring the code. Add this type back
and change function name so its intent is more clear.

Reviewed By: #bolt, Amir

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

14 months ago[LAA] Simplify identification of speculatable strides [nfc]
Philip Reames [Thu, 11 May 2023 18:44:53 +0000 (11:44 -0700)]
[LAA] Simplify identification of speculatable strides [nfc]

Mostly just avoiding the need to keep both Value and SCEVs flowing through with consistent handling.  We can do everything in terms of SCEV - aside from the profitability heuristics which are now isolated in one spot.

14 months ago[ShrinkWrap] Allow shrinkwrapping past memory accesses to jump tables
Jonathon Penix [Thu, 4 May 2023 18:35:24 +0000 (11:35 -0700)]
[ShrinkWrap] Allow shrinkwrapping past memory accesses to jump tables

This patch adds a check for whether the memory operand is known to be
a jump table and, if so, allows shrinkwrapping to continue. In the
case that we are looking at a jump table, I believe it is safe to
assume that the access will not be to the stack (but please correct me
if I am wrong here).

In the test attached, this is helpful in that we are able to generate
only one instruction for each non-default case in the original switch
statement.

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

14 months ago[Propeller] Use a bit-field struct for the metdata fields of BBEntry.
Rahman Lavaee [Thu, 11 May 2023 18:15:12 +0000 (11:15 -0700)]
[Propeller] Use a bit-field struct for the metdata fields of BBEntry.

This patch encapsulates the encoding and decoding logic of basic block metadata into the Metadata struct, and also reduces the decoded size of `SHT_LLVM_BB_ADDR_MAP` section.

The patch would've looked more readable if we could use designated initializer, but that is a c++20 feature.

Reviewed By: jhenderson

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

14 months ago[LV/LAA] Use PSE to identify stride multiplies which simplify [mostly nfc]
Philip Reames [Thu, 11 May 2023 17:55:15 +0000 (10:55 -0700)]
[LV/LAA] Use PSE to identify stride multiplies which simplify [mostly nfc]

LV/LAA will speculate that (some) strided access patterns have unit stride, and insert runtime checks if required.

LV cost models a multiply by such a stride as free.  We did this by keeping around the StrideSet structure, just to check if one of the operands were one of the strides we speculated.

We can instead just ask PredicatedScalarEvolution if either of the operands are one (after predicates are applied).  We get mostly the same result - PSE can prove it in more cases in theory - and simpler code.

14 months ago[mlgo] Fix reference files / values post - D140975
Mircea Trofin [Thu, 11 May 2023 17:59:28 +0000 (10:59 -0700)]
[mlgo] Fix reference files / values post - D140975

14 months ago[libc] Fix undeclared 'free' function in stream test
Joseph Huber [Thu, 11 May 2023 17:46:37 +0000 (12:46 -0500)]
[libc] Fix undeclared 'free' function in stream test

Summary:
We need this function from the test.cpp but need to declare it manually.

14 months ago[mlir][Linalg] Add support for lowerPack on dynamic outer shapes.
Hanhan Wang [Mon, 1 May 2023 18:23:02 +0000 (11:23 -0700)]
[mlir][Linalg] Add support for lowerPack on dynamic outer shapes.

The revision adds support for tensor.pack op decomposition when all
inner tile sizes are static. The generated tensor.expand_shape op is
still valid because only one of the expanding dimension is dynamic.

Reviewed By: mravishankar

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

14 months ago[mlir][sparse] add util for ToCoordinatesBuffer for COO AoS
Aart Bik [Thu, 11 May 2023 17:05:16 +0000 (10:05 -0700)]
[mlir][sparse] add util for ToCoordinatesBuffer for COO AoS

Reviewed By: Peiming

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

14 months ago[mlir][flang][openacc] Remove obsolete operand legalization passes
Valentin Clement [Thu, 11 May 2023 17:24:22 +0000 (10:24 -0700)]
[mlir][flang][openacc] Remove obsolete operand legalization passes

The information needed for translation is now encoded in the dialect
operations and does not require a dedicated pass to be extracted.
Remove the obsolete passes that were performing operand legalization.

Reviewed By: jeanPerier

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

14 months ago[LAA/LV] Simplify stride speculation logic [NFC] (try 2)
Philip Reames [Thu, 11 May 2023 16:47:37 +0000 (09:47 -0700)]
[LAA/LV] Simplify stride speculation logic [NFC] (try 2)

The original commit wasn't quite NFC, and this was caught by an arguably overly strong assert.  Specifically, I'd failed to strip off the integer cast off the SCEV before saving it in the map.  The result - other than a failed assert - is that we'd speculate on the casted unknown, not the unknown.  The only case I can think of where that might change behavior would be a sext(i1 load).  I doubt that case is interesting in practice, but it's good to be strictly NFC on this change regardless.

Original commit message follows..

The existing code makes it hard to tell that collectStridedAccess is really about identifying some loop invariant SCEV which is *profitable* to speculate is equal to one. The odd dual usage structure of Value and SCEV confuses this point.

We could choose to loosen the profitability analysis if desired. I'm not proposing doing so at this time as it exposes too many cases where the speculation is unprofitable.

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

14 months ago[libc] Implement a generic streaming interface in the RPC
Joseph Huber [Thu, 11 May 2023 16:11:24 +0000 (11:11 -0500)]
[libc] Implement a generic streaming interface in the RPC

Currently we provide the `send_n` and `recv_n` functions. These were
somewhat divergent and not tested on the GPU. This patch changes the
support to be more common. We do this my making the CPU provide an array
equal the to at least the lane size while the GPU can rely on the
private memory address of its stack variables. This allows us to send
data back and forth generically.

Reviewed By: JonChesterfield

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

14 months agoRevert "[LAA/LV] Simplify stride speculation logic [NFC]"
Philip Reames [Thu, 11 May 2023 16:25:45 +0000 (09:25 -0700)]
Revert "[LAA/LV] Simplify stride speculation logic [NFC]"

This reverts commit d5b840131223f2ffef4e48ca769ad1eb7bb1869a.  Running this through broader testing after rebasing is revealing a crash.  Reverting while I investigate.

14 months ago[WPD] Update llvm.public.type.test after importing functions
Teresa Johnson [Wed, 10 May 2023 23:05:41 +0000 (16:05 -0700)]
[WPD] Update llvm.public.type.test after importing functions

I noticed that we are converting llvm.public.type.test to regular
llvm.type.test too early, and thus not updating those in imported
functions. This would result in losing out on WPD opportunities. Move
the update to after function importing, and improve test to cover this
case.

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

14 months ago[LV] Use VPValue to get expanded value for SCEV step expressions.
Florian Hahn [Thu, 11 May 2023 15:49:18 +0000 (16:49 +0100)]
[LV] Use VPValue to get expanded value for SCEV step expressions.

Update skeleton creation logic to use SCEV expansion results from
expanding the pre-header. This avoids another set of SCEV expansions
that may happen after the CFG has been modified.

Fixes #58811.

Depends on D147964.

Reviewed By: Ayal

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

14 months ago[flang][hlfir] Establish <storage, mustFree> tuple for ApplyOp and NoReassocOp.
Slava Zakharin [Thu, 11 May 2023 04:41:14 +0000 (21:41 -0700)]
[flang][hlfir] Establish <storage, mustFree> tuple for ApplyOp and NoReassocOp.

The bufferization pass must create the tuple for these operations, because
the users may require it. For example, in case of ElementalOp inlining
a DestroyOp may be generated for the operand of YieldElementOp, and
the operand may be ApplyOp->NoReassocOp chain.

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

14 months ago[LAA/LV] Simplify stride speculation logic [NFC]
Philip Reames [Thu, 11 May 2023 15:10:49 +0000 (08:10 -0700)]
[LAA/LV] Simplify stride speculation logic [NFC]

The existing code makes it hard to tell that collectStridedAccess is really about identifying some loop invariant SCEV which is *profitable* to speculate is equal to one. The odd dual usage structure of Value and SCEV confuses this point.

We could choose to loosen the profitability analysis if desired. I'm not proposing doing so at this time as it exposes too many cases where the speculation is unprofitable.

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

14 months ago[flang] Use internal linkage for string literals
David Truby [Thu, 11 May 2023 13:47:31 +0000 (14:47 +0100)]
[flang] Use internal linkage for string literals

On Windows, global string literals with "linkonce" linkage is not
supported without using comdat. As a simpler fix than adding comdat
support we can use internal linkage instead.

This fixes a bug where two string literals with the same value in
different fortran files would cause a linker error due to the use
of linkonce linkage.

Reviewed By: jeanPerier

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

14 months agollvm/lib: Use <cerrno> explicitly since D146395 has hidden `errno`
NAKAMURA Takumi [Sat, 29 Apr 2023 07:25:06 +0000 (16:25 +0900)]
llvm/lib: Use <cerrno> explicitly since D146395 has hidden `errno`

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