platform/upstream/llvm.git
2 years ago[Test] Add pointer comparison test that crashed with D118317
Max Kazantsev [Sat, 29 Jan 2022 03:12:28 +0000 (10:12 +0700)]
[Test] Add pointer comparison test that crashed with D118317

2 years ago[RISCV] Improve extract_vector_elt for fixed mask registers.
jacquesguan [Sat, 15 Jan 2022 09:14:38 +0000 (17:14 +0800)]
[RISCV] Improve extract_vector_elt for fixed mask registers.

Now the backend promotes mask vector to an i8 vector and extract element from that. We could bitcast to a widen element vector, and extract from it to GPR, then use I instruction to extract the certain bit.

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

2 years ago[Test] Recommit tests that were reverted by mistake along with other patch
Max Kazantsev [Sat, 29 Jan 2022 02:53:36 +0000 (09:53 +0700)]
[Test] Recommit tests that were reverted by mistake along with other patch

2 years ago[M68k][GlobalISel] Legalize more instruction in M68k Legalizer.
Sheng [Sat, 29 Jan 2022 01:59:58 +0000 (09:59 +0800)]
[M68k][GlobalISel] Legalize more instruction in M68k Legalizer.

This patch legalizes more instructions and data types.

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

2 years agoAdd 'clangd' prefix to remote index proto targets
Sam McCall [Sat, 29 Jan 2022 01:19:43 +0000 (02:19 +0100)]
Add 'clangd' prefix to remote index proto targets

Some pieces of build infrastructure (shlib, debian package) classify
targets based on whether they begin with "clang".

2 years agoRevert "[UpdateTestChecks] Add --filter and --filter-out options"
David Greene [Sat, 29 Jan 2022 01:06:51 +0000 (17:06 -0800)]
Revert "[UpdateTestChecks] Add --filter and --filter-out options"

Broke some update-test-checks tests.  Reverting while developing a fix.

This reverts commit 030f71698d52f228929da5e3148602f4a3daff7d.

2 years agoMove LLVM Proposal to doc directory, create index
Jeff Bailey [Sat, 29 Jan 2022 00:27:34 +0000 (00:27 +0000)]
Move LLVM Proposal to doc directory, create index

The LLVM Libc project is no longer just a proposal and should have
a webpage tracking the status of the project.  This changes
puts the pieces into the right place so that the webpage can be
created.

Reviewed By: sivachandra

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

2 years ago[flang] Implement a runtime routine to report fatal errors with source position
Peter Steinfeld [Fri, 28 Jan 2022 21:21:29 +0000 (13:21 -0800)]
[flang] Implement a runtime routine to report fatal errors with source position

The title says it all.

I implemented a routine called "Crash" and added a test.

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

2 years ago[OpenMP] Accept shortened triples for -Xopenmp-target=
Joseph Huber [Fri, 28 Jan 2022 18:28:28 +0000 (13:28 -0500)]
[OpenMP] Accept shortened triples for -Xopenmp-target=

This patch builds on the change in D117634 that expanded the short
triples when passed in by the user. This patch adds the same
functionality for the `-Xopenmp-target=` flag. Previously it was
unintuitive that passing `-fopenmp-targets=nvptx64
-Xopenmp-target=nvptx64 <arg>` would not forward the arg because the
triples did not match on account of `nvptx64` being expanded to
`nvptx64-nvidia-cuda`.

Reviewed By: jdoerfert

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

2 years agoRevert "Add BITINT_MAXWIDTH support"
Jan Korous [Fri, 28 Jan 2022 23:08:45 +0000 (15:08 -0800)]
Revert "Add BITINT_MAXWIDTH support"

This reverts commit 86797fdb6f51d32f285e48b6d3e0fc5b8b852734.

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

2 years ago[mlir][sparse] Adding standard pipeline for tests.
wren romano [Thu, 27 Jan 2022 00:44:32 +0000 (16:44 -0800)]
[mlir][sparse] Adding standard pipeline for tests.

Addresses https://bugs.llvm.org/show_bug.cgi?id=52409 aka https://github.com/llvm/llvm-project/issues/51751

Reviewed By: aartbik, mehdi_amini

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

2 years ago[clang-tidy] Recognize labelled statements when simplifying boolean exprs
Richard [Thu, 30 Dec 2021 22:41:27 +0000 (15:41 -0700)]
[clang-tidy] Recognize labelled statements when simplifying boolean exprs

Inside a switch the caseStmt() and defaultStmt() have a nested statement
associated with them.  Similarly, labelStmt() has a nested statement.
These statements were being missed when looking for a compound-if of the
form "if (x) return true; return false;" when the if is nested under one
of these labelling constructs.

Enhance the matchers to look for these nested statements using some
private matcher hasSubstatement() traversal matcher on case, default
and label statements.  Add the private matcher hasSubstatementSequence()
to match the compound "if (x) return true; return false;" pattern.

- Add unit tests for private matchers and corresponding test
  infrastructure
- Add corresponding test file readability-simplify-bool-expr-case.cpp.
- Fix variable name copy/paste error in readability-simplify-bool-expr.cpp.
- Drop the asserts, which were used only for debugging matchers.
- Run clang-format on the whole check.
- Move local functions out of anonymous namespace and declare state, per
  LLVM style guide
- Declare labels constexpr
- Declare visitor arguments as pointer to const
- Drop braces around simple control statements per LLVM style guide
- Prefer explicit arguments over default arguments to methods

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

Fixes #27078

2 years ago[Driver] Remove -fno-experimental-new-pass-manager
Fangrui Song [Fri, 28 Jan 2022 22:58:26 +0000 (14:58 -0800)]
[Driver] Remove -fno-experimental-new-pass-manager

to give users a final warning that they need to migrate away. They could still
use -flegacy-pass-manager for Clang 14.0.0, but the functionality may not work
for 15.0.0.

-fexperimental-new-pass-manager is a no-op for default builds, so not urgent to
be removed for 14.0.0.

clang/test/Frontend/optimization-remark-with-hotness.c is removed because its
new PM replacement optimization-remark-with-hotness-new-pm.c exists.

Reviewed By: aeubanks, nikic

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

2 years ago[MLIR][GPU] Add missing #include to SerializeToHsaco.cpp
Krzysztof Drewniak [Fri, 28 Jan 2022 21:05:02 +0000 (21:05 +0000)]
[MLIR][GPU] Add missing #include to SerializeToHsaco.cpp

llvm/Support/Path.h was likely previously implicitly included, and a
refactoring removed that inclusion, breaking the pass.

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

2 years ago[MLIR] Factor out common parts of the TLike constraint
Krzysztof Drewniak [Thu, 27 Jan 2022 16:48:44 +0000 (16:48 +0000)]
[MLIR] Factor out common parts of the TLike constraint

