platform/upstream/llvm.git
15 months ago[CostModel][X86] Add BITREVERSE cost model estimations
Simon Pilgrim [Mon, 17 Apr 2023 21:23:29 +0000 (22:23 +0100)]
[CostModel][X86] Add BITREVERSE cost model estimations

Use a modified version of the D103695 script to determine more accurate throughput/latency/codesize/size-latency cost estimates

15 months ago[InstCombine] Don't reassociate GEPs for loop invariance
Nikita Popov [Tue, 11 Apr 2023 08:46:20 +0000 (10:46 +0200)]
[InstCombine] Don't reassociate GEPs for loop invariance

Since D146813, LICM will reassociate GEPs to expose hoisting
opportunities itself. Don't perform this transform in InstCombine,
where it is fragile because it depends on an optional LoopInfo
analysis.

15 months ago[clang] Return std::unique_ptr<TargetInfo> from AllocateTarget
Stoorx [Tue, 18 Apr 2023 09:54:40 +0000 (09:54 +0000)]
[clang] Return std::unique_ptr<TargetInfo> from AllocateTarget

In file 'clang/lib/Basic/Targets.cpp' the function 'AllocateTarget' had a raw pointer as a return type, which have been wrapped in the 'std::unique_ptr' in all usages.
This commit changes the signature of the function to return an instance of 'std::unique_ptr' directly.

Reviewed By: DavidSpickett

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

15 months ago[mlir][llvm] Handle invoke op branching to block with its result as an argument
Victor Perez [Fri, 14 Apr 2023 08:54:38 +0000 (09:54 +0100)]
[mlir][llvm] Handle invoke op branching to block with its result as an argument

In LLVM, having an invoke instruction branching to a block with a phi
node receiving the invoke instruction result as an argument is
perfectly legal. However, the translation of this construct to MLIR
would result in an invoke with its result being used as a block
argument to a successor, i.e., the operation result would be used in
its definition.

In order to fix this issue due to different IR structures (phi nodes
vs block arguments), this construct is interpreted with an llvm.invoke
operation branching to a dummy block having a single llvm.br operation
passing the required block arguments (including the result of the
llvm.invoke operation) to the actual successor block.

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

15 months ago[LV] Regenerate test checks (NFC)
Nikita Popov [Tue, 18 Apr 2023 09:52:12 +0000 (11:52 +0200)]
[LV] Regenerate test checks (NFC)

15 months agoFix uninitialized pointer members in MC
Akshay Khadse [Tue, 18 Apr 2023 09:32:18 +0000 (17:32 +0800)]
Fix uninitialized pointer members in MC

Reviewed By: LuoYuanke

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

15 months ago[llvm-opt-fuzzer] Skip creating/initializing legacy PM passes
Bjorn Pettersson [Fri, 14 Apr 2023 21:41:07 +0000 (23:41 +0200)]
[llvm-opt-fuzzer] Skip creating/initializing legacy PM passes

Afaict llvm-opt-fuzzer is using the new pass manager. So there
shouldn't be a need to create/initialize/register the legacy PM
version of passes.

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

15 months agoRecommit "[VPlan] Unify Value2VPValue and VPExternalDefs maps (NFCI)."
Florian Hahn [Tue, 18 Apr 2023 09:29:17 +0000 (10:29 +0100)]
Recommit "[VPlan] Unify Value2VPValue and VPExternalDefs maps (NFCI)."

This reverts the revert commit 8c2276f89887d0a27298a1bbbd2181fa54bbb509.

The updated patch re-orders the getDefiningRecipe check in getVPalue to avoid
a use-after-free.

Original commit message:

    Before this patch, a VPlan contained 2 mappings for Values -> VPValue:
    1) Value2VPValue and 2) VPExternalDefs.

    This duplication is unnecessary and there are already cases where
    external defs are added to Value2VPValue. This patch replaces all uses
    of VPExternalDefs with Value2VPValue.

    It clarifies the naming of getOrAddVPValue (to getOrAddExternalVPValue)
    and addVPValue (to addExternalVPValue).

    At the moment, this is NFC, but will enable additional simplifications
    in D147783.

    Depends on D147891.

    Reviewed By: Ayal

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

15 months ago[LV][AArch64] Autogenerate checks for scalable-strict-fadd.ll (NFC)
Graham Hunter [Tue, 18 Apr 2023 08:59:15 +0000 (09:59 +0100)]
[LV][AArch64] Autogenerate checks for scalable-strict-fadd.ll (NFC)

Precommit for D145163.

15 months ago[clang-format] C# short ternary operator misinterpreted as a CSharpNullable
mydeveloperday [Tue, 18 Apr 2023 09:17:28 +0000 (10:17 +0100)]
[clang-format] C# short ternary operator misinterpreted as a CSharpNullable

