platform/upstream/llvm.git
17 months ago[NFC] Deprecate SelectionDag::getLoad that takes alignment as
Guillaume Chatelet [Mon, 23 Jan 2023 10:08:01 +0000 (10:08 +0000)]
[NFC] Deprecate SelectionDag::getLoad that takes alignment as
unsigned

17 months ago[FPEnv] Fix complex operations in strictfp mode
Serge Pavlov [Fri, 13 Jan 2023 15:32:10 +0000 (22:32 +0700)]
[FPEnv] Fix complex operations in strictfp mode

Operations on floating-point complex data had incorrect FP attributes
in strictfp mode, because IRBuilder object was not synchronized with AST
node attributes.

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

17 months ago[7/15][Clang][RISCV][NFC] Correct the default value for Policy to TAMU
eopXD [Sat, 14 Jan 2023 13:19:49 +0000 (05:19 -0800)]
[7/15][Clang][RISCV][NFC] Correct the default value for Policy to TAMU

The default value is set to `Omit`, but in fact the value is then
assigned in `updateNamesAndPolicy`, which is set to TUMU when masked and
TAMU when unmasked. This commit demonstrates so and further remove
another dependency of `Omit`.

This is the 7th commit of a patch-set that aims to change the default policy
for RVV intrinsics from TAMU to TAMA.

Please refer to the cover letter in the 1st commit (D141573) for an
overview.

Reviewed By: craig.topper, kito-cheng

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

17 months ago[flang] Support polymorphic input array for PACK intrinsic
Valentin Clement [Tue, 24 Jan 2023 09:18:55 +0000 (10:18 +0100)]
[flang] Support polymorphic input array for PACK intrinsic

When `ARRAY` is polymorphic, the result needs to carry over
the dynamic type information. This patch updates the lowering
to make the result polymorphic when needed.

Reviewed By: jeanPerier

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

17 months ago[AArch64][SME2] Add Multi-vector saturating extract narrow and interleave intrinsics
Caroline Concatto [Mon, 23 Jan 2023 18:01:48 +0000 (18:01 +0000)]
[AArch64][SME2] Add Multi-vector saturating extract narrow and interleave intrinsics

 Add the following intrinsic:
      SQCVTN
      SQCVTUN
      UQCVTN

 NOTE: These intrinsics are still in development and are subject to future changes.

Reviewed By: kmclaughlin

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

17 months ago[InstCombine] trunc (fptoui|fptosi)
Samuel Parker [Tue, 24 Jan 2023 09:07:37 +0000 (09:07 +0000)]
[InstCombine] trunc (fptoui|fptosi)

Attempt to fold the trunc into the fp-to-int conversion.

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

17 months ago[gn build] Port a2b3ab8f7786
LLVM GN Syncbot [Tue, 24 Jan 2023 09:09:28 +0000 (09:09 +0000)]
[gn build] Port a2b3ab8f7786

17 months ago[6/15][Clang][RISCV][NFC] Instructions with a mask destination register is always...
eopXD [Tue, 24 Jan 2023 08:45:11 +0000 (00:45 -0800)]
[6/15][Clang][RISCV][NFC] Instructions with a mask destination register is always tail agnostic

The logic under `computeBuiltinTypes` is an amendment to setting Policy as
`Omit`. The tail policy should be set to agnostic for those intrinsics that
has `HasTailPolicy = false`, which are the intrinsics with a mask destination
register.

This is the 6th commit of a patch-set that aims to change the default policy
for RVV intrinsics from TAMU to TAMA.

Please refer to the cover letter in the 1st commit (D141573) for an
overview.

Reviewed By: craig.topper, kito-cheng

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

17 months ago[libc++][ranges] implement `std::ranges::split_view`
Hui [Wed, 18 Jan 2023 23:26:34 +0000 (23:26 +0000)]
[libc++][ranges] implement `std::ranges::split_view`

- implement `std::ranges::split_view` (last c++20 view)
- Work in process on testing iterator/sentinel, but since we are
getting closer to the deadline, I'd like to send the review early

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

17 months ago[AMDGPU] Add missing physical register check in SIFoldOperands::tryFoldLoad
Yashwant Singh [Tue, 24 Jan 2023 08:52:01 +0000 (14:22 +0530)]
[AMDGPU] Add missing physical register check in SIFoldOperands::tryFoldLoad

tryFoldLoad() is not meant to work on physical registers moreover
use_nodbg_instructions(reg) makes the compiler buggy when called with
physical reg

Fix for SWDEV-373493

Reviewed By: arsenm

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

17 months ago[clang][Lex] Add back PPCallbacks::FileNotFound
Jonas Hahnfeld [Fri, 20 Jan 2023 10:13:44 +0000 (11:13 +0100)]
[clang][Lex] Add back PPCallbacks::FileNotFound

This callback was removed with commit 7a124f4859, but we use it
downstream in ROOT/Cling to implement handling of a special include
syntax. Add back a "safe" version of the callback that only takes
the file name and return a bool to silently skip the file.

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

17 months ago[mlir][FuncToLLVM] Fix arg attr memref interaction
Christian Ulmann [Tue, 24 Jan 2023 08:44:29 +0000 (09:44 +0100)]
[mlir][FuncToLLVM] Fix arg attr memref interaction

This commit ensures that argument attributes are dropped from types
that are expanded to multiple function arguments. Previously, they
were attached to all arguments belonging to the memref, which
resulted in illegal LLVMIR, e.g., noalias on integers.

Reviewed By: gysit

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

17 months ago[NFC] Use new version of SelectionDAG::getLoad in NVPTXLowerFormalArguments
Guillaume Chatelet [Mon, 16 Jan 2023 09:55:47 +0000 (09:55 +0000)]
[NFC] Use new version of SelectionDAG::getLoad in NVPTXLowerFormalArguments

Let's use the new version of the API that helps tighten the alignment
values Semantic.

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

17 months ago[mlir][linalg] Convert tensor.pad to destination style
Matthias Springer [Tue, 24 Jan 2023 08:23:39 +0000 (09:23 +0100)]
[mlir][linalg] Convert tensor.pad to destination style

This can be a pre-processing for bufferization and allows for more efficient lowerings without an alloc.

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

17 months ago[cmake] Stop using add_definitions
Jay Foad [Mon, 23 Jan 2023 15:04:23 +0000 (15:04 +0000)]
[cmake] Stop using add_definitions

Since CMake 3.12 this has been superseded by add_compile_definitions and
other commands.

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

17 months ago[cmake] Remove AddLLVMDefinitions
Jay Foad [Mon, 23 Jan 2023 15:00:43 +0000 (15:00 +0000)]
[cmake] Remove AddLLVMDefinitions

This has been unused since D31125.

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