Type constraints such as BoolLike and SignlessIntegerLike appear to
have been defined by copy-paste and all share an underlying TypesLike
structure that can be factored out.

This also allows for defining additional constraints of a similar
form, such as F32Like.

Reviewed By: rriddle

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

2 years agoUpdate module map for 4ce1f3d47c33daccfb7f4e906c3f57b404900036
Adrian Prantl [Fri, 28 Jan 2022 22:51:46 +0000 (14:51 -0800)]
Update module map for 4ce1f3d47c33daccfb7f4e906c3f57b404900036

2 years ago[Driver] Add CUDA support for --offload param
Daniele Castagna [Fri, 28 Jan 2022 22:49:48 +0000 (14:49 -0800)]
[Driver] Add CUDA support for --offload param

The --offload option was added in D110622 to "override the default
device target". When it landed it supported only HIP.  This patch
extends that option to support SPIR-V targets for CUDA.

Reviewed By: tra

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

2 years ago[ScalarEvolution] Handle <= and >= in non infinite loops
William S. Moses [Tue, 25 Jan 2022 01:02:53 +0000 (20:02 -0500)]
[ScalarEvolution] Handle <= and >= in non infinite loops

Extend scalar evolution to handle >= and <= if a loop is known to be finite and the induction variable guards the condition. Specifically, with these assumptions lhs <= rhs is equivalent to lhs < rhs + 1 and lhs >= rhs to lhs > rhs -1.

In the case of lhs <= rhs, this is true since the only case these are not equivalent
is when rhs == unsigned/signed intmax, which would have resulted in an infinite loop.

In the case of lhs >= rhs, this is true since the only case these are not equivalent
is when rhs == unsigned/signed intmin, which would again have resulted in an infinite loop.

Reviewed By: lebedev.ri

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

2 years ago[AttrDocs] Fix docs for the sycl_special_class attribute after D114483
Fangrui Song [Fri, 28 Jan 2022 22:30:49 +0000 (14:30 -0800)]
[AttrDocs] Fix docs for the sycl_special_class attribute after D114483

Fixes `AttributeReference.rst:6628:Explicit markup ends without a blank line; unexpected unindent.`
for `ninja docs-clang-html`

2 years ago[mlir] Fix build after 83d59e05b201
Alexandre Ganea [Fri, 28 Jan 2022 22:21:15 +0000 (17:21 -0500)]
[mlir] Fix build after 83d59e05b201

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

2 years ago[UpdateTestChecks] Add --filter and --filter-out options
David Greene [Wed, 19 Jan 2022 17:33:17 +0000 (09:33 -0800)]
[UpdateTestChecks] Add --filter and --filter-out options

Enhance the various update_*_test_checks.py tools to allow filtering the tool
output with regular expressions.  The --filter option will emit only tool output
lines matching the given regular expression while the --filter-out option will
emit only tools output lines not matching the given regular expression.  Filters
are applied in order of appearance on the command line (or in UTC_ARGS) and the
first matching filter terminates the search.

This allows test authors to create more focused tests by removing irrelevant
tool output and checking only the pieces of output necessary to test the desired
functionality.

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

2 years ago[flang] Initial lowering for empty program
Valentin Clement [Fri, 28 Jan 2022 21:39:44 +0000 (22:39 +0100)]
[flang] Initial lowering for empty program

This patch enable lowering from Fortran to FIR for a basic empty
program. It brings all the infrastructure needed for that. As discussed
previously, this is the first patch for lowering and follow up patches
should be smaller.

With this patch we can lower the following code:

```
program basic
end program
```

To a the FIR equivalent:

```
func @_QQmain() {
  return
}
```

Follow up patch will add lowering of more complex constructs.

Reviewed By: kiranchandramohan, schweitz, PeteSteinfeld

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

2 years ago[flang][NFC] Remove obsolete IntrinsicCall helper
Valentin Clement [Fri, 28 Jan 2022 21:37:36 +0000 (22:37 +0100)]
[flang][NFC] Remove obsolete IntrinsicCall helper

Remove obsolete code that has moved to the
`flang/Optimizer/Builder/Intrinsic` directory.

`genMin` is inlined in the code since it's not available
in the builder.

Reviewed By: kiranchandramohan, schweitz

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

2 years ago[mlir][sparse][pytaco] enable dimension ordering syntax
Aart Bik [Fri, 28 Jan 2022 18:52:28 +0000 (10:52 -0800)]
[mlir][sparse][pytaco] enable dimension ordering syntax

Reviewed By: bixia

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

2 years ago[clang-format] Fix misaligned trailing comments in the presence of an empty block...
Marek Kurdej [Fri, 28 Jan 2022 09:37:22 +0000 (10:37 +0100)]
[clang-format] Fix misaligned trailing comments in the presence of an empty block comment.

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

Expected code:
```
/**/   //
int a; //
```

was before misformatted to:
```
/**/     //
int a; //
```

Because the "remaining length" (after the starting `/*`) of an empty block comment `/**/` was computed to be 0 instead of 2.

Reviewed By: MyDeveloperDay, HazardyKnusperkeks, owenpan

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

2 years agoRemove reference type when checking const structs
Weverything [Fri, 14 Jan 2022 23:42:36 +0000 (15:42 -0800)]
Remove reference type when checking const structs

ConstStructBuilder::Finalize in CGExprConstant.ccp assumes that the
passed in QualType is a RecordType.  In some instances, the type is a
reference to a RecordType and the reference needs to be removed first.

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

2 years ago[CUDA][HIP] Do not treat host var address as constant in device compilation
Yaxun (Sam) Liu [Tue, 25 Jan 2022 04:49:07 +0000 (23:49 -0500)]
[CUDA][HIP] Do not treat host var address as constant in device compilation

Currently clang treats host var address as constant in device compilation,
which causes const vars initialized with host var address promoted to
device variables incorrectly and results in undefined symbols.

This patch fixes that.

Reviewed by: Artem Belevich

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

Fixes: SWDEV-309881

Change-Id: I0a69357063c6f8539ef259c96c250d04615f4473

2 years ago[polly][unittests] Link DeLICMTests with libLLVMCore
Rainer Orth [Fri, 28 Jan 2022 20:58:40 +0000 (21:58 +0100)]
[polly][unittests] Link DeLICMTests with libLLVMCore

A `-DBUILD_SHARED_LIBS=ON` build on Solaris/amd64 failed with

  Undefined                       first referenced
   symbol                             in file
  _ZNK4llvm3cfg6UpdateIPNS_10BasicBlockEE4dumpEv tools/polly/unittests/DeLICM/CMakeFiles/DeLICMTests.dir/DeLICMTest.cpp.o  (symbol belongs to implicit dependency /var/llvm/local-amd64-release-stage2-shared-A/bin/../lib/libLLVMCore.so.14git)
  ld: fatal: symbol referencing errors