Refactor the CSharpNullable assignment code to be a little easier to read (Honestly I don't like it when an if expression get really long and complicated).
Handle the case where '?' is actually a ternary operator.

Fixes: #58067

Reviewed By: owenpan, HazardyKnusperkeks

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

15 months agoAdd loop-versioning pass to improve unit-stride
Mats Petersson [Fri, 16 Dec 2022 18:52:28 +0000 (18:52 +0000)]
Add loop-versioning pass to improve unit-stride

Introduce conditional code to identify stride of "one element", and simplify the array accesses for that case.

This allows better loop performance in various benchmarks.

Reviewed By: tblah, kiranchandramohan

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

15 months ago[RISCV][NFC] Fix comment in RISCVISAInfo after f98ca363bed
Alex Bradbury [Tue, 18 Apr 2023 08:50:53 +0000 (09:50 +0100)]
[RISCV][NFC] Fix comment in RISCVISAInfo after f98ca363bed

My fault for missing this in initial review -
f98ca363bed7405a23ad4b77167e39505a1ca9dd didn't properly update the
comment to reflect the change.

15 months agoAdd -f[no-]loop-versioning option
Mats Petersson [Mon, 9 Jan 2023 15:30:29 +0000 (15:30 +0000)]
Add -f[no-]loop-versioning option

Add flags for loop-versioning pass enable/disable

Reviewed By: awarzynski, tblah

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

15 months ago[MachineCSE] Add a test with mutiple blocks between instructions.
Serguei Katkov [Tue, 18 Apr 2023 07:55:31 +0000 (14:55 +0700)]
[MachineCSE] Add a test with mutiple blocks between instructions.

Due to limitation that we consider only one alone predecessor
we cannot generate the code like
ucomiss
jp
ja
jne

15 months ago[mlir][Arith] Fix Windows build
Matthias Springer [Tue, 18 Apr 2023 08:29:19 +0000 (17:29 +0900)]
[mlir][Arith] Fix Windows build

15 months ago[RISCV][test] Add test for RISCVISAInfo::OrderedExtensionMap ordering
Alex Bradbury [Tue, 18 Apr 2023 08:20:36 +0000 (09:20 +0100)]
[RISCV][test] Add test for RISCVISAInfo::OrderedExtensionMap ordering

15 months ago[llvm] Remove llvm-compilers-check script
David Spickett [Mon, 17 Apr 2023 13:08:04 +0000 (13:08 +0000)]
[llvm] Remove llvm-compilers-check script

I do not know of anyone currently using this and could not
find any uses over in llvm-zorg.

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

15 months ago[TableGen] Const-correct TreePatternNode::getChild. NFC
Craig Topper [Tue, 18 Apr 2023 08:19:29 +0000 (01:19 -0700)]
[TableGen] Const-correct TreePatternNode::getChild. NFC

Make the const version return a const TreePatterNode* and add a non-const
version to return a non-const TreePatternNode*.

15 months ago[RISCV] Modify arch string parsing order according to latest riscv spec
Jun Sha (Joshua) [Tue, 18 Apr 2023 08:20:08 +0000 (16:20 +0800)]
[RISCV] Modify arch string parsing order according to latest riscv spec

According to latest risc-v spec, the canonical order in which extension names must appear in the name string specified in Table 29.1 is different from before. In the latest table, non-standard extensions must be listed after all standard extensions. To keep consistent, we now change the parsing order in parseArchString().

Reviewed By: asb

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

15 months ago[lldb] Use llvm::byteswap in DumpRegisterValue
David Spickett [Tue, 18 Apr 2023 08:15:50 +0000 (08:15 +0000)]
[lldb] Use llvm::byteswap in DumpRegisterValue

7978abd5aef1ba84d7a1cefbc3443245acff2c48 fixed a build issue
on MSVC with some code I previously added, by adding some
ifdefs.

Now I realise that I should have been using llvm::byteswap
in the first place, which does exactly that.

15 months ago[mlir][llvm] Fix for MemRefBuilder when using opaque pointers.
Stephan Herhut [Mon, 17 Apr 2023 16:29:27 +0000 (18:29 +0200)]
[mlir][llvm] Fix for MemRefBuilder when using opaque pointers.

Loading the offset of an unranked memref descriptor is creating an invalid load.

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

15 months ago[include-cleaner] Unify behaviour for static & instance members
Kadir Cetinkaya [Mon, 17 Apr 2023 18:25:25 +0000 (20:25 +0200)]
[include-cleaner] Unify behaviour for static & instance members

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

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

15 months ago[mlir][Arith] ValueBoundsOpInterface: Reify with Arith ops
Matthias Springer [Tue, 18 Apr 2023 07:44:44 +0000 (16:44 +0900)]
[mlir][Arith] ValueBoundsOpInterface: Reify with Arith ops

This revision adds an additional `reifyValueBounds` helper that reifies the IR with Arith ops instead of Affine ops. This is needed to support value bounds for integer types different from `index` in a subsequent revision.

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

15 months ago[test] Remove occurences of br undef in CodeGen/AMDGPU tests
Kriti Gupta [Tue, 18 Apr 2023 07:46:54 +0000 (08:46 +0100)]
[test] Remove occurences of br undef in CodeGen/AMDGPU tests

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

15 months ago[Assignment Tracking] Skip empty-metadata dbg.declares in AssignmentTrackingPass
OCHyams [Tue, 18 Apr 2023 07:11:31 +0000 (08:11 +0100)]
[Assignment Tracking] Skip empty-metadata dbg.declares in AssignmentTrackingPass

Debug intrinsics sometimes end up with empty metadata location operands. The
debug intrinsic interfaces return nullptr when retrieving location operand in
this case.

Skip empty-metadata dbg.declares to avoid dereferencing the nullptr. This
doesn't affect the final debug info in any way.

Reviewed By: jryans

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

15 months ago[Assignment Tracking][SelectionDAG] Fix dbg.declare location nullptr deref
OCHyams [Tue, 18 Apr 2023 07:05:12 +0000 (08:05 +0100)]
[Assignment Tracking][SelectionDAG] Fix dbg.declare location nullptr deref

Debug intrinsics sometimes end up with empty metadata location operands. The
debug intrinsic interfaces return nullptr when retrieving location operand in
this case.

When assignment tracking is not enabled a dbg.declare with a nullptr location
operand is skipped. Do the same when assignment tracking is enabled (a nullptr
address component of a dbg.assign is already handled correctly.

Reviewed By: jmorse

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

15 months ago[mlir][affine][NFC] Split `reifyValueBound` in two functions
Matthias Springer [Tue, 18 Apr 2023 07:27:02 +0000 (16:27 +0900)]
[mlir][affine][NFC] Split `reifyValueBound` in two functions

There are now two entry points. One for shaped values and one for index-typed values. This addresses a comment in D146524.

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

15 months ago[TableGen] Call std::vector::reserve to preallocate memory before a loop of push_back...
Craig Topper [Tue, 18 Apr 2023 07:16:36 +0000 (00:16 -0700)]
[TableGen] Call std::vector::reserve to preallocate memory before a loop of push_back. NFC

15 months agoAdd assert to avoid unexpected situation
Wang, Xin10 [Tue, 18 Apr 2023 06:49:18 +0000 (02:49 -0400)]
Add assert to avoid unexpected situation

In line 68, func getBlockFreqRelativeToEntryBlock assume getEntryFreq() is
non-zero, but the function could return 0, add assert to confirm it.

Reviewed By: HaohaiWen

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

15 months ago[clang][dataflow] Associate `FunctionToPointerDecay` nodes with a value.
Martin Braenne [Tue, 18 Apr 2023 04:49:38 +0000 (04:49 +0000)]
[clang][dataflow] Associate `FunctionToPointerDecay` nodes with a value.

To ensure that we have a pointee for the `PointerValue`, we also create
storage locations for `FunctionDecl`s referenced in the function under analysis.

Reviewed By: gribozavr2

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

15 months agoRevert "[InstCombine] Add transforms for `(icmp {u|s}ge/le (xor X, Y), X)`"
Noah Goldstein [Tue, 18 Apr 2023 06:23:40 +0000 (01:23 -0500)]
Revert "[InstCombine] Add transforms for `(icmp {u|s}ge/le (xor X, Y), X)`"

May be related to PR62175

This reverts commit a3fd060d4223c6a7470554561bc479d4b8e423f4.

15 months agoRevert "[ValueTracking] Apply the isKnownNonZero techniques in `ashr`/`lshl` to ...
Noah Goldstein [Tue, 18 Apr 2023 06:23:08 +0000 (01:23 -0500)]
Revert "[ValueTracking] Apply the isKnownNonZero techniques in `ashr`/`lshl` to `shl` and vice-versa"

May be related to PR62175

This reverts commit 57590d1dd47bbe9aa4b79a0f93cc3ec62cc5d060.

15 months ago[Test] Add test showing that we can infer nsw
Max Kazantsev [Tue, 18 Apr 2023 06:17:45 +0000 (13:17 +0700)]
[Test] Add test showing that we can infer nsw

15 months ago[clang][dataflow] Add support for new expressions.
Martin Braenne [Tue, 18 Apr 2023 03:42:24 +0000 (03:42 +0000)]
[clang][dataflow] Add support for new expressions.

Reviewed By: xazax.hun, gribozavr2

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

15 months ago[InstCombine] Add transforms for `(icmp {u|s}ge/le (xor X, Y), X)`
Noah Goldstein [Tue, 18 Apr 2023 00:49:27 +0000 (19:49 -0500)]
[InstCombine] Add transforms for `(icmp {u|s}ge/le (xor X, Y), X)`

If Y is non-zero we can simplify the ge/le -> gt/lt

`(X ^ Y_NonZero) u>= X` --> `(X ^ Y_NonZero) u> X`
    - https://alive2.llvm.org/ce/z/k482NQ
`(X ^ Y_NonZero) u<= X` --> `(X ^ Y_NonZero) u< X`
    - https://alive2.llvm.org/ce/z/TuUDGy
`(X ^ Y_NonZero) s>= X` --> `(X ^ Y_NonZero) s> X`
    - https://alive2.llvm.org/ce/z/vXQypR
`(X ^ Y_NonZero) s<= X` --> `(X ^ Y_NonZero) s< X    `
    - https://alive2.llvm.org/ce/z/fbUq-z

Reviewed By: spatel

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

15 months ago[InstCombine] Add tests for transforming `(icmp (xor X, Y), X)`; NFC
Noah Goldstein [Thu, 23 Feb 2023 00:37:46 +0000 (18:37 -0600)]
[InstCombine] Add tests for transforming `(icmp (xor X, Y), X)`; NFC

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

15 months ago[ValueTracking] Apply the isKnownNonZero techniques in `ashr`/`lshl` to `shl` and...
Noah Goldstein [Tue, 18 Apr 2023 00:49:36 +0000 (19:49 -0500)]
[ValueTracking] Apply the isKnownNonZero techniques in `ashr`/`lshl` to `shl` and vice-versa

For all shifts we can apply the same two optimizations.

    1) `ShiftOp(KnownVal.One, Max(KnownCnt)) != 0`
        -> result is non-zero
    2) If already known `Val != 0` and we only shift out zeros (based
       on `Max(KnownCnt)`)
        -> result is non-zero

