platform/upstream/llvm.git
17 months ago[Propeller] Change SHT_LLVM_BB_ADDR_MAP version to 2.
Rahman Lavaee [Mon, 6 Feb 2023 21:39:28 +0000 (13:39 -0800)]
[Propeller] Change SHT_LLVM_BB_ADDR_MAP version to 2.

D100808 implemented the new version, but kept version 1 as the
emitted version. This patch changes the version to 2 and updates the
codegen tests.

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

17 months ago[libc++] In tests, use `abort` to terminate upon an error.
Konstantin Varlamov [Fri, 10 Feb 2023 19:31:26 +0000 (11:31 -0800)]
[libc++] In tests, use `abort` to terminate upon an error.

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

17 months agoAMDGPU: Use module flag to get code object version at IR level folow-up
Changpeng Fang [Fri, 10 Feb 2023 19:16:38 +0000 (11:16 -0800)]
AMDGPU: Use module flag to get code object version at IR level folow-up

Summary:
  This is part of the leftover work for https://reviews.llvm.org/D143138.
In this work, we pass code object version as an argument to initialize target ID
and use it for targetID dump.

Reviewers: arsenm

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

17 months agoA slightly more concise AST dump :)
Dani Ferreira Franco Moura [Tue, 31 Jan 2023 11:53:40 +0000 (11:53 +0000)]
A slightly more concise AST dump :)

If the modifiedType and the minimally desugared type of an AttributedType are the same, then we do not need to show both in an AST dump.

Here, we change VisitAttributedType to only visit the modifiedType when it is different from the equivalentType (the minimally desugared type), because the latter is already visited by default.

Reviewed By: sammccall

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

17 months ago[InstCombine] precommit tests for D143593
ManuelJBrito [Fri, 10 Feb 2023 19:04:14 +0000 (19:04 +0000)]
[InstCombine] precommit tests for D143593

17 months ago[mlir][sparse] Sparse reduction in lex order no longer produces dense output
Jim Kitchen [Fri, 10 Feb 2023 19:08:49 +0000 (13:08 -0600)]
[mlir][sparse] Sparse reduction in lex order no longer produces dense output

Previously, when performing a reduction on a sparse tensor, the result
would be different depending on iteration order. For expanded access pattern,
an empty row would contribute no entry in the output. For lex ordering, the
identity would end up in the output.

This code changes that behavior and keeps track of whether any entries were
actually reduced in lex ordering, making the output consistent between the
two iteration styles.

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

17 months ago[libc][math] Update exceptional cases for logf, log10f, log2f, log1pf.
Tue Ly [Fri, 10 Feb 2023 05:10:22 +0000 (00:10 -0500)]
[libc][math] Update exceptional cases for logf, log10f, log2f, log1pf.

Properly set floating point exceptions and add more exceptional
values for non-FMA x86-64 targets.

Reviewed By: michaelrj

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

17 months ago[dfsan] Fix build-libc-list.py for Python 3 after D143701
Fangrui Song [Fri, 10 Feb 2023 18:55:44 +0000 (10:55 -0800)]
[dfsan] Fix build-libc-list.py for Python 3 after D143701

17 months agoFix handling of -> calls for modernize-use-emplace
BigPeet [Fri, 10 Feb 2023 18:36:41 +0000 (18:36 +0000)]
Fix handling of -> calls for modernize-use-emplace

Fixes #55869

Reviewed By: njames93, nicovank

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

17 months ago[lldb][Test] TestExternalCtorDtorLookup.py: skip on Windows and dwo
Michael Buch [Fri, 10 Feb 2023 18:38:09 +0000 (18:38 +0000)]
[lldb][Test] TestExternalCtorDtorLookup.py: skip on Windows and dwo

Also make expected mangling more flexible since it's different
between Linux and Darwin

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

17 months ago[Passes] Remove some legacy passes
Arthur Eubanks [Fri, 10 Feb 2023 01:22:56 +0000 (17:22 -0800)]
[Passes] Remove some legacy passes

Namely CrossDSOCFI and GlobalSplit.

These are part of the optimization pipeline, of which the legacy pass manager version is deprecated.

17 months ago[libc] add standalone strtoint/float fuzzers
Michael Jones [Thu, 9 Feb 2023 00:38:35 +0000 (16:38 -0800)]
[libc] add standalone strtoint/float fuzzers

Fuzzing the string to integer and float functions without relying on the
system libc allows for tests to be run in a wider variety of places.

Reviewed By: sivachandra

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

17 months ago[ClangScanDeps] Add UNSUPPORTED: system-windows to test P1689.cppm
Tom Weaver [Fri, 10 Feb 2023 18:29:41 +0000 (18:29 +0000)]
[ClangScanDeps] Add UNSUPPORTED: system-windows to test P1689.cppm

The revert of
  https://reviews.llvm.org/rG65f9719913eca9c7c72d1abf4eddab767abaebf6

removes a system-windows guard but does not remove the test causing windows
system failures. This patch adds back a guard to prevent further failures.

17 months ago[clang-tidy] Clarify documention of `bugprone-unchecked-optional-access`.
Yitzhak Mandelbaum [Fri, 10 Feb 2023 16:53:11 +0000 (16:53 +0000)]
[clang-tidy] Clarify documention of `bugprone-unchecked-optional-access`.

Removes a reference to google-internal document and expands the relevant material in place.

Fixes: #60633.

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

17 months ago[Assignment Tracking] Fix migrateDebuginfo in SROA
OCHyams [Fri, 10 Feb 2023 17:43:29 +0000 (17:43 +0000)]
[Assignment Tracking] Fix migrateDebuginfo in SROA

Without this patch, migrateDebugInfo doesn't understand how to handle existing
fragments that are smaller than the to-be-split store. This can occur
if. e.g. a vector store (1 dbg.assign) is split (many dbg.assigns - 1 fragment
for each scalar) and later those stores are re-vectorized (many dbg.assigns),
and then SROA runs on that.