Solaris `ld` requires to directly link with dependant libraries, so this
patch explicitly adds `libLLVMCore`.

Tested on `amd64-pc-solaris2.11` and `x86_64-pc-linux-gnu`.

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

2 years ago[SLP] Use moveBefore to simplify code [NFC]
Philip Reames [Fri, 28 Jan 2022 20:43:56 +0000 (12:43 -0800)]
[SLP] Use moveBefore to simplify code [NFC]

2 years ago[ObjCARC] Require the function argument in the clang.arc.attachedcall bundle.
Ahmed Bougacha [Fri, 28 Jan 2022 19:55:53 +0000 (11:55 -0800)]
[ObjCARC] Require the function argument in the clang.arc.attachedcall bundle.

Currently, the clang.arc.attachedcall bundle takes an optional function
argument.  Depending on whether the argument is present, calls with this
bundle have the following semantics:

- on x86, with the argument present, the call is lowered to:
    call _target
    mov rax, rdi
    call _objc_retainAutoreleasedReturnValue

- on AArch64, without the argument, the call is lowered to:
    bl _target
    mov x29, x29

  and the objc runtime call is expected to be emitted separately.

That's because, on x86, the objc runtime checks for both the mov and
the call on x86, and treats the combination as the ARC autorelease elision
marker.

But on AArch64, it only checks for the dedicated NOP marker, as that's
historically been sufficiently unique.  Thanks to that, the runtime call
wasn't required to be adjacent to the NOP marker, so it wasn't emitted
as part of the bundle sequence.

This patch unifies both architectures: on AArch64, we now emit all
3 instructions for the bundle.  This guarantees that the runtime call
is adjacent to the marker in the sequence, and that's information the
runtime can use to further optimize this.

This helps simplify some of the handling, in particular
BundledRetainClaimRVs, which no longer needs to know whether the bundle
is sufficient or not: it now always should be.

Note that this does not include an AutoUpgrade for the nullary bundles,
as they are only produced in ObjCContract as part of the obj/asm emission
pipeline, and are not expected to be in bitcode.

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

2 years ago[BOLT] Imported llvm-bolt-wrapper script
Amir Ayupov [Wed, 24 Feb 2021 20:46:53 +0000 (12:46 -0800)]
[BOLT] Imported llvm-bolt-wrapper script

Commit history in chronological order:

[BOLT] llvm-bolt-wrapper: added wrapper for bolt binary matching

Summary:
Wrapper to compare two versions of BOLT to see if they produce the same output
binary given the same input.

(cherry picked from FBD26626137)

[BOLT] llvm-bolt-wrapper: support for no-output tests and heatmap mode

Summary:
- Added an option `skip_binary_cmp` to support invocations that don't output
  a binary
- Minor fixes for heatmap mode, timeout, log comparison
- Rearranged in-line config example to be copy-pasteable

(cherry picked from FBD26822016)

[BOLT] llvm-bolt-wrapper: merge stdout/stderr, search for config in script dir

(cherry picked from FBD27529335)

[BOLT] llvm-bolt-wrapper: handle /dev/null

Summary:
Fixed the wrapper to preserve `-o /dev/null` and skip binary matching for such
invocations.

(cherry picked from FBD28013747)

[BOLT] llvm-bolt-wrapper: handle cases where output binary doesn't exist

Summary:
Handle invocations where output binary is not generated (e.g. due to an expected
assertion or exit with BOLT-ERROR) and skip binary comparison in such cases.

(cherry picked from FBD28080158)

[BOLT] llvm-bolt-wrapper: handle boltdiff mode

Summary:
Handle `llvm-boltdiff` invocation similarly to `perf2bolt`

(cherry picked from FBD28080157)

[BOLT] llvm-bolt-wrapper: find section with mismatch

Summary:
For mismatching ELF files, find section with mismatch and print sections table
with highlighted mismatch section.

(cherry picked from FBD28087231)

[BOLT] llvm-bolt-wrapper: ignore-build-id in perf2bolt mode

Summary:
When perf2bolt fails to match build-id from perf output for cmp binary, we need
to use -ignore-build-id option to override the strict checking behavior.

(cherry picked from FBD28087232)

[BOLT] llvm-bolt-wrapper: suppress -bolt-info=0 in heatmap mode

Summary:
Heatmap mode is incompatible with `-bolt-info=0` used to suppress binary
differences. Remove it.

(cherry picked from FBD28087230)

[BOLT] llvm-bolt-wrapper: add config-generator mode

Summary:
llvm-bolt-wrapper config can be generated by the script itself.
It makes the workflow more reliable compared to preparing the config manually.

(cherry picked from FBD28358939)

[BOLT] llvm-bolt-wrapper: fix mismatch reporting

Summary:
1. Fixed header comparison issue where headers were skipped due to
  `skip_end == 0` (`lst[:-n]` does not work if n==0).
2. Detect color support while printing mismatching section:
  - use bold color if terminal supports ANSI escape codes,
  - otherwise print ">" at mismatching section.
3. Remove extra 0x before mismatching offset.

(cherry picked from FBD28691979)

[BOLT] llvm-bolt-wrapper: handle perf2bolt tests with ignore-build-id

Summary:
`ignore-build-id` must be passed not more than once. Account for that.

(cherry picked from FBD29830266)

[BOLT] llvm-bolt-wrapper: fix running subprocesses in parallel

Summary:
The commands were running sequentially due to the use of blocking `communicate`
call, which is needed when stdout/stderr are directed to a pipe.
Fix this behavior by directing the output to a file.

(cherry picked from FBD29951863)

2 years ago[GVN] Add tests with redundant load of pointer select.
Florian Hahn [Fri, 28 Jan 2022 20:15:32 +0000 (20:15 +0000)]
[GVN] Add tests with redundant load of pointer select.

Additional test cases for D118144.

2 years ago[libc] Add missing sqrt deps for layering checks
Jordan Rupprecht [Fri, 28 Jan 2022 20:07:19 +0000 (12:07 -0800)]
[libc] Add missing sqrt deps for layering checks

2 years agoRevert "[SLP] Add a clarifying assert in block scheduling [NFC]"
Philip Reames [Fri, 28 Jan 2022 20:07:39 +0000 (12:07 -0800)]
Revert "[SLP] Add a clarifying assert in block scheduling [NFC]"

This reverts commit db49a78900f5e4b59714565876b5dbb5e2dfe840.  The reasoning in the patch applied to a downstream branch, and I got myself confused when trying to split apart pieces.  Thankfully, the assert was simply weaker than the actual invariant currently upstream which is that ReadyInsts is not empty.

2 years agoAdd vector.scan op
harsh [Fri, 28 Jan 2022 20:07:35 +0000 (20:07 +0000)]
Add vector.scan op

This patch adds the vector.scan op which computes the
scan for a given n-d vector. It requires specifying the operator,
the identity element and whether the scan is inclusive or
exclusive.