The former exists for `shl` and the latter (for constant `Cnt`) exists
for `ashr`/`lshr`.

This patch improves the latter to use `Max(KnownCnt)` instead of
relying on a constant shift `Cnt` and applies both techniques for all
shift ops.

Reviewed By: nikic

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

15 months ago[ValueTracking] Add more tests for `isKnownNonZero(Shift)`; NFC
Noah Goldstein [Fri, 14 Apr 2023 23:42:32 +0000 (18:42 -0500)]
[ValueTracking] Add more tests for `isKnownNonZero(Shift)`; NFC

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

15 months ago[TableGen] clang-format some recent changes. NFC
Craig Topper [Tue, 18 Apr 2023 03:26:47 +0000 (20:26 -0700)]
[TableGen] clang-format some recent changes. NFC

15 months ago[NFC][lsan] Use LowLevelAllocator to allocate ThreadContext
Vitaly Buka [Sat, 15 Apr 2023 05:50:28 +0000 (22:50 -0700)]
[NFC][lsan] Use LowLevelAllocator to allocate ThreadContext

This is more RAM and CPU efficient than allocating entire page per
context, and this approach is used by other sanitizers already.

With the patch "create_thread_loop2.cpp.tmp 5000" is 30% faster.

15 months ago[NFC][Clang] Fix static analyzer tool remark about missing user-defined assignment...
Manna, Soumi [Tue, 18 Apr 2023 02:21:03 +0000 (22:21 -0400)]
[NFC][Clang] Fix static analyzer tool remark about missing user-defined assignment operator