17 months ago[mlir][linalg] Convert tensor.generate to destination style
Matthias Springer [Tue, 24 Jan 2023 08:10:32 +0000 (09:10 +0100)]
[mlir][linalg] Convert tensor.generate to destination style

This can be a pre-processing for bufferization and allows for more efficient lowerings without an alloc.

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

17 months ago[5/15][Clang][RISCV][NFC] Remove extra attribute Policy::IntrinsicWithoutMU by reusin...
eopXD [Sat, 14 Jan 2023 11:58:35 +0000 (03:58 -0800)]
[5/15][Clang][RISCV][NFC] Remove extra attribute Policy::IntrinsicWithoutMU by reusing HasTailPolicy and HasMaskPolicy

Righteously there shouldn't be any special cases here because
`HasTailPolicy` and `HasMaskPolicy` is able to express necessary cases.
This commit is a part of the step-by-step effort to remove
`Policy::Scheme::Omit`, which completely does not make sense in RVV 1.0
because an RVV instruction always executes with `vta` and `vma` set
to a certain value.

This is the 5th commit of a patch-set that aims to change the default policy
for RVV intrinsics from TAMU to TAMA.

Please refer to the cover letter in the 1st commit (D141573) for an
overview.

Reviewed By: craig.topper, kito-cheng

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

17 months ago[4/15][Clang][RISCV][NFC] Remove unnecessary logic under RVVIntrinsic::computeBuiltin...
eopXD [Sat, 7 Jan 2023 09:04:26 +0000 (01:04 -0800)]
[4/15][Clang][RISCV][NFC] Remove unnecessary logic under RVVIntrinsic::computeBuiltinTypes

`PolicyAttrs::IsUnspecified` is modified in
`RVV::Intrinsic::computeBuiltInTypes` and used under
`RVVIntrinsic::updateNamesAndPolicy`. Suprisingly the modification
in `RVV::Intrinsic::computeBuiltInTypes` is completely unnecessary.
This commit removes the redundant logic.

This is the 4th commit of a patch-set that aims to change the default policy
for RVV intrinsics from TAMU to TAMA.

Please refer to the cover letter in the 1st commit (D141573) for an
overview.

Reviewed By: craig.topper

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

17 months ago[3/15][Clang][RISCV][NFC] Clarify edge cases of RVVIntrinsic::getSupportedMaskedPolic...
eopXD [Sat, 7 Jan 2023 08:17:08 +0000 (00:17 -0800)]
[3/15][Clang][RISCV][NFC] Clarify edge cases of RVVIntrinsic::getSupportedMaskedPolicies for clarity

This is the 3rd commit of a patch-set that aims to change the default policy
for RVV intrinsics from TAMU to TAMA.

Please refer to the cover letter in the 1st commit (D141573) for an
overview.

Reviewed By: kito-cheng

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

17 months ago[2/15][Clang][RISCV][NFC] Rename Policy::IsPolicyNone to IsUnspecifed
eopXD [Sat, 7 Jan 2023 08:05:41 +0000 (00:05 -0800)]
[2/15][Clang][RISCV][NFC] Rename Policy::IsPolicyNone to IsUnspecifed

The original naming is inaccurate. An RVV intrinsic always comes with
a corresponding policy behavior. When the policy is unspecified for an
intrinsic, its policy behavior should be it's default assumption.

This is the 2nd commit of a patch-set that aims to change the default policy
for RVV intrinsics from TAMU to TAMA.

Please refer to the cover letter in the 1st commit (D141573) for an
overview.

Reviewed By: kito-cheng

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

17 months ago[1/15][Clang][RISCV][NFC] Extract common utility to RISCVVIntrinsicUtils
eopXD [Thu, 5 Jan 2023 11:37:37 +0000 (03:37 -0800)]
[1/15][Clang][RISCV][NFC] Extract common utility to RISCVVIntrinsicUtils

This is the 1st commit of a patch-set that aims to change the default policy
for RVV intrinsics from TAMU to TAMA.

The patch-set work towards the simplification proposal [0] of Nick
Knight. After this patch-set, all intrinsics operates under a general
assumption that the policy behavior is agnostic.

You may find that most of the patches are NFC patches. They subtly remove
implicit assumptions that entangles the codebase, making the singular patch
that contains functional change clear and obvious.

In [2/15], The attribute `Policy::IsPolicyNone` may give the mis-perception
that an RVV intrinsic may operate without any policy. However this is not the
case because the policy CSR-s (`vta` and `vma`) always affect an RVV
instruction's behavior, except that some instructions have policy always set
as agnostic (e.g. instructions with a mask destination register is always
tail agnostic).

Next, to perform the change from TAMU to TAMA, we need to first remove
`Policy::PolicyType::Omit`. [4/15] ~ [12/15] removes it with NFC patches step
by step. Without the patches, directly applying [14/15] to the existing codebase
will not work because there will be complicated logics that are scattered in
places that is hard to maintain.

[1/15], [3/15] are not related to the main goal of this patch-set, they were
clean-up along the way as I was going through the codebase. [13/15] is a
clean-up that was an oversight in D141198.

Finally, [14/15] performs the functional change this patch-set aims for. The
default policy is changed from TAMU to TAMA. This affects the masked version of
the intrinsics without a policy suffix. The masked-off operand is removed. Due
to the removal, masked version of `vid` and `viota` intrinsics are no longer
available for overloading.

[15/15] is a final commit to set data members of `Policy` as constants. Through
the refactoring the class `Policy` is now correct-by-construction.

The next patch-set will be to remove redundant intrinsics with a policy suffix
`_ta` and `_tama` intrinsics are redundant and will be removed. Other policy
suffix will be renamed to adapt to the general assumption that policy is
generally agnostic.

[0] https://gist.github.com/nick-knight/6cb0b74b351a25323dfb1821d3a269b9

Pull Request: riscv-non-isa/rvv-intrinsic-doc#186

Reviewed By: craig.topper, kito-cheng

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

17 months ago[7/7][Clang][RISCV][NFC] Remove attribute `IsPrototypeDefaultTU`
eopXD [Wed, 4 Jan 2023 07:10:25 +0000 (23:10 -0800)]
[7/7][Clang][RISCV][NFC] Remove attribute `IsPrototypeDefaultTU`

This is the 7th commit of a patch-set that aims to remove the
IsPrototypeDefaultTU special case for the rvv-intrinsics.

This is the final commit of the patch-set. Now that no intrinsics is
using the attribute, we are safe to remove it.

Please refer to the cover letter in the 1st commit (D140895) for an
overview.

Reviewed By: craig.topper

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

17 months ago[6/7][Clang][RISCV] Remove default tail-undisturbed for vmv_s_x and vfmv_s_f intrinsics
eopXD [Tue, 3 Jan 2023 05:43:56 +0000 (21:43 -0800)]
[6/7][Clang][RISCV] Remove default tail-undisturbed for vmv_s_x and vfmv_s_f intrinsics