The approach taken in this patch is to drop intrinsics with fragments outside
of the slice.

For example, starting with:

  store <2 x float> %v, ptr %dest !DIAssignID !1
  call void @llvm.dbg.assign(..., DIExpression(DW_OP_LLVM_fragment, 0, 32), !1, ...)
  call void @llvm.dbg.assign(..., DIExpression(DW_OP_LLVM_fragment, 32, 32), !1, ...)

When visiting the slice of bits 0 to 31 we get:

  store float %v.extract.0, ptr %dest !DIAssignID !2
  call void @llvm.dbg.assign(..., DIExpression(DW_OP_LLVM_fragment, 0, 32), !2, ...)

The other dbg.assign associated with the currently-split store is dropped for
this split part. And visiting bits 32 to 63 we get the following:

  store float %v.extract.1, ptr %adjusted.dest !DIAssignID !3
  call void @llvm.dbg.assign(..., DIExpression(DW_OP_LLVM_fragment, 32, 32), !3, ...)

I've added two tests that cover this case.

Implementing this meant re-writing the fragment-calculation part of
migrateDebugInfo to work with the absolute offset of the new slice in terms of
the base alloca (instead of the offset of the slice into the new alloca), the
fragment (if any) of the variable associated with the base alloca, and the
fragment associated with the split store. Because we need the offset into the
base alloca for the variables being split, some careful wiring is required for
memory intrinsics due to the fact that memory intrinsics can be split when
either the source or dest allocas are split. In the case where the source
alloca drives the splitting, we need to be careful to pass migrateDebugInfo the
information in relation to the dest alloca.

Reviewed By: StephenTozer

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

17 months ago[AArch64] Reassociate sub(x, add(m1, m2)) to sub(sub(x, m1), m2)
David Green [Fri, 10 Feb 2023 18:09:11 +0000 (18:09 +0000)]
[AArch64] Reassociate sub(x, add(m1, m2)) to sub(sub(x, m1), m2)

The mid end will reassociate sub(sub(x, m1), m2) to sub(x, add(m1, m2)). This
reassociates it back to allow the creation of more mls instructions.

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

17 months ago[X86] Attempt to fix ubsan failure.
Craig Topper [Fri, 10 Feb 2023 18:02:51 +0000 (10:02 -0800)]
[X86] Attempt to fix ubsan failure.

operator~ promote the single bit input to int. The ~ will cause the upper
31 bits to become 1s making it a negative value. This is undefined for
shift.

Mask it back down to a single bit.

The extra 1s were being shifted to bit 8 and above and the they aren't
used by the emitByte call so this shouldn't be a functional change.

17 months ago[bazel] Port 81a79ee446
Benjamin Kramer [Fri, 10 Feb 2023 18:02:01 +0000 (19:02 +0100)]
[bazel] Port 81a79ee446

17 months ago[Attributor][NFCI] Use a set to track dependences
Johannes Doerfert [Tue, 7 Feb 2023 15:17:02 +0000 (07:17 -0800)]
[Attributor][NFCI] Use a set to track dependences

17 months ago[Attributor][NFCI] Avoid AAIntraFnReachability updates if possible
Johannes Doerfert [Fri, 3 Feb 2023 10:35:06 +0000 (02:35 -0800)]
[Attributor][NFCI] Avoid AAIntraFnReachability updates if possible

Even if liveness changed, we only care about certain dead edges in
AAIntraFnReachability. If those are still dead, we can avoid an update.

17 months ago[Attributor][NFCI] Use queries without exclusion set whenever possible
Johannes Doerfert [Fri, 3 Feb 2023 09:42:30 +0000 (01:42 -0800)]
[Attributor][NFCI] Use queries without exclusion set whenever possible

If a query uses an exclusion set but we haven't used it to determine the
result, we can cache the query without exclusion set too. When we lookup
a cached result we can check for the non-exclusion set version first.

17 months ago[Attributor][FIX] Ensure we use the right set comparison
Johannes Doerfert [Wed, 8 Feb 2023 15:02:24 +0000 (07:02 -0800)]
[Attributor][FIX] Ensure we use the right set comparison

17 months ago[Attributor][NFC] Avoid unnecessary string operations
Johannes Doerfert [Tue, 7 Feb 2023 14:17:08 +0000 (06:17 -0800)]
[Attributor][NFC] Avoid unnecessary string operations

This caused multiple string operations which we don't need if we do not
create a profile.

17 months ago[Attributor][NFCI] Create a AAIsDead for the function eagerly
Johannes Doerfert [Fri, 3 Feb 2023 09:42:10 +0000 (01:42 -0800)]
[Attributor][NFCI] Create a AAIsDead for the function eagerly

17 months ago[Attributor][NFCI] Avoid a temporary vector and exit early
Johannes Doerfert [Fri, 3 Feb 2023 09:40:36 +0000 (01:40 -0800)]
[Attributor][NFCI] Avoid a temporary vector and exit early

This change simply avoids the temporary vector and processes the elments
right away.

17 months ago[libc++][NFC] Reorganize hash.h
Louis Dionne [Thu, 9 Feb 2023 18:52:20 +0000 (10:52 -0800)]
[libc++][NFC] Reorganize hash.h

- Add missing _LIBCPP_HIDE_FROM_ABI
- Implement inline functions in the class to simplify the code
- Add missing `const` to `operator()`
- Move _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK to the usual location for function attributes

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

17 months ago[lldb][DWARFASTParserClang] Attach linkage name to ctors/dtors if missing
Michael Buch [Tue, 7 Feb 2023 13:53:30 +0000 (13:53 +0000)]
[lldb][DWARFASTParserClang] Attach linkage name to ctors/dtors if missing

