platform/upstream/llvm.git
16 months agoRemove an extra `//` in the IWYU pragma for gtest-matchers.h
Haojian Wu [Tue, 14 Mar 2023 08:37:18 +0000 (09:37 +0100)]
Remove an extra `//` in the IWYU pragma for gtest-matchers.h

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

16 months ago[Codegen][ARM][AArch64] Support symmetric operations on complex numbers
Nicholas Guy [Mon, 13 Mar 2023 14:46:30 +0000 (14:46 +0000)]
[Codegen][ARM][AArch64] Support symmetric operations on complex numbers

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

16 months agoCleanup of Complex Deinterleaving pass (NFCI)
Nicholas Guy [Mon, 13 Mar 2023 14:44:57 +0000 (14:44 +0000)]
Cleanup of Complex Deinterleaving pass (NFCI)

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

16 months ago[Tooling/Inclusion] Index more sub std namespace symbols.
Haojian Wu [Tue, 14 Mar 2023 08:34:39 +0000 (09:34 +0100)]
[Tooling/Inclusion] Index more sub std namespace symbols.

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

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

16 months ago[mlir][GPUTransforms] NFC - Refactor GPUTransforms.cpp in preparation for improvements.
Nicolas Vasilache [Mon, 13 Mar 2023 20:33:15 +0000 (13:33 -0700)]
[mlir][GPUTransforms] NFC - Refactor GPUTransforms.cpp in preparation for improvements.

Depends on: D145977

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

16 months ago[Support][MemBuffer] Prevent UB on empty StringRefs
Kadir Cetinkaya [Fri, 24 Feb 2023 08:36:07 +0000 (09:36 +0100)]
[Support][MemBuffer] Prevent UB on empty StringRefs

Empty StringRefs are usually identified by their length being zero, and
sometimes they'll have Data==nullptr (e.g. default constructed, or derived from
an operation like split/copy and result turned out to be empty).

If such StringRef objects are passed to llvm::MemoryBuffer::getMemBufferCopy,
it'll result in UB as neither src nor dst can be null, even if size is zero.

This patch prevents that UB by not issuing a copy whenever StringRef is empty.

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

16 months ago[X86] Fix encoding for ATOMIC_LOGIC_OP
Nabeel Omer [Mon, 13 Mar 2023 16:17:03 +0000 (16:17 +0000)]
[X86] Fix encoding for ATOMIC_LOGIC_OP

Fixes PR#61384.

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

16 months ago[X86] Add negative test for D145930
Nabeel Omer [Mon, 13 Mar 2023 16:08:42 +0000 (16:08 +0000)]
[X86] Add negative test for D145930

This patch adds a negative test for the issue discovered in D145930.

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

16 months ago[mlir][Transform] NFC - Various API cleanups and use RewriterBase in lieu of PatternR...
Nicolas Vasilache [Mon, 13 Mar 2023 19:35:14 +0000 (12:35 -0700)]
[mlir][Transform] NFC - Various API cleanups and use RewriterBase in lieu of PatternRewriter

Depends on: D145685

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

16 months ago[RISCV][test] Test case for regression when MachineOutliner and MachineCopyPropagatio...
Alex Bradbury [Tue, 14 Mar 2023 11:16:23 +0000 (11:16 +0000)]
[RISCV][test] Test case for regression when MachineOutliner and MachineCopyPropagation are both enabled

MachineCopyPropagation removes a register copy in the outlined function
as it doesn't see that it's live-out from the function.

16 months ago[mlir][Affine] Add helper functions to allow reordering affine.apply operands and...
Nicolas Vasilache [Mon, 13 Mar 2023 19:29:10 +0000 (12:29 -0700)]
[mlir][Affine] Add helper functions to allow reordering affine.apply operands and decompose the ops into smaller components

Care is taken to order operands from least hoistable to most hoistable and to process subexpressions in the same
order.

This allows exposing more oppportunities for licm, cse and strength reduction.

Such a step should typically be applied while we still have loops in the IR and just before lowering affine ops to arith.
This is because the affine.apply canonicalization currently tries to maximally compose chains of affine.apply operations
and could undo the effects of these decompositions.

Depends on: D145784

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

16 months agoReapply [LowerTypeTests] Avoid creation of select constant expression
Nikita Popov [Fri, 3 Mar 2023 15:22:41 +0000 (16:22 +0100)]
Reapply [LowerTypeTests] Avoid creation of select constant expression

Reapply with a fix for phi handling: For phis, we need to insert
into the incoming block, not above the phi. This is especially
tricky if there are multiple incoming values from the same
predecessor, because these must all use the same value.

-----

LowerTypeTests replaces weak declarations with an icmp+select
constant expressions. As this is not a relocatable expression,
it additionally promotes initializers using it to global ctors.

As part of https://discourse.llvm.org/t/rfc-remove-most-constant-expressions/63179,
I would like to remove the select constant expression, of which LTT
is now the last user. This is a bit tricky, because we now need to
replace a constant with an instruction, which might require
converting intermediate constant expression users to instructions as
well.

We do this using the convertUsersOfConstantsToInstructions() helper.
However, it needs to be slightly extended to also support expansion
of ConstantAggregates. These are important in this context, because
the promotion of initializers to global ctors will produce stores
of such aggregates.

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

16 months ago[RISCV][NFC] Share interleave mask checking logic
Luke Lau [Mon, 13 Mar 2023 18:12:12 +0000 (18:12 +0000)]
[RISCV][NFC] Share interleave mask checking logic