The destination parameter is removed for non-policy unmasked intrinsics.

The default policy for non-policy (implicit) vmv_s_x and vfmv_s_f
intrinsics will be tail agnostic and mask undisturbed.

Upon change of prototype, vmv_s_x and vfmv_s_f is no longer able to
have an overloading version for its non-policy and tail agnostic
intrinsics.

This is the 6th commit of a patch-set that aims to remove the
IsPrototypeDefaultTU special case for the rvv-intrinsics.

Please refer to the cover letter in the 1st commit (D140895) for an
overview.

Reviewed By: craig.topper

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

17 months ago[5/7][Clang][RISCV] Remove default tail-undisturbed for vcompress intrinsics
eopXD [Tue, 3 Jan 2023 05:35:07 +0000 (21:35 -0800)]
[5/7][Clang][RISCV] Remove default tail-undisturbed for vcompress intrinsics

The destination parameter is removed for non-policy unmasked intrinsics.

The default policy for non-policy (implicit) vcompress intrinsics will
be tail agnostic and mask undisturbed.

This is the 5th commit of a patch-set that aims to remove the
IsPrototypeDefaultTU special case for the rvv-intrinsics.

Please refer to the cover letter in the 1st commit (D140895) for an
overview.

Reviewed By: craig.topper

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

17 months ago[4/7][Clang][RISCV] Remove default tail-undisturbed for multiply-add intrinsics
eopXD [Tue, 3 Jan 2023 05:19:12 +0000 (21:19 -0800)]
[4/7][Clang][RISCV] Remove default tail-undisturbed for multiply-add intrinsics

The destination parameter is still needed as the computation requires
so.

The default policy for non-policy (implicit) vslideup intrinsics
will be tail agnostic and mask undisturbed.

This is the 4th commit of a patch-set that aims to remove the
IsPrototypeDefaultTU special case for the rvv-intrinsics.

Please refer to the cover letter in the 1st commit (D140895) for an overview.

Reviewed By: craig.topper

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

17 months ago[3/7][Clang][RISCV] Remove default tail-undisturbed for vslidedown intrinsics
eopXD [Tue, 3 Jan 2023 10:37:10 +0000 (02:37 -0800)]
[3/7][Clang][RISCV] Remove default tail-undisturbed for vslidedown intrinsics

The destination parameter is removed for non-policy unmasked vslidedown
intrinsics.

The default policy for non-policy (implicit) vslidedown intrinsics will
be tail agnostic and mask undisturbed.

This is the 3rd commit of a patch-set that aims to remove the
IsPrototypeDefaultTU special case for the rvv-intrinsics.

Please refer to the cover letter in the 1st commit (D140895) for an
overview.

Reviewed By: craig.topper

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

17 months ago[2/7][Clang][RISCV] Remove default tail-undisturbed for vslideup intrinsics
eopXD [Tue, 3 Jan 2023 04:06:42 +0000 (20:06 -0800)]
[2/7][Clang][RISCV] Remove default tail-undisturbed for vslideup intrinsics

The destination parameter is still needed as elements of
0 <  i < max(vstart, OFFSET) in vd remains unchanged.

The default policy for non-policy (implicit) vslideup intrinsics
will be tail agnostic and mask undisturbed.

This is the 2nd commit of a patch-set that aims to remove the
IsPrototypeDefaultTU special case for the rvv-intrinsics.

Please refer to the cover letter in the 1st commit (D140895) for an overview.

Reviewed By: craig.topper

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

17 months ago[1/7][Clang][RISCV] Remove default tail-undisturbed for vector reduction intrinsics
eopXD [Tue, 3 Jan 2023 03:49:29 +0000 (19:49 -0800)]
[1/7][Clang][RISCV] Remove default tail-undisturbed for vector reduction intrinsics

The destination parameter is removed for non-policy unmasked intrinsics,
they are now tail agnostic. The non-policy masked intrinsics are tail
agnostic and masked undisturbed, just like normal instructions like
vadd.

This is the 1st commit of a patch-set that aims to remove the
`IsPrototypeDefaultTU` special case for the rvv-intrinsics.

The patch-set work towards the simplification proposal [0] of Nick
Knight, the plan is that after this patch-set, all non-policy
intrinsics will be aligned with default policy behavior of tail
agnostic and mask undisturbed. Then the next patch-set will aim
towards changing non-policy intrinsics to tail agnostic and mask
agnostic.

[0] https://gist.github.com/nick-knight/6cb0b74b351a25323dfb1821d3a269b9

Pull Request: riscv-non-isa/rvv-intrinsic-doc#186

Reviewed By: craig.topper

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

17 months ago[llvm] Use llvm::countr_zero instead of findFirstSet (NFC)
Kazu Hirata [Tue, 24 Jan 2023 07:07:41 +0000 (23:07 -0800)]
[llvm] Use llvm::countr_zero instead of findFirstSet (NFC)

At each call to findFirstSet in this patch, the argument is known to
be nonzero, so we can safely switch to llvm::countr_zero, which will
become std::countr_zero once C++20 is available.

17 months ago[SystemZ] Use isShiftedMask_64 instead of isStringOfOnes (NFC)
Kazu Hirata [Tue, 24 Jan 2023 06:48:42 +0000 (22:48 -0800)]
[SystemZ] Use isShiftedMask_64 instead of isStringOfOnes (NFC)

isStringOfOnes does the same thing as isShiftedMask_64, provided that
the parameter is nonzero, which is the case for both calls in this
patch.

17 months ago[Attributor] Allow (inter-procedural) "CFG" reasoning for aligned regions
Johannes Doerfert [Tue, 24 Jan 2023 03:53:12 +0000 (19:53 -0800)]
[Attributor] Allow (inter-procedural) "CFG" reasoning for aligned regions

If an instruction is executed in an aligned region we can ignore
threading effects and use CFG reasoning (dominance and reachability).
This is true because all threads are together in an aligned region and
there cannot be one waiting for a signal at a place not connected via
the control flow.

More dedicated tests will follow.

More details can be found here:
"Co-Designing an OpenMP GPU Runtime and Optimizations for Near-Zero
Overhead Execution", IPDPS 2022,
https://www.osti.gov/servlets/purl/1890094

17 months ago[OpenMP] Readnone calls do not have non-local side-effects
Johannes Doerfert [Tue, 24 Jan 2023 03:46:38 +0000 (19:46 -0800)]
[OpenMP] Readnone calls do not have non-local side-effects

17 months ago[OpenMP] Run the Attributor as part of the device runtime optimization
Johannes Doerfert [Tue, 24 Jan 2023 03:45:06 +0000 (19:45 -0800)]
[OpenMP] Run the Attributor as part of the device runtime optimization