**Summary**

This patch addresses the case where we have a `DW_AT_external`
subprogram for a constructor (and/or destructor) that doesn't carry
a `DW_AT_linkage_name` attribute. The corresponding DIE(s) that
represent the definition will have a linkage name, but if the name
contains constructs that LLDBs fallback mechanism for guessing mangled
names to resolve external symbols doesn't support (e.g., abi-tags)
then we end up failing to resolve the function call.

We address this by trying to find the linkage name before we create
the constructor/destructor decl, which will get attached using
an `AsmLabelAttr` to make symbol resolution easier.

**Testing**

* Added API test

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

17 months agoReland "[llvm][dsymutil] Add DW_TAG_imported_declaration to accelerator table"
Michael Buch [Fri, 10 Feb 2023 12:43:42 +0000 (12:43 +0000)]
Reland "[llvm][dsymutil] Add DW_TAG_imported_declaration to accelerator table"

This relands the commit previously reverted in
`8570bee53a8ce0c5d04bc11f288e19a457474c4c` due to failures on linux.

The problem was that the test executable was built with absolute
OSO prefix paths. This re-commit adds a modified version of the
executable that strips the absolute OSO prefix paths and makes
sure the test appends the OSO prefix appropriately (via the appropriate
dsymutil flags).

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

17 months ago[ConstraintElim] Update getLastConstraint to return to last row. (NFC)
Florian Hahn [Fri, 10 Feb 2023 17:12:21 +0000 (17:12 +0000)]
[ConstraintElim] Update getLastConstraint to return to last row. (NFC)

The current code incorrectly returned the first instead of the last row.
This fixes the debug output.

17 months ago[flang] Fixed selective TargetRewrite.
Slava Zakharin [Thu, 9 Feb 2023 22:38:24 +0000 (14:38 -0800)]
[flang] Fixed selective TargetRewrite.

Some conversions were still happening under no-complex/character-conversion
options. This change fixes that and adds a LIT test.

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

17 months ago[mlir][OpenMP] Add support for using Opaque Pointers in the OpenMP Dialect
Markus Böck [Wed, 8 Feb 2023 14:37:17 +0000 (15:37 +0100)]
[mlir][OpenMP] Add support for using Opaque Pointers in the OpenMP Dialect

The current OpenMP implementation assumes the use of typed pointers (or rather typed pointer like types). Given the support for typed pointers in LLVM is now pending removal, the OpenMP Dialect should be able to support opaque pointers as well, given that any users of it must lower OpenMP through the LLVM Dialect.

This patch fixes the above and adds support for using LLVM opaque pointers with the OpenMP dialect. This is implemented by making all related code not make use of the element type of pointer arguments. The few (one) op requiring a pointer element type now use an explicit `TypeAttr` for representing the element type.
More concretely, the list of changes are:
* `omp.atomic.read` now has an extra `TypeAttr` (also in syntax) which is the element type of the values read and stored from the operands
* `omp.reduction` now has an type argument in the syntax for both the accmulator and operand since the operand type can no longer be inferred from the accumulator
* `OpenMPToLLVMIRTranslation.cpp` was rewritten to never query element types of pointers
* Adjusted the verifier to be able to handle pointers without element types

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

17 months ago[mlir][Async] Add option to LLVM lowering to use opaque pointers
Markus Böck [Fri, 10 Feb 2023 11:35:49 +0000 (12:35 +0100)]
[mlir][Async] Add option to LLVM lowering to use opaque pointers

Part of https://discourse.llvm.org/t/rfc-switching-the-llvm-dialect-and-dialect-lowerings-to-opaque-pointers/68179

This patch adds the pass option 'use-opaque-pointers' to allow the dialect conversion from async to LLVM to create LLVM opaque pointers instead of typed pointers.
The gist of the changes boil down to having to propagate the choice of whether opaque or typed pointers should be used, to various helper functions that then either create typed pointers or opaque pointers.
This sadly creates a bit of a code duplication in comparison to other patches in this series, which I think is mostly unavoidable however, since a lot of the patterns in this lowering require the use of the AsyncTypeConverter, instead of the LLVMTypeConverter.

Besides that, the tests have been converter to opaque pointers with one file with typed pointer support having been created as regression tests.

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

17 months ago[clang] [extract-api] Don't crash for category in libclang APIs
Daniel Grumberg [Thu, 19 Jan 2023 11:25:17 +0000 (11:25 +0000)]
[clang] [extract-api] Don't crash for category in libclang APIs

Remove failure conditions for categories in libclang and return empty
content instead.

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

17 months ago[ConstraintElim] Improve debug test to show removed constraints (NFC).
Florian Hahn [Fri, 10 Feb 2023 16:26:38 +0000 (16:26 +0000)]
[ConstraintElim] Improve debug test to show removed constraints (NFC).

The current checks show incorrect debug output.

17 months ago[mlir] Add function for checking if a block is inside a loop
Tom Eccles [Tue, 10 Jan 2023 16:08:58 +0000 (16:08 +0000)]
[mlir] Add function for checking if a block is inside a loop

This function returns whether a block is nested inside of a loop. There
can be three kinds of loop:
  1) The block is nested inside of a LoopLikeOpInterface
  2) The block is nested inside another block which is in a loop
  3) There is a cycle in the control flow graph

This will be useful for Flang's stack arrays pass, which moves array
allocations from the heap to the stack. Special handling is needed when
allocations occur inside of loops to ensure additional stack space is
not allocated on each loop iteration.

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

17 months ago[VectorCombine] fix insertion point of shuffles
Sanjay Patel [Fri, 10 Feb 2023 15:53:22 +0000 (10:53 -0500)]
[VectorCombine] fix insertion point of shuffles

As shown in issue #60649, the new shuffles were
being inserted before a phi, and that is invalid.