TEST: Added test in ops.mlir

Reviewed By: ThomasRaoux

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

2 years ago[libc] Enable creat, fsync, open, openat, read and write for aarch64.
Siva Chandra [Fri, 28 Jan 2022 19:41:26 +0000 (11:41 -0800)]
[libc] Enable creat, fsync, open, openat, read and write for aarch64.

2 years agoAdd BITINT_MAXWIDTH support
Aaron Ballman [Fri, 28 Jan 2022 20:00:20 +0000 (15:00 -0500)]
Add BITINT_MAXWIDTH support

Part of the _BitInt feature in C2x
(http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2763.pdf) is a new
macro in limits.h named BITINT_MAXWIDTH that can be used to determine
the maximum width of a bit-precise integer type. This macro must expand
to a value that is at least as large as ULLONG_WIDTH.

This adds an implementation-defined macro named __BITINT_MAXWIDTH__ to
specify that value, which is used by limits.h for the standard macro.

This also limits the maximum bit width to 128 bits because backends do
not currently support all mathematical operations (such as division) on
wider types yet. This maximum is expected to be increased in the future.

2 years ago[flang][NFC] Remove obsolete ComplexExpr helper
Valentin Clement [Fri, 28 Jan 2022 20:01:39 +0000 (21:01 +0100)]
[flang][NFC] Remove obsolete ComplexExpr helper

Functionality present in `flang/include/flang/Lower/ComplexExpr.h` are
available in `flang/include/flang/Optimizer/Builder/Complex.h`. This patch removes
the obsolete files.

Reviewed By: kiranchandramohan, schweitz

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

2 years ago[clang][NFC] Fix Typo
Jacob Lambert [Fri, 28 Jan 2022 19:55:46 +0000 (11:55 -0800)]
[clang][NFC] Fix Typo

2 years ago[IRSim][IROutliner] Allowing Intrinsic Calls to be Used in Similarity Matching and...
Andrew Litteken [Thu, 23 Dec 2021 00:07:43 +0000 (18:07 -0600)]
[IRSim][IROutliner] Allowing Intrinsic Calls to be Used in Similarity Matching and Outlined Regions