This will help us propagate assumptions to call sites, among other
things.

17 months ago[Clang][NFC] Remove a redundancy check in Sema::adjustMemberFunctionCC
Shivam Gupta [Tue, 24 Jan 2023 06:25:54 +0000 (11:55 +0530)]
[Clang][NFC] Remove a redundancy check in Sema::adjustMemberFunctionCC

If the current calling convection CurCC is not equal to Target calling
convection ToCC and current calling convention (CurCC) is equal to the
default calling convention (DefaultCC), that means DefaultCC can not be
equal to ToCC so the right part of the expression DefaultCC == ToCC is
not needed.

revelant code -
  if (CurCC == ToCC)
    return;
  if (CurCC != DefaultCC || DefaultCC == ToCC)
    return;

Found by PVS-Studio - https://pvs-studio.com/en/blog/posts/cpp/1003/, N41.

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

17 months agoOpting out of Clang 16 ABI Changes for AIX and z/OS
Nicole Rabjohn [Tue, 24 Jan 2023 05:00:27 +0000 (00:00 -0500)]
Opting out of Clang 16 ABI Changes for AIX and z/OS

There is already a GCC compatibility gap on AIX, & GCC compatibility is
not a concern on z/OS. GCC compatibility is not sufficient motivation
for breaking ABI on AIX and z/OS. This opts out of changes introduced in
https://reviews.llvm.org/D119051. For AIX only, also opt out of D117616
(which z/OS had picked up at the time ABI stabilization occurred).

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

17 months ago[AMDGPU][NFC] Apply new naming convention for feature fmacf64
Mariusz Sikora [Mon, 23 Jan 2023 06:13:02 +0000 (07:13 +0100)]
[AMDGPU][NFC] Apply new naming convention for feature fmacf64

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

17 months ago[IndVars] Improve handling of multi-exit loops with known symbolic counts
Max Kazantsev [Tue, 24 Jan 2023 05:46:48 +0000 (12:46 +0700)]
[IndVars] Improve handling of multi-exit loops with known symbolic counts

This patch does two things, both related to support of multi-exit loops with
many exits that have known symbolic max exit count. They can theoretically
go independently, but I don't know how to write a test showing separate
impact.

Part 1: `SkipLastIter` can be set to `true` not when a particular exit has exit
count same as the whole loop (and therefore it must exit on the last iteration),
but when the aggregate of first few exits has umin same as whole loop exit count.
It means that it's not known which of them will exit exactly, but one of them will.

Part 2: when `SkipLastIter` is set, and exit count is `umin(a, b, c)`, instead of
`umin(a, b, c) - 1` use `umin(a - 1, b - 1, c - 1)`. We don't care about overflows
here, but the further logic knows how to deal with umin by element, but the
`SCEVAddExpr` node will confuse it.

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

17 months ago[IndVars] Apply more optimistic SkipLastIter for AND/OR conditions
Max Kazantsev [Tue, 24 Jan 2023 05:17:33 +0000 (12:17 +0700)]
[IndVars] Apply more optimistic SkipLastIter for AND/OR conditions

When exit by condition `C1` dominates exit by condition `C2`, and
max symbolic exit count for `C1` matches those for loop, we will
apply more optimistic logic to `C2` by setting `SkipLastIter` for it,
meaning that it will do 1 iteration less because the dominating branch
must exit on the last loop iteration.

But when we have a single exit by condition `C1 & C2`, we cannot
apply the same logic, because there is no dominating condition.

However, if we can prove that the symbolic max exit count of `C1 & C2`
matches those of `C1`, it means that for `C2` we can assume that it
doesn't matter on the last iteration (because the whole thing is `false`
because `C1` must be `false`). Therefore, in this situation, we can handle
`C2` as if it had `SkipLastIter`.

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

17 months ago[MLIR] Add LocationAttr declarations to ODS
Andrew Young [Tue, 24 Jan 2023 04:08:35 +0000 (20:08 -0800)]
[MLIR] Add LocationAttr declarations to ODS

This commit adds location attributes and arrays of locations to OpBase.td.
Using LocationAttrs directly in an operation is useful when the location does
not correspond 1-1 to an operation or value in the IR.  We use this in CIRCT to
store the declaration location of result ports of HWModule operations.

Reviewed By: rriddle

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

17 months ago[Attributor] Check assumptions to improve `isAlignedBarrier` queries
Johannes Doerfert [Tue, 24 Jan 2023 03:41:02 +0000 (19:41 -0800)]
[Attributor] Check assumptions to improve `isAlignedBarrier` queries

17 months ago[Attributor] Allow to delete (assume) intrinsics outside the SCC
Johannes Doerfert [Tue, 24 Jan 2023 03:40:17 +0000 (19:40 -0800)]
[Attributor] Allow to delete (assume) intrinsics outside the SCC

17 months ago[Attributor][FIX] Ensure not to run new queries during manifest
Johannes Doerfert [Tue, 24 Jan 2023 03:58:20 +0000 (19:58 -0800)]
[Attributor][FIX] Ensure not to run new queries during manifest

If we modified the IR during manifest, e.g., SPMDzation, we might end up
with un-cached reachability queries. This is not good as the result is
going to be optimistic. We now cache the updateImpl result and use it
during manifest.

Bug was exposed in a follow up extension.

17 months ago[Attributor][FIX] Reachability needs to process the entire worklist
Johannes Doerfert [Tue, 24 Jan 2023 03:38:46 +0000 (19:38 -0800)]
[Attributor][FIX] Reachability needs to process the entire worklist

17 months ago[Attributor][FIX] Replace typo with something more sane
Johannes Doerfert [Tue, 24 Jan 2023 04:09:09 +0000 (20:09 -0800)]
[Attributor][FIX] Replace typo with something more sane

17 months ago[mlir] support !shape.value_shape when replace WithOp in OutlineShapeComputationPass.
Xiang Li [Sat, 21 Jan 2023 06:50:40 +0000 (01:50 -0500)]
[mlir] support !shape.value_shape when replace WithOp in OutlineShapeComputationPass.

Fixes #60069  https://github.com/llvm/llvm-project/issues/60069

In case like:
  %1 = shape.with_shape %arg1, %0 : !shape.value_shape, !shape.shape
  %2 = shape.value_of %1 : tensor<?xf32>
cannot replace %2 with %arg1.
Transform it into
  %2 = shape.value_of %arg1 : tensor<?xf32>

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

17 months agoRevert "[Fuchsia] Build windows runtimes using cross compilation on Linux"
Haowei Wu [Tue, 24 Jan 2023 02:43:23 +0000 (18:43 -0800)]
Revert "[Fuchsia] Build windows runtimes using cross compilation on Linux"