Reported by Coverity:

Copy without assign
This class has a user-defined copy constructor but no user-defined assignment operator. If the copy constructor is necessary to manage owned resources then a corresponding assignment operator is usually required. If an object of this type is assigned memory leaks and/or use-after-free errors may occur. Note that a compiler-generated assignment operator will perform only a bit-wise copy for any fields that do not have their own assignment operators defined.

Class has user-written copy constructor but no user-written assignment operator

copy_without_assign: Class <unnamed>::DeclUseTracker has a user-written copy constructor <unnamed>::DeclUseTracker::DeclUseTracker(<unnamed>::DeclUseTracker const &) =delete but no corresponding user-written assignment operator.

Reviewed By: aaron.ballman

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

15 months agoremove useless condition in assert in SelectionDAG.cpp
Wang, Xin10 [Tue, 18 Apr 2023 01:50:10 +0000 (21:50 -0400)]
remove useless condition in assert in SelectionDAG.cpp

The condition Opcode <= std::numeric_limits<int>::max() will
always be true here.

Reviewed By: skan

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

15 months ago[lldb] Add more asserts to TestExec
Dave Lee [Tue, 18 Apr 2023 00:14:55 +0000 (17:14 -0700)]
[lldb] Add more asserts to TestExec

If this test fails, the error message isn't helpful:

```
self.assertEqual(len(threads), 1,
AssertionError: 0 != 1 : Stopped at breakpoint in exec'ed process
```

This change adds asserts to verify that:
1. The process is stopped
2. For each thread, that the stop reason is None, or Breakpoint

The latter will indicate if execution has stopped for some other reason, and if so what
that reason is.

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

15 months ago[compiler-rt] [test] Mark dfsan tests XFAIL on glibc-2.37
Michał Górny [Mon, 17 Apr 2023 05:54:57 +0000 (07:54 +0200)]
[compiler-rt] [test] Mark dfsan tests XFAIL on glibc-2.37

Mark the two dfsan tests that are known to be broken on glibc-2.37
as XFAIL, to make the test suite start passing on Gentoo again.

Bug: https://github.com/llvm/llvm-project/issues/60678

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

15 months ago[NFC][clang] Fix coverity static analyzer concerns about AUTO_CAUSES_COPY
Manna, Soumi [Tue, 18 Apr 2023 00:50:41 +0000 (20:50 -0400)]
[NFC][clang] Fix coverity static analyzer concerns about AUTO_CAUSES_COPY

Reported by Coverity:

AUTO_CAUSES_COPY
Unnecessary object copies can affect performance.

1. [NFC] Fix auto keyword use without an & causes the copy of an object of type SimpleRegistryEntry in clang::getAttributePluginInstances()

2. [NFC] Fix auto keyword use without an & causes the copy of an object of type tuple in CheckStmtInlineAttr<clang::NoInlineAttr, 2>(clang::Sema &, clang::Stmt const *, clang::Stmt const *, clang::AttributeCommonInfo const &)

3. [NFC] Fix auto keyword use without an & causes the copy of an object of type QualType in <unnamed>::SystemZTargetCodeGenInfo::isVectorTypeBased(clang::Type const *, bool)

4. [NFC] Fix auto keyword use without an & causes the copy of an object of type Policy in <unnamed>::RISCVIntrinsicManagerImpl::InitIntrinsicList()

5. [NFC] Fix auto keyword use without an & causes the copy of an object of type pair in checkUndefinedButUsed(clang::Sema &)

Reviewed By: tahonermann

Differential Revision: <https://reviews.llvm.org/D147543>

15 months ago[flang] Added missing _Complex for COMPLEX(10) C reduction API.
Slava Zakharin [Sun, 16 Apr 2023 20:21:25 +0000 (13:21 -0700)]
[flang] Added missing _Complex for COMPLEX(10) C reduction API.

I noticed _Complex was missing for the long double case.
I might be missing something, but it looks like the compiler
does not call the C wrappers directly. Do we need to keep
the complex-reduction.[ch] at all?

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

15 months ago[Attributor][FIX] Ensure to cache all intra procedural AA queries
Johannes Doerfert [Tue, 18 Apr 2023 00:57:12 +0000 (17:57 -0700)]
[Attributor][FIX] Ensure to cache all intra procedural AA queries

We failed to cache queries without an exclusion set that resulted in
non-reachable results. That is obviously bad as changes to liveness can
influence the result.

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

15 months ago[MLIR] Patch StandalonePlugin CMake for MacOS
max [Tue, 18 Apr 2023 00:59:08 +0000 (19:59 -0500)]
[MLIR] Patch StandalonePlugin CMake for MacOS

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

15 months ago[BOLT][DWARF] Fix handling of CUs without TU reference
Alexander Yermolovich [Tue, 18 Apr 2023 00:48:54 +0000 (17:48 -0700)]
[BOLT][DWARF] Fix handling of CUs without TU reference

When input is DWP with DWARF5 bolt wasn't handling correctly CUs that didn't
have TU references. Which resulted in a crash.

Reviewed By: maksfb

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

15 months ago[X86] Fix whitespace issue in CombineSetCC; NFC
Noah Goldstein [Tue, 18 Apr 2023 00:49:55 +0000 (19:49 -0500)]
[X86] Fix whitespace issue in CombineSetCC; NFC

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