It seems like most test coverage for this fold
(foldSelectShuffle) lives in the AArch64 dir,
but this doesn't repro there for a base target.

17 months ago[extract_symbols.py] Adjust how the output of nm is interpreted
John Brawn [Fri, 10 Feb 2023 14:51:54 +0000 (14:51 +0000)]
[extract_symbols.py] Adjust how the output of nm is interpreted

When looking for defined symbols, look for symbols that aren't of a
type that we don't want, instead of having specific list of symbol
types that we do want. This fixes a problem where (when using GNU
nm at least) there were some symbol types that we want to export but
which weren't in the list.

17 months ago[clang][dataflow] Convert nonnull pointer parameter to a reference.
Yitzhak Mandelbaum [Fri, 10 Feb 2023 15:02:44 +0000 (15:02 +0000)]
[clang][dataflow] Convert nonnull pointer parameter to a reference.

The parameter in question belongs to a function that is only called once. This patch updates the API to use a reference and changes the caller accordingly.

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

17 months agoRevert "[mlgo] Fix test after D143624"
Mircea Trofin [Fri, 10 Feb 2023 15:46:47 +0000 (07:46 -0800)]
Revert "[mlgo] Fix test after D143624"

This reverts commit dc4c3cfd78c01bef427fca0431fe66a6c6de7c35.

Reverting because D143624 has been reverted.

17 months ago[libc] Move likely/unlikely to the optimization header
Guillaume Chatelet [Fri, 10 Feb 2023 15:15:10 +0000 (15:15 +0000)]
[libc] Move likely/unlikely to the optimization header

17 months ago[InstCombine] propagate FMF in exp2->ldexp fold
Sanjay Patel [Fri, 10 Feb 2023 14:59:33 +0000 (09:59 -0500)]
[InstCombine] propagate FMF in exp2->ldexp fold

17 months ago[InstCombine] copy tail markings in exp2->ldexp fold
Sanjay Patel [Fri, 10 Feb 2023 14:54:22 +0000 (09:54 -0500)]
[InstCombine] copy tail markings in exp2->ldexp fold

17 months ago[InstCombine] add 'tail' to exp2 call in test; NFC
Sanjay Patel [Fri, 10 Feb 2023 14:51:27 +0000 (09:51 -0500)]
[InstCombine] add 'tail' to exp2 call in test; NFC

Tail markings are not propagated if the transform succeeds.

17 months agoRevert "Inlining: Run the legacy AlwaysInliner before the regular inliner."
David Green [Fri, 10 Feb 2023 15:01:49 +0000 (15:01 +0000)]
Revert "Inlining: Run the legacy AlwaysInliner before the regular inliner."

This seems to cause large regressions in existing code, as much as 75% slower
(4x the time taken). Small always inline functions seem to be used a lot in the
cmsis-dsp library.

I would add a phase ordering test to show the problems, but one already exists!
The llvm/test/Transforms/PhaseOrdering/ARM/arm_mult_q15.ll was just changed by
removing alwaysinline to hide the problems that existed.

This reverts commit cae033dcf227aeecf58fca5af6fc7fde1fd2fb4f.
This reverts commit 8e33c41e72ad42e4c27f8cbc3ad2e02b169637a1.