This reverts commit 20bb7658f53b0b8db165ff4d404ede3f9b34862d.
It breaks Fuchsia stage2 builders.

17 months ago[bugpoint] Fix compilation of bugpoint-passes on Windows
Alexey Bader [Tue, 24 Jan 2023 01:19:26 +0000 (17:19 -0800)]
[bugpoint] Fix compilation of bugpoint-passes on Windows

Bugpoint also depends on libLLVMSupport.dll for 'llvm_unreachable'

Reviewed By: beanz

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

17 months agoRevert "[profile] Disable test which needs update after D141512"
Vitaly Buka [Tue, 24 Jan 2023 01:05:59 +0000 (17:05 -0800)]
Revert "[profile] Disable test which needs update after D141512"

Work around with -fno-slp-vectorize.

This reverts commit 31260a4ce43aab7c04f501095a9032de063ccaf9.

17 months ago[libc++] Fix installation path for the modulemap
Louis Dionne [Mon, 23 Jan 2023 15:19:27 +0000 (10:19 -0500)]
[libc++] Fix installation path for the modulemap

As pointed out in a post-commit comment of https://reviews.llvm.org/rGd00e035a4270.

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

17 months ago[libc][NFC] Another round of replacement of static inline with LIBC_INLINE.
Siva Chandra Reddy [Mon, 23 Jan 2023 18:18:08 +0000 (18:18 +0000)]
[libc][NFC] Another round of replacement of static inline with LIBC_INLINE.

Reviewed By: lntue

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

17 months ago[HWASAN] Fix PointsIntoChunk to untag pointers. Also added some checks where we know...
Kirill Stoimenov [Mon, 23 Jan 2023 17:55:53 +0000 (17:55 +0000)]
[HWASAN] Fix PointsIntoChunk to untag pointers. Also added some checks where we know that the pointer should be untagged.

Reviewed By: vitalybuka

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

17 months agoRe-apply [build] Fix stand-alone builds of clang.
Francesco Petrogalli [Tue, 24 Jan 2023 00:25:26 +0000 (01:25 +0100)]
Re-apply [build] Fix stand-alone builds of clang.

This reverts commit 0e09bb8b143c80426c497a924ee4fa57a26af6b5.

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

17 months agoRevert "[build] Fix stand-alone builds of clang."
Francesco Petrogalli [Tue, 24 Jan 2023 00:23:41 +0000 (01:23 +0100)]
Revert "[build] Fix stand-alone builds of clang."

There is a typo in the cmake configuration. It should be
RISCVTargetParserTableGen, not RISCVTargetParserTablegen.

This reverts commit 5d02e38f56dfa6c46dd71658c185582af1ffb07b.

17 months ago[WoA] Use fences for sequentially consistent stores/writes
Nadeem, Usman [Mon, 23 Jan 2023 19:13:58 +0000 (11:13 -0800)]
[WoA] Use fences for sequentially consistent stores/writes

LLVM currently uses LDAR/STLR and variants for acquire/release
as well as seq_cst operations. This is fine as long as all code uses
this convention.

Normally LDAR/STLR act as one way barriers but when used in
combination they provide a sequentially consistent model. i.e.
when an LDAR appears after an STLR in program order the STLR
acts as a two way fence and the store will be observed before
the load.

The problem is that normal loads (unlike ldar), when they appear
after the STLR can be observed before STLR (if my understanding
is correct). Possibly providing weaker than expected guarantees if
they are used for ordered atomic operations.

Unfortunately in Microsoft Visual Studio STL seq_cst ld/st are
implemented using normal load/stores and explicit fences:
dmb ish + str + dmb ish
ldr + dmb ish

This patch uses fences for MSVC target whenever we write to the
memory in a sequentially consistent way so that we don't rely on
the assumptions that just using LDAR/STLR will give us sequentially
consistent ordering.

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

Change-Id: I48f3500ff8ec89677c9f089ce58181bd139bc68a

17 months ago[NFC][WoA] Precommit test for aarch64 atomics
Nadeem, Usman [Sat, 14 Jan 2023 04:16:39 +0000 (20:16 -0800)]
[NFC][WoA] Precommit test for aarch64 atomics

This copies the atomic-ops file.
Committed without review.

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

Change-Id: I7d7b05339d9ca23f88848c56f73a3e4d3e1abeba

17 months ago[Sanitizer] Make GetBlockBeginFastLocked parameters const.
Kirill Stoimenov [Mon, 23 Jan 2023 23:59:56 +0000 (23:59 +0000)]
[Sanitizer] Make GetBlockBeginFastLocked parameters const.

Reviewed By: vitalybuka

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

17 months ago[HWASAN] Fix memory leaks in tests.
Kirill Stoimenov [Mon, 23 Jan 2023 23:56:41 +0000 (23:56 +0000)]
[HWASAN] Fix memory leaks in tests.

Reviewed By: vitalybuka

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

17 months ago[Clang][NFC] Fix documentation and remove unused tool
Joseph Huber [Mon, 23 Jan 2023 23:56:22 +0000 (17:56 -0600)]
[Clang][NFC] Fix documentation and remove unused tool

Summary:
I removed some documentation but not its Sphinx index, this fixes that.
Also I realized that we had a tool in the header still around so that's
gone too.

17 months ago[build] Fix stand-alone builds of clang.
Francesco Petrogalli [Mon, 23 Jan 2023 23:56:37 +0000 (00:56 +0100)]
[build] Fix stand-alone builds of clang.

The target RISCVTargetParserTablegen needs to be visible for stand-alone [1] builds of clang to prevent configuration failures.

[1] https://llvm.org/docs/GettingStarted.html#stand-alone-builds

Reviewed By: tstellar

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

17 months ago[NFC] Add missing llvm:: specifier
Scott Linder [Mon, 23 Jan 2023 23:50:44 +0000 (23:50 +0000)]
[NFC] Add missing llvm:: specifier

This was omitted in 25c0ea2a5370813f46686918a84e0de27e107d08

17 months ago[NFC] Use int underlying type for CodeGenOpt::Level
Scott Linder [Mon, 23 Jan 2023 23:26:11 +0000 (23:26 +0000)]
[NFC] Use int underlying type for CodeGenOpt::Level

In practice the change from an unspecified underlying type to uint8_t in
25c0ea2a5370813f46686918a84e0de27e107d08 means some builds break due to
ambiguity resolving operator<< on ostreams (I assume because they define
uint8_t differently).

There were also valid points raised on the review saying that we can
just use int here anyway. Pinning it to any type removes the potential
for UB when constructing it, and int is the de-facto default.

17 months ago[Support] revert accidentally removed "std::" specifiers
Sanjay Patel [Mon, 23 Jan 2023 23:29:30 +0000 (18:29 -0500)]
[Support] revert accidentally removed "std::" specifiers