Due to some complications with lifetime, and assume-like intrinsics, intrinsics were not included as outlinable instructions. This patch opens up most intrinsics, excluding lifetime and assume-like intrinsics, to be outlined. For similarity, it is required that the intrinsic IDs, and the intrinsics names match exactly, as well as the function type. This puts intrinsics in a different class than normal call instructions (https://reviews.llvm.org/D109448), where the name will no longer have to match.

This also adds an additional command line flag debug option to disable outlining intrinsics.

Recommit of: 8de76bd569732acae6a10fdcb0152a49f7d4cd39
Adds extra checking of intrinsic function calls names to avoid taking the address of intrinsic calls when extracting function calls.

Reviewers: paquette, jroelofs

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

2 years ago[lld] Add module name to LTO inline asm diagnostic
Fangrui Song [Fri, 28 Jan 2022 19:32:42 +0000 (11:32 -0800)]
[lld] Add module name to LTO inline asm diagnostic

Close #52781: for LTO, the inline asm diagnostic uses `<inline asm>` as the file
name (lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp) and it is unclear which
module has the issue.

With this patch, we will see the module name (say `asm.o`) before `<inline asm>` with ThinLTO.

```
% clang -flto=thin -c asm.c && myld.lld asm.o -e f
ld.lld: error: asm.o <inline asm>:1:2: invalid instruction mnemonic 'invalid'
        invalid
        ^~~~~~~
```

For regular LTO, unfortunately the original module name is lost and we only get
ld-temp.o.

Reviewed By: #lld-macho, ychen, Jez Ng

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

2 years ago[libc] Add implementations of the POSIX creat and openat functions.
Siva Chandra Reddy [Thu, 27 Jan 2022 23:47:50 +0000 (23:47 +0000)]
[libc] Add implementations of the POSIX creat and openat functions.

Reviewed By: michaelrj

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

2 years ago[gn build] Port f489e86a24d3
LLVM GN Syncbot [Fri, 28 Jan 2022 19:20:50 +0000 (19:20 +0000)]
[gn build] Port f489e86a24d3

2 years agoRemove Waymarking.h as it is unused
Aaron Ballman [Fri, 28 Jan 2022 19:19:18 +0000 (14:19 -0500)]
Remove Waymarking.h as it is unused

This file was added in https://reviews.llvm.org/D74415. There was no
justification as to why it was added, and after about a year of being
in-tree, it's still unused, so this removes it.

2 years ago[ScalarEvolution] Mark a loop as finite if in a willreturn function
William S. Moses [Fri, 28 Jan 2022 04:52:40 +0000 (23:52 -0500)]
[ScalarEvolution] Mark a loop as finite if in a willreturn function

A limited version of (https://reviews.llvm.org/D118090) that only marks a loop as finite if in a willreturn function.

Reviewed By: jdoerfert

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

2 years ago[GVN] Add additional tests for PRE with pointer selects.
Florian Hahn [Fri, 28 Jan 2022 19:11:35 +0000 (19:11 +0000)]
[GVN] Add additional tests for PRE with pointer selects.

Additional tests for D118143.

2 years ago[SLP] Add a clarifying assert in block scheduling [NFC]
Philip Reames [Fri, 28 Jan 2022 18:34:16 +0000 (10:34 -0800)]
[SLP] Add a clarifying assert in block scheduling [NFC]

The fact we could have a block with a valid scheduling window, but nothing to schedule was surprising to me.  After digging through the code, this can only happen if we don't find anything to directly vectorize.  However, the reduction handling code relies on this mode, so we can't simply consider such trees unvectorizeable.  The assert conveys both that this situation can happen, but also that it can *only* happen for an immediate gather.

Context: We built the bundle before deciding that vectorization of a bundle is possible.  A side effect of bundle construction is manipulating the scheduling window, so a bundle which isn't vectorizable can cause the creation or expansion of a scheduling window.

2 years agoGCC ABI Compatibility: Preserve alignment of non-pod members in packed structs
David Blaikie [Tue, 18 Jan 2022 22:28:14 +0000 (14:28 -0800)]
GCC ABI Compatibility: Preserve alignment of non-pod members in packed structs

This matches GCC: https://godbolt.org/z/sM5q95PGY

I realize this is an API break for clang+clang - so I'm totally open to
discussing how we should deal with that. If Apple wants to keep the
Clang layout indefinitely, if we want to put a flag on this so non-Apple
folks can opt out of this fix/new behavior.

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

2 years ago[lld][Macho] Include dead-stripped symbols in mapfile
Roger Kim [Fri, 28 Jan 2022 18:51:27 +0000 (10:51 -0800)]
[lld][Macho] Include dead-stripped symbols in mapfile

ld64 outputs dead stripped symbols when using the -dead-strip flag. This change mimics that behavior for lld.

ld64's -dead_strip flag outputs:
```
$ ld -map map basics.o -o out -dead_strip -L/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib -lSystem
$ cat map
# Path: out
# Arch: x86_64
# Object files:
[  0] linker synthesized
[  1] basics.o
# Sections:
# Address       Size            Segment Section
0x100003F97     0x00000021      __TEXT  __text
0x100003FB8     0x00000048      __TEXT  __unwind_info
0x100004000     0x00000008      __DATA_CONST    __got
0x100008000     0x00000010      __DATA  __ref_section
0x100008010     0x00000001      __DATA  __common
# Symbols:
# Address       Size            File  Name
0x100003F97     0x00000006      [  1] _ref_local
0x100003F9D     0x00000001      [  1] _ref_private_extern
0x100003F9E     0x0000000C      [  1] _main
0x100003FAA     0x00000006      [  1] _no_dead_strip_globl
0x100003FB0     0x00000001      [  1] _ref_from_no_dead_strip_globl
0x100003FB1     0x00000006      [  1] _no_dead_strip_local
0x100003FB7     0x00000001      [  1] _ref_from_no_dead_strip_local
0x100003FB8     0x00000048      [  0] compact unwind info
0x100004000     0x00000008      [  0] non-lazy-pointer-to-local: _ref_com
0x100008000     0x00000008      [  1] _ref_data
0x100008008     0x00000008      [  1] l_ref_data
0x100008010     0x00000001      [  1] _ref_com

# Dead Stripped Symbols:
#               Size            File  Name
<<dead>>        0x00000006      [  1] _unref_extern
<<dead>>        0x00000001      [  1] _unref_local
<<dead>>        0x00000007      [  1] _unref_private_extern
<<dead>>        0x00000001      [  1] _ref_private_extern_u
<<dead>>        0x00000008      [  1] _unref_data
<<dead>>        0x00000008      [  1] l_unref_data
<<dead>>        0x00000001      [  1] _unref_com
```

Reviewed By: int3, #lld-macho, thevinster

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

2 years ago[libc] Refactor sqrt implementations and add tests for generic sqrt implementations.
Tue Ly [Tue, 25 Jan 2022 20:11:15 +0000 (15:11 -0500)]
[libc] Refactor sqrt implementations and add tests for generic sqrt implementations.

Re-apply https://reviews.llvm.org/D118173 with fix for aarch64.

Reviewed By: michaelrj

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

2 years ago[mlir][taco] Accept an integer list for the ordering when defining a tensor format.
Bixia Zheng [Fri, 28 Jan 2022 00:17:26 +0000 (16:17 -0800)]
[mlir][taco] Accept an integer list for the ordering when defining a tensor format.

The unit tests for PyTACO hasn't been upstreamed yet. A unit test for this
change will be added when we upstream all the unit tests for PyTACO.

Reviewed By: aartbik

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

2 years ago[AIX][clang] include_next through clang provided float.h
David Tenty [Mon, 17 Jan 2022 20:32:33 +0000 (15:32 -0500)]
[AIX][clang] include_next through clang provided float.h

AIX provides additional definitions in the system libc float.h that we
would like to be available to users, so we need to include_next through,
similar to what is done on some other platforms.

We also adjust the guards for some definitions which are restricted
based on language level to also be provide with the _ALL_SOURCE feature
test macro on AIX, similar to what is done by the platform float.h
header, so we don't run into cases where we don't provide the compiler
macro but still have a different definition from the system.

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

2 years agoReapply "[llvm-libtool-darwin] Print a warning if object file names are repeated"
Shoaib Meenai [Fri, 28 Jan 2022 07:40:30 +0000 (23:40 -0800)]
Reapply "[llvm-libtool-darwin] Print a warning if object file names are repeated"

Loosen the test to make it pass on Windows.

This reapplies commit 4993eff3e253a1c04e1a1a2fa5d68f6b33423419.
This reverts commit 96c66040125e87808b23410632b1a6a34547b4e3.

2 years ago[lldb] Update the lldb build instructions on Windows
Stella Stamenova [Fri, 28 Jan 2022 18:18:19 +0000 (10:18 -0800)]
[lldb] Update the lldb build instructions on Windows

The existing instructions for lldb on Windows can be more explicit. This adds a few details on how to install various components and the easiest way to get to a working build.

Reviewed By: JDevlieghere

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

2 years agoEmit swift5 reflection section data in dsym bundle generated by dsymutil in the Dwarf...
Shubham Sandeep Rastogi [Wed, 17 Nov 2021 23:05:58 +0000 (15:05 -0800)]
Emit swift5 reflection section data in dsym bundle generated by dsymutil in the Dwarf section.

Add support for Swift reflection metadata to dsymutil.

This patch adds support for copying Swift reflection metadata (__swift5_.* sections) from .o files to into the symbol-rich binary in the output .dSYM. The functionality is automatically enabled only if a .o file has reflection metadata sections and the binary doesn't. When copying dsymutil moves the section from the __TEXT segment to the __DWARF segment.

rdar://76973336

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

2 years ago[mlir] Only build mlir-cpu-runner when the native arch is targeted
Stella Stamenova [Fri, 28 Jan 2022 18:09:09 +0000 (10:09 -0800)]
[mlir] Only build mlir-cpu-runner when the native arch is targeted

mlir-cpu-runner has a dependency on ExecutionEngine which is only built for the native arch. So currently mlir-cpu-runner does not link correctly when the native arch is not targeted.

Reviewed By: mehdi_amini

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

2 years ago[ADT] support fixed-width output with `utohexstr`
Yuanfang Chen [Fri, 28 Jan 2022 18:07:37 +0000 (10:07 -0800)]
[ADT] support fixed-width output with `utohexstr`

Will use it to output a hash value that needs fixed-width.

Reviewed By: dblaikie

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

2 years ago[AMDGPU] SILoadStoreOptimizer: break lists on instructions with side effects
Jay Foad [Thu, 27 Jan 2022 16:58:00 +0000 (16:58 +0000)]
[AMDGPU] SILoadStoreOptimizer: break lists on instructions with side effects

This just helps to keep the lists shorter and faster to sort. NFCI.

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

2 years ago[RISCV] Update comments about getInstSizeInBytes hard-coding the number of bytes.
Craig Topper [Fri, 28 Jan 2022 17:43:00 +0000 (09:43 -0800)]
[RISCV] Update comments about getInstSizeInBytes hard-coding the number of bytes.

After D118175, we get the information from the tablegen definition.

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

2 years ago[NFC][AIX]Disable new pcm tests on AIX
Steven Wan [Fri, 28 Jan 2022 17:38:50 +0000 (12:38 -0500)]
[NFC][AIX]Disable new pcm tests on AIX

Same as D114481, the PCH reader looks for a `__clangast` section in the precompiled module file, which isn't present on AIX, and we don't support writing this custom section in XCOFF yet.

Reviewed By: Jake-Egan, daltenty, sfertile

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

2 years ago[RISCV] Preserve VL when truncating i64 gather/scatter indices on RV32.
Craig Topper [Fri, 28 Jan 2022 17:21:52 +0000 (09:21 -0800)]
[RISCV] Preserve VL when truncating i64 gather/scatter indices on RV32.

We were creating a truncate with the default for the type, but for
VP intrinsics we have a VL that we should use.

Reviewed By: frasercrmck

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

2 years ago[InstrProf][NFC] Move function out of InstrProf.h
Ellis Hoag [Fri, 28 Jan 2022 01:40:19 +0000 (17:40 -0800)]
[InstrProf][NFC] Move function out of InstrProf.h

`createIRLevelProfileFlagVar()` seems to be only used in
`PGOInstrumentation.cpp` so we move it to that file. Then it can also
take advantage of directly using options rather than passing them as
arguments.

Reviewed By: kyulee, phosek

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

2 years ago[RISCV] Use tablegen size for getInstSizeInBytes.
Craig Topper [Fri, 28 Jan 2022 17:12:10 +0000 (09:12 -0800)]
[RISCV] Use tablegen size for getInstSizeInBytes.

Fix the pseudos to have the correct size in the MCInstrDesc description.

Inspired by D118009 and D117970.

Reviewed By: asb

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

2 years ago[SLP]Do not reorder top nodes if they do not require reordering.
Alexey Bataev [Thu, 6 Jan 2022 17:46:16 +0000 (09:46 -0800)]
[SLP]Do not reorder top nodes if they do not require reordering.

No need to reorder the top nodes, if they are not stores or
insertelement instructions and each node should be analized only
once, when the bottom-to-top analysis is performed.
We still endup with extractelements for the top node scalars and
the final shuffle just adds an extra cost and currently
crashes the compiler for PHI nodes.

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

2 years ago[msan][tsan] Refine __fxstat{,at}{,64} condition
Fangrui Song [Fri, 28 Jan 2022 17:15:39 +0000 (09:15 -0800)]
[msan][tsan] Refine __fxstat{,at}{,64} condition

In glibc before 2.33, include/sys/stat.h defines fstat/fstat64 to
`__fxstat/__fxstat64` and provides `__fxstat/__fxstat64` in libc_nonshared.a.
The symbols are glibc specific and not needed on other systems.

Reviewed By: vitalybuka, #sanitizers

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

2 years ago[DAGCombiner] Fix invalid size request in combineRepeatedFPDivisors
Cullen Rhodes [Fri, 28 Jan 2022 16:28:40 +0000 (16:28 +0000)]
[DAGCombiner] Fix invalid size request in combineRepeatedFPDivisors

If we have a vector FP division with a splatted divisor, use
getVectorMinNumElements when scaling the num of uses by splat factor.

For AArch64 the combine kicks in for the <vscale x 4 x float> case since it's
above the fdiv threshold (3) when scaling num uses by splat factor, but the
codegen is worse (splat + vector fdiv + vector fmul) than the <vscale x 2 x
double> case (splat + vector fdiv).

If the combine could be converted into a scalar FP division by
scalarizeBinOpOfSplats it may be cheaper, but it looks like this is predicated
on the isExtractVecEltCheap TLI function which is implemented for x86 but not
AArch64. Perhaps for now combineRepeatedFPDivisors should only scale num uses
by splat if the division can be converted into scalar op.

Reviewed By: sdesmalen

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

2 years ago[lldb] [gdb-remote] Support getting siginfo via API
Michał Górny [Mon, 24 Jan 2022 17:52:49 +0000 (18:52 +0100)]
[lldb] [gdb-remote] Support getting siginfo via API

Add Thread::GetSiginfo() and SBThread::GetSiginfo() methods to retrieve
the siginfo value from server.

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

2 years ago[libc][NFC] Create file with all permissions for the user in read_write_test.
Siva Chandra Reddy [Fri, 28 Jan 2022 16:32:45 +0000 (16:32 +0000)]
[libc][NFC] Create file with all permissions for the user in read_write_test.

2 years ago[clang][deps] Adapt test to be compatible when the assembler is called by default
Jake Egan [Fri, 28 Jan 2022 16:39:33 +0000 (11:39 -0500)]
[clang][deps] Adapt test to be compatible when the assembler is called by default

When `-fno-integrated-as` is in effect (the default on AIX) the cc1 job produces a `.s` file instead. This patch adapts the test to accept `.s` or `.o` files.

Reviewed By: jansvoboda11

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

2 years ago[MLIR] Introduce LexSimplex to support lexicographic optimization
Arjun P [Fri, 28 Jan 2022 16:25:19 +0000 (21:55 +0530)]
[MLIR] Introduce LexSimplex to support lexicographic optimization

This patch introduces a class LexSimplex that can currently be used to find the
lexicographically minimal rational point in an IntegerPolyhedron. This is a
series of patches leading to computing the lexicographically minimal integer
lattice point as well parametric lexicographic minimization.

Reviewed By: Groverkss

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

2 years ago[NFC][AIX][clang] un-XFAIL gcc profile flag compat test
David Tenty [Fri, 28 Jan 2022 15:47:23 +0000 (10:47 -0500)]
[NFC][AIX][clang] un-XFAIL gcc profile flag compat test

We can pass this test now thanks to recent changes that allow us to use PGO without LTO, so un-XFAIL the test and update the comments.

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

2 years ago[lldb] Make ReadCStringFromMemory default to read from the file-cache.
Augusto Noronha [Wed, 26 Jan 2022 17:26:42 +0000 (14:26 -0300)]
[lldb] Make ReadCStringFromMemory default to read from the file-cache.

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

2 years ago[RISCV] Use __extendhfsf2/__truncsfhf2 for fp16 <-> fp32
Kito Cheng [Tue, 6 Apr 2021 01:09:55 +0000 (09:09 +0800)]
[RISCV] Use __extendhfsf2/__truncsfhf2 for fp16 <-> fp32

`__gnu_h2f_ieee` and `__gnu_f2h_ieee` are introduce by ARM and set that as
default name for fp16 and fp32 conversion in LLVM.

However RISC-V GCC using default naming scheme for that, which is
`__extendhfsf2` and `__truncsfhf2` for that, that cause runtime ABI
incompatible issue.

Although we didn't have formal runtime ABI spec to specify those naming
convention yet, but I think it would be great to fix the incompatible
issue first.

And I've plan to create a runtime ABI spec undere psABI spec this year.

Reviewed By: asb

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

2 years ago[CodeExtractor] Fix warning in assert (NFC)
Nikita Popov [Fri, 28 Jan 2022 15:33:34 +0000 (16:33 +0100)]
[CodeExtractor] Fix warning in assert (NFC)

2 years ago[BasicBlockUtils] Fix typo in API name (NFC)
Nikita Popov [Fri, 28 Jan 2022 15:32:13 +0000 (16:32 +0100)]
[BasicBlockUtils] Fix typo in API name (NFC)

detatch -> detach. As this requires touching all uses, also
lower-case it in accordance with the style guide.

2 years ago[Loads] Require Align in isDereferenceableAndAlignedPointer() (NFC)
Nikita Popov [Fri, 28 Jan 2022 15:15:21 +0000 (16:15 +0100)]
[Loads] Require Align in isDereferenceableAndAlignedPointer() (NFC)

Now that loads always have an alignment, we should not perform an
ABI alignment fallback here.

2 years ago[x86] try harder to scalarize a vector load with extracted integer op uses
Sanjay Patel [Fri, 28 Jan 2022 14:55:13 +0000 (09:55 -0500)]
[x86] try harder to scalarize a vector load with extracted integer op uses

extract_vec_elt (load X), C --> scalar load (X+C)

As noted in the comment, DAGCombiner has this fold -- and the code in this
patch is adapted from DAGCombiner::scalarizeExtractedVectorLoad() -- but
x86 should benefit even if the loaded vector has other uses as long as we
apply some other x86-specific conditions. The motivating example from #50310
is shown in vec_int_to_fp.ll.

Fixes #50310

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

2 years ago[RISCV][NFC] Make Zb* instruction naming match the convention used elsewhere in the...
Alex Bradbury [Fri, 28 Jan 2022 15:13:42 +0000 (15:13 +0000)]
[RISCV][NFC] Make Zb* instruction naming match the convention used elsewhere in the RISC-V backend

Where the instruction mnemonic contains a dot, we name the corresponding
instruction in the .td file using a _ in the place of the dot. e.g. LR_W
rather than LRW. This commit updates RISCVInstrInfoZb.td to follow that
convention.

2 years ago[NFC][RISCV] Bundle up ISAInfo updates and checks
eopXD [Thu, 27 Jan 2022 09:19:52 +0000 (01:19 -0800)]
[NFC][RISCV] Bundle up ISAInfo updates and checks

Reviewed By: kito-cheng

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

2 years ago[ArgPromotion] Don't assume all entry block instrs are executed
Nikita Popov [Fri, 28 Jan 2022 15:07:40 +0000 (16:07 +0100)]
[ArgPromotion] Don't assume all entry block instrs are executed

We should abort this walk if we hit any instruction that is not
guaranteed to transfer.

2 years ago[ArgPromotion] Add test for non-willreturn load hoisting (NFC)
Nikita Popov [Fri, 28 Jan 2022 15:02:41 +0000 (16:02 +0100)]
[ArgPromotion] Add test for non-willreturn load hoisting (NFC)

In this case, we have no guarantee that the load is unconditionally
executed, so the argument promotion is not legal.

2 years ago[MVerifier] Don't check liveness of any debug instruction operands
Jeremy Morse [Fri, 28 Jan 2022 14:52:55 +0000 (14:52 +0000)]
[MVerifier] Don't check liveness of any debug instruction operands

Shiny new DBG_PHI instruction usually have physical registers as operands
-- however, the machine verifier checks to see whether they're live, and
occasionally this fails. There's a filter for DBG_VALUE instructions to not
get verified in this way: expand it to exempt all debug instructions from
liveness checking, which means DBG_PHIs get treated like DBG_VALUEs.

This also future proofs against us adding new debug instructions.

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

2 years ago[update_test_checks] Fix option name in warning message
Jay Foad [Fri, 28 Jan 2022 14:44:25 +0000 (14:44 +0000)]
[update_test_checks] Fix option name in warning message

2 years ago[X86] SimplifyDemandedBitsForTargetNode - fold MOVMSK(YMM) -> MOVMSK(XMM)
Simon Pilgrim [Fri, 28 Jan 2022 14:42:18 +0000 (14:42 +0000)]
[X86] SimplifyDemandedBitsForTargetNode - fold MOVMSK(YMM) -> MOVMSK(XMM)

If we don't demand the upper elements of the 256-bit vector, then just perform as a 128-bit vector

2 years ago[Sema] Add signed/unsigned integer mismatch tests for min/max elementwise builtins
Simon Pilgrim [Fri, 28 Jan 2022 14:23:17 +0000 (14:23 +0000)]
[Sema] Add signed/unsigned integer mismatch tests for min/max elementwise builtins

As suggested on D117898

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

2 years ago[ArgPromotion] Make areFunctionArgsABICompatible() static (NFC)
Nikita Popov [Fri, 28 Jan 2022 14:26:00 +0000 (15:26 +0100)]
[ArgPromotion] Make areFunctionArgsABICompatible() static (NFC)

This function used to be shared with the Attributor, but can now
be made private.

2 years ago[PowerPC] Update handling of splat loads for v4i32/v4f32/v2i64 to require non-extendi...
Amy Kwan [Fri, 28 Jan 2022 03:36:04 +0000 (21:36 -0600)]
[PowerPC] Update handling of splat loads for v4i32/v4f32/v2i64 to require non-extending loads.

This patch updates how splat loads handled and is an extension of D106555.

Particularly, for v2i64/v4f32/v4i32 types, they are updated to handle only
non-extending loads. For v8i16/v16i8 types, they are updated to handle extending
loads only if the memory VT is the same vector element VT type.

A test case has been added to illustrate a scenario where a PPCISD::LD_SPLAT
node should not be produced. In this test, it depicts the following f64
extending load used in a v2f64 build vector, but the extending load is actually
used in more places other than the build vector (such as in t12 and t16).
```
Type-legalized selection DAG: %bb.0 'test:entry'
SelectionDAG has 20 nodes:
  t0: ch = EntryToken
  t4: i64,ch = CopyFromReg t0, Register:i64 %1
  t6: i64,ch = CopyFromReg t0, Register:i64 %2
  t11: f64,ch = load<(load (s64) from %ir.b, !tbaa !7)> t0, t4, undef:i64
        t16: f64 = fadd t31, t37
      t34: ch = store<(store (s64) into %ir.c, !tbaa !7)> t31:1, t16, t6, undef:i64
    t36: ch = TokenFactor t34, t37:1
    t27: v2f64 = BUILD_VECTOR t37, t37
  t22: ch,glue = CopyToReg t36, Register:v2f64 $v2, t27
      t12: f64 = fadd t11, t37
    t28: ch = store<(store (s64) into %ir.b, !tbaa !7)> t11:1, t12, t4, undef:i64
  t31: f64,ch = load<(load (s64) from %ir.c, !tbaa !7)> t28, t6, undef:i64
    t2: i64,ch = CopyFromReg t0, Register:i64 %0
  t37: f64,ch = load<(load (s32) from %ir.a, !tbaa !3), anyext from f32> t0, t2, undef:i64
  t23: ch = PPCISD::RET_FLAG t22, Register:v2f64 $v2, t22:1
```

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

2 years ago[AArch64][SVE][VLS] Move extends into arguments of comparisons
David Truby [Tue, 16 Nov 2021 11:33:12 +0000 (11:33 +0000)]
[AArch64][SVE][VLS] Move extends into arguments of comparisons

When a comparison is extended and it would be free to extend the
arguments to that comparison, we can propagate the extend into those arguments.
This prevents extra instructions being generated to extend the result of the
comparison, which is not free to extend.

This is a resubmission of D116812 with fixes that need another review.

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

2 years ago[HWASan] Leave pointer tagged when calling memmove.
Matt Morehouse [Fri, 28 Jan 2022 14:14:46 +0000 (06:14 -0800)]
[HWASan] Leave pointer tagged when calling memmove.

Fixes a false positive that occurs when a user-implemented memmove is
instrumented by HWASan.

Reviewed By: vitalybuka

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

2 years ago[x86] add test for possible load scalarization fold; NFC
Sanjay Patel [Fri, 28 Jan 2022 13:33:00 +0000 (08:33 -0500)]
[x86] add test for possible load scalarization fold; NFC

This is a minimal test to show a transform proposed in D118376.

2 years ago[flang] Add missing FIRBuilder library
Valentin Clement [Fri, 28 Jan 2022 13:46:10 +0000 (14:46 +0100)]
[flang] Add missing FIRBuilder library

Fix buildbot failure https://lab.llvm.org/buildbot/#/builders/160

2 years agoDo not crash when trying to encode a _BitInt type
Aaron Ballman [Fri, 28 Jan 2022 13:37:09 +0000 (08:37 -0500)]
Do not crash when trying to encode a _BitInt type

Using a _BitInt (or _ExtInt) type as a block parameter or block return
type hits an "unreachable" when trying to determine the encoding for
the block. Instead of crashing, this patch handles it like some of the
other types for which we don't yet have an encoding. The test case
verifies we no longer crash, but does not verify that we provide any
particular encoding (it can be updated once someone more familiar with
ObjC steps in to define the encoding).

Fixes PR50503.

2 years ago[X86] combineSetCCMOVMSK - don't fold MOVMSK(BITCAST(PCMPEQ(X,0))) -> PTESTZ(X,X...
Simon Pilgrim [Fri, 28 Jan 2022 13:22:25 +0000 (13:22 +0000)]
[X86] combineSetCCMOVMSK - don't fold MOVMSK(BITCAST(PCMPEQ(X,0))) -> PTESTZ(X,X) if we're not testing every element comparison

2 years ago[X86] Add test showing incorrect movmsk->ptest fold
Simon Pilgrim [Fri, 28 Jan 2022 13:01:25 +0000 (13:01 +0000)]
[X86] Add test showing incorrect movmsk->ptest fold

We can't fold MOVMSK(BITCAST(PCMPEQ(X,0))) -> PTESTZ(X,X) if we're not testing every element comparison

2 years ago[SVE] Extend isel pattern coverage for BIC.
Paul Walker [Thu, 27 Jan 2022 13:31:18 +0000 (13:31 +0000)]
[SVE] Extend isel pattern coverage for BIC.

Adds patterns of the form "(and a, (not b)) -> bic".

NOTE: With this support I'm inclined to remove AArch64ISD::BIC,
but will leave that investigation for another time.

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

2 years ago[AArch64][SVE] NFC: Add test for scaled stepvector.
Sander de Smalen [Fri, 28 Jan 2022 11:51:44 +0000 (11:51 +0000)]
[AArch64][SVE] NFC: Add test for scaled stepvector.

This commutative test could be optimised into:
  index z0.d, x0, x1

But currently isn't yet.

2 years ago[test][NewGVN] Use '-passes=newgvn' instead of '-basic-aa -newgvn'
Bjorn Pettersson [Wed, 26 Jan 2022 21:35:08 +0000 (22:35 +0100)]
[test][NewGVN] Use '-passes=newgvn' instead of '-basic-aa -newgvn'

This updates NewGVN test cases that were running
  "opt -basic-aa -newgvn ..."
to run
  "opt -passes=newgvn ..."
instead.

The pipeline will be more similar to what we used to have with
legacy PM by doing it this way. The compatility mode that we've
been using for awhile during transition from legacy PM to new PM,
i.e. using the legacy syntax together with new PM, has resulted in
a pipeline such as
  -passes='function(require<basic-aa>),function(newgvn)'
but running the analysis in a separate function pass manager seem
overly complicated for these tests.

Another difference is that we will get the default aa-pipeline instead
of only running basic-aa. That might be a bit questioned (given that
the tests originally specified basic-aa). The output is however
identival for all the test cases modified here regardless of using
basic-aa or the default aa-pipeline.

This is also another small step towards removal of the support for
using the legacy PM syntax in opt.

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

2 years ago[test][NewGVN] Use -passes=newgvn instead of -newgvn
Bjorn Pettersson [Wed, 26 Jan 2022 21:51:13 +0000 (22:51 +0100)]
[test][NewGVN] Use -passes=newgvn instead of -newgvn

Use the new PM syntax when specifying the pipeline in regression
tests previously running
  "opt -newgvn ..."

Instead we now do
  "opt -passes=newgvn ..."

Notice that this also changes the aa-pipeline to become the default
aa-pipeline instead of just basic-aa. Since these tests haven't been
explicitly requesting basic-aa in the past (compared to the test cases
updated in a separate patch involving "-basic-aa -newgvn") it is
assumed that the exact aa-pipeline isn't important for the validity
of the test cases. An alternative could have been to add
-aa-pipeline=basic-aa as well to the run lines, but that might just
add clutter in case the test cases do not care about the aa-pipeline.

This is another step to move away from the legacy PM syntax when
specifying passes in opt.

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

2 years ago[RISCV] Add tests for possible splat optimizations
Fraser Cormack [Fri, 28 Jan 2022 12:14:12 +0000 (12:14 +0000)]
[RISCV] Add tests for possible splat optimizations

These splats -- whether BUILD_VECTOR or SPLAT_VECTOR -- are formed by
first extracting a value from a vector and splatting it to all elements
of the destination vector. These could be performed more optimally,
avoiding the drop to scalar, using RVV's vrgather, for example.

2 years ago[RISCV] Fix FileCheck prefixes in RVV test
Fraser Cormack [Fri, 28 Jan 2022 11:34:15 +0000 (11:34 +0000)]
[RISCV] Fix FileCheck prefixes in RVV test

The LMULMAX check names didn't match the options we were passing to llc
(they were swapped around) and we were silently missing coverage for one
test which differs between RV32 and RV64.