17 months ago[AMDGPU][MC] Generate relative relocations for allocatable (more particularly, eh_fra...
Juan Manuel MARTINEZ CAAMAÑO [Fri, 10 Feb 2023 14:05:05 +0000 (15:05 +0100)]
[AMDGPU][MC] Generate relative relocations for allocatable (more particularly, eh_frame) sections

Reviewed By: scott.linder

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

17 months ago[DebugInfo] Handle missed DW_FORM_addrx3 and DW_FORM_strx3 cases
Benjamin Maxwell [Tue, 7 Feb 2023 10:36:34 +0000 (10:36 +0000)]
[DebugInfo] Handle missed DW_FORM_addrx3 and DW_FORM_strx3 cases

This fixes a few places where the addrx3 and strx3 forms were missed.
Previously this meant if one of these forms appeared somewhere various
errors could occur. This now also adds an extra test case for the addrx3
form (which previously failed).

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

17 months ago[clangd] Move function body to out-of-line: unnamed class method incorrect moving
Denis Fatkulin [Fri, 10 Feb 2023 14:19:11 +0000 (17:19 +0300)]
[clangd] Move function body to out-of-line: unnamed class method incorrect moving

The refactoring !!Move function body to out-of-line!! produces incorrect code for methods of unnamed classes.
For this simple example
  // foo.h
  struct Foo {
    struct {
      void f^oo() {}
    } Bar;
  };

the refactoring generates code:
  // foo.cpp
  void Foo::(unnamed struct at D:\test\foo.h:2:3)foo() {}

Outplace definition for methods of unnamed classes is meaningless. The patch disables it.

Reviewed By: kadircet

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

17 months ago[mlir][llvm] Store memory op metadata using op attributes.
Tobias Gysi [Fri, 10 Feb 2023 14:22:54 +0000 (15:22 +0100)]
[mlir][llvm] Store memory op metadata using op attributes.

The revision introduces operation attributes to store tbaa metadata on
load and store operations rather than relying using dialect attributes.
At the same time, the change also ensures the provided getters and
setters instead are used instead of a string based lookup. The latter
is done for the tbaa, access groups, and alias scope attributes.

The goal of this change is to ensure the metadata attributes are only
placed on operations that have the corresponding operation attributes.
This is imported since only these operations later on translate these
attributes to LLVM IR. Dialect attributes placed on other operations
are lost during the translation.

Reviewed By: vzakhari, Dinistro

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

17 months ago[amdgpu-arch] Fix build of amdgpu-arch with CLANG_LINK_CLANG_DYLIB
Joseph Huber [Fri, 10 Feb 2023 14:22:05 +0000 (08:22 -0600)]
[amdgpu-arch] Fix build of amdgpu-arch with CLANG_LINK_CLANG_DYLIB

The function clang_target_link_libraries must only be used with real
Clang libraries; with CLANG_LINK_CLANG_DYLIB, it will instead link in
clang-cpp. We must use the standard CMake target_link_libraries for
the HSA library.

17 months ago[clangd] fix wrong CalleeArgInfo in the hover
v1nh1shungry [Wed, 18 Jan 2023 14:15:28 +0000 (22:15 +0800)]
[clangd] fix wrong CalleeArgInfo in the hover

```
void foobar(int);
int main() {
  foobar(1 + 2);
           ^
}
```

Currently the CalleeArgInfo will be "Passed by reference", which should
be "Passed by value".

Fixes https://github.com/clangd/clangd/issues/1467

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

17 months ago[gn build] Port 6470706bc0ed
LLVM GN Syncbot [Fri, 10 Feb 2023 14:07:17 +0000 (14:07 +0000)]
[gn build] Port 6470706bc0ed

17 months ago[X86] combineConcatVectorOps - concatenate AVX512 vselect nodes. NFC.
Simon Pilgrim [Fri, 10 Feb 2023 13:14:38 +0000 (13:14 +0000)]
[X86] combineConcatVectorOps - concatenate AVX512 vselect nodes. NFC.

This also requires us to constant fold vXi1 concat_vector nodes

17 months ago[libc] Fix exp2f and prevent misuse of likely/unlikely
Guillaume Chatelet [Fri, 10 Feb 2023 13:49:03 +0000 (13:49 +0000)]
[libc] Fix exp2f and prevent misuse of likely/unlikely

Let's make sure that we only accept boolean expressions when using likely/unlikely.

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

17 months ago[gn] port 6470706bc0e
Nico Weber [Fri, 10 Feb 2023 13:58:51 +0000 (08:58 -0500)]
[gn] port 6470706bc0e

17 months ago[Assignment Tracking] Fix fragment index error in getDerefOffsetInBytes
OCHyams [Fri, 10 Feb 2023 12:33:16 +0000 (12:33 +0000)]
[Assignment Tracking] Fix fragment index error in getDerefOffsetInBytes

Without this patch `getDerefOffsetInBytes` incorrectly always returns
`std::nullopt` for expressions with fragments due to an off-by-one error with
fragment element indices.

Reviewed By: StephenTozer

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

17 months ago[mlir][llvm] Adapt loop metadata to match llvm
Christian Ulmann [Fri, 10 Feb 2023 13:33:41 +0000 (14:33 +0100)]
[mlir][llvm] Adapt loop metadata to match llvm

This commit adds support for the "llvm.loop.isvectorized" metadata and
ensures that the unroll followups match llvm's naming.

Reviewed By: gysit

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

17 months ago[NFC][compiler-rt] Shorten comment
Tobias Hieta [Fri, 10 Feb 2023 13:42:48 +0000 (14:42 +0100)]
[NFC][compiler-rt] Shorten comment

17 months ago[Workflow] Add Release Repo sync script
Tobias Hieta [Fri, 27 Jan 2023 15:46:19 +0000 (16:46 +0100)]
[Workflow] Add Release Repo sync script

Adds a bash script that syncs llvm/llvm-project and llvm/llvm-project-release-prs.
This should run on pushes to any of the repositories release branches.

I will follow this up with a change to the github actions to run this
script.

This breaks out the sync script from: https://reviews.llvm.org/D133476
so we can keep them separate.

Reviewed By: kwk

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

17 months ago[CMake][compiler-rt] Support clang-cl in CompilerRTMockLLVMCMakeConfig
Tobias Hieta [Wed, 8 Feb 2023 08:26:49 +0000 (09:26 +0100)]
[CMake][compiler-rt] Support clang-cl in CompilerRTMockLLVMCMakeConfig

clang-cl doesn't support -dumpmachine directly, so we need to
preface it with /clang: in order to get this probing function
to work.

This is needed in order to run cmake directly on the runtimes
directory.

Reviewed By: hans

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

17 months ago[RISCV] Add tests for .attribute stack_align
Job Noorman [Fri, 10 Feb 2023 11:50:26 +0000 (19:50 +0800)]
[RISCV] Add tests for .attribute stack_align

As suggested by @asb [here](https://reviews.llvm.org/D143570#4112877), we need tests for `.attribute stack_align`. This patch simply verifies a stack alignment of 16 is emitted for any combination of currently supported base ISA and extensions.

Reviewed By: asb, kito-cheng

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

17 months ago[InstCombine] avoid crashing in pow->ldexp
Sanjay Patel [Fri, 10 Feb 2023 13:01:04 +0000 (08:01 -0500)]
[InstCombine] avoid crashing in pow->ldexp

Similar to 62a0a1b9eea7788c1f9dbae -

We have pow math intrinsics in IR, but no ldexp intrinsics
to handle vector types.

A patch for that was proposed in D14327, but it was not completed.

Issue #60605

17 months ago[clang] Update Clang version from 16 to 17 in scan-build.1.
Frederic Cambus [Fri, 10 Feb 2023 12:50:04 +0000 (13:50 +0100)]
[clang] Update Clang version from 16 to 17 in scan-build.1.

Similar to D110763.

17 months ago[InstCombine] avoid crashing in exp2->ldexp
Sanjay Patel [Fri, 10 Feb 2023 12:03:56 +0000 (07:03 -0500)]
[InstCombine] avoid crashing in exp2->ldexp

We have exp2 math intrinsics in IR, but no ldexp intrinsics
to handle vector types.

A patch for that was proposed in D14327, but it was not completed.

Issue #60605

17 months ago[InstCombine] add test for exp2->ldexp; NFC
Sanjay Patel [Fri, 10 Feb 2023 11:55:59 +0000 (06:55 -0500)]
[InstCombine] add test for exp2->ldexp; NFC

17 months ago[InstCombine] auto-generate check lines in test file; NFC
Sanjay Patel [Fri, 10 Feb 2023 11:51:57 +0000 (06:51 -0500)]
[InstCombine] auto-generate check lines in test file; NFC

17 months agoARM: skip debug instructions when matching jump-table patterns.
Tim Northover [Fri, 10 Feb 2023 11:40:20 +0000 (11:40 +0000)]
ARM: skip debug instructions when matching jump-table patterns.

When working out whether we can see a compressible jump-table pattern during
ConstantIslands, we were stopping when we saw a debug instruction. Instead it's
better to keep iterating backwards to the first real instruction.

https://reviews.llvm.org/D142019

17 months ago[mlir][bufferization] Restrict function boundary buffer. to func.call.
Ingo Müller [Fri, 10 Feb 2023 11:31:35 +0000 (11:31 +0000)]
[mlir][bufferization] Restrict function boundary buffer. to func.call.

The current bufferization on function boundaries works on `func.func`
and any call op implementing `CallOpInterface`. Then, an error is thrown
if there is a `CallOpInterface` op that is not `func.call`. This is
unnecessary and breaks the pass whenever such an op occurs (such as
`llvm.call`). This PR simply restricts the handling of call ops to
`func.call`.

Reviewed By: springerm

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

17 months ago[bazel] Fix build and make all target respect layering_check
Guillaume Chatelet [Fri, 10 Feb 2023 11:40:14 +0000 (11:40 +0000)]
[bazel] Fix build and make all target respect layering_check

Tested with `bazelisk-linux-amd64 query //... + @llvm-project//... | xargs bazelisk-linux-amd64 test --config=ci --features=layering_check`

17 months ago[RISCV] Add precommit tests for D143646
LiaoChunyu [Fri, 10 Feb 2023 11:34:37 +0000 (19:34 +0800)]
[RISCV] Add precommit tests for D143646

17 months ago[AMDGPU][AsmParser] Fix matching immediate literals.
Ivan Kosarev [Fri, 10 Feb 2023 11:07:17 +0000 (11:07 +0000)]
[AMDGPU][AsmParser] Fix matching immediate literals.

Prevents potential matching of literal offsets to non-literal operands.

Reviewed By: dp

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

17 months ago[InstCombine][NFC] regenerate tests for simple_phi_condition.ll
Yingchi Long [Fri, 10 Feb 2023 11:26:14 +0000 (19:26 +0800)]
[InstCombine][NFC] regenerate tests for simple_phi_condition.ll

17 months ago[Test] Add complementary tests for OR analogous for those for AND
Max Kazantsev [Fri, 10 Feb 2023 10:55:01 +0000 (17:55 +0700)]
[Test] Add complementary tests for OR analogous for those for AND

17 months ago[Test] Add test showing an opportunity to transform checks and hoist invariants
Max Kazantsev [Fri, 10 Feb 2023 10:41:03 +0000 (17:41 +0700)]
[Test] Add test showing an opportunity to transform checks and hoist invariants

17 months ago[SanitizerBinaryMetadata] Fix ignorelist test under Windows
Marco Elver [Fri, 10 Feb 2023 10:22:17 +0000 (11:22 +0100)]
[SanitizerBinaryMetadata] Fix ignorelist test under Windows

Windows paths confuse the regular expression. Just use the test source
name directly.

Fixes: 421215b919d0 ("[SanitizerBinaryMetadata] Support ignore list")

17 months agoMove SIMD alignment calculation to LLVM Frontend
Dominik Adamski [Tue, 17 Jan 2023 09:51:48 +0000 (03:51 -0600)]
Move SIMD alignment calculation to LLVM Frontend

Currently default simd alignment is defined by Clang specific TargetInfo class.
This class cannot be reused for LLVM Flang. That's why default simd alignment
calculation has been moved to OMPIRBuilder which is common for Flang and Clang.

Previous attempt: https://reviews.llvm.org/D138496 was wrong because
the default alignment depended on the number of built LLVM targets.

If we wanted to calculate the default alignment for PPC and we hadn't specified
PPC LLVM target to build, then we would get 0 as the alignment because
OMPIRBuilder couldn't create PPCTargetMachine object and it returned 0 as
the default value.

If PPC LLVM target had been built earlier, then OMPIRBuilder could have created
PPCTargetMachine object and it would have returned 128.

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

Reviewed By: jdoerfert

17 months ago[LVI] Don't traverse uses when calculating range at use
Dmitry Makogon [Fri, 10 Feb 2023 09:00:16 +0000 (16:00 +0700)]
[LVI] Don't traverse uses when calculating range at use

This effectively reverts 5c38c6a and 4f772b0.

A recently introduced LazyValueInfo::getConstantRangeAtUse returns incorrect
ranges for values in certain cases. One such example is described in PR60629.
The issue has something to do with traversing PHI uses of a value transitively.
As nikic pointed out, we're effectively reasoning about values from different
loop iterations.

In the faulting test case, CVP made a miscompilation because the calculated
range for a shift argument was incorrect. It returned empty-set, however it is
clearly not a dead code. CVP then erased the shift instruction because
of empty range.

17 months ago[LVI][CVP] Add test for miscompilation by CVP due to incorrect range returned by LVI
Dmitry Makogon [Fri, 10 Feb 2023 09:30:47 +0000 (16:30 +0700)]
[LVI][CVP] Add test for miscompilation by CVP due to incorrect range returned by LVI

This adds a test case from PR60629 which shows a miscompilation by CVP.

17 months ago[NFC][TargetParser] Replace uses of llvm/Support/Host.h
Archibald Elliott [Fri, 10 Feb 2023 09:59:46 +0000 (09:59 +0000)]
[NFC][TargetParser] Replace uses of llvm/Support/Host.h

The forwarding header is left in place because of its use in
`polly/lib/External/isl/interface/extract_interface.cc`, but I have
added a GCC warning about the fact it is deprecated, because it is used
in `isl` from where it is included by Polly.

17 months ago[Assignment Tracking][mem2reg] Remove overly defensive assert
OCHyams [Fri, 10 Feb 2023 09:27:37 +0000 (09:27 +0000)]
[Assignment Tracking][mem2reg] Remove overly defensive assert

The assert fires if a store to an alloca with no linked dbg.assigns has linked
dbg.assigns. This can happen in the wild due to optimisations dropping the
alloca's debug info so we shouldn't assert against it.

Reviewed By: jryans

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

17 months ago[Assignment Tracking][SROA] Delete dbg.assigns linked to rewritten stores
OCHyams [Fri, 10 Feb 2023 09:26:26 +0000 (09:26 +0000)]
[Assignment Tracking][SROA] Delete dbg.assigns linked to rewritten stores

AggLoadStoreRewriter splits aggregate loads and stores into scalars (before the
alloca is split up). The new stores and debug intrinsics are already wired up
correctly - we just need to also delete the dbg.assign that is linked to the
split to-be-deleted store too.

Reviewed By: jmorse

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

17 months agoRevert "[C++20] [Modules] [ClangScanDeps] Enable to print make-style dependency file...
Chuanqi Xu [Fri, 10 Feb 2023 09:46:18 +0000 (17:46 +0800)]
Revert "[C++20] [Modules] [ClangScanDeps] Enable to print make-style dependency file within P1689 format (4/4)"

This reverts commit e1354763b6e641e45cc2371270883fcd26edf705.

There is a build failure in m68k-linux testing bot
(https://lab.llvm.org/buildbot/#/builders/192/builds/267), which is
weird. Revert this for now and look at the reasons.

17 months ago[WebAssembly] Additional patterns for pmin/pax
Samuel Parker [Wed, 8 Feb 2023 14:09:06 +0000 (14:09 +0000)]
[WebAssembly] Additional patterns for pmin/pax

Each operation was missing their inverted condition using olt or ogt.
Also, as we don't need to discern +/-0, I think we should also be
able to use ole and oge.

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

17 months ago[flang][NFC] Clean up polymorphic-temp.f90
Valentin Clement [Fri, 10 Feb 2023 09:25:01 +0000 (10:25 +0100)]
[flang][NFC] Clean up polymorphic-temp.f90

17 months ago[SanitizerBinaryMetadata] Support ignore list
Marco Elver [Fri, 10 Feb 2023 08:34:08 +0000 (09:34 +0100)]
[SanitizerBinaryMetadata] Support ignore list

For large projects it will be required to opt out entire subdirectories.
In the absence of fine-grained control over the flags passed via the
build system, introduce -fexperimental-sanitize-metadata-ignorelist=.

The format is identical to other sanitizer ignore lists, and its effect
will be to simply not instrument either functions or entire modules
based on the rules in the ignore list file.

Reviewed By: dvyukov

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

17 months ago[NFC][Assignment Tracking] Remove lifetime intrinsics from some tests
OCHyams [Fri, 10 Feb 2023 09:20:53 +0000 (09:20 +0000)]
[NFC][Assignment Tracking] Remove lifetime intrinsics from some tests

The intrinsics don't add anything to the tests and the tests are easier to
debug without the additional noise.

Some SSA value names have changed as a result of no longer visiting the
intrinsics.

Reviewed By: jryans

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

17 months ago[Test][SCEV] Add tests where multiple assumes can be used to improve trip multiple
Max Kazantsev [Fri, 10 Feb 2023 09:05:16 +0000 (16:05 +0700)]
[Test][SCEV] Add tests where multiple assumes can be used to improve trip multiple

Add tests combining assume on trip count divisibility (TV % VF) and minimum/maximum
values (TC > N, TC < M).

Patch by Alon Kom!

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

17 months ago[bazel] Add missing dependency after 687f78210d0
Benjamin Kramer [Fri, 10 Feb 2023 09:22:18 +0000 (10:22 +0100)]
[bazel] Add missing dependency after 687f78210d0

17 months ago[NFC] convert compiler-rt/lib/dfsan/scripts/build-libc-list.py to python3 syntax
Tobias Hieta [Fri, 10 Feb 2023 07:33:32 +0000 (08:33 +0100)]
[NFC] convert compiler-rt/lib/dfsan/scripts/build-libc-list.py to python3 syntax

I found a few Python files not using Python 3 syntax in the tree
when trying to apply reformatting to them. This was converted with
2to3 and the changes seemed sane.

Reviewed By: MaskRay, browneee

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

17 months ago[libc][Obvious] Include MPFRWrapper and testutils only if tests are enabled.
Siva Chandra Reddy [Fri, 10 Feb 2023 09:03:05 +0000 (09:03 +0000)]
[libc][Obvious] Include MPFRWrapper and testutils only if tests are enabled.

17 months ago[bazel] fix build for 6470706bc0ed
Mikhail Goncharov [Fri, 10 Feb 2023 09:03:37 +0000 (10:03 +0100)]
[bazel] fix build for 6470706bc0ed

17 months ago[Reland][LSR] Hoist IVInc to loop header if its all uses are in the loop header
chenglin.bi [Fri, 10 Feb 2023 08:49:56 +0000 (16:49 +0800)]
[Reland][LSR] Hoist IVInc to loop header if its all uses are in the loop header

Original code will cause crash when the load/store memory type is structure because isIndexedLoadLegal/isIndexedStore doesn't support struct type.
So we limit the load/store memory type to integer.

Origin commit message:
When the latch block is different from header block, IVInc will be expanded in the latch loop. We can't generate the post index load/store this case.
But if the IVInc only used in the loop, actually we still can use the post index load/store because when exit loop we don't care the last IVInc value.
So, trying to hoist IVInc to help backend to generate more post index load/store.

Fix #53625

Reviewed By: eopXD

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

17 months ago[libc] Run libc tests unconditionally, even if there are no source changes.
Siva Chandra Reddy [Thu, 9 Feb 2023 05:42:12 +0000 (05:42 +0000)]
[libc] Run libc tests unconditionally, even if there are no source changes.

Before this change, the test binaries were executed only if the deps
changed. This change makes the test binaries run unconditionally. This
is more in line with the rest of LLVM. Future patches will print test
statistics etc., much like the rest of LLVM.

Reviewed By: gchatelet

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

17 months ago[mlir][bufferization] Support multiple leaves in EmptyTensorElimination
Matthias Springer [Fri, 10 Feb 2023 08:30:21 +0000 (09:30 +0100)]
[mlir][bufferization] Support multiple leaves in EmptyTensorElimination

Support cases where a source tensor can be traced back to multiple possible tensor.empty ops.

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

17 months ago[OPENMP][NFC] added loop bind to the support page
Sandeep Kosuri [Fri, 10 Feb 2023 08:32:50 +0000 (02:32 -0600)]
[OPENMP][NFC] added loop bind to the support page

17 months ago[SimplifyIndVar][NFC] Refactor Binary Operator's flag strengthening
Max Kazantsev [Fri, 10 Feb 2023 08:20:03 +0000 (15:20 +0700)]
[SimplifyIndVar][NFC] Refactor Binary Operator's flag strengthening

Extract complex logic of Binary Operator's flag strengthening to a separate
method in order to reuse it.

Patch by Aleksandr Popov!

Differential Revision: https://reviews.llvm.org/D143562
Reviewed By: mkazantsev

17 months ago[NFC] Add test to show that preprocess an import decl won't require to load it actually
Chuanqi Xu [Fri, 10 Feb 2023 08:13:46 +0000 (16:13 +0800)]
[NFC] Add test to show that preprocess an import decl won't require to load it actually

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

This is addressed in D137526 but I forgot to add a test for it.

17 months ago[MLIR] Fold away divs and mods in affine ops with operand info
Uday Bondhugula [Fri, 10 Feb 2023 08:05:04 +0000 (13:35 +0530)]
[MLIR] Fold away divs and mods in affine ops with operand info

Fold away divs and mods in affine maps exploiting operand info during
canonicalization. This simplifies affine map applications such as the ones
below:

```
// Simple ones.
affine.for %i = 0 to 32 {
  affine.load %A[%i floordiv 32]
  affine.load %A[%i mod 32]
  affine.load %A[2 * %i floordiv 64]
  affine.load %A[(%i mod 16) floordiv 16]
  ...
}

// Others.
 affine.for %i = -8 to 32 {
   // Will be simplified %A[0].
   affine.store %cst, %A[2 + (%i - 96) floordiv 64] : memref<64xf32>
}
```

Reviewed By: springerm

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

17 months ago[NFC] Remove the unused parameter introduced in e135476
Chuanqi Xu [Fri, 10 Feb 2023 08:02:31 +0000 (16:02 +0800)]
[NFC] Remove the unused parameter introduced in e135476

I introduced an unused parameter due to an oversight during rebasing.
Now the patch removes the parameter.

17 months ago[flang][hlfir] Ramp-up support of implicit interface mismatches
Jean Perier [Fri, 10 Feb 2023 07:56:53 +0000 (08:56 +0100)]
[flang][hlfir] Ramp-up support of implicit interface mismatches

There is a lot of Fortran code that takes advantage of F77 implicit
interface to pass arguments with a different type than those from
the subprogram definition (which is well defined if the storage
and passing convention are the same or compatible).

When the definition and calls are in different files, there is nothing
special to do: the actual arguments are already used to compute the
call interface.

The trouble for lowering comes when the definition is in the same
compilation unit (Semantics raises warning). Then, lowering will
be provided with the interface from the definition to prepare the
argument, and this leads to many ad-hoc handling (see
builder.convertWithSemantics) in the current lowering to cope
with the dummy/actual mismatches on a case by case basis. The
current lowering to FIR is not even complete for all mismatch cases that
can be found in the wild (see https://github.com/llvm/llvm-project/issues/60550),
it is crashing or hitting asserts for many of the added tests.

For HLFIR, instead of coping on a case by case basis, the call
interface will be recomputed according to the actual arguments when
calling an external procedure that can be called with an explicit
interface.

One extra case still has to be handled manually because it may happen
in calls with explicit interfaces: passing a character procedure
designator to a non character procedure dummy (and vice-versa) is widely
accepted even with explicit interfaces (and flang semantic accepts it).
Yet, this "mismatch" cannot be dealt with a simple fir.convert because
character dummy procedure are passed with a different passing
convention: an extra argument is hoisted for the result length (in FIR,
there is no extra argument yet, but the MLIR func argument is a
tuple<fir.boxproc, len>).

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

17 months ago[mlir][llvm] Fix TBAA verfication crash
Christian Ulmann [Fri, 10 Feb 2023 07:21:46 +0000 (08:21 +0100)]
[mlir][llvm] Fix TBAA verfication crash

This commit fixes a crash of the TBAA verification that happened due to
accessing memory through invalid pointers. A DenseMap does not guarantee
that pointers to its elements remain valid after additional elements
are inserted.

A testcase that caused this crash had more than 100 TBAA metadata
operations and thus no test is added. Instead, there is now an assertion
that ensures that the graph class is used correctly.

Reviewed By: vzakhari

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