platform/upstream/llvm.git
22 months ago[mlir][dataflow] Consolidate AbstractSparseLattice::markPessimisticFixpoint() and...
Zhixun Tan [Mon, 29 Aug 2022 15:52:46 +0000 (08:52 -0700)]
[mlir][dataflow] Consolidate AbstractSparseLattice::markPessimisticFixpoint() and AbstractDenseLattice::reset() into Abstract{Sparse,Dense}DataFlowAnalysis::setToEntryState().

### Rationale

For a program point where we cannot reason about incoming dataflow (e.g. an argument of an entry block), the framework needs to initialize the state.

Currently, `AbstractSparseDataFlowAnalysis` initializes such state to the "pessimistic fixpoint", and `AbstractDenseDataFlowAnalysis` calls the state's `reset()` function.

However, entry states aren't necessarily the pessimistic fixpoint. Example: in reaching definition, the pessimistic fixpoint is `{all definitions}`, but the entry state is `{}`.

This awkwardness might be why the dense analysis API currently uses `reset()` instead of `markPessimisticFixpoint()`.

This patch consolidates entry point initialization into a single function `setToEntryState()`.

### API Location

Note that `setToEntryState()` is defined in the analysis rather than the lattice, so that we allow different analyses to use the same lattice but different entry states.

### Removal of the concept of optimistic/known value

The concept of optimistic/known value is too specific to SCCP.

Furthermore, the known value is not really used: In the current SCCP implementation, the known value (pessimistic fixpoint) is always `Attribute{}` (non-constant). This means there's no point storing a `knownValue` in each state.

If we do need to re-introduce optimistic/known value, we should put it in the SCCP analysis, not the sparse analysis API.

### Terminology

Please let me know if "entry state" is a good terminology.