This snuck into e76c95fb40b1 but wasn't intended.
Note: for some reason, these prefixes are causing build failures
on a macOS XCode project of LLVM.

17 months agoCoroFrame: Fix missing bitcast for some frame merges
Matthias Braun [Mon, 23 Jan 2023 17:54:15 +0000 (09:54 -0800)]
CoroFrame: Fix missing bitcast for some frame merges

The code to adjust types when merging fields on the coroutine frame
accidentally used `GetElementPtrInst::getResultElementType()` which does
the return the type the resulting pointer points to (so misses a pointer
type). This worked most of the time by accident because the type nearly
never matched, but failed to add a necessary bitcast for from `i8**` to
`i8*`.

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

17 months ago[Libomptarget] Use the nextgen plugins by default.
Joseph Huber [Mon, 23 Jan 2023 21:06:44 +0000 (15:06 -0600)]
[Libomptarget] Use the nextgen plugins by default.

The next-gen plugins are complete drop-in replacements for the old
versions. We should strive to replace the old ones as quickly as
possible now that we have a viable alternative.

The only test failing is the `prelock.cpp` test as the support has not landed in
the next-gen plugins.

Reviewed By: JonChesterfield

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

17 months ago[InstCombine] allow matching vector types for icmp-of-mask/cast
Sanjay Patel [Mon, 23 Jan 2023 22:58:10 +0000 (17:58 -0500)]
[InstCombine] allow matching vector types for icmp-of-mask/cast

Also use a more specific matcher to simplify the mask
compare to type size.

17 months ago[InstCombine] relax one-use check for icmp with mask/cast
Sanjay Patel [Mon, 23 Jan 2023 22:46:14 +0000 (17:46 -0500)]
[InstCombine] relax one-use check for icmp with mask/cast

17 months ago[InstCombine] add tests for masked/casted icmp; NFC
Sanjay Patel [Mon, 23 Jan 2023 22:45:18 +0000 (17:45 -0500)]
[InstCombine] add tests for masked/casted icmp; NFC

17 months ago[InstCombine] remove dead pattern matching code; NFC
Sanjay Patel [Mon, 23 Jan 2023 21:55:25 +0000 (16:55 -0500)]
[InstCombine] remove dead pattern matching code; NFC

Complexity canonicalization guarantees that a binop and cast
are op0/op1 respectively. Adjusted generic test names to
show that this pattern is still useful.

17 months ago[InstCombine] add tests for signbit compares; NFC
Sanjay Patel [Mon, 23 Jan 2023 20:48:15 +0000 (15:48 -0500)]
[InstCombine] add tests for signbit compares; NFC

17 months ago[NFC] Remove redundant range check
Scott Linder [Mon, 23 Jan 2023 23:00:15 +0000 (23:00 +0000)]
[NFC] Remove redundant range check

Remove gratuitous check introduced in
25c0ea2a5370813f46686918a84e0de27e107d08 which was generating a warning
when compiling under GCC.

17 months ago[CMake] Replace list(FIND) by if(IN_LIST) where index isn't used
Aaron Puchert [Mon, 23 Jan 2023 22:58:43 +0000 (23:58 +0100)]
[CMake] Replace list(FIND) by if(IN_LIST) where index isn't used

If we don't use the index otherwise, if(IN_LIST) is more readable and
doesn't clutter the local scope with index variables.

This was pointed out by @beanz in D96670.

Reviewed By: beanz

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

17 months ago[profile] Disable test which needs update after D141512
Vitaly Buka [Mon, 23 Jan 2023 22:50:52 +0000 (14:50 -0800)]
[profile] Disable test which needs update after D141512

17 months ago[NFC] Consolidate llvm::CodeGenOpt::Level handling
Scott Linder [Mon, 16 Jan 2023 23:55:22 +0000 (23:55 +0000)]
[NFC] Consolidate llvm::CodeGenOpt::Level handling

Add free functions llvm::CodeGenOpt::{getLevel,getID,parseLevel} to
provide common implementations for functionality that has been
duplicated in many places across the codebase.

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

17 months ago[clang-format] Fix bugs in parsing C++20 module import statements
Owen Pan [Sun, 22 Jan 2023 03:46:41 +0000 (19:46 -0800)]
[clang-format] Fix bugs in parsing C++20 module import statements

Also fixes #60145.

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

17 months ago[clang] Fix unused variable warning in isBuiltinSupported
serge-sans-paille [Mon, 23 Jan 2023 22:11:05 +0000 (23:11 +0100)]
[clang] Fix unused variable warning in isBuiltinSupported

Warnings introduced by cf1756146d386667a80501fb8161505d12950804

17 months ago[Fuchsia] Build windows runtimes using cross compilation on Linux
Haowei Wu [Sat, 14 Jan 2023 00:51:14 +0000 (16:51 -0800)]
[Fuchsia] Build windows runtimes using cross compilation on Linux

This patch provides initial support of building Clang runtimes for
Windows when using Fuchsia Clang toolchains under Linux.

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

17 months agoreadability-const-return-type: don't diagnose a template function returning T, even...
Andy Getzendanner [Mon, 23 Jan 2023 13:36:55 +0000 (13:36 +0000)]
readability-const-return-type: don't diagnose a template function returning T, even if sometimes instantiated with e.g. T = const int.

It's not really a readability problem since there's no `const` to read at the declaration site, and returning std::remove_const_t<T> instead usually only hurts readability.

Reviewed By: ymandel

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

17 months agoFix test expected result [NFC]
Nuno Lopes [Mon, 23 Jan 2023 22:04:55 +0000 (22:04 +0000)]
Fix test expected result [NFC]

Take 2
Aopologies for the noise. Metadata numbering doesn't seem to be stable..

17 months ago[docs] Add/update docs regarding LLVM_NATIVE_TOOL_DIR vs LLVM_TABLEGEN
Martin Storsjö [Mon, 23 Jan 2023 12:09:56 +0000 (14:09 +0200)]
[docs] Add/update docs regarding LLVM_NATIVE_TOOL_DIR vs LLVM_TABLEGEN

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

17 months agoFix test expected result [NFC]
Nuno Lopes [Mon, 23 Jan 2023 21:36:56 +0000 (21:36 +0000)]
Fix test expected result [NFC]

For some reason, it only fails on some buildbots, but not in all, and not on my computer..

17 months agoRevert "[build] Fix stand-alone builds of clang."
Francesco Petrogalli [Mon, 23 Jan 2023 21:31:34 +0000 (22:31 +0100)]
Revert "[build] Fix stand-alone builds of clang."

It breaks some builds [1] with the following error:

```
ccache /usr/bin/c++ -DGTEST_HAS_RTTI=0 -D_DEBUG -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/home/omp-vega20-0/bbot/openmp-offload-amdgpu-runtime/llvm.build/tools/clang/lib/Basic -I/home/omp-vega20-0/bbot/openmp-offload-amdgpu-runtime/llvm.src/clang/lib/Basic -I/home/omp-vega20-0/bbot/openmp-offload-amdgpu-runtime/llvm.src/clang/include -I/home/omp-vega20-0/bbot/openmp-offload-amdgpu-runtime/llvm.build/tools/clang/include -I/home/omp-vega20-0/bbot/openmp-offload-amdgpu-runtime/llvm.build/include -I/home/omp-vega20-0/bbot/openmp-offload-amdgpu-runtime/llvm.src/llvm/include -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wno-maybe-uninitialized -Wno-class-memaccess -Wno-redundant-move -Wno-pessimizing-move -Wno-noexcept-type -Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment -Wno-misleading-indentation -fdiagnostics-color -ffunction-sections -fdata-sections -fno-common -Woverloaded-virtual -fno-strict-aliasing -O3 -DNDEBUG  -fno-exceptions -fno-rtti -UNDEBUG -std=c++17 -MD -MT tools/clang/lib/Basic/CMakeFiles/obj.clangBasic.dir/Targets/RISCV.cpp.o -MF tools/clang/lib/Basic/CMakeFiles/obj.clangBasic.dir/Targets/RISCV.cpp.o.d -o tools/clang/lib/Basic/CMakeFiles/obj.clangBasic.dir/Targets/RISCV.cpp.o -c /home/omp-vega20-0/bbot/openmp-offload-amdgpu-runtime/llvm.src/clang/lib/Basic/Targets/RISCV.cpp
In file included from /home/omp-vega20-0/bbot/openmp-offload-amdgpu-runtime/llvm.src/clang/lib/Basic/Targets/RISCV.cpp:19:
/home/omp-vega20-0/bbot/openmp-offload-amdgpu-runtime/llvm.src/llvm/include/llvm/TargetParser/RISCVTargetParser.h:29:10: fatal error: llvm/TargetParser/RISCVTargetParserDef.inc: No such file or directory
   29 | #include "llvm/TargetParser/RISCVTargetParserDef.inc"
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
2.225 [3029/31/825] Building CXX object tools/clang/lib/Basic/CMakeFiles/obj.clangBasic.dir/Version.cpp.o
2.524 [3029/30/826] Building RISCVTargetParserDef.inc...
```

[1] https://lab.llvm.org/buildbot/#/builders/193/builds/25362

This reverts commit 52bcdac3b8425e20023151bb726b56fd6f62ec17.

17 months ago[clang-tidy] Improve rename_check.py
Chris Cotter [Mon, 23 Jan 2023 21:24:01 +0000 (21:24 +0000)]
[clang-tidy] Improve rename_check.py

rename_check.py now find and renames the test file. rename_check.py
also will now use 'git mv', so the developer no longer has to manually
add the file after running the script.

Reviewed By: carlosgalvezp

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

17 months ago[clang-tidy][NFC] Use C++17 nested namespaces in clang-tidy headers
Carlos Galvez [Sun, 22 Jan 2023 16:30:10 +0000 (16:30 +0000)]
[clang-tidy][NFC] Use C++17 nested namespaces in clang-tidy headers

We forgot to apply the change to headers in the previous patch,
due to missing "-header-filter" in the run-clang-tidy invocation.

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

17 months ago[Clang] [Python] Fix tests when default config file contains -include
Sam James [Mon, 9 Jan 2023 04:32:10 +0000 (04:32 +0000)]
[Clang] [Python] Fix tests when default config file contains -include

In Gentoo, we make use of Clang's recently-enhanced config file support
and add a default include to `clang` invocations using '-include ...'.

This breaks clang-python tests like so:
```
======================================================================
ERROR: test_includes (tests.cindex.test_translation_unit.TestTranslationUnit)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/var/tmp/portage/dev-python/clang-python-15.0.6/work/clang/bindings/python/tests/cindex/test_translation_unit.py", line 145, in test_includes
    eq(i[0], i[1])
  File "/var/tmp/portage/dev-python/clang-python-15.0.6/work/clang/bindings/python/tests/cindex/test_translation_unit.py", line 132, in eq
    self.assert_normpaths_equal(expected[0], actual.source.name)
AttributeError: 'NoneType' object has no attribute 'name'

======================================================================
FAIL: test_inclusion_directive (tests.cindex.test_translation_unit.TestTranslationUnit)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/var/tmp/portage/dev-python/clang-python-15.0.6/work/clang/bindings/python/tests/cindex/test_translation_unit.py", line 157, in test_inclusion_directive
    self.assert_normpaths_equal(i[0], i[1])
  File "/var/tmp/portage/dev-python/clang-python-15.0.6/work/clang/bindings/python/tests/cindex/test_translation_unit.py", line 126, in assert_normpaths_equal
    self.assertEqual(os.path.normpath(path1),
AssertionError: '/var/tmp/portage/dev-python/clang-python-1[58 chars]r1.h' != '/usr/include/gentoo/fortify.h'
- /var/tmp/portage/dev-python/clang-python-15.0.6/work/clang/bindings/python/tests/cindex/INPUTS/header1.h
+ /usr/include/gentoo/fortify.h
```

Disable using the default Clang configuration files on the system, like
we did for other tests.

Bug: https://bugs.gentoo.org/890204
Differential Revision: https://reviews.llvm.org/D141248

17 months ago[build] Fix stand-alone builds of clang.
Francesco Petrogalli [Mon, 23 Jan 2023 12:27:10 +0000 (13:27 +0100)]
[build] Fix stand-alone builds of clang.

The header file `llvm/include/llvm/Targetparser/RISCVTargetParser.h`
relies on the auto-generated *.inc file associated to the tablegen
target `RISCVTargetParserTableGen`.

Both clangBasic and clangDriver include `RISCVTargetParser.h`,
therefore we need to make sure that the *.inc file is avaiable to
avoid compilation errors like the following:

    FAILED: tools/clang/lib/Basic/CMakeFiles/obj.clangBasic.dir/Targets/RISCV.cpp.o
    /usr/bin/c++  [bunch of non interesting stuff]  -c <path-to>/llvm-project/clang/lib/Basic/Targets/RISCV.cpp
    In file included from <path-to>/llvm-project/clang/lib/Basic/Targets/RISCV.cpp:19:
    <path-to>/llvm-project/llvm/include/llvm/TargetParser/RISCVTargetParser.h:29:10: fatal error: llvm/TargetParser/RISCVTargetParserDef.inc: No such file or directory
      29 | #include "llvm/TargetParser/RISCVTargetParserDef.inc"
         |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