This adds two new methods to ShuffleVectorInst, isInterleave and
isInterleaveMask, so that the logic to check if a shuffle mask is an
interleave can be shared across the TTI, codegen and the interleaved
access pass.

Reviewed By: craig.topper

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

16 months agoRevert "[DAG/AMDGPU] Use UniformityAnalysis in DAGISel"
pvanhout [Tue, 14 Mar 2023 10:48:40 +0000 (11:48 +0100)]
Revert "[DAG/AMDGPU] Use UniformityAnalysis in DAGISel"

This reverts commit 0022b5803fd4f5a4e9fcf233267c0ffa1b88f763.

16 months ago[clang-format] Treat &/&& as reference when followed by requires clause
Emilia Dreamer [Tue, 14 Mar 2023 10:48:05 +0000 (12:48 +0200)]
[clang-format] Treat &/&& as reference when followed by requires clause

Previously, the token annotator would get confused and annotate a member
function's ref qualifier as a binary operator, if said function also had
a requires clause after it.

This patch accounts for that, treating requires clauses more similarly
to `noexcept`, which also comes after the ref qualifier.

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

Reviewed By: HazardyKnusperkeks, owenpan

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

16 months ago[mlir][DialectUtils] Cleanup IndexingUtils and provide more affine variants while...
Nicolas Vasilache [Mon, 13 Mar 2023 19:24:58 +0000 (12:24 -0700)]
[mlir][DialectUtils] Cleanup IndexingUtils and provide more affine variants while reusing implementations

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

16 months ago[NFC] Drop NDEBUG around MSSA verification
Max Kazantsev [Tue, 14 Mar 2023 10:16:54 +0000 (17:16 +0700)]
[NFC] Drop NDEBUG around MSSA verification

Proposed on review of https://reviews.llvm.org/D145894.

16 months ago[IndVars] Option verify-indvars is broken (and always has been), delete it
Max Kazantsev [Tue, 14 Mar 2023 10:13:59 +0000 (17:13 +0700)]
[IndVars] Option verify-indvars is broken (and always has been), delete it

This option is switched off by default, and it seems that it has never worked correctly.
What it basically does is: it remembers current BECount SCEV, and after all transforms
tries to validate some facts for it. However, between these two points this SCEV may
become invalid (e.g. because some SCEVUnknown it references may be deleted as dead
code). So basically it may work with broken pointers.

Besides, its implementation does strange things (e.g. forgetLoop) which are invasive and
may affect behavior in other parts of the system (specifically verification), concealing some
other problems. Another issue is that it may use SCEVCouldNotCompute object without
checking this.

The option is not used in any unit tests, and if switched on by default, the following tests
fail:
```
********************
Failed Tests (14):
  LLVM :: Transforms/IndVarSimplify/2005-06-15-InstMoveCrash.ll
  LLVM :: Transforms/IndVarSimplify/2007-06-06-DeleteDanglesPtr.ll
  LLVM :: Transforms/IndVarSimplify/2008-10-03-CouldNotCompute.ll
  LLVM :: Transforms/IndVarSimplify/2009-05-24-useafterfree.ll
  LLVM :: Transforms/IndVarSimplify/2011-10-27-lftrnull.ll
  LLVM :: Transforms/IndVarSimplify/ARM/code-size.ll
  LLVM :: Transforms/IndVarSimplify/X86/deterministic-scev-verify.ll
  LLVM :: Transforms/IndVarSimplify/X86/pr57187.ll
  LLVM :: Transforms/IndVarSimplify/X86/verify-scev.ll
  LLVM :: Transforms/IndVarSimplify/bbi-63564.ll
  LLVM :: Transforms/IndVarSimplify/invalidate-modified-lcssa-phi.ll
  LLVM :: Transforms/IndVarSimplify/loop-predication.ll
  LLVM :: Transforms/IndVarSimplify/post-inc-range.ll
  LLVM :: Transforms/IndVarSimplify/turn-to-invariant.ll

********************
Unexpectedly Passed Tests (1):
  LLVM :: Transforms/IndVarSimplify/pr55689.ll
```