I chose "entry" from Wikipedia (https://en.wikipedia.org/wiki/Data-flow_analysis#Basic_principles).

Another term I can think of is "boundary" (https://suif.stanford.edu/~courses/cs243/lectures/L3-DFA2-revised.pdf) which might be better since it also makes sense for backward analysis.

Reviewed By: Mogball

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

22 months ago[DSE] Add extra test for loop invariant store in loop, update comments.
Florian Hahn [Mon, 29 Aug 2022 15:59:59 +0000 (16:59 +0100)]
[DSE] Add extra test for loop invariant store in loop, update comments.

Add extra test coverage and updates some slightly stale comments as
pointed out in D132365.

22 months ago[AMDGPU][NFC] Allow separate RC for VOP3 DPP Dst
Joe Nash [Thu, 25 Aug 2022 14:37:30 +0000 (10:37 -0400)]
[AMDGPU][NFC] Allow separate RC for VOP3 DPP Dst

Create a field in VOPProfile called DstRCVOP3DPP to allow the VOP3
versions of DPP instructions to have a different destination register
class than the non-VOP3 encoding. NFC for current instructions, but
planned to be functional in upcoming ones.

Reviewed By: rampitec

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

22 months ago[clang] Fix ambiguous use of `report_fatal_error`.
Wei Yi Tee [Mon, 29 Aug 2022 15:15:44 +0000 (15:15 +0000)]
[clang] Fix ambiguous use of `report_fatal_error`.

`report_fatal_error` is overloaded on `StringRef` and `Twine &`, therefore passing a `std::string` argument leads to ambiguity as it is convertible to either type.

Reviewed By: gribozavr2, sgatev

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

22 months ago[SLP]Improve lookup of the buildvector top insertelement instruction.
Alexey Bataev [Fri, 26 Aug 2022 13:10:43 +0000 (06:10 -0700)]
[SLP]Improve lookup of the buildvector top insertelement instruction.

When estimating the cost of the in-tree vectorized scalars in
buildvector sequences, need to take into account the vectorized
insertelement instruction. The top of the buildvector seuences is the
topmost vectorized insertelement instruction, because it will have
> than 1 use after the vectorization.

For the affected test case improves througput from 21 to 16 (per
llvm-mca).

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

22 months ago[flang] Allow compiler directives for collapsed loops in OpenACC
Daniil Dudkin [Mon, 29 Aug 2022 15:00:02 +0000 (18:00 +0300)]
[flang] Allow compiler directives for collapsed loops in OpenACC

If one tries to compile the attached test case code with flan,
the one will get an internal compiler error on `CHECK(level == 0)`
at the end of `PrivatizeAssociatedLoopIndex` function.
Other compilers (gfortran and nvfortran) build this code just fine.
This change fixes the ICE.

Reviewed By: clementval

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

22 months ago[flang][OpenMP] Support lowering of threadprivate directive for non global variables
Peixin Qiao [Mon, 29 Aug 2022 14:33:46 +0000 (22:33 +0800)]
[flang][OpenMP] Support lowering of threadprivate directive for non global variables

Non-global variable which can be in threadprivate directive must be one
variable in main program, and it has implicit SAVE attribute. Take it as
with SAVE attribute, so to create GlobalOp for it to simplify the
translation to LLVM IR.

Reviewed By: NimishMishra

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

22 months ago[flang] Support lowering of C_PTR and C_FUNPTR argument with VALUE attribute
Peixin Qiao [Mon, 29 Aug 2022 14:29:34 +0000 (22:29 +0800)]
[flang] Support lowering of C_PTR and C_FUNPTR argument with VALUE attribute

As Fortran 2018 18.3.2, C_PTR is interoperable with any C object pointer
type. C_FUNPTR is interoperable with any C function pointer type. As
18.3.6, a C pointer can correspond to a Fortran dummy argument of type
C_PTR with the VALUE attribute.

The interface for type(C_PTR)/type(C_FUNPTR) argument with value
attribute is different from the the usual derived type. For type(C_PTR)
or type(C_FUNPTR), the component is the address, and the interface is
a pointer even with VALUE attribute. For a usual derived type such as
the drived type with the component of integer 64, the interface is a i64
value when it has VALUE attribute on aarch64 linux.

To lower the type(C_PTR)/type(C_FUNPTR) argument with value attribute,
get the value of the component of the type(C_PTR)/type(C_FUNPTR), which
is the address, and then convert it to the pointer and pass it.

Reviewed By: Jean Perier

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

22 months ago[InstCombine] fold not-shift of signbit to icmp+zext
Sanjay Patel [Mon, 29 Aug 2022 13:12:49 +0000 (09:12 -0400)]
[InstCombine] fold not-shift of signbit to icmp+zext

https://alive2.llvm.org/ce/z/j_8Wz9

The arithmetic shift was converted to logical shift with:
246078604c871d43

That does not seem to uncover any other missing/conflicting folds,
so convert directly to signbit test + cast.

We still need to fold the pattern with logical shift to test + cast.

This allows reducing patterns where the output type is not
the same as the input value:
https://alive2.llvm.org/ce/z/nydwFV

Fixes #57394

22 months agoMake this test slightly less fragile; NFC
Aaron Ballman [Mon, 29 Aug 2022 13:39:23 +0000 (09:39 -0400)]
Make this test slightly less fragile; NFC

The rule IDs are not stable, so this uses a regex for the rule ids
instead of concrete values. It also moves the CHECK lines below the
code so that it's easier to modify the test in the future. It also
breaks the CHECK lines into multiple lines to improve the performance
of the test and aid in debugging failures. Finally, it adds a comment
to the top of the test explaining that things are still rather fragile.

22 months ago[Libomptarget] Do not check for valid binaries twice.
Joseph Huber [Mon, 8 Aug 2022 21:28:02 +0000 (17:28 -0400)]
[Libomptarget] Do not check for valid binaries twice.

The only RTLs that get added to the `UsedRTLs` list have already been
checked is they were valid binaries. We shouldn't need to do this again
when we unregister all the used binaries as they wouldn't have been used
if they were invalid anyway. Let me know if I'm incorrect in this
assumption.

Reviewed By: jdoerfert

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

22 months ago[InstCombine] fold inc-of-signbit-splat to not+lshr
Sanjay Patel [Mon, 29 Aug 2022 12:13:38 +0000 (08:13 -0400)]
[InstCombine] fold inc-of-signbit-splat to not+lshr

(iN X s>> (N - 1)) + 1 --> (~X) u>> (N - 1)

https://alive2.llvm.org/ce/z/wzS474

22 months ago[InstCombine] add tests for increment-of-ashr; NFC
Sanjay Patel [Mon, 29 Aug 2022 11:51:36 +0000 (07:51 -0400)]
[InstCombine] add tests for increment-of-ashr; NFC

22 months agoApply clang-tidy fixes for performance-unnecessary-value-param in IRAttributes.cpp...
Mehdi Amini [Mon, 29 Aug 2022 10:06:17 +0000 (10:06 +0000)]
Apply clang-tidy fixes for performance-unnecessary-value-param in IRAttributes.cpp (NFC)

22 months agoApply clang-tidy fixes for llvm-else-after-return in Parser.cpp (NFC)
Mehdi Amini [Mon, 29 Aug 2022 10:04:06 +0000 (10:04 +0000)]
Apply clang-tidy fixes for llvm-else-after-return in Parser.cpp (NFC)

22 months agoExpose QualType::getUnqualifiedType in libclang
Luca Di Sera [Mon, 29 Aug 2022 12:16:18 +0000 (08:16 -0400)]
Expose QualType::getUnqualifiedType in libclang

The method is now wrapped by clang_getUnqualifiedType.

A declaration for clang_getUnqualifiedType was added to
clang-c/Index.h to expose it to user of the library.

An implementation for clang_getUnqualifiedType was introduced in
CXType.cpp that wraps the equivalent method of the underlying
QualType of a CXType.

An export symbol was added to libclang.map under the new version entry
LLVM_16.

A test was added to LibclangTest.cpp that tests the removal of
qualifiers for some CXTypes.

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

22 months ago[mlir][Vector] Fix unused variable warning in release builds. NFCI.
Benjamin Kramer [Mon, 29 Aug 2022 12:02:31 +0000 (14:02 +0200)]
[mlir][Vector] Fix unused variable warning in release builds. NFCI.

22 months ago[mlir] Delete MemRefType::Builder::setMemorySpace(unsigned)
Tres Popp [Tue, 23 Aug 2022 12:47:47 +0000 (14:47 +0200)]
[mlir] Delete MemRefType::Builder::setMemorySpace(unsigned)

This operation has been deprecated for a very long time now, so remove
it completely.

https://llvm.discourse.group/t/rfc-memref-memory-shape-as-attribute/2229

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

22 months ago[analyzer] Silence GCC warnings about unused variables. NFC.
Martin Storsjö [Mon, 29 Aug 2022 09:10:07 +0000 (12:10 +0300)]
[analyzer] Silence GCC warnings about unused variables. NFC.

Use `isa<T>()` instead of `Type *Var = dyn_cast<T>()`
when the result of the cast isn't used.

22 months ago[lldb] Fix warnings about unused variables when building without asserts. NFC.
Martin Storsjö [Mon, 29 Aug 2022 09:32:10 +0000 (12:32 +0300)]
[lldb] Fix warnings about unused variables when building without asserts. NFC.

22 months ago[mlir][Linalg] Move verification of block arguments back.
Adrian Kuegel [Mon, 29 Aug 2022 08:55:10 +0000 (10:55 +0200)]
[mlir][Linalg] Move verification of block arguments back.

DestinationStyleOpInterface should be possible to use for ops that don't
have regions. Therefore the check for block arguments should be done in
verifyStructedOpInterface.

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

22 months ago[LV] Add test where either a libfunc or intrinsic is chosen.
Florian Hahn [Mon, 29 Aug 2022 09:51:19 +0000 (10:51 +0100)]
[LV] Add test where either a libfunc or intrinsic is chosen.

In the newly added test either a libfunc (VF=2) or a intrinsic (VF=4)
can be chosen.

Test coverage for D132585.

22 months ago[docs] improve documentation for misc-const-correctness
Jonas Toth [Mon, 29 Aug 2022 09:19:16 +0000 (11:19 +0200)]
[docs] improve documentation for misc-const-correctness

Improve the documentation for 'misc-const-correctness' to:

- include better examples
- improve the english
- fix links to other checks that were broken due to the directory-layout changes
- mention the limitation that the check does not run on `C` code.

Addresses #56749, #56958

Reviewed By: njames93

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

22 months ago[LV] Remove unneeded getVectorIntrinsicIDForCall call (NFC).
Florian Hahn [Mon, 29 Aug 2022 09:19:46 +0000 (10:19 +0100)]
[LV] Remove unneeded getVectorIntrinsicIDForCall call (NFC).

Suggested as independent fix during the review of D132585.

22 months ago[Flang] Use find_program() to find clang-tblgen
Nikita Popov [Mon, 8 Aug 2022 10:40:49 +0000 (12:40 +0200)]
[Flang] Use find_program() to find clang-tblgen

There are two scenarios here:

1. Standalone flang build, where we use an installed clang-tblgen
   binary. We need to use find_package() to find it.
2. Combined build of clang and flang, where we want to use the
   path specified in CLANG_TABLEGEN_EXE during the clang build --
   however, this variable was previously not exported.

The new implementation matches what is done for mlir-tblgen.

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

22 months ago[clang] Make guard(nocf) attribute available only for Windows
Alvin Wong [Mon, 29 Aug 2022 08:27:27 +0000 (11:27 +0300)]
[clang] Make guard(nocf) attribute available only for Windows

Control Flow Guard is only supported on Windows target, therefore there
is no point to make it an accepted attribute for other targets.

Reviewed By: rnk, aaron.ballman

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

22 months ago[X86][BF16] Add type mangling for Windows
Phoebe Wang [Mon, 29 Aug 2022 07:39:04 +0000 (15:39 +0800)]
[X86][BF16] Add type mangling for Windows

Reviewed By: FreddyYe

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

22 months ago[mlir][Vector] Support 0-D vectors in ShuffleOp
Nicolas Vasilache [Fri, 26 Aug 2022 11:08:13 +0000 (04:08 -0700)]
[mlir][Vector] Support 0-D vectors in ShuffleOp

Co-authored-by: Michal Terepeta <michalt@google.com>
Reviewed-by: nicolasvasilache
Differential Revision: https://reviews.llvm.org/D115744

22 months ago[Fuchsia][CMake] Disable LLVM plugin support
Petr Hosek [Mon, 29 Aug 2022 07:23:36 +0000 (07:23 +0000)]
[Fuchsia][CMake] Disable LLVM plugin support

We already disable plugin support in Clang, disable LLVM side as well
since we don't support plugins in Fuchsia toolchain.

22 months ago[mlir] Apply ClangTidy performance finding (NFC).
Adrian Kuegel [Mon, 29 Aug 2022 07:15:35 +0000 (09:15 +0200)]
[mlir] Apply ClangTidy performance finding (NFC).

22 months ago[llvm][ADT] Fix formatting for files relevant to `StringMap`.
Wei Yi Tee [Mon, 29 Aug 2022 06:55:54 +0000 (06:55 +0000)]
[llvm][ADT] Fix formatting for files relevant to `StringMap`.

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

22 months ago[docs] Expand lit documentation on response files
Petr Hosek [Mon, 29 Aug 2022 06:50:10 +0000 (06:50 +0000)]
[docs] Expand lit documentation on response files

This was requested in https://reviews.llvm.org/D132437.

22 months agoRevert "[llvm][ADT] Fix formatting for files relevant to `StringMap`."
Wei Yi Tee [Mon, 29 Aug 2022 06:43:48 +0000 (06:43 +0000)]
Revert "[llvm][ADT] Fix formatting for files relevant to `StringMap`."

This reverts commit d23df9c9e81e186c3218bd924976fbd646f3bad1.
Revert due to missing review link.

22 months ago[llvm][ADT] Fix formatting for files relevant to `StringMap`.
Wei Yi Tee [Fri, 26 Aug 2022 18:21:29 +0000 (18:21 +0000)]
[llvm][ADT] Fix formatting for files relevant to `StringMap`.

22 months agoUse StringRef::contains (NFC)
Kazu Hirata [Mon, 29 Aug 2022 06:29:02 +0000 (23:29 -0700)]
Use StringRef::contains (NFC)

22 months ago[llvm] Qualify auto in range-based for loops (NFC)
Kazu Hirata [Mon, 29 Aug 2022 06:29:00 +0000 (23:29 -0700)]
[llvm] Qualify auto in range-based for loops (NFC)

22 months ago[llvm] Use range-based for loops (NFC)
Kazu Hirata [Mon, 29 Aug 2022 06:28:58 +0000 (23:28 -0700)]
[llvm] Use range-based for loops (NFC)

22 months ago[Instrumentation] Use std::clamp (NFC)
Kazu Hirata [Mon, 29 Aug 2022 06:28:57 +0000 (23:28 -0700)]
[Instrumentation] Use std::clamp (NFC)

The use of std::clamp should be safe here.  MinRZ is at most 32, while
kMaxRZ is 1 << 18, so we have MinRZ <= kMaxRZ, avoiding the undefind
behavior of std::clamp.

22 months ago[tests] precommit tests for D132658
zhongyunde [Mon, 29 Aug 2022 06:17:06 +0000 (14:17 +0800)]
[tests] precommit tests for D132658

Reviewed By: bcl5980
Differential Revision: https://reviews.llvm.org/D132820

22 months ago[MC][test] Test FreeBSD after D131162
Fangrui Song [Mon, 29 Aug 2022 06:13:46 +0000 (23:13 -0700)]
[MC][test] Test FreeBSD after D131162

22 months ago[test][msan] Add debug info use-after-dtor tests
Vitaly Buka [Mon, 29 Aug 2022 06:05:23 +0000 (23:05 -0700)]
[test][msan] Add debug info use-after-dtor tests

22 months ago[test][msan] Simplify tests with --implicit-check-not
Vitaly Buka [Mon, 29 Aug 2022 05:42:27 +0000 (22:42 -0700)]
[test][msan] Simplify tests with --implicit-check-not

22 months ago[libc][Obvious] Re-enable math unit tests.
Siva Chandra Reddy [Mon, 29 Aug 2022 04:28:57 +0000 (04:28 +0000)]
[libc][Obvious] Re-enable math unit tests.

22 months ago[RISCV] Merge vmerge.vvm and unmasked intrinsic with VLMAX vector length.
Yeting Kuo [Sat, 13 Aug 2022 14:59:19 +0000 (22:59 +0800)]
[RISCV] Merge vmerge.vvm and unmasked intrinsic with VLMAX vector length.

The motivation of this patch is to lower the IR pattern
(vp.merge mask, (add x, y), false, vl) to
(PseudoVADD_VV_<LMUL>_MASK false, x, y, mask, vl).

Reviewed By: craig.topper

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

22 months ago[MLIR] Add mlir::TypedValue
Tyker [Wed, 17 Aug 2022 04:17:03 +0000 (21:17 -0700)]
[MLIR] Add mlir::TypedValue

mlir::TypedValue is a wrapper class for mlir::Values with a known type
getType will return the known type and all assignements will be checked

Also the tablegen Operation generator was adapted to use mlir::TypedValue
when appropriate

22 months ago[RISCV][NFC] Add cost model coverage for fp arithmetic instructions.
jacquesguan [Wed, 24 Aug 2022 07:42:10 +0000 (15:42 +0800)]
[RISCV][NFC] Add cost model coverage for fp arithmetic instructions.

This patch adds cost model coverage for fp arithmetic instructions. Some is not exact, I am working on a revision to implement that.

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

22 months ago[RISCV][NFC] Refactor fadd test to match the code.
jacquesguan [Fri, 26 Aug 2022 08:18:16 +0000 (16:18 +0800)]
[RISCV][NFC] Refactor fadd test to match the code.

Change fadd test case in D122563 to match the fold base case.

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

22 months ago[RISCV] Remove unused code
liqinweng [Mon, 29 Aug 2022 02:16:44 +0000 (10:16 +0800)]
[RISCV] Remove unused code

Reviewed By: benshi001

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

22 months ago[RISCV] Refactor for costs of integer min/max
liqinweng [Mon, 29 Aug 2022 02:10:35 +0000 (10:10 +0800)]
[RISCV] Refactor for costs of integer min/max

Reviewed By: reames

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

22 months ago[LoongArch] Combine add + shl to alsl.[w/d/wu]
gonglingqin [Mon, 29 Aug 2022 01:57:18 +0000 (09:57 +0800)]
[LoongArch] Combine add + shl to alsl.[w/d/wu]

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

22 months agoRevert "[llvm] Use llvm::is_contained (NFC)"
Kazu Hirata [Mon, 29 Aug 2022 01:52:49 +0000 (18:52 -0700)]
Revert "[llvm] Use llvm::is_contained (NFC)"

This reverts commit ebf574f59a80ca00e234eee0b047e5f0df99587d.

This patch seems to cause build failures on Windows.

22 months ago[NFC][clang-format] Fix typo
Sheng [Mon, 29 Aug 2022 01:32:25 +0000 (09:32 +0800)]
[NFC][clang-format] Fix typo

combinartorial
       v
combinatorial

22 months ago[Target] Qualify auto in range-based for loops (NFC)
Kazu Hirata [Mon, 29 Aug 2022 00:35:09 +0000 (17:35 -0700)]
[Target] Qualify auto in range-based for loops (NFC)

22 months ago[Support] Remove greatestCommonDivisor and GreatestCommonDivisor64 (NFC)
Kazu Hirata [Mon, 29 Aug 2022 00:35:08 +0000 (17:35 -0700)]
[Support] Remove greatestCommonDivisor and GreatestCommonDivisor64 (NFC)

This patch removes greatestCommonDivisor and GreatestCommonDivisor64
as I've migrated all the uses to std::gcd.

22 months ago[llvm] Use std::is_unsigned instead of std::numeric_limits (NFC)
Kazu Hirata [Mon, 29 Aug 2022 00:35:06 +0000 (17:35 -0700)]
[llvm] Use std::is_unsigned instead of std::numeric_limits (NFC)

22 months ago[llvm] Use range-based for loops (NFC)
Kazu Hirata [Mon, 29 Aug 2022 00:35:04 +0000 (17:35 -0700)]
[llvm] Use range-based for loops (NFC)

22 months ago[llvm] Use llvm::is_contained (NFC)
Kazu Hirata [Mon, 29 Aug 2022 00:35:03 +0000 (17:35 -0700)]
[llvm] Use llvm::is_contained (NFC)

22 months ago[RISC-V][HWASAN] Fold variable into assert
Benjamin Kramer [Sun, 28 Aug 2022 22:32:37 +0000 (00:32 +0200)]
[RISC-V][HWASAN] Fold variable into assert

22 months ago[clang-format] Fix a bug in removing braces for the LLVM style
owenca [Sun, 28 Aug 2022 05:22:50 +0000 (22:22 -0700)]
[clang-format] Fix a bug in removing braces for the LLVM style

When an l_brace is wrapped and the line above it ends with a
comment, the annotator adds ColumnLimit to the TotalLength of the
l_brace, so the actual column position of the l_brace must be
adjusted accordingly.

Fixes #57376.

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

22 months ago[SPIRV] Add tests to improve test coverage
Andrey Tretyakov [Wed, 24 Aug 2022 14:42:33 +0000 (17:42 +0300)]
[SPIRV] Add tests to improve test coverage

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

22 months ago[Driver][Linux] Pass --hash-style=gnu to ld unless special cased
Fangrui Song [Sun, 28 Aug 2022 19:13:01 +0000 (12:13 -0700)]
[Driver][Linux] Pass --hash-style=gnu to ld unless special cased

To align with many Linux distributions which configure GCC with
--enable-default-hash-style=gnu or binutils with --with-linker-hash-style=gnu.
ld.lld does not support changed default, so passing the option in the driver is
better.

Note: there was a bug that Debian specified both --hash-style=gnu and
--hash-style=both. Actually its GCC has defaulted to --hash-style=gnu since 2007.

22 months ago[MachO] Remove stale comments
Shoaib Meenai [Sun, 28 Aug 2022 18:27:40 +0000 (23:27 +0500)]
[MachO] Remove stale comments

https://reviews.llvm.org/D93267 implemented handling more than 127
compact unwind encodings, and https://reviews.llvm.org/D123435 and
https://reviews.llvm.org/D124561 implemented stripping redundant
__eh_frame entries.

22 months ago[Driver] Don't pass --enable-new-dtags to ld for Android/openSUSE
Fangrui Song [Sun, 28 Aug 2022 18:38:40 +0000 (11:38 -0700)]
[Driver] Don't pass --enable-new-dtags to ld for Android/openSUSE

This has been the default for a very long time.

22 months ago[RISC-V][HWASAN] Add support for lowering HWASAN intrinsic for RISC-V
Alexey Baturo [Sun, 31 Jul 2022 10:42:45 +0000 (13:42 +0300)]
[RISC-V][HWASAN] Add support for lowering HWASAN intrinsic for RISC-V

Reviewed By: vitalybuka

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

22 months ago[RISC-V][HWASAN] Save sp address at the start of tag mismatch routine
Alexey Baturo [Wed, 10 Aug 2022 05:28:27 +0000 (08:28 +0300)]
[RISC-V][HWASAN] Save sp address at the start of tag mismatch routine

Reviewed By: vitalybuka

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

22 months ago[RISC-V][HWASAN] Add runtime support for HWASAN for RISC-V
Alexey Baturo [Sun, 31 Jul 2022 10:38:36 +0000 (13:38 +0300)]
[RISC-V][HWASAN] Add runtime support for HWASAN for RISC-V

Reviewed By: vitalybuka

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

22 months agoUse std::gcd (NFC)
Kazu Hirata [Sun, 28 Aug 2022 17:41:53 +0000 (10:41 -0700)]
Use std::gcd (NFC)

To avoid changing semantics inadvertently, this patch casts arguments
to uint64_t before calling std::gcd.

22 months agoUse std::gcd (NFC)
Kazu Hirata [Sun, 28 Aug 2022 17:41:51 +0000 (10:41 -0700)]
Use std::gcd (NFC)

This patch replaces calls to greatestCommonDivisor with std::gcd where
two arguments are of the same type.  This means that
std::common_type_t of the argument type is the same as the argument
type.

We could drop calls to std::abs in some cases, but that's left for
another patch.

22 months ago[Target] Qualify auto in range-based for loops (NFC)
Kazu Hirata [Sun, 28 Aug 2022 17:41:50 +0000 (10:41 -0700)]
[Target] Qualify auto in range-based for loops (NFC)

22 months ago[llvm] Use llvm::find_if (NFC)
Kazu Hirata [Sun, 28 Aug 2022 17:41:48 +0000 (10:41 -0700)]
[llvm] Use llvm::find_if (NFC)

22 months ago[flang] Split up synchronization, event, and error stop stmt tests
Katherine Rasmussen [Thu, 18 Aug 2022 00:06:28 +0000 (17:06 -0700)]
[flang] Split up synchronization, event, and error stop stmt tests

Splitting up the tests for the synchronization statements,
event statements, and error stop statement allow for some of the
errors which are hidden by other errors, to be caught in the test.
This then reveals which invalid code does produce errors and which
does not produce errors.

22 months ago[RISC-V][HWASAN] Add tag mismatch routines for HWASAN required for RISC-V
Alexey Baturo [Sun, 31 Jul 2022 10:39:53 +0000 (13:39 +0300)]
[RISC-V][HWASAN] Add tag mismatch routines for HWASAN required for RISC-V

Reviewed By: vitalybuka

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

22 months ago[InstCombine] allow sext in fold of mask using signbit, part 2
Sanjay Patel [Sun, 28 Aug 2022 14:58:21 +0000 (10:58 -0400)]
[InstCombine] allow sext in fold of mask using signbit, part 2

https://alive2.llvm.org/ce/z/rcbZmx

Sibling tranform to 275aa24c0a51

This pattern is seen in the examples in issue #57381.

22 months ago[RISC-V][HWASAN] Add intrinsics required for HWASAN support for RISC-V
Alexey Baturo [Sun, 31 Jul 2022 10:39:08 +0000 (13:39 +0300)]
[RISC-V][HWASAN] Add intrinsics required for HWASAN support for RISC-V

Reviewed By: vitalybuka

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

22 months ago[InstCombine] Propagate the nuw for combine of add+mul
zhongyunde [Sun, 28 Aug 2022 09:46:37 +0000 (17:46 +0800)]
[InstCombine] Propagate the nuw for combine of add+mul

As the commit of D132658, make the 'nuw' change separately.
Reviewed By: spatel
Differential Revision: https://reviews.llvm.org/D132777

22 months ago[VPlan] Use range check in VPHeaderPHIRecipe::classof (NFC).
Florian Hahn [Sun, 28 Aug 2022 14:53:35 +0000 (15:53 +0100)]
[VPlan] Use range check in VPHeaderPHIRecipe::classof (NFC).

This addresses a suggestion to simplify the check from D131989. This
also makes it easier to ensure that VPHeaderPHIRecipe::classof checks
for all header phi ids.

22 months ago[InstCombine] allow sext in fold of mask using signbit
Sanjay Patel [Sat, 27 Aug 2022 21:38:27 +0000 (17:38 -0400)]
[InstCombine] allow sext in fold of mask using signbit

~(iN X s>> (N-1)) & Y --> (X s< 0) ? 0 : Y -- with optional sext

https://alive2.llvm.org/ce/z/wFFnZT

22 months ago[InstCombine] add tests for inverted signbit splat mask; NFC
Sanjay Patel [Sat, 27 Aug 2022 17:34:13 +0000 (13:34 -0400)]
[InstCombine] add tests for inverted signbit splat mask; NFC

22 months ago[Orc] Use MapperJITLinkMemoryManager with SharedMemoryMapper in llvm-jitlink tool
Anubhab Ghosh [Sat, 20 Aug 2022 20:36:47 +0000 (02:06 +0530)]
[Orc] Use MapperJITLinkMemoryManager with SharedMemoryMapper in llvm-jitlink tool

MapperJITLinkMemoryManager combined with SharedMemoryMapper can be
used in place of EPCGenericJITLinkMemoryManager when running on top of
same physical memory. This commit enables it when --use-shared-memory is
passed.

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

22 months ago[bazel] Add missing dependency after 1b002d27683522e15d6ef3bccb74e751bbf56e74
Benjamin Kramer [Sun, 28 Aug 2022 07:56:17 +0000 (09:56 +0200)]
[bazel] Add missing dependency after 1b002d27683522e15d6ef3bccb74e751bbf56e74

22 months ago[Pipelines] Introduce DAE after ArgumentPromotion
Pavel Samolysov [Fri, 26 Aug 2022 12:06:21 +0000 (15:06 +0300)]
[Pipelines] Introduce DAE after ArgumentPromotion

The ArgumentPromotion pass uses Mem2Reg promotion at the end to cutting
down generated `alloca` instructions as well as meaningless `store`s and
this behavior can leave unused (dead) arguments. To eliminate the dead
arguments and therefore let the DeadCodeElimination remove becoming dead
inserted `GEP`s as well as `load`s and `cast`s in the callers, the
DeadArgumentElimination pass should be run after the ArgumentPromotion
one.

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

22 months ago[llvm-objdump] Add -dyld_info to llvm-otool
Daniel Bertalan [Wed, 17 Aug 2022 14:14:03 +0000 (16:14 +0200)]
[llvm-objdump] Add -dyld_info to llvm-otool

This option outputs the location, encoded value and target of chained
fixups, using the same format as `otool -dyld_info`.

This initial implementation only supports the DYLD_CHAINED_PTR_64 and
DYLD_CHAINED_PTR_64_OFFSET pointer encodings, which are used in x86_64
and arm64 userspace binaries.

When Apple's effort to upstream their chained fixups code continues,
we'll replace this code with the then-upstreamed code. But we need
something in the meantime for testing ld64.lld's chained fixups code.

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

22 months ago[NFC] Fix typo
Sheng [Sun, 28 Aug 2022 07:15:20 +0000 (15:15 +0800)]
[NFC] Fix typo

22 months ago[Transform] Use range-based for loops (NFC)
Kazu Hirata [Sun, 28 Aug 2022 06:54:32 +0000 (23:54 -0700)]
[Transform] Use range-based for loops (NFC)

22 months ago[Utils] Remove redundaunt declarations (NFC)
Kazu Hirata [Sun, 28 Aug 2022 06:54:31 +0000 (23:54 -0700)]
[Utils] Remove redundaunt declarations (NFC)

Identified with readability-redundant-declaration.

22 months ago[llvm] Use std::gcd (NFC)
Kazu Hirata [Sun, 28 Aug 2022 06:54:29 +0000 (23:54 -0700)]
[llvm] Use std::gcd (NFC)

This patch replaces calls to greatestCommonDivisor with std::gcd where
both arguments are known to be of unsigned.  This means that
std::common_type_t of the two argument types should just be the wider
one of the two.

22 months ago[flang] Use std::clamp (NFC)
Kazu Hirata [Sun, 28 Aug 2022 06:54:27 +0000 (23:54 -0700)]
[flang] Use std::clamp (NFC)

The use of std::clamp here is safe because the definition of
largestLDKind gurantees that 8 <= largestLDKind.

22 months ago[BOLT][NFC] Use llvm::any_of
Amir Ayupov [Fri, 19 Aug 2022 22:57:24 +0000 (15:57 -0700)]
[BOLT][NFC] Use llvm::any_of

Replace the imperative pattern of the following kind
```
bool IsTrue = false;
for (Element : Range) {
  if (Condition(Element)) {
    IsTrue = true;
    break;
  }
}
```
with functional style `llvm::any_of`:
```
bool IsTrue = llvm::any_of(Range, [&](Element) {
  return Condition(Element);
});
```

Reviewed By: rafauler

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

22 months ago[Support] Use std::clamp (NFC)
Kazu Hirata [Sun, 28 Aug 2022 04:21:08 +0000 (21:21 -0700)]
[Support] Use std::clamp (NFC)

We can safely use std::clamp here because the call to
report_size_overflow a few lines above guarantees MinSize <= MaxSize.

22 months ago[lldb] Use nullptr instead of NULL (NFC)
Kazu Hirata [Sun, 28 Aug 2022 04:21:07 +0000 (21:21 -0700)]
[lldb] Use nullptr instead of NULL (NFC)

Identified with modernize-use-nullptr.

22 months ago[lldb] Remove a redundaunt return statement (NFC)
Kazu Hirata [Sun, 28 Aug 2022 04:21:05 +0000 (21:21 -0700)]
[lldb] Remove a redundaunt return statement (NFC)

Identified with readability-redundant-control-flow.

22 months ago[flang] Simplify string comparisons (NFC)
Kazu Hirata [Sun, 28 Aug 2022 04:21:04 +0000 (21:21 -0700)]
[flang] Simplify string comparisons (NFC)

Identified with readability-string-compare.

22 months ago[Transforms] Qualify auto in range-based for loops (NFC)
Kazu Hirata [Sun, 28 Aug 2022 04:21:02 +0000 (21:21 -0700)]
[Transforms] Qualify auto in range-based for loops (NFC)

Identified with readability-qualified-auto.

22 months agoUse llvm::is_contained (NFC)
Kazu Hirata [Sun, 28 Aug 2022 04:21:00 +0000 (21:21 -0700)]
Use llvm::is_contained (NFC)

22 months agoUse std::gcd (NFC)
Kazu Hirata [Sun, 28 Aug 2022 04:20:58 +0000 (21:20 -0700)]
Use std::gcd (NFC)

This patch replaces calls to GreatestCommonDivisor64 with std::gcd
where both arguments are known to be of unsigned types no larger than
64 bits in size.

22 months agoFold memref.expand_shape and memref.collapse_shape ops
Arnab Dutta [Sun, 28 Aug 2022 01:25:48 +0000 (06:55 +0530)]
Fold memref.expand_shape and memref.collapse_shape ops

Fold memref.expand_shape and memref.collapse_shape ops into their
memref/affine load/store ops.

Reviewed By: bondhugula, nicolasvasilache

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

22 months ago[clang-tidy] Tweak diagnostics for bugprone-assign-in-if-condition
Nathan James [Sat, 27 Aug 2022 23:21:39 +0000 (00:21 +0100)]
[clang-tidy] Tweak diagnostics for bugprone-assign-in-if-condition

Currently the diagnostic is printed at the start of the assignment expression, This can be misleading.
Having the location for the diagnostic be the location of the assignment operator is much more intuitive.

Reviewed By: gribozavr2

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

22 months ago[Clang] Avoid crashes when parsing using enum declarations
Shafik Yaghmour [Sat, 27 Aug 2022 22:18:36 +0000 (15:18 -0700)]
[Clang] Avoid crashes when parsing using enum declarations

In Parser::ParseUsingDeclaration(...) when we call ParseEnumSpecifier(...) it is
not calling SetTypeSpecError() on DS when it detects an error. That means that
DS is left set to TST_unspecified. When we then pass DS into
Sema::ActOnUsingEnumDeclaration(...) we hit an llvm_unreachable(...) since it
expects it to be one of three states TST_error, TST_enum or TST_typename.

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

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

22 months ago[clang-format] Rework removeBraces() in Format.cpp
owenca [Fri, 26 Aug 2022 06:13:34 +0000 (23:13 -0700)]
[clang-format] Rework removeBraces() in Format.cpp

Fixes #57373.

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

22 months ago[VPlan] Verify that header only contains header phi recipes.
Florian Hahn [Sat, 27 Aug 2022 21:06:11 +0000 (22:06 +0100)]
[VPlan] Verify that header only contains header phi recipes.

Add verification that VPHeaderPHIRecipes are only in header VPBBs. Also
adds missing checks for VPPointerInductionRecipe to
VPHeaderPHIRecipe::classof.

Split off from D119661.

Reviewed By: Ayal

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