The stand-alone build of `clang` has been tested with the following
script (see [*] for further information):

```
build_llvm=`pwd`/build-llvm
build_clang=`pwd`/build-clang
installprefix=`pwd`/install
llvm=`pwd`/llvm-project
mkdir -p $build_llvm
mkdir -p $installprefix

cmake -G Ninja -S $llvm/llvm -B $build_llvm \
      -DLLVM_INSTALL_UTILS=ON \
      -DCMAKE_INSTALL_PREFIX=$installprefix \
      -DCMAKE_BUILD_TYPE=Release

ninja -C $build_llvm install

cmake -G Ninja -S $llvm/clang -B $build_clang \
      -DLLVM_EXTERNAL_LIT=$build_llvm/utils/lit \
      -DLLVM_ROOT=$installprefix
```

[*] https://llvm.org/docs/GettingStarted.html#stand-alone-builds

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

17 months ago[libc++] implement P1020R1 P1973R1 make_unique[shared]_for_overwrite
Hui [Tue, 3 Jan 2023 18:51:34 +0000 (18:51 +0000)]
[libc++] implement P1020R1 P1973R1 make_unique[shared]_for_overwrite

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

17 months ago[clang-tidy][NFC] Fix Release Notes build error
Carlos Galvez [Mon, 23 Jan 2023 21:05:08 +0000 (21:05 +0000)]
[clang-tidy][NFC] Fix Release Notes build error

17 months ago[clang-tidy] Introduce HeaderFileExtensions and ImplementationFileExtensions options
Carlos Galvez [Wed, 4 Jan 2023 16:42:16 +0000 (16:42 +0000)]
[clang-tidy] Introduce HeaderFileExtensions and ImplementationFileExtensions options

We have a number of checks designed to analyze problems
in header files only, for example:

bugprone-suspicious-include
google-build-namespaces
llvm-header-guard
misc-definitions-in-header
...

All these checks duplicate the same logic and options
to determine whether a location is placed in the main
source file or in the header. More checks are coming
up with similar requirements.

Thus, to remove duplication, let's move this option
to the top-level configuration of clang-tidy (since
it's something all checks should share).

Since the checks fetch the option via getLocalOrGlobal,
the behavior is unchanged.

Add a deprecation notice for all checks that use the
local option, prompting to update to the global option.

The functionality for parsing the option will need to
remain in the checks during the transition period.
Once the local options are fully removed, the goal
is to store the parsed options in the ClangTidyContext,
that checks can easily have access to.

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

17 months ago[bazel] Enable layering_check for llvm/unittests
Fangrui Song [Mon, 23 Jan 2023 20:56:23 +0000 (12:56 -0800)]
[bazel] Enable layering_check for llvm/unittests

17 months ago[bazel] Fix --features=layering_check issues for llvm/unittests
Fangrui Song [Mon, 23 Jan 2023 20:55:00 +0000 (12:55 -0800)]
[bazel] Fix --features=layering_check issues for llvm/unittests

17 months agoAMDGPU: Clean up LDS-related occupancy calculations
Nicolai Hähnle [Thu, 1 Dec 2022 10:00:30 +0000 (11:00 +0100)]
AMDGPU: Clean up LDS-related occupancy calculations

Occupancy is expressed as waves per SIMD. This means that we need to
take into account the number of SIMDs per "CU" or, to be more precise,
the number of SIMDs over which a workgroup may be distributed.

getOccupancyWithLocalMemSize was wrong because it didn't take SIMDs
into account at all.

At the same time, we need to take into account that WGP mode offers
access to a larger total amount of LDS, since this can affect how
non-power-of-two LDS allocations are rounded. To make this work
consistently, we distinguish between (available) local memory size and
addressable local memory size (which is always limited by 64kB on
gfx10+, even with WGP mode).

This change results in a massive amount of test churn. A lot of it is
caused by the fact that the default work group size is 1024, which means
that (due to rounding effects) the default occupancy on older hardware
is 8 instead of 10, which affects scheduling via register pressure
estimates. I've adjusted most tests by just running the UTC tools, but
in some cases I manually changed the work group size to 32 or 64 to make
sure that work group size chunkiness has no effect.

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

17 months agoAMDGPU: Add a scheduler test to demonstrate an upcoming change
Nicolai Hähnle [Tue, 6 Dec 2022 22:10:15 +0000 (23:10 +0100)]
AMDGPU: Add a scheduler test to demonstrate an upcoming change

17 months agoAMDGPU: Re-run UTC scripts on some test cases
Nicolai Hähnle [Tue, 6 Dec 2022 21:41:08 +0000 (22:41 +0100)]
AMDGPU: Re-run UTC scripts on some test cases

Reduce the diff of subsequent changes.

17 months agoAMDGPU: Add AMDGPUSubtarget::getEUsPerCU()
Nicolai Hähnle [Thu, 1 Dec 2022 09:57:22 +0000 (10:57 +0100)]
AMDGPU: Add AMDGPUSubtarget::getEUsPerCU()

We will use this for more accurate occupancy computations. Note that
IsaInfo takes WGP mode vs. CU mode into account on gfx10+.

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

17 months ago[RISCV] Add a test case for a missed PRE oppurtunity when inserting vsetvlis
Philip Reames [Mon, 23 Jan 2023 20:29:36 +0000 (12:29 -0800)]
[RISCV] Add a test case for a missed PRE oppurtunity when inserting vsetvlis

17 months ago[flang] Avoid unnecessary temporaries in ArrayValueCopy.
Slava Zakharin [Sat, 21 Jan 2023 03:58:36 +0000 (19:58 -0800)]
[flang] Avoid unnecessary temporaries in ArrayValueCopy.

Assume no conflict between pointer arrays and arrays without the target
attribute, if the fact of an array not having the target attribute
can be reliably computed.

This change speeds up SPEC CPU2017/527.cam from 2.5k seconds to 880 seconds
on Icelake, and makes further performance investigation easier.

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

17 months ago[docs] Add release notes for news in 16.x done by me, or otherwise relating to MinGW...
Martin Storsjö [Mon, 23 Jan 2023 11:25:55 +0000 (13:25 +0200)]
[docs] Add release notes for news in 16.x done by me, or otherwise relating to MinGW targets

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

17 months ago[mlir][sparse] clean vectorization bail-out for VL=0
Aart Bik [Sat, 21 Jan 2023 21:05:32 +0000 (13:05 -0800)]
[mlir][sparse] clean vectorization bail-out for VL=0

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

Reviewed By: Peiming

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

17 months ago[bazel] Fix layering_check issues of {llvm,clang}:all
Fangrui Song [Mon, 23 Jan 2023 20:08:13 +0000 (12:08 -0800)]
[bazel] Fix layering_check issues of {llvm,clang}:all