15 months agoRevert "[sanitizer] Try to fix windows bot"
Vitaly Buka [Tue, 18 Apr 2023 00:37:11 +0000 (17:37 -0700)]
Revert "[sanitizer] Try to fix windows bot"

Not needed.

This reverts commit e864e6f234b24ae2e05dcc1ea9a516859db9c9b5.

15 months ago[sanitizer] Fix Windows build
Vitaly Buka [Tue, 18 Apr 2023 00:35:52 +0000 (17:35 -0700)]
[sanitizer] Fix Windows build

15 months ago[sanitizer] Try to fix windows bot
Vitaly Buka [Tue, 18 Apr 2023 00:27:45 +0000 (17:27 -0700)]
[sanitizer] Try to fix windows bot

https://lab.llvm.org/buildbot/#/builders/127/builds/46887/steps/4/logs/stdio

15 months ago[lldb] Change parameter type of StructuredData::ParseJSON
Alex Langford [Mon, 17 Apr 2023 23:11:07 +0000 (16:11 -0700)]
[lldb] Change parameter type of StructuredData::ParseJSON

Instead of taking a `const std::string &` we can take an
`llvm::StringRef`. The motivation for this change is that many of the
callers of `ParseJSON` end up creating a temporary `std::string` from an existing
`StringRef` or `const char *` in order to satisfy the API. There's no
reason we need to do this.

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

15 months agoRevert "[VPlan] Unify Value2VPValue and VPExternalDefs maps (NFCI)."
Vitaly Buka [Tue, 18 Apr 2023 00:19:57 +0000 (17:19 -0700)]
Revert "[VPlan] Unify Value2VPValue and VPExternalDefs maps (NFCI)."

Asan detects heap-use-after-free, see D147892.

This reverts commit 4fc190351e5af901b6107d162d07e1fbca90934f.
This reverts commit 668045eb77628be13e448ffbb855473ffca1cc43.

15 months agoExpose PassBuilder extension point callbacks
Prem Chintalapudi [Tue, 18 Apr 2023 00:14:30 +0000 (17:14 -0700)]
Expose PassBuilder extension point callbacks

This patch allows access to callbacks registered by TargetMachines to allow custom pipelines to run those callbacks.

Reviewed By: aeubanks

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

15 months ago[NFC][sanitizer] Clang-format some includes
Vitaly Buka [Tue, 18 Apr 2023 00:08:11 +0000 (17:08 -0700)]
[NFC][sanitizer] Clang-format some includes

15 months ago[lldb] Build libcxx unique_ptr and shared_ptr test programs with -glldb.
Jorge Gorbe Moya [Mon, 17 Apr 2023 23:35:21 +0000 (16:35 -0700)]
[lldb] Build libcxx unique_ptr and shared_ptr test programs with -glldb.

The functionality added by https://reviews.llvm.org/D145803 is gated by
lldb tuning, so we need to build the test programs with `-glldb` to make
these tests print the expected preferred name.

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

15 months ago[Bazel] Use dynamic workspace root determination
Aaron Siddhartha Mondal [Mon, 17 Apr 2023 23:53:46 +0000 (01:53 +0200)]
[Bazel] Use dynamic workspace root determination

The `clang:ast` and `clang:builtin_headers_gen` targets currently use hardcoded `external/llvm-project`
paths to access generated headers.

With bzlmod this path becomes dependent on the module name, module version and module extension,
so we need a more dynamic approach.

Does not affect the WORKSPACE build.

Reviewed By: GMNGeoffrey, #bazel_build

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

15 months agoMake gentable outputs and strip_include_prefix match llvm directory.
Sterling Augustine [Mon, 17 Apr 2023 23:50:29 +0000 (16:50 -0700)]
Make gentable outputs and strip_include_prefix match llvm directory.

15 months ago[mlir][linalg] Promote operands for convolution vectorization
Lei Zhang [Mon, 17 Apr 2023 23:29:28 +0000 (16:29 -0700)]
[mlir][linalg] Promote operands for convolution vectorization

We are already doing this for depthwise convolution and pooling.
This helps to preserve the promotion semantics from Linalg op
definitions to lower layers.

Along the way, fixed the type mismatch issue in the existing
`promote` implementation.

Reviewed By: kuhar

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

15 months ago[lsan] Fix Darwin build
Vitaly Buka [Mon, 17 Apr 2023 23:35:19 +0000 (16:35 -0700)]
[lsan] Fix Darwin build

15 months ago[Android] Use ELF TLS for Android API level 29+
Brad Smith [Mon, 17 Apr 2023 23:21:15 +0000 (19:21 -0400)]
[Android] Use ELF TLS for Android API level 29+

Use ELF TLS by default instead of emulated TLS for Android build targets when
the API level is >= 29.

Android Q features full TLS support. See release notes
(https://developer.android.com/preview/features#elf-tls) and implementation details
(https://android.googlesource.com/platform/bionic/+/master/docs/elf-tls.md#Workaround_Use-Variant-2-on-arm32_arm64).

Reviewed By: rprichard, danalbert

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

15 months ago[lsan] Fix Darwin build
Vitaly Buka [Mon, 17 Apr 2023 23:29:18 +0000 (16:29 -0700)]
[lsan] Fix Darwin build

15 months ago[lldb] Add support for MSP430 in LLDB.
Ilya Kuklin [Mon, 17 Apr 2023 22:26:48 +0000 (15:26 -0700)]
[lldb] Add support for MSP430 in LLDB.

Add MSP430 to the list of available targets, implement MSP430 ABI, add support for debugging targets with 16-bit address size.

The update is intended for use with MSPDebug, a GDB server implementation for MSP430.

Reviewed By: bulbazord, DavidSpickett

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

15 months ago[OpenMP][NFC] Silence warning
Johannes Doerfert [Mon, 17 Apr 2023 22:53:13 +0000 (15:53 -0700)]
[OpenMP][NFC] Silence warning

15 months ago[AMDGPU] Ressociate patterns with sub to use SALU
chenglin.bi [Mon, 17 Apr 2023 22:49:16 +0000 (06:49 +0800)]
[AMDGPU] Ressociate patterns with sub to use SALU

Reviewed By: rampitec

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

15 months ago[lsan] Don't crash on ThreadRegistry::threads_ data race
Vitaly Buka [Fri, 14 Apr 2023 23:27:19 +0000 (16:27 -0700)]
[lsan] Don't crash on ThreadRegistry::threads_ data race

Comment "No lock needed" in CurrentThreadContext was wrong.
Concurent ThreadRegistry::CreateThread can resize and relocate
ThreadRegistry::threads_ the same time CurrentThreadContext reads it.

To mitigate lock cost we store ThreadContext* instead of tid in
THREADLOCAL cache, we can tid from the ThreadContext*.

Reviewed By: kstoimenov, MaskRay

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

15 months ago[OpenMP] Ensure memory fences are created with barriers for AMDGPUs
Johannes Doerfert [Tue, 21 Mar 2023 01:55:05 +0000 (18:55 -0700)]
[OpenMP] Ensure memory fences are created with barriers for AMDGPUs

It turns out that the __builtin_amdgcn_s_barrier() alone does not emit
a fence. We somehow got away with this and assumed it would work as it
(hopefully) is correct on the NVIDIA path where we just emit a
__syncthreads. After talking to @arsenm we now (mostly) align with the
OpenCL barrier implementation [1] and emit explicit fences for AMDGPUs.

It seems this was the underlying cause for #59759, but I am not 100%
certain. There is a chance this simply hides the problem.

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

[1] https://github.com/RadeonOpenCompute/ROCm-Device-Libs/blob/07b347366eb2c6ebc3414af323c623cbbbafc854/opencl/src/workgroup/wgbarrier.cl#L21

15 months ago[lldb] Remove use of ConstString from Args::GetShellSafeArgument
Alex Langford [Sat, 15 Apr 2023 00:13:55 +0000 (17:13 -0700)]
[lldb] Remove use of ConstString from Args::GetShellSafeArgument

Having the names of various shells in ConstString's StringPool is not
really necessary, especially if they are otherwise not going to be there
in the first place. For example, if the person debugging uses bash on
their system, the `shell` parameter will have its `m_filename` set to a
ConstString containing "bash". However, fish, tcsh, zsh, and sh will
probably never be used and are just taking up space in the StringPool.

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

15 months ago[lldb] Lock accesses to PathMappingLists's internals
Alex Langford [Fri, 14 Apr 2023 21:16:26 +0000 (14:16 -0700)]
[lldb] Lock accesses to PathMappingLists's internals

This class is not safe in multithreaded code. It's possible for one
thread to modify a PathMappingList's `m_pair` vector while another
thread is iterating over it, effectively invalidating the iterator and
potentially leading to crashes or other difficult-to-diagnose bugs.

rdar://107695786

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

15 months ago[FuzzMutate] RandomIRBuilder has more source and sink type now.
Peter Rong [Mon, 17 Apr 2023 19:10:18 +0000 (12:10 -0700)]
[FuzzMutate] RandomIRBuilder has more source and sink type now.

Source and Sink are required when generating a new instruction.
(Term defined by previous author, in LLVM terms it's probably Use and User.)
Previously, only instructions in the same block is considered when taking source and sink.

In this patch, more source and sink types are considered.
For source, we have SrcFromInstInCurBlock, FunctionArgument, InstInDominator, SrcFromGlobalVariable, and NewConstOrStack.
For sink, we have SinkToInstInCurBlock, PointersInDominator, InstInDominatee, NewStore, and SinkToGlobalVariable.

A unit test to make sure source always dominates an instruction, and the instruction always dominates the sink is included.

Reviewed By: arsenm

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

15 months ago[llvm-driver] Check more specific tools first
Alex Brachet [Mon, 17 Apr 2023 21:38:08 +0000 (21:38 +0000)]
[llvm-driver] Check more specific tools first

We allow tools to be called {tool}-{suffix} to support tools being
called something like clang-17. Many clang tools follow this pattern
too for example, clang-scan-deps. It is pure luck wether clang or
clang-scan-deps will appear first in the LLVMDriverTools.def file. If
the former appears first, clang-scan-deps will match against clang,
which is not preferable. Instead we can control the order that tools
are checked so that we always look at more specific tool names first.

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

15 months ago[libc][Bazel][NFC] add missing string deps
Michael Jones [Mon, 17 Apr 2023 21:26:07 +0000 (14:26 -0700)]
[libc][Bazel][NFC] add missing string deps

With the recent move away from StringStream some tests were given a
dependency on cpp::string. Some of these were missed for the bazel
build, causing build failures.

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

15 months ago[BOLT][test] Update AArch64/r_aarch64_prelxx.s test
Amir Ayupov [Mon, 17 Apr 2023 21:32:18 +0000 (23:32 +0200)]
[BOLT][test] Update AArch64/r_aarch64_prelxx.s test

Update section flags and type after https://reviews.llvm.org/D148386

Reviewed By: #bolt, rafauler, MaskRay

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

15 months ago[WebAssembly][NFC] Fix typos.
Hiroshi Yamauchi [Mon, 17 Apr 2023 20:24:49 +0000 (13:24 -0700)]
[WebAssembly][NFC] Fix typos.

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

15 months ago[ORC-RT] Check for jit-compatible-osx-swift-runtime on tests that need one.
Lang Hames [Mon, 17 Apr 2023 21:27:32 +0000 (14:27 -0700)]
[ORC-RT] Check for jit-compatible-osx-swift-runtime on tests that need one.

rdar://107846455

15 months agoMake BPF stack size overridable
Niclas Hedam [Mon, 17 Apr 2023 19:50:44 +0000 (22:50 +0300)]
Make BPF stack size overridable

With the emergence of TP 4091 for NVMe, eBPF can be used to offload programs to computational storage processors.
This change introduces the possibility of overriding the default stack size of 512 bytes for non-kernel runtime environments.

Reviewed By: yonghong-song, eddyz87

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

15 months agoAllow using getters for metadata fields of BBAddrMap::BBEntry.
Rahman Lavaee [Mon, 17 Apr 2023 21:15:23 +0000 (21:15 +0000)]
Allow using getters for metadata fields of BBAddrMap::BBEntry.

This is a prequel for D148360.

Reviewed By: jhenderson

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

15 months ago[test][sanitizer] Add another stress test for pthread_create
Vitaly Buka [Sat, 15 Apr 2023 05:38:58 +0000 (22:38 -0700)]
[test][sanitizer] Add another stress test for pthread_create

15 months ago[ORC-RT] Don't check for objc image registration functions unless needed.
Lang Hames [Mon, 17 Apr 2023 20:40:42 +0000 (13:40 -0700)]
[ORC-RT] Don't check for objc image registration functions unless needed.

If we don't have any ObjC metadata to register we shouldn't require these
symbols to be available.

15 months ago[LSV] Improve chain splitting in some corner cases.
Artem Belevich [Mon, 10 Apr 2023 22:55:39 +0000 (15:55 -0700)]
[LSV] Improve chain splitting in some corner cases.

Currently we happen to split a chain of 12xi8 accesses into 6xi8 + 6xi8, which
produces rather suboptimal code.

This change attempts to split-off non-multiples of 4bytes at the end and if that
does not work, splits on the smaller power-of-2 boundary.

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

15 months ago[lldb][DataFormatter] Fix libcxx std::deque formatter for references and pointers
Michael Buch [Mon, 17 Apr 2023 14:04:57 +0000 (15:04 +0100)]
[lldb][DataFormatter] Fix libcxx std::deque formatter for references and pointers

(Addresses GH#62153)

The `SBType` APIs to retrieve details about template arguments,
such as `GetTemplateArgumentType` or `GetTemplateArgumentKind`
don't "desugar" LValueReferences/RValueReferences or pointers.
So when we try to format a `std::deque&`, the python call to
`GetTemplateArgumentType` fails to get a type, leading to
an `element_size` of `0` and a division-by-zero python exception
(which gets caught by the summary provider silently). This leads
to the contents of such `std::deque&` to be printed incorrectly.

This patch dereferences the reference/pointer before calling
into the above SBAPIs.

**Testing**

* Add API test

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

15 months ago[gn build] Port b0b2b2e047ca
LLVM GN Syncbot [Mon, 17 Apr 2023 20:21:50 +0000 (20:21 +0000)]
[gn build] Port b0b2b2e047ca

15 months ago[arcanist] rm -f for write protected temp files
Nick Desaulniers [Mon, 17 Apr 2023 20:18:16 +0000 (13:18 -0700)]
[arcanist] rm -f for write protected temp files

When running `arc diff` on a newly added file,
utils/arcanist/clang-format.sh is run. For new files there is no change,
but the script will bail. Without the use of the -f flag, we get
interactive prompts like:
rm: remove write-protected regular file '/tmp/tmp.ReMybrBw35'?

Reviewed By: MaskRay

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

15 months ago[COFF] Add MC support for emitting IMAGE_WEAK_EXTERN_ANTI_DEPENDENCY symbols
Eli Friedman [Mon, 17 Apr 2023 20:15:46 +0000 (13:15 -0700)]
[COFF] Add MC support for emitting IMAGE_WEAK_EXTERN_ANTI_DEPENDENCY symbols

This is mostly useful for ARM64EC, which uses such symbols extensively.

One interesting quirk of ARM64EC is that we need to be able to emit weak
symbols that point at each other (so if either symbol is defined
elsewhere, both symbols point at the definition).  This required a few
changes to the way we handle weak symbols on Windows.

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

15 months agoRevert "[ADT] add StringViewExtras llvm::starts_with for std::string_view"
Nick Desaulniers [Mon, 17 Apr 2023 20:10:16 +0000 (13:10 -0700)]
Revert "[ADT] add StringViewExtras llvm::starts_with for std::string_view"

This reverts commit d6d30dd9590b41fbcdc88b43767b27a31bfb1c73.

These helpers were added to be used by LLVMDemangle, which would be a
layering violation for that to depend on LLVMSupport. Undo this commit,
and I'll these these directly in LLVMDemangle.

Reviewed By: MaskRay

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

15 months ago[scudo] Tune FuchsiaConfig for RiscV
Caslyn Tonelli [Sun, 16 Apr 2023 19:07:09 +0000 (19:07 +0000)]
[scudo] Tune FuchsiaConfig for RiscV

Reduce `PrimaryRegionSizeLog` to 28U to be compatible with a 38bit user
address space on the fuchsia-riscv platform. `PrimaryGroupSizeLog` is
reduced to 19 to preserve 512 BatchGroups per region.

This change can be tested on Fuchsia with:

```
fx set --auto-dir bringup.riscv64 --with //bundles:boot_tests \
fx build bundles:boot_tests \
fx run-boot-test --args={-s,1} boot-libc-unittests \
--cmdline='--gtest_filter=-*DeathTest*:PthreadGetSet*:ScudoSecondaryTest*'
```
The gtest filter ignores pthread and death tests due to non-scudo
related issues on fuchsia-riscv (ScudoSecondaryTest includes a death
check).

Related Ticket: https://fxbug.dev/125263

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

15 months ago[InstCombine] support fold select(X|Y,X|Y,X) to X|Y
Congcong Cai [Mon, 17 Apr 2023 20:06:59 +0000 (22:06 +0200)]
[InstCombine] support fold select(X|Y,X|Y,X) to X|Y

Fixed: https://github.com/llvm/llvm-project/issues/62113
Add addtional check in `visitSelectInst` to:
1. match `select(X|Y==0, X, X|Y)` and replaced with `X|Y`
2. match `select(X&Y==-1, X, X&Y)` and replaced with `X&Y`

alive proof:
https://alive2.llvm.org/ce/z/4qHmv-
https://alive2.llvm.org/ce/z/c2MBGy

Reviewed By: nikic

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

15 months ago[InstCombine][NFC] Add tests for simplifying select(X|Y,X|Y,X) to X|Y
Congcong Cai [Mon, 17 Apr 2023 20:06:43 +0000 (22:06 +0200)]
[InstCombine][NFC] Add tests for simplifying select(X|Y,X|Y,X) to X|Y

Reviewed By: nikic

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

15 months ago[libc] Partial revert of "[libc] Update supported riscv libs"
Mikhail R. Gadelha [Mon, 17 Apr 2023 19:45:46 +0000 (16:45 -0300)]
[libc] Partial revert of "[libc] Update supported riscv libs"

Partial revert of commit ee917996708c936dd7f275de06b7895f5e3c11ec.

I can't reproduce the error locally, so let's revert it to keep the bots
happy.

15 months ago[mlir][openacc][NFC] Use assembly format for acc.loop
Valentin Clement [Mon, 17 Apr 2023 19:44:36 +0000 (12:44 -0700)]
[mlir][openacc][NFC] Use assembly format for acc.loop

Use the assembly format with custom parser/printer
for specific clauses instead of a full custom parser/printer.

Reviewed By: PeteSteinfeld

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

15 months ago[lldb] fix build issue on MSVC because of missing byte-swap builtins
Ashay Rane [Mon, 17 Apr 2023 16:17:43 +0000 (11:17 -0500)]
[lldb] fix build issue on MSVC because of missing byte-swap builtins

The `__builtin_bswap{32,64}()` builtins (introduced in commit e07a421d)
are missing from MSVC, which causes build errors when compiling LLDB on
Windows (tested with MSVC 19.34.31943.0).  This patch replaces the
builtins with either MSVC's `_byteswap_u{long,64}()` or the original
builtins, or the `bswap_{32,64}()` functions from byteswap.h, depending
on which ones are available.

Reviewed By: bulbazord

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

15 months agoRevert "[VPlan] Switch to checking sinking legality for recurrences in VPlan."
Manoj Gupta [Mon, 17 Apr 2023 18:39:07 +0000 (11:39 -0700)]
Revert "[VPlan] Switch to checking sinking legality for recurrences in VPlan."

This reverts commit 7fc0b3049df532fce726d1ff6869a9f6e3183780.

Causes a clang hang when building xz utils, github issue #62187.

15 months ago[libc] Update supported riscv libs
Mikhail R. Gadelha [Mon, 17 Apr 2023 19:13:14 +0000 (16:13 -0300)]
[libc] Update supported riscv libs

This patch updates the list of supported libs according to the latest changes to x86_64

Reviewed By: sivachandra

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

15 months agogithub: Add manual workflow to build and upload release binaries
Jack Grigg [Mon, 17 Apr 2023 18:59:56 +0000 (11:59 -0700)]
github: Add manual workflow to build and upload release binaries

Reviewed By: kwk

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

15 months ago[lldb] Fix TestObjectFileJSON and TestSymbolFileJSON
Jonas Devlieghere [Mon, 17 Apr 2023 18:58:27 +0000 (11:58 -0700)]
[lldb] Fix TestObjectFileJSON and TestSymbolFileJSON

 - Separate the two test and only have TestSymbolFileJSON rely on strip.
 - Use different file names to make sure LLDB reloads the module.

This should address all the post commit review from D148062.

15 months ago[JITLink][ELF] Check that ELF buffer has at least ELF::EI_NIDENT bytes.
Lang Hames [Mon, 17 Apr 2023 17:58:29 +0000 (10:58 -0700)]
[JITLink][ELF] Check that ELF buffer has at least ELF::EI_NIDENT bytes.

This allows the subsequent code to access the E_IDENT fields, which will be
used in the upcoming JITLink ppc64 backend (https://reviews.llvm.org/D148192).

15 months ago[nfc][llvm] Replace pointer cast functions in PointerUnion by llvm casting functions.
Shraiysh Vaishay [Sun, 16 Apr 2023 02:16:16 +0000 (21:16 -0500)]
[nfc][llvm] Replace pointer cast functions in PointerUnion by llvm casting functions.

This patch replaces the uses of PointerUnion.is function by llvm::isa,
PointerUnion.get function by llvm::cast, and PointerUnion.dyn_cast by
llvm::dyn_cast_if_present. This is according to the FIXME in
the definition of the class PointerUnion.

This patch does not remove them as they are being used in other
subprojects.

Reviewed By: mehdi_amini

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

15 months ago[clang-format] CSharp don't allow there not to be a space between `is` and `[`
mydeveloperday [Mon, 17 Apr 2023 18:38:53 +0000 (19:38 +0100)]
[clang-format] CSharp don't allow there not to be a space between `is` and `[`

as `is` is a keyword in C# ensure there is always a space before the `[` regardless of `SpaceBeforeSquareBrackets` setting

Fixes: #61965

https://github.com/llvm/llvm-project/issues/61965

Reviewed By: owenpan, HazardyKnusperkeks

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