None of these looks like real problems found by verification, these are
bugs in the verifying code itself (such as use of deleted SCEVs and
SCEVCouldNotCompute's).

I think it all gives enough justification for its removal.

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

Differential Revision: https://reviews.llvm.org/D145894
Reviewed By: nikic

16 months ago[StructurizeCFG] Correctly depend on UniformityAnalysis
pvanhout [Tue, 14 Mar 2023 10:25:22 +0000 (11:25 +0100)]
[StructurizeCFG] Correctly depend on UniformityAnalysis

Small oversight in https://reviews.llvm.org/D145688 - the pass' dependency was not updated to reflect the change to UA.

Also, change DivergenceAnalysis to UniformityAnalysis in a comment. That way, StructurizeCFG only refers to UA and not DA anymore.

16 months ago[DAG/AMDGPU] Use UniformityAnalysis in DAGISel
pvanhout [Mon, 13 Mar 2023 10:33:15 +0000 (11:33 +0100)]
[DAG/AMDGPU] Use UniformityAnalysis in DAGISel

Switch DAGISel over to UniformityAnalysis, which was one of the last remaining users of the DivergenceAnalysis.
No explosions seen during internal testing so this looks like a smooth transition.

Reviewed By: sameerds

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

16 months ago[AArch64] Add svboolx2_t and svboolx4_t tuple types
Matt Devereau [Tue, 7 Mar 2023 15:12:31 +0000 (15:12 +0000)]
[AArch64] Add svboolx2_t and svboolx4_t tuple types

https://reviews.llvm.org/D145505

16 months ago[TTI] Evaluate cost of experimental_widenable_condition as zero
Max Kazantsev [Tue, 14 Mar 2023 10:09:50 +0000 (17:09 +0700)]
[TTI] Evaluate cost of experimental_widenable_condition as zero

This intrinsic is not supposed to live through lowering, eventually it should turn
into `true` constant and be optimized away.

Differential Revision: https://reviews.llvm.org/D146027
Reviewed By: skatkov

16 months ago[SCEV] Rename ControlsExit -> ControlsOnlyExit (NFC)
Nikita Popov [Tue, 14 Mar 2023 10:04:54 +0000 (11:04 +0100)]
[SCEV] Rename ControlsExit -> ControlsOnlyExit (NFC)

As suggested in https://reviews.llvm.org/D145510#4192162.

16 months ago[SCEV] Fix finite loop non-strict predicate simplification (PR60944)
Nikita Popov [Tue, 7 Mar 2023 14:42:16 +0000 (15:42 +0100)]
[SCEV] Fix finite loop non-strict predicate simplification (PR60944)

There are a number of issues with the current code for converting
ule -> ult (etc) predicates for comparisons controlling finite loops:

* It sets nowrap flags, which may only hold for that particular
  comparison, not globally. (PR60944)
* It doesn't check that the RHS is invariant. (I'm not sure this
  can cause practical issues independently of the previous point.)
* It runs before simplifications that may be more profitable. (PR54191)

This patch moves the handling for this into computeExitLimitFromICmp(),
because it is somewhat tightly coupled with assumptions in that code,
and addresses the aforementioned issues.

Fixes https://github.com/llvm/llvm-project/issues/60944.
Fixes https://github.com/llvm/llvm-project/issues/54191.

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

16 months ago[InstCombine] Regenerate test checks (NFC)
Nikita Popov [Tue, 14 Mar 2023 09:42:01 +0000 (10:42 +0100)]
[InstCombine] Regenerate test checks (NFC)

16 months ago[SCEV] Clarify ControlsExit comment (NFC)
Nikita Popov [Tue, 14 Mar 2023 09:37:33 +0000 (10:37 +0100)]
[SCEV] Clarify ControlsExit comment (NFC)

ControlsExit implies a single exit branch.

16 months ago[Test] Add missing REQUIRES: asserts in test
Max Kazantsev [Tue, 14 Mar 2023 09:27:40 +0000 (16:27 +0700)]
[Test] Add missing REQUIRES: asserts in test

16 months ago[Assignment Tracking] getIntrinsicInstrCost: set dbg.assign cost to zero
OCHyams [Tue, 14 Mar 2023 09:17:06 +0000 (09:17 +0000)]
[Assignment Tracking] getIntrinsicInstrCost: set dbg.assign cost to zero

Reviewed By: jmorse

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

16 months ago[LLVM][OHOS] Clang toolchain and targets
Pavel Kosov [Tue, 14 Mar 2023 09:12:35 +0000 (12:12 +0300)]
[LLVM][OHOS] Clang toolchain and targets

Add a clang part of OpenHarmony target

Related LLVM part: D138202

~~~

Huawei RRI, OS Lab

Reviewed By: DavidSpickett

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

16 months ago[mlir] Move tosa.concat lowering from TosaToLinalg to TosaToTensor
Maya Amrami [Thu, 9 Mar 2023 15:30:54 +0000 (17:30 +0200)]
[mlir] Move tosa.concat lowering from TosaToLinalg to TosaToTensor

tosa.concat is lowered to tensor.insert_slice thus it should be in
TosaToTensor rather than in TosaToLinalg.

Reviewed By: rsuderman

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

16 months agoNFC Fix cost model checks in tests for debug intrinsics
OCHyams [Tue, 14 Mar 2023 08:17:19 +0000 (08:17 +0000)]
NFC Fix cost model checks in tests for debug intrinsics

These tests don't have a "Debug Info Version" module flag causing the debug
intrinsics to be dropped with a warning `warning: ignoring debug info with an
invalid version (0)`. The test passes because there are no CHECK lines for
these intrinsics. Fix the issue and auto-update the test checks.

Reviewed By: jryans

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

16 months ago[AMDGPU] Fix .amdhsa_shared_vgpr_count error checking for GFX11
Jay Foad [Mon, 13 Mar 2023 14:05:17 +0000 (14:05 +0000)]
[AMDGPU] Fix .amdhsa_shared_vgpr_count error checking for GFX11

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

16 months ago[Test] Add test showing difference in cost models for guards
Max Kazantsev [Tue, 14 Mar 2023 08:49:25 +0000 (15:49 +0700)]
[Test] Add test showing difference in cost models for guards

16 months ago[IR] Allow !range on vector of integer instructions
Nikita Popov [Mon, 13 Mar 2023 10:18:57 +0000 (11:18 +0100)]
[IR] Allow !range on vector of integer instructions

Inspired by https://reviews.llvm.org/D144467#4188310, this allows
!range on vector of integer instructions, with the usual
element-wise interpretation, which is already used by various
analysis APIs that support vectors.

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

16 months ago[IncludeCleaner][NFC] Dont rely on implicit conversion of StringRef
Kadir Cetinkaya [Tue, 14 Mar 2023 08:20:13 +0000 (09:20 +0100)]
[IncludeCleaner][NFC] Dont rely on implicit conversion of StringRef

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

16 months ago[bazel][libc] Add errno target to function_deps of tests.
Siva Chandra Reddy [Tue, 14 Mar 2023 07:23:07 +0000 (07:23 +0000)]
[bazel][libc] Add errno target to function_deps of tests.

Existing listings in normal deps have been removed.

Reviewed By: akuegel

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

16 months ago[Analysis] Use *{Set,Map}::contains (NFC)
Kazu Hirata [Tue, 14 Mar 2023 07:32:40 +0000 (00:32 -0700)]
[Analysis] Use *{Set,Map}::contains (NFC)

16 months ago[Transforms] Use *{Set,Map}::contains (NFC)
Kazu Hirata [Tue, 14 Mar 2023 07:24:30 +0000 (00:24 -0700)]
[Transforms] Use *{Set,Map}::contains (NFC)

16 months ago[clang] Store the template param list of an explicit variable template specialization
Nathan Ridge [Fri, 27 Jan 2023 07:17:20 +0000 (02:17 -0500)]
[clang] Store the template param list of an explicit variable template specialization

VarTemplateSpecializationDecl does not store a template param list,
so the "template<>" needs to be stored in the ExtInfo.

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

16 months ago[clangd] Fix a bug in TweakTest::decorate()
Nathan Ridge [Tue, 21 Feb 2023 08:22:59 +0000 (03:22 -0500)]
[clangd] Fix a bug in TweakTest::decorate()

The second argument to string::substr() is a count,
not an end position.

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

16 months ago[C++20] [Modules] Profile TemplateName by canonical decl
Chuanqi Xu [Tue, 14 Mar 2023 06:20:44 +0000 (14:20 +0800)]
[C++20] [Modules] Profile TemplateName by canonical decl

Close https://github.com/llvm/llvm-project/issues/61317

The root cause of the problem is that we profile TemplateName by the
non-canonical decls so that the compiler thought they are two different
types. But this is not true. We fixed the issue after we profile the
template name by using the same name.

16 months ago[libc] Enable more functions on riscv64.
Siva Chandra [Tue, 14 Mar 2023 05:47:00 +0000 (05:47 +0000)]
[libc] Enable more functions on riscv64.

The list of headers has also been updated. Some duplicated entrypoints
have been removed.

16 months ago[flang] Use llvm.zext when converting from i1 -> iXX
Valentin Clement [Tue, 14 Mar 2023 05:31:27 +0000 (06:31 +0100)]
[flang] Use llvm.zext when converting from i1 -> iXX

CodeGen used llvm.sext when converting fir.convert %0 : (i1) -> iXX
where iXX is any integer. This leads to wrong values when the initial
i1 is equal to 1.

Reviewed By: PeteSteinfeld

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

16 months ago[libc] Update cross-compilation instructions
Jeff Bailey [Tue, 14 Mar 2023 05:31:01 +0000 (05:31 +0000)]
[libc] Update cross-compilation instructions

 * Add various options so that it uses the build lld and compiler-rt
 * Add instructions on how to use the newly built libc
 * Remove trailing comments in code-block for cut and pastability

Reviewed By: sivachandra

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

16 months ago[Driver] Make -X default for baremetal riscv
Alex Brachet [Tue, 14 Mar 2023 05:17:54 +0000 (05:17 +0000)]
[Driver] Make -X default for baremetal riscv

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

16 months ago[libc] Make libc_errno point to internal errno for non-public builds.
Siva Chandra Reddy [Mon, 13 Mar 2023 22:05:03 +0000 (22:05 +0000)]
[libc] Make libc_errno point to internal errno for non-public builds.

The macro llvmlibc_errno has also been removed. This change completes
the switch to using a hermetic errno for unit tests.

Fixes #61037

Reviewed By: lntue

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

16 months ago[libc] Switch sys/stat implementations over to libc_errno.
Siva Chandra Reddy [Tue, 14 Mar 2023 01:12:11 +0000 (01:12 +0000)]
[libc] Switch sys/stat implementations over to libc_errno.

Reviewed By: lntue

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

16 months ago[clang-format] Recognize Verilog always blocks
sstwcw [Fri, 10 Mar 2023 15:12:13 +0000 (15:12 +0000)]
[clang-format] Recognize Verilog always blocks

The small `Coverage` test was added because we added the space rule
about 2 at signs along with the rule about only 1 of it. We have not
fully covered covergroup yet.

Reviewed By: MyDeveloperDay, owenpan

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

16 months ago[Docs] Added llvm-mc documentation
aabhinavg [Mon, 13 Mar 2023 06:22:00 +0000 (11:52 +0530)]
[Docs] Added llvm-mc documentation

Fix #61313

Reviewed By: lattner

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

16 months ago[PowerPC] remove side effect for some cases for saturate instructions
Chen Zheng [Tue, 7 Mar 2023 02:31:32 +0000 (21:31 -0500)]
[PowerPC] remove side effect for some cases for saturate instructions

Fixes #60684

Reviewed By: nemanjai

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

16 months agoadd testcases for D145353; NFC
Chen Zheng [Mon, 6 Mar 2023 05:28:39 +0000 (00:28 -0500)]
add testcases for D145353; NFC

16 months ago[libc][NFC] Switch nanosleep_test and getcwd_test to libc_errno.
Siva Chandra Reddy [Tue, 14 Mar 2023 01:25:47 +0000 (01:25 +0000)]
[libc][NFC] Switch nanosleep_test and getcwd_test to libc_errno.

16 months ago[libc] Switch termios implementations to libc_errno.
Siva Chandra Reddy [Tue, 14 Mar 2023 01:00:23 +0000 (01:00 +0000)]
[libc] Switch termios implementations to libc_errno.

16 months agoRevert "[LogicCombine 1/?] Implement a general way to simplify logical operations."
chenglin.bi [Tue, 14 Mar 2023 00:59:53 +0000 (08:59 +0800)]
Revert "[LogicCombine 1/?] Implement a general way to simplify logical operations."

This reverts commit 97dcbea63e11d566cff0cd3a758cf1114cf1f633.

16 months ago[ADT][NFCI] Do not use non-const lvalue-refs with enumerate in llvm/
Jakub Kuderski [Tue, 14 Mar 2023 00:48:38 +0000 (20:48 -0400)]
[ADT][NFCI] Do not use non-const lvalue-refs with enumerate in llvm/

Replace references to `enumerate` results with either const lvalue
rerences or structured bindings. I did not use structured bindings
everywhere as it wasn't clear to me it would improve readability.

This is in preparation to the switch to `zip` semantics which won't
support non-const lvalue reference to elements:
https://reviews.llvm.org/D144503.

Reviewed By: dblaikie

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

16 months ago[flang] Accept non-interoperable LOGICAL scalar dummy arguments
Peter Klausler [Mon, 13 Mar 2023 18:02:32 +0000 (11:02 -0700)]
[flang] Accept non-interoperable LOGICAL scalar dummy arguments

Some Fortran compilers allow kinds of LOGICAL other than C_BOOL
for the types of dummy arguments to interoperable (BIND(C))
procedures.  As any kind of LOGICAL can be converted to any
other without loss of information, this seems to be a useful
unambiguous extension that is attested in real codes; accept it
for scalars with a portability warning.

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

16 months ago[libc][NFC] Switch unistd.h tests to libc_errno.
Siva Chandra Reddy [Mon, 13 Mar 2023 23:44:03 +0000 (23:44 +0000)]
[libc][NFC] Switch unistd.h tests to libc_errno.

16 months agollvm-symbolizer: Don't crash when referencing an invalid CU in a dwp file twice
David Blaikie [Tue, 14 Mar 2023 00:49:32 +0000 (00:49 +0000)]
llvm-symbolizer: Don't crash when referencing an invalid CU in a dwp file twice

Previously we'd stash a null pointer in a sorted vector of CUs - the
next time around, we'd try to do a binary search in that vector (sorting
on a key inside the objects pointed to by the elements of the vector)
which would deref null if we'd stashed a null in there previously.

As a reasonable, but not ideal, workaround - don't stash any result in
the vector - this means every query will produce a new warning
(resulting in duplicate warnings) but better than a crash.

Stashing null in the list could be workable if we also stashed the
offset in a pair - but then all the clients would need to be fixed up
(maybe using a filtering iterator) which seems like overkill for this
uncommon error case.

16 months ago[-Wunsafe-buffer-usage] Reducing non-determinism in diagnostics output stream
ziqingluo-90 [Tue, 14 Mar 2023 00:17:30 +0000 (17:17 -0700)]
[-Wunsafe-buffer-usage] Reducing non-determinism in diagnostics output stream

The -Wunsafe-buffer-usage analysis outputs diagnostics in the order of
pointer values to associated `VarDecl`s. This creates non-determinism
in the order of diagnostics in output since the order cannot be
guaranteed in pointer values. However, our fix-it tests were written
under the assumption that diagnostics are output in source location
order.  This results in non-deterministic failures in our tests.  This
patch fixes the problem by keeping analysis results sorted by source
locations.

Reviewed by: jkorous, NoQ

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

16 months ago[lldb] Remove MIPS Linux UnixSignals
Alex Langford [Tue, 14 Mar 2023 00:17:02 +0000 (17:17 -0700)]
[lldb] Remove MIPS Linux UnixSignals

MIPS Linux support was removed in ce03a862372a6f36d2fcf80dc80052aa155fcae8

16 months ago[libc][NFC] Switch sys/*.h tests over to libc_errno.
Siva Chandra Reddy [Mon, 13 Mar 2023 23:43:31 +0000 (23:43 +0000)]
[libc][NFC] Switch sys/*.h tests over to libc_errno.

16 months ago[IRLinker] Fix mapping of declaration metadata
Carl Ritson [Mon, 13 Mar 2023 23:42:22 +0000 (08:42 +0900)]
[IRLinker] Fix mapping of declaration metadata

Ensure metadata for declarations copied during materialization
is properly mapped if declarations do not become definitions.

Reviewed By: tejohnson

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

16 months agoSwitch ABI references to env/environment
Jacob Lambert [Sat, 11 Mar 2023 01:27:43 +0000 (17:27 -0800)]
Switch ABI references to env/environment

To be consistent with Triple.h, we update references to the
optional fourth triple field from ABI to env or enviornment

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

16 months ago[clang][deps] Handle response files in dep scanner
Ben Langmuir [Sat, 11 Mar 2023 05:21:09 +0000 (21:21 -0800)]
[clang][deps] Handle response files in dep scanner

Extract the code the driver uses to expand response files and reuse it
in the dependency scanner.

rdar://106155880

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

16 months ago[libc][NFC] Switch mman.h tests to libc_errno and update Bazel build.
Siva Chandra Reddy [Mon, 13 Mar 2023 22:46:19 +0000 (22:46 +0000)]
[libc][NFC] Switch mman.h tests to libc_errno and update Bazel build.

16 months ago[libc][NFC] Switch startup tests to libc_errno.
Siva Chandra Reddy [Mon, 13 Mar 2023 22:11:32 +0000 (22:11 +0000)]
[libc][NFC] Switch startup tests to libc_errno.

16 months ago[libc][NFC] Switch string and errno tests to libc_errno.
Siva Chandra Reddy [Mon, 13 Mar 2023 22:11:07 +0000 (22:11 +0000)]
[libc][NFC] Switch string and errno tests to libc_errno.

16 months ago[libc][NFC] Switch all uses of errno in math and math tests to libc_errno.
Siva Chandra Reddy [Mon, 13 Mar 2023 22:07:34 +0000 (22:07 +0000)]
[libc][NFC] Switch all uses of errno in math and math tests to libc_errno.

16 months ago[RISCV] Improve SK_Reverse shuffle costs for fixed length vectors
Philip Reames [Mon, 13 Mar 2023 22:10:13 +0000 (15:10 -0700)]
[RISCV] Improve SK_Reverse shuffle costs for fixed length vectors

As noted by @luke (https://reviews.llvm.org/D145953#inline-1409312), we were accounting for the cost of vector element size using vlenb whereas the expression can be constant folded for fixed length vectors.

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

16 months ago[Propeller][ELF] Add Doxygen comment for decodeBBAddrMap
Aiden Grossman [Mon, 13 Mar 2023 21:43:05 +0000 (21:43 +0000)]
[Propeller][ELF] Add Doxygen comment for decodeBBAddrMap

Adds a doxygen comment on decodeBBAddrMap specifying what it does as well
as some requirements that need to be met when calling it (especially
the condition of passing in a relocation section when the ELFFile is
relocatable).

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

16 months ago[ASAN] Extract out a helper routine for foreach lane on vectors [nfc]
Philip Reames [Mon, 13 Mar 2023 21:40:15 +0000 (14:40 -0700)]
[ASAN] Extract out a helper routine for foreach lane on vectors [nfc]

The new API matches a case we also need in MSAN.  For the moment, I'm staging this as a local-to-ASAN commit, but I expect to move this to a shared location and reuse in the next day or two.

16 months ago[lldb] Explicitly import json in TestSymbolFileJSON.py
Jonas Devlieghere [Mon, 13 Mar 2023 21:39:10 +0000 (14:39 -0700)]
[lldb] Explicitly import json in TestSymbolFileJSON.py

The test was relying on the json module getting imported transitively by
one of its imported modules. Make this less brittle by importing it
explicitly.

16 months ago[SPIR-V] Promote arbitrary width ints to regular width
Michal Paszkowski [Mon, 13 Mar 2023 21:26:04 +0000 (22:26 +0100)]
[SPIR-V] Promote arbitrary width ints to regular width

After this patch all arbitrary size integers (smaller than 64 bits) in
LLVM IR will be promoted to regular size type in SPIR-V (OpTypeInt
8/16/32/64).

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

16 months ago[Propeller] Make decoding BBAddrMaps trace through relocations
Aiden Grossman [Sat, 25 Feb 2023 10:18:57 +0000 (10:18 +0000)]
[Propeller] Make decoding BBAddrMaps trace through relocations

Currently when using the LLVM tools (eg llvm-readobj, llvm-objdump) to
find information about basic block locations using the propeller tooling
in relocatable object files function addresses are not mapped properly
which causes problems. In llvm-readobj this means that incorrect
function names will be pulled. In llvm-objdum this means that most BBs
won't show up in the output if --symbolize-operands is used. This patch
changes the behavior of decodeBBAddrMap to trace through relocations
to get correct function addresses if it is going through a relocatable
object file. This fixes the behavior in both tools and also other
consumers of decodeBBAddrMap. Some helper functions have been added
in/refactoring done to aid in grabbing BB address map sections now that
in some cases both relocation and BB address map sections need to be
obtained at the same time.

Regression tests moved around/added.

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

16 months ago[libc] Fix policy CMP0116 warnings for cmake 3.20 or above.
Tue Ly [Mon, 13 Mar 2023 20:14:53 +0000 (16:14 -0400)]
[libc] Fix policy CMP0116 warnings for cmake 3.20 or above.

Warnings due to changes in behavior of cmake 3.20 or above.  See
https://cmake.org/cmake/latest/policy/CMP0116.html

Reviewed By: sivachandra

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

16 months ago[MSAN] Use TypeSize and related utilities [nfc-ish]
Philip Reames [Mon, 13 Mar 2023 20:55:24 +0000 (13:55 -0700)]
[MSAN] Use TypeSize and related utilities [nfc-ish]

This is part of prework for supporting scalable vector types.  This isn't NFC because it shifts the point of failure (i.e. which assert triggers first), but should be NFC for all non-scalable vector inputs.

16 months ago[clang][driver] accept maix32/maix64 gcc compat options
David Tenty [Wed, 8 Mar 2023 20:48:44 +0000 (15:48 -0500)]
[clang][driver] accept maix32/maix64 gcc compat options

GCC on AIX primarily uses the -maix32 and -maix64 to select the bitmode
to target. In order to be compatible with existing build configurations,
clang should accept these options as well. In this patch we implement
these options for AIX targets.

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

16 months ago[MSAN] Remove usage of FixedVectorType where trivial [nfc]
Philip Reames [Mon, 13 Mar 2023 20:05:53 +0000 (13:05 -0700)]
[MSAN] Remove usage of FixedVectorType where trivial [nfc]

This is a prepass on generalizing for scalable vectors; I'm just picking off the easy bits.

16 months agoRevert "[memprof] Record BuildIDs in the raw profile."
Snehasish Kumar [Mon, 13 Mar 2023 20:08:41 +0000 (20:08 +0000)]
Revert "[memprof] Record BuildIDs in the raw profile."

This reverts commit 287177a47a396ca6cc0bef7696108cdaa0c68e5f.

16 months ago[BOLT][NFC] Return instruction list from createInstrIncMemory
Amir Ayupov [Mon, 6 Feb 2023 22:03:40 +0000 (14:03 -0800)]
[BOLT][NFC] Return instruction list from createInstrIncMemory

Leverage move semantics for `std::vector`.

This also makes it consistent with `createInstrumentationSnippet`.

Reviewed By: Elvina

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

16 months ago[flang] Handle parent component in user function argument for special cases
Valentin Clement [Mon, 13 Mar 2023 13:08:20 +0000 (06:08 -0700)]
[flang] Handle parent component in user function argument for special cases

In some cases the argument is already handled by a fir.rebox operation. Just
adapat the type to match the parent component in that case.

Depends on D145928

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

16 months ago[LV][VPlan] Fix printing TripCount liveins. NFC
David Green [Mon, 13 Mar 2023 19:44:12 +0000 (19:44 +0000)]
[LV][VPlan] Fix printing TripCount liveins. NFC

The TripCount liveins would currently be printed as badref in the vplan as they
are not allocated slots in the VPSlotTracker. This patch allocates them a slot
and adds them to the printed Live-Ins. It also makes a minor adjustment to
printing of Live-ins to reduce the empty lines when multiple Live-ins are
present.

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

16 months ago[flang] Handle parent component in user function argument
Valentin Clement [Mon, 13 Mar 2023 19:29:43 +0000 (20:29 +0100)]
[flang] Handle parent component in user function argument

When the argument is a parent component the box needs to
be updated to reflect the correct type. Use `updateBoxForParentComponent`
to update the argument accordingly.

Depends on D145907

Reviewed By: PeteSteinfeld

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

16 months ago[AArchExpandPseudo] Preserve instruction debug number in expansions
Felipe de Azevedo Piovezan [Mon, 13 Mar 2023 14:44:13 +0000 (10:44 -0400)]
[AArchExpandPseudo] Preserve instruction debug number in expansions

This is an initial attempt at preserving debug information in the pseudo
instruction expansion of the AArch backend. In particular, we preserve
the instruction number required by the InstrRef implementation of live
debug values.

There are many other expansions that need to be considered, but the ones
addressed in this commit should be extremely common, as they handle most
arithmetic and logical instructions.

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

16 months ago[memprof] Record BuildIDs in the raw profile.
Snehasish Kumar [Tue, 28 Feb 2023 21:33:30 +0000 (21:33 +0000)]
[memprof] Record BuildIDs in the raw profile.

This patch adds support for recording BuildIds usng the sanitizer
ListOfModules API. We add another entry to the SegmentEntry struct and
change the memprof raw version.

Reviewed By: tejohnson

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

16 months agoRevert "[Libomptarget] Use freestanding stdint.h header for DeviceRTL"
Joseph Huber [Mon, 13 Mar 2023 19:16:13 +0000 (14:16 -0500)]
Revert "[Libomptarget] Use freestanding stdint.h header for DeviceRTL"

This patch breaks the handling of `printf` in the OpenMP library. Usiing
`-ffreestanding` prevents clang from emitting LLVM builtins, which we
use for OpenMP printing support. Shelve this until we have functioning
`printf` in the GPU `libc` and we can remove that code.

This reverts commit a92eaa3ebee6ff85549e8f1c50da4958dbbdcb30.

16 months ago[AArch64][SVE]: custom lower AVGFloor/AVGCeil.
Hassnaa Hamdi [Thu, 23 Feb 2023 16:13:16 +0000 (16:13 +0000)]
[AArch64][SVE]: custom lower AVGFloor/AVGCeil.

-Lower AVGFloor(A, B) to:
 SRL(A) + SRL(B) + (A&B)&1.
-Lower AVGCeil(A, B) to:
 SRL(A) + SRL(B) + (A|B)&1.

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

16 months ago[lldb] Fix lldb code for renaming of OpenCL AVC types.
Joshua Cranmer [Mon, 13 Mar 2023 18:53:55 +0000 (14:53 -0400)]
[lldb] Fix lldb code for renaming of OpenCL AVC types.

16 months ago[IRBuilder] Add utilities for materializing scalable values [nfc]
Philip Reames [Mon, 13 Mar 2023 18:39:00 +0000 (11:39 -0700)]
[IRBuilder] Add utilities for materializing scalable values [nfc]

These idioms already appear a number of places in code, and upcoming changes to the various sanitizers continue to need more instances of the same patterns.

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

16 months ago[BOLT][NFC] Improve performance of MCPlusBuilder::initAliases
Job Noorman [Fri, 10 Mar 2023 20:12:57 +0000 (12:12 -0800)]
[BOLT][NFC] Improve performance of MCPlusBuilder::initAliases

It was using a redundant iteration over super regs to build
SmallerAliasMap. Removing this results in exactly the same alias maps
and a noticeable performance gain on targets with a large number of
registers.

Just anecdotally: on my machine, processing a small AArch64 binary went
from 2.7s down to 80ms.

Reviewed By: Amir

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

16 months ago[docs] Add more complete documentation for -f[no]split-lto-unit
Teresa Johnson [Mon, 13 Mar 2023 16:21:01 +0000 (09:21 -0700)]
[docs] Add more complete documentation for -f[no]split-lto-unit

Option was added in D53891, and only has basic documentation added
later in 5168ddfac44206e94f7ddd484d1cf03dee320fa7. Add more extensive
documentation with links to related docs.

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

16 months ago[GVNHoist] add cast to unbreak windows build
Nick Desaulniers [Mon, 13 Mar 2023 18:22:25 +0000 (11:22 -0700)]
[GVNHoist] add cast to unbreak windows build

Follow up to
commit 831e99fee90e ("[GVNHoist] don't hoist callbr users into the callbr's block")

Looks like MSVC has trouble with llvm::is_contained. Unbreak the build.

Link: https://lab.llvm.org/buildbot/#/builders/127/builds/45021/steps/7/logs/stdio
Reviewed By: hans, kuhar

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

16 months ago[Clang][SPIR-V] Emit target extension types for OpenCL types on SPIR-V.
Joshua Cranmer [Mon, 13 Mar 2023 18:14:12 +0000 (14:14 -0400)]
[Clang][SPIR-V] Emit target extension types for OpenCL types on SPIR-V.

Reviewed By: Anastasia

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

16 months agoRefactor ObjectFilePlaceholder for sharing
Jeffrey Tan [Mon, 13 Mar 2023 16:42:11 +0000 (09:42 -0700)]
Refactor ObjectFilePlaceholder for sharing

This patch refactors PlaceholderObjectFile into ObjectFile plugin directory
so that we can reuse it for other cases like coredump debugging with NT_FILE
notes.

PlaceholderObjectFile is also renamed to ObjectFilePlaceholder to be consistent
with ObjectFile plugin naming convention.

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

16 months ago[RISCV] Extend SK_Broadcast costing to scalable vectors
Philip Reames [Mon, 13 Mar 2023 18:01:19 +0000 (11:01 -0700)]
[RISCV] Extend SK_Broadcast costing to scalable vectors

The existing scalable costing was just bad.  No LMUL cost, no i1 specific costing, etc..  We had updated the fixed cost model, but none of the code is actually fixed length specific.  Moving it down handles the scalable cases too.

16 months ago[mlir] Don't use -z,defs on sanitizer builds
Rahul Kayaith [Mon, 13 Mar 2023 16:42:25 +0000 (12:42 -0400)]
[mlir] Don't use -z,defs on sanitizer builds

This works around link errors when building the python bindings with
ASAN, since the ASAN run-time doesn't get linked into shared libraries.
The ASAN docs specficially call out -z,defs as a potential issue:
https://clang.llvm.org/docs/AddressSanitizer.html#usage

closes https://github.com/llvm/llvm-project/issues/60565

Reviewed By: stellaraccident, mehdi_amini

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

16 months ago[clang-tidy] Support readability-redundant-string-cstr.StringParameterFunctions option
Mike Crowe [Mon, 13 Mar 2023 17:38:34 +0000 (17:38 +0000)]
[clang-tidy] Support readability-redundant-string-cstr.StringParameterFunctions option

Add StringParameterFunctions option to allow the
readability-redundant-string-cstr check to work with library functions
such as fmt::format and spdlog::logger:info that are able to support
std::string arguments in addition to const char * ones.

Depends on D143342

Reviewed By: PiotrZSL

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

16 months ago[mlir][vector] Clarify OOB semantics for `gather` and `scatter`
Jakub Kuderski [Mon, 13 Mar 2023 17:58:11 +0000 (13:58 -0400)]
[mlir][vector] Clarify OOB semantics for `gather` and `scatter`

Reword the vector gather and scatter op description to make it
well-defined to have out-of-bounds indices when the corresponding mask
bits are false.

Update the code sample to avoid relying on C UB semantics to provide
informal semantics for vector.gather.

This change should be consistent with the existing interpretation of the
semantics in the codebase.

Issue: https://github.com/llvm/llvm-project/issues/60905

Reviewed By: dcaballe

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

16 months ago[lld] Use installed llvm_gtest in standalone builds
Michał Górny [Mon, 13 Mar 2023 17:22:31 +0000 (18:22 +0100)]
[lld] Use installed llvm_gtest in standalone builds

Use the installed llvm_gtest library instead of rebuilding it locally
when standalone builds are used.  This change is now required
as otherwise the build fails due to duplicate llvm_gtest target.
This is based on 82169103958583d3320b3a9a1e6542e8d32ef8da in clang.

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

16 months ago[SystemZ] NFC minor cleanup
Jonas Paulsson [Mon, 13 Mar 2023 17:52:09 +0000 (18:52 +0100)]
[SystemZ] NFC minor cleanup

Don't create local pointers to Subtarget in places in SystemZTargetLowering
as the class already has a Subtarget member.

Review: Ulrich Weigand