platform/upstream/llvm.git
3 years ago[mlir][sparse] add a "release" operation to sparse tensor dialect
Aart Bik [Mon, 4 Oct 2021 20:13:24 +0000 (13:13 -0700)]
[mlir][sparse] add a "release" operation to sparse tensor dialect

We have several ways to materialize sparse tensors (new and convert) but no explicit operation to release the underlying sparse storage scheme at runtime (other than making an explicit delSparseTensor() library call). To simplify memory management, a sparse_tensor.release operation has been introduced that lowers to the runtime library call while keeping tensors, opague pointers, and memrefs transparent in the initial IR.

*Note* There is obviously some tension between the concept of immutable tensors and memory management methods. This tension is addressed by simply stating that after the "release" call, no further memref related operations are allowed on the tensor value. We expect the design to evolve over time, however, and arrive at a more satisfactory view of tensors and buffers eventually.

Bug:
http://llvm.org/pr52046

Reviewed By: bixia

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

3 years ago[SystemZ] Implement memcmp of variable length with CLC.
Jonas Paulsson [Tue, 3 Aug 2021 17:49:45 +0000 (19:49 +0200)]
[SystemZ] Implement memcmp of variable length with CLC.

Following the same pattern of memset/memcpy, this patch implements a variable
length memcmp with a CLC loop followed by an EXRL instruction.

Review: Ulrich Weigand

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

3 years ago[APInt] Fix type limits warning (NFC)
Nikita Popov [Tue, 5 Oct 2021 16:09:09 +0000 (18:09 +0200)]
[APInt] Fix type limits warning (NFC)

Unsigned number is always >= 0.

3 years ago[clang-tidy] Fix add_new_check.py to generate correct list.rst autofix column from...
Matt Beardsley [Tue, 5 Oct 2021 16:09:25 +0000 (18:09 +0200)]
[clang-tidy] Fix add_new_check.py to generate correct list.rst autofix column from relative path

Previously, the code in add_new_check.py that looks for fixit keywords in check source files when generating list.rst assumed that the script would only be called from its own path. That means it doesn't find any source files for the checks it's attempting to scan for, and it defaults to writing out nothing in the "Offers fixes" column for all checks. Other parts of add_new_check.py work from other paths, just not this part.

After this fix, add_new_check.py's "offers fixes" column generation for list.rst will be consistent regardless of what path it's called from by using the caller path that's deduced elsewhere already from sys.argv[0].

Reviewed By: kbobyrev

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

3 years ago[MacroFusion] Expose useful static methods. NFC.
Joe Nash [Mon, 4 Oct 2021 14:29:51 +0000 (10:29 -0400)]
[MacroFusion] Expose useful static methods. NFC.

hasLessThanNumFused and fuseInstructionPair are useful for
DAG mutations similar to MacroFusion, but which cannot use
MacroFusion as a whole (such as fusing non-dependent instruction).

Reviewed By: MatzeB

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

Change-Id: I3a5d56aba0471d45ef64cebb9b724030e2eae2f3

3 years ago[clangd] IncludeCleaner: Mark used headers
Kirill Bobyrev [Tue, 5 Oct 2021 16:08:00 +0000 (18:08 +0200)]
[clangd] IncludeCleaner: Mark used headers

Follow-up on D105426.

Reviewed By: sammccall

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

3 years ago[ConstantFold] Refactor load folding
Nikita Popov [Sun, 3 Oct 2021 10:33:59 +0000 (12:33 +0200)]
[ConstantFold] Refactor load folding

This refactors load folding to happen in two cleanly separated
steps: ConstantFoldLoadFromConstPtr() takes a pointer to load from
and decomposes it into a constant initializer base and an offset.
Then ConstantFoldLoadFromConst() loads from that initializer at
the given offset. This makes the core logic independent of having
actual GEP expressions (and those GEP expressions having certain
structure) and will allow exposing ConstantFoldLoadFromConst() as
an independent API in the future.

This is mostly only a refactoring, but it does make the folding
logic slightly more powerful.

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

3 years ago[Support] Update SmallVector report_fatal_error calls to use Twine and add missing...
Simon Pilgrim [Tue, 5 Oct 2021 16:02:18 +0000 (17:02 +0100)]
[Support] Update SmallVector report_fatal_error calls to use Twine and add missing implicit header dependency.

3 years ago[TableGen] CodeEmitterGen - emit report_fatal_error(const char*) instead of report_fa...
Simon Pilgrim [Tue, 5 Oct 2021 16:00:13 +0000 (17:00 +0100)]
[TableGen] CodeEmitterGen - emit report_fatal_error(const char*) instead of report_fatal_error(std::string&)

As described on D111049, we're trying to remove the <string> dependency from error handling. In most cases the plan is to use the Twine() variant directly but to reduce introducing additional headers for the generated files, I'm using the const char* variant here instead.

3 years ago[clang] FatalErrorHandler.cpp - add explicit <stdio.h> include
Simon Pilgrim [Tue, 5 Oct 2021 15:29:33 +0000 (16:29 +0100)]
[clang] FatalErrorHandler.cpp - add explicit <stdio.h> include

Required for fprintf/stderr usage in the error handler, noticed while trying to remove the <string> dependency described in D111049

3 years ago[APInt] Make insertBits and concat work with zero width APInts.
Chris Lattner [Tue, 5 Oct 2021 04:33:51 +0000 (21:33 -0700)]
[APInt] Make insertBits and concat work with zero width APInts.

These should both clearly work with our current model for zero width
integers, but don't until now!

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

3 years ago[clangd] Include refs of base method in refs for derived method.
Utkarsh Saxena [Mon, 4 Oct 2021 06:20:09 +0000 (08:20 +0200)]
[clangd] Include refs of base method in refs for derived method.

Addresses https://github.com/clangd/clangd/issues/881

Includes refs of base class method in refs of derived class method.
Previously we reported base class method's refs only for decl of derived
class method. Ideally this should work for all usages of derived class method.

Related patch:
https://github.com/llvm/llvm-project/commit/fbeff2ec2bc6e44b92931207b0063f83ff7a3b3a.

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

3 years ago[llvm] Migrate from getNumArgOperands to arg_size (NFC)
Kazu Hirata [Tue, 5 Oct 2021 15:29:19 +0000 (08:29 -0700)]
[llvm] Migrate from getNumArgOperands to arg_size (NFC)

Note that getNumArgOperands is considered a legacy name.  See
llvm/include/llvm/IR/InstrTypes.h for details.

3 years agoRevert "Revert "Revert "[GlobalISel][IRTranslator] Emit trap intrinsic for "unreachab...
Amara Emerson [Tue, 5 Oct 2021 15:24:44 +0000 (08:24 -0700)]
Revert "Revert "Revert "[GlobalISel][IRTranslator] Emit trap intrinsic for "unreachable""""

This reverts commit c93bc508ee446d17f9d5d59b48d98aef15f22d52.

Seems to break a different thing now.

3 years ago[SystemZ] Implement memcpy of variable length with MVC.
Jonas Paulsson [Tue, 20 Jul 2021 18:53:22 +0000 (20:53 +0200)]
[SystemZ] Implement memcpy of variable length with MVC.

Instead of making a memcpy libcall, emit an MVC loop and an EXRL instruction
the same way as is already done for memset 0.

Review: Ulrich Weigand

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

3 years ago[AArch64][SVE] Remove redundant PTEST following PNEXT/PFIRST
Peter Waller [Tue, 21 Sep 2021 14:31:09 +0000 (14:31 +0000)]
[AArch64][SVE] Remove redundant PTEST following PNEXT/PFIRST

PNEXT and PFIRST set the NZCV flags, so the subsequent PTEST can be
optimized away in AArch64InstrInfo::optimizePTestInstr.

See-also: https://reviews.llvm.org/D93292

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

3 years ago[AArch64][SVE] Propagate math flags from intrinsics to instructions
Matthew Devereau [Mon, 4 Oct 2021 15:56:56 +0000 (16:56 +0100)]
[AArch64][SVE] Propagate math flags from intrinsics to instructions

Retain floating-point math flags inside instCombineSVEVectorBinOp

3 years ago[lldb testing] Avoid subtle terminfo behavioral differences
David Zarzycki [Tue, 5 Oct 2021 14:21:32 +0000 (10:21 -0400)]
[lldb testing] Avoid subtle terminfo behavioral differences

The original "arbitrary" changes were causing EINVAL on a Fedora 34 box.

3 years ago[libc++][test] Remove unused macro in is_constructible.pass.cpp. NFC.
Joe Loser [Tue, 5 Oct 2021 14:14:48 +0000 (10:14 -0400)]
[libc++][test] Remove unused macro in is_constructible.pass.cpp. NFC.

Test file defines `LIBCPP11_STATIC_ASSERT` but it never uses it now. It
always uses `static_assert` unconditionally. So, remove the unused
macro.

3 years agoAdd .cmt and .cmti files for OCaml bindings
TN Khanh [Tue, 5 Oct 2021 14:04:34 +0000 (19:34 +0530)]
Add .cmt and .cmti files for OCaml bindings

We can build .cmt and .cmti files for easier
code navigation for OCaml bindings

3 years ago[X86][Costmodel] Load/store i64/f64 Stride=6 VF=8 interleaving costs
Roman Lebedev [Tue, 5 Oct 2021 13:28:54 +0000 (16:28 +0300)]
[X86][Costmodel] Load/store i64/f64 Stride=6 VF=8 interleaving costs

The only sched models that for cpu's that support avx2
but not avx512 are: haswell, broadwell, skylake, zen1-3

For load we have:
https://godbolt.org/z/1jfGddcre - for intels `Block RThroughput: =36.0`; for ryzens, `Block RThroughput: =12.0`
So could pick cost of `36`

For store we have:
https://godbolt.org/z/ao9srMT8r - for intels `Block RThroughput: =30.0`; for ryzens, `Block RThroughput: =12.0`
So we could pick cost of `30`.

I'm directly using the shuffling asm the llc produced,
without any manual fixups that may be needed
to ensure sequential execution.

Reviewed By: RKSimon

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

3 years ago[X86][Costmodel] Load/store i64/f64 Stride=6 VF=4 interleaving costs
Roman Lebedev [Tue, 5 Oct 2021 13:28:54 +0000 (16:28 +0300)]
[X86][Costmodel] Load/store i64/f64 Stride=6 VF=4 interleaving costs

The only sched models that for cpu's that support avx2
but not avx512 are: haswell, broadwell, skylake, zen1-3

For load we have:
https://godbolt.org/z/rc8jYxW6M - for intels `Block RThroughput: =18.0`; for ryzens, `Block RThroughput: =6.0`
So could pick cost of `18`.

For store we have:
https://godbolt.org/z/9PhPEr65G - for intels `Block RThroughput: =15.0`; for ryzens, `Block RThroughput: =6.0`
So we could pick cost of `15`.

I'm directly using the shuffling asm the llc produced,
without any manual fixups that may be needed
to ensure sequential execution.

Reviewed By: RKSimon

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

3 years ago[X86][Costmodel] Load/store i64/f64 Stride=6 VF=2 interleaving costs
Roman Lebedev [Tue, 5 Oct 2021 13:28:49 +0000 (16:28 +0300)]
[X86][Costmodel] Load/store i64/f64 Stride=6 VF=2 interleaving costs

The only sched models that for cpu's that support avx2
but not avx512 are: haswell, broadwell, skylake, zen1-3

For load we have:
https://godbolt.org/z/onese7rec - for intels `Block RThroughput: =6.0`; for ryzens, `Block RThroughput: =3.0`
So could pick cost of `6`.

For store we have:
https://godbolt.org/z/bMd7dddnT - for intels `Block RThroughput: =8.0`; for ryzens, `Block RThroughput: <=6.0`
So we could pick cost of `8`.

I'm directly using the shuffling asm the llc produced,
without any manual fixups that may be needed
to ensure sequential execution.

Reviewed By: RKSimon

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

3 years ago[X86][Costmodel] Load/store i32/f32 Stride=6 VF=16 interleaving costs
Roman Lebedev [Tue, 5 Oct 2021 13:28:04 +0000 (16:28 +0300)]
[X86][Costmodel] Load/store i32/f32 Stride=6 VF=16 interleaving costs

This one required quite a bit of an assembly surgery, but i think it's in the right ballpark..

The only sched models that for cpu's that support avx2
but not avx512 are: haswell, broadwell, skylake, zen1-3

For load we have:
https://godbolt.org/z/na97Kb96o - for intels `Block RThroughput: <=64.0`; for ryzens, `Block RThroughput: <=32.0`
So could pick cost of `64`.

For store we have:
https://godbolt.org/z/GG1WeoKar - for intels `Block RThroughput: =66.0`; for ryzens, `Block RThroughput: <=27.5`
So we could pick cost of `66`.

I'm directly using the shuffling asm the llc produced,
without any manual fixups that may be needed
to ensure sequential execution.

Reviewed By: RKSimon

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

3 years ago[X86][Costmodel] Load/store i32/f32 Stride=6 VF=8 interleaving costs
Roman Lebedev [Tue, 5 Oct 2021 13:28:03 +0000 (16:28 +0300)]
[X86][Costmodel] Load/store i32/f32 Stride=6 VF=8 interleaving costs

The only sched models that for cpu's that support avx2
but not avx512 are: haswell, broadwell, skylake, zen1-3

For load we have:
https://godbolt.org/z/jK85GWKaK - for intels `Block RThroughput: =31.0`; for ryzens, `Block RThroughput: <=17.0`
So could pick cost of `31`.

For store we have:
https://godbolt.org/z/hPWWhEEf9 - for intels `Block RThroughput: =33.0`; for ryzens, `Block RThroughput: <=13.8`
So we could pick cost of `33`.

I'm directly using the shuffling asm the llc produced,
without any manual fixups that may be needed
to ensure sequential execution.

Reviewed By: RKSimon

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

3 years ago[X86][Costmodel] Load/store i32/f32 Stride=6 VF=4 interleaving costs
Roman Lebedev [Tue, 5 Oct 2021 13:27:58 +0000 (16:27 +0300)]
[X86][Costmodel] Load/store i32/f32 Stride=6 VF=4 interleaving costs

The only sched models that for cpu's that support avx2
but not avx512 are: haswell, broadwell, skylake, zen1-3

For load we have:
https://godbolt.org/z/szEj1ceee - for intels `Block RThroughput: =15.0`; for ryzens, `Block RThroughput: <=8.8`
So could pick cost of `15`.

For store we have:
https://godbolt.org/z/81bq4fTo1 - for intels `Block RThroughput: =12.0`; for ryzens, `Block RThroughput: <=10.0`
So we could pick cost of `12`.

I'm directly using the shuffling asm the llc produced,
without any manual fixups that may be needed
to ensure sequential execution.

Reviewed By: RKSimon

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

3 years ago[X86][Costmodel] Load/store i32/f32 Stride=6 VF=2 interleaving costs
Roman Lebedev [Tue, 5 Oct 2021 13:27:53 +0000 (16:27 +0300)]
[X86][Costmodel] Load/store i32/f32 Stride=6 VF=2 interleaving costs

The only sched models that for cpu's that support avx2
but not avx512 are: haswell, broadwell, skylake, zen1-3

For load we have:
https://godbolt.org/z/aec96Thee - for intels `Block RThroughput: =6.0`; for ryzens, `Block RThroughput: <=3.3`
So could pick cost of `6`.

For store we have:
https://godbolt.org/z/aec96Thee - for intels `Block RThroughput: =9.0`; for ryzens, `Block RThroughput: <=3.0`
So we could pick cost of `9`.

I'm directly using the shuffling asm the llc produced,
without any manual fixups that may be needed
to ensure sequential execution.

Reviewed By: RKSimon

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

3 years ago[X86][Costmodel] Load/store i64/f64 Stride=4 VF=8 interleaving costs
Roman Lebedev [Mon, 4 Oct 2021 19:50:11 +0000 (22:50 +0300)]
[X86][Costmodel] Load/store i64/f64 Stride=4 VF=8 interleaving costs

The only sched models that for cpu's that support avx2
but not avx512 are: haswell, broadwell, skylake, zen1-3

For load we have:
https://godbolt.org/z/3M3hbq7n8 - for intels `Block RThroughput: =20.0`; for ryzens, `Block RThroughput: =8.0`
So could pick cost of `20`.

For store we have:
https://godbolt.org/z/zvnPYWTx7 - for intels `Block RThroughput: =20.0`; for ryzens, `Block RThroughput: =8.0`
So we could pick cost of `20`.

I'm directly using the shuffling asm the llc produced,
without any manual fixups that may be needed
to ensure sequential execution.

Reviewed By: RKSimon

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

3 years ago[X86][Costmodel] Load/store i64/f64 Stride=4 VF=4 interleaving costs
Roman Lebedev [Mon, 4 Oct 2021 19:50:11 +0000 (22:50 +0300)]
[X86][Costmodel] Load/store i64/f64 Stride=4 VF=4 interleaving costs

The only sched models that for cpu's that support avx2
but not avx512 are: haswell, broadwell, skylake, zen1-3

For load we have:
https://godbolt.org/z/MTKdzjvnr - for intels `Block RThroughput: =8.0`; for ryzens, `Block RThroughput: <=4.0`
So could pick cost of `8`.

For store we have:
https://godbolt.org/z/cMYEvqoah - for intels `Block RThroughput: =8.0`; for ryzens, `Block RThroughput: <=4.0`
So we could pick cost of `8`.

I'm directly using the shuffling asm the llc produced,
without any manual fixups that may be needed
to ensure sequential execution.

Reviewed By: RKSimon

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

3 years ago[X86][Costmodel] Load/store i64/f64 Stride=4 VF=2 interleaving costs
Roman Lebedev [Mon, 4 Oct 2021 19:50:06 +0000 (22:50 +0300)]
[X86][Costmodel] Load/store i64/f64 Stride=4 VF=2 interleaving costs

The only sched models that for cpu's that support avx2
but not avx512 are: haswell, broadwell, skylake, zen1-3

For load we have:
https://godbolt.org/z/z197317d1 - for intels `Block RThroughput: =6.0`; for ryzens, `Block RThroughput: =2.0`
So could pick cost of `6`.

For store we have:
https://godbolt.org/z/8dzszjf9q - for intels `Block RThroughput: =6.0`; for ryzens, `Block RThroughput: <=4.0`
So we could pick cost of `6`.

I'm directly using the shuffling asm the llc produced,
without any manual fixups that may be needed
to ensure sequential execution.

Reviewed By: RKSimon

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

3 years ago[X86][Costmodel] Load/store i32/f32 Stride=4 VF=16 interleaving costs
Roman Lebedev [Mon, 4 Oct 2021 16:30:14 +0000 (19:30 +0300)]
[X86][Costmodel] Load/store i32/f32 Stride=4 VF=16 interleaving costs

This one required quite a bit of assembly surgery, but the trend continues, so i think this is right.

The only sched models that for cpu's that support avx2
but not avx512 are: haswell, broadwell, skylake, zen1-3

For load we have:
https://godbolt.org/z/EKWdj8cKT - for intels `Block RThroughput: <=32.0`; for ryzens, `Block RThroughput: <=24.0`
So could pick cost of `32`.

For store we have:
https://godbolt.org/z/zj4bb9P75 - for intels `Block RThroughput: =32.0`; for ryzens, `Block RThroughput: <=16.0`
So we could pick cost of `32`.

I'm directly using the shuffling asm the llc produced,
without any manual fixups that may be needed
to ensure sequential execution.

Reviewed By: RKSimon

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

3 years ago[X86][Costmodel] Load/store i32/f32 Stride=4 VF=8 interleaving costs
Roman Lebedev [Mon, 4 Oct 2021 16:30:14 +0000 (19:30 +0300)]
[X86][Costmodel] Load/store i32/f32 Stride=4 VF=8 interleaving costs

The only sched models that for cpu's that support avx2
but not avx512 are: haswell, broadwell, skylake, zen1-3

For load we have:
https://godbolt.org/z/a6rxMG6ec - for intels `Block RThroughput: =16.0`; for ryzens, `Block RThroughput: <=12.0`
So could pick cost of `16`.

For store we have:
https://godbolt.org/z/ced1bdqc9 - for intels `Block RThroughput: =16.0`; for ryzens, `Block RThroughput: <=8.0`
So we could pick cost of `16`.

I'm directly using the shuffling asm the llc produced,
without any manual fixups that may be needed
to ensure sequential execution.

Reviewed By: RKSimon

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

3 years ago[X86][Costmodel] Load/store i32/f32 Stride=4 VF=4 interleaving costs
Roman Lebedev [Mon, 4 Oct 2021 16:30:07 +0000 (19:30 +0300)]
[X86][Costmodel] Load/store i32/f32 Stride=4 VF=4 interleaving costs

The only sched models that for cpu's that support avx2
but not avx512 are: haswell, broadwell, skylake, zen1-3

For load we have:
https://godbolt.org/z/avq1oz98W - for intels `Block RThroughput: =8.0`; for ryzens, `Block RThroughput: =4.0`
So could pick cost of `8`.

For store we have:
https://godbolt.org/z/89PGMc1qs - for intels `Block RThroughput: =6.0`; for ryzens, `Block RThroughput: <=6.0`
So we could pick cost of `6`.

I'm directly using the shuffling asm the llc produced,
without any manual fixups that may be needed
to ensure sequential execution.

Reviewed By: RKSimon

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

3 years ago[X86][Costmodel] Load/store i32/f32 Stride=4 VF=2 interleaving costs
Roman Lebedev [Mon, 4 Oct 2021 16:30:00 +0000 (19:30 +0300)]
[X86][Costmodel] Load/store i32/f32 Stride=4 VF=2 interleaving costs

Finally, we are getting to the heavy-hitter stuff!

The only sched models that for cpu's that support avx2
but not avx512 are: haswell, broadwell, skylake, zen1-3

For load we have:
https://godbolt.org/z/7crGWoar6 - for intels `Block RThroughput: =4.0`; for ryzens, `Block RThroughput: <=2.0`
So could pick cost of `4`.

For store we have:
https://godbolt.org/z/T8aq3MszM - for intels `Block RThroughput: =5.0`; for ryzens, `Block RThroughput: <=2.0`
So we could pick cost of `5`.

I'm directly using the shuffling asm the llc produced,
without any manual fixups that may be needed
to ensure sequential execution.

Reviewed By: RKSimon

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

3 years ago[AMDGPU] Use "hostcall" module flag instead of searching for ockl_hostcall_internal...
kpyzhov [Tue, 5 Oct 2021 13:56:04 +0000 (09:56 -0400)]
[AMDGPU] Use "hostcall" module flag instead of searching for ockl_hostcall_internal() declaration.
The current way to detect hostcalls by looking for "ockl_hostcall_internal()" function in the module seems to be not reliable enough. The LTO may rename the "ockl_hostcall_internal()" function when an application is compiled with "-fgpu-rdc", and MetadataStreamer pass to fail to detect hostcalls, therefore it does not set the "hidden_hostcall_buffer" kernel argument.
This change adds a new module flag: hostcall that can be used to detect whether GPU functions use host calls for printf.

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

3 years ago[RISCV] Update to vlm.v and vsm.v according to v1.0-rc1.
Hsiangkai Wang [Tue, 5 Oct 2021 06:20:36 +0000 (14:20 +0800)]
[RISCV] Update to vlm.v and vsm.v according to v1.0-rc1.

vle1.v  -> vlm.v
vse1.v  -> vsm.v

Reviewed By: craig.topper

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

3 years ago[mlir] Add an 'cppNamespace' field to availability
Lei Zhang [Tue, 5 Oct 2021 13:32:35 +0000 (09:32 -0400)]
[mlir] Add an 'cppNamespace' field to availability

This allows us to generate interfaces in a namespace,
following other TableGen'erated code.

Reviewed By: rriddle

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

3 years agotsan: improve detection of stack/tls races
Dmitry Vyukov [Tue, 5 Oct 2021 13:26:02 +0000 (15:26 +0200)]
tsan: improve detection of stack/tls races

Print meaningful stack frames for stack/tls races
(instead of PC 1/2 that don't symbolize).

Imitate stack/tls writes after we create and initialize
the new thread, otherwise the races are not detected.

This is re-submit of the following reverted commits,
but without tests as they failed on a number of OSes/arches:
"tsan: fix and test detection of TLS races"
"tsan: fix tls_race3 test on darwin"
"tsan: print a meaningful frame for stack races"

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

3 years ago[mlir][spirv] Fix path in define_enum.sh script
Lei Zhang [Tue, 5 Oct 2021 13:31:49 +0000 (09:31 -0400)]
[mlir][spirv] Fix path in define_enum.sh script

Reviewed By: mravishankar

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

3 years ago[PHIElimination] Update LiveVariables after handling an unspillable terminator
Jay Foad [Fri, 1 Oct 2021 14:39:38 +0000 (15:39 +0100)]
[PHIElimination] Update LiveVariables after handling an unspillable terminator

Update the LiveVariables analysis after the special handling for
unspillable terminators which was added in D91358. This is just enough
to fix some "Block should not be in AliveBlocks" / "Block missing from
AliveBlocks" errors in the codegen test suite when machine verification
is forced to run after PHIElimination (currently it is disabled).

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

3 years agotsan: make cur_thread_init return cur_thread
Dmitry Vyukov [Fri, 24 Sep 2021 04:57:37 +0000 (06:57 +0200)]
tsan: make cur_thread_init return cur_thread

Whenever we call cur_thread_init, we call cur_thread on the next line.
So make cur_thread_init return the current thread directly.
Makes code a bit shorter, does not affect codegen.

Reviewed By: vitalybuka, melver

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

3 years agoReland "[clang-repl] Allow loading of plugins in clang-repl."
Vassil Vassilev [Tue, 5 Oct 2021 06:11:42 +0000 (06:11 +0000)]
Reland "[clang-repl] Allow loading of plugins in clang-repl."

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

3 years ago[DebugInfo][InstrRef] Track all of DBG_PHIs operands
Jeremy Morse [Tue, 5 Oct 2021 12:44:40 +0000 (13:44 +0100)]
[DebugInfo][InstrRef] Track all of DBG_PHIs operands

An important part of the instruction referencing solution is that we
identify all the registers that values move between before we then compute
an SSA-like function from the machine code, and from the variable
intrinsics. DBG_PHIs weren't causing all the subregisters of their operands
to be tracked; this patch forces that to happen.

The practical implications were that not enough space is allocated for
storing values when analysing the function -- asan will crash on the
attached test case with an unpatched compiler. Non-asan llc's will produce
a DBG_VALUE $noreg, where it should be $dil.

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

3 years ago[PowerPC][MMA] Allow MMA builtin types in pre-P10 compilation units
Kamau Bridgeman [Thu, 30 Sep 2021 16:36:54 +0000 (11:36 -0500)]
[PowerPC][MMA] Allow MMA builtin types in pre-P10 compilation units

This patch allows the use of __vector_quad and __vector_pair, PPC MMA builtin
types, on all PowerPC 64-bit compilation units. When these types are
made available the builtins that use them automatically become available
so semantic checking for mma and pair vector memop __builtins is also
expanded to ensure these builtin function call are only allowed on
Power10 and new architectures. All related test cases are updated to
ensure test coverage.

Reviewed By: #powerpc, nemanjai

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

3 years ago[mlir][linalg] Move generalization pattern to Transforms (NFC).
Tobias Gysi [Tue, 5 Oct 2021 12:24:19 +0000 (12:24 +0000)]
[mlir][linalg] Move generalization pattern to Transforms (NFC).

Move the generalization pattern to the other Linalg transforms to make it available to the codegen strategy.

Reviewed By: nicolasvasilache

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

3 years ago[lldb][NFC] Remove unnecessary include in cpp/const_this test
Raphael Isemann [Tue, 5 Oct 2021 12:27:54 +0000 (14:27 +0200)]
[lldb][NFC] Remove unnecessary include in cpp/const_this test

3 years agoconsteval if is now fully supported
Aaron Ballman [Tue, 5 Oct 2021 12:21:29 +0000 (08:21 -0400)]
consteval if is now fully supported

This amends 424733c12aacc227a28114deba72061153f8dff2 which accidentally
dropped the change to the status page.

3 years agoImplement if consteval (P1938)
Corentin Jabot [Tue, 5 Oct 2021 12:02:53 +0000 (08:02 -0400)]
Implement if consteval (P1938)

Modify the IfStmt node to suppoort constant evaluated expressions.

Add a new ExpressionEvaluationContext::ImmediateFunctionContext to
keep track of immediate function contexts.

This proved easier/better/probably more efficient than walking the AST
backward as it allows diagnosing nested if consteval statements.

3 years ago[fir] Split FIROptimizer lib into several smaller libraries
Valentin Clement [Tue, 5 Oct 2021 12:01:17 +0000 (14:01 +0200)]
[fir] Split FIROptimizer lib into several smaller libraries

Partition libFIROptimizer into smaller libraries that reflect the
structure. Adapt potential problems.

This patch is part of the upstreaming effort from fir-dev branch. It's a
building stone to upstreaming transformations.

Reviewed By: schweitz

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

Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
3 years ago[SCCPSolver] Fix use-after-free in markArgInFuncSpecialization
Sjoerd Meijer [Tue, 5 Oct 2021 11:12:39 +0000 (12:12 +0100)]
[SCCPSolver] Fix use-after-free in markArgInFuncSpecialization

In SCCPSolver::markArgInFuncSpecialization, the ValueState map may be
reallocated *after* the initial ValueLatticeElement reference is grabbed, but
*before* its use in copy initialization. This causes a use-after-free.  To fix
this, this commit changes the behavior to create the new ValueLatticeElement
before assigning the old one to it.

Patch by: https://github.com/duck-37/

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

3 years ago[GlobalISel] Combine fabs(fneg(x)) to fabs(x)
Mirko Brkusanin [Tue, 5 Oct 2021 11:43:39 +0000 (13:43 +0200)]
[GlobalISel] Combine fabs(fneg(x)) to fabs(x)

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

3 years ago[mlir][Linalg] Allow operand-less scf::ExecuteRegionOp to encapsulate scf::YieldOp
Nicolas Vasilache [Tue, 5 Oct 2021 10:06:50 +0000 (10:06 +0000)]
[mlir][Linalg] Allow operand-less scf::ExecuteRegionOp to encapsulate scf::YieldOp

These are considered noops.
Buferization will still fail on scf.execute_region which yield values.
This is used to make comprehensive bufferization interoperate better with external clients.

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

3 years agoSilence an implicit conversion warning on the bit shift result in MSVC; NFC
Aaron Ballman [Tue, 5 Oct 2021 11:13:00 +0000 (07:13 -0400)]
Silence an implicit conversion warning on the bit shift result in MSVC; NFC

3 years ago[llvm-cxxfilt][NFC] Fix test for running in Windows cmd
gbhyamso [Tue, 5 Oct 2021 11:04:01 +0000 (12:04 +0100)]
[llvm-cxxfilt][NFC] Fix test for running in Windows cmd

The test llvm\test\tools\llvm-cxxfilt\delimiters.test started failling when run
from cmd.exe on Windows after D110986 which added a unicode character (⦙) to it.
Piping the unicode character in cmd.exe causes it to be converted to a '?'.
That causes the test to fail because the llvm-cxxfilt output becomes Foo?Bar
rather than the expected Foo⦙Bar.

Redirect the echo output to and from a temporary file to get around this
problem.

It's not entirely clear what the root cause is, but two separate downstream
builders are tripping up on this, so we are landing the work around for the
time being.

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

3 years ago[clang][ASTImporter] Add import of thread safety attributes.
Balázs Kéri [Tue, 5 Oct 2021 10:24:34 +0000 (12:24 +0200)]
[clang][ASTImporter] Add import of thread safety attributes.

Attributes of "C/C++ Thread safety attributes" section in Attr.td
are added to ASTImporter. The not added attributes from this section
do not need special import handling.

Reviewed By: martong

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

3 years ago[Test] Add test showing profitable peeling opportunity
Max Kazantsev [Tue, 5 Oct 2021 10:49:03 +0000 (17:49 +0700)]
[Test] Add test showing profitable peeling opportunity

Patch by Dmitry Makogon!

3 years ago[gn build] Port 214054f78a4e
LLVM GN Syncbot [Tue, 5 Oct 2021 10:41:33 +0000 (10:41 +0000)]
[gn build] Port 214054f78a4e

3 years ago[lldb] Move DynamicRegisterInfo to public Target library
Michał Górny [Fri, 1 Oct 2021 15:21:45 +0000 (17:21 +0200)]
[lldb] Move DynamicRegisterInfo to public Target library

Move DynamicRegisterInfo from the internal lldbPluginProcessUtility
library to the public lldbTarget library.  This is a prerequisite
towards ABI plugin changes that are going to pass DynamicRegisterInfo
parameters.

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

3 years ago[ELF][test] Enhance relative dynamic relocation tests
Andrew Ng [Mon, 4 Oct 2021 16:09:18 +0000 (17:09 +0100)]
[ELF][test] Enhance relative dynamic relocation tests

Add checking of the value of the relocation with an addend. Also check
all relocation offsets.

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

3 years ago[SelectionDAG] Replace error prone index check in BaseIndexOffset::computeAliasing
Bjorn Pettersson [Mon, 20 Sep 2021 09:32:01 +0000 (11:32 +0200)]
[SelectionDAG] Replace error prone index check in BaseIndexOffset::computeAliasing

Deriving NoAlias based on having the same index in two BaseIndexOffset
expressions seemed weird (and as shown in the added unittest the
correctness of doing so depended on undocumented pre-conditions that
the user of BaseIndexOffset::computeAliasing would need to take care
of.

This patch removes the code that dereived NoAlias based on indices
being the same. As a compensation, to avoid regressions/diffs in
various lit test, we also add a new check. The new check derives
NoAlias in case the two base pointers are based on two different
GlobalValue:s (neither of them being a GlobalAlias).

Reviewed By: niravd

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

3 years ago[SelectionDAG] Assume that a GlobalAlias may alias other global values
Bjorn Pettersson [Mon, 20 Sep 2021 08:29:11 +0000 (10:29 +0200)]
[SelectionDAG] Assume that a GlobalAlias may alias other global values

This fixes a bug detected in DAGCombiner when using global alias
variables. Here is an example:
  @foo = global i16 0, align 1
  @aliasFoo = alias i16, i16 * @foo
  define i16 @bar() {
    ...
    store i16 7, i16 * @foo, align 1
    store i16 8, i16 * @aliasFoo, align 1
    ...
  }

BaseIndexOffset::computeAliasing would incorrectly derive NoAlias
for the two accesses in the example above, resulting in DAGCombiner
miscompiles.

This patch fixes the problem by a defensive approach letting
BaseIndexOffset::computeAliasing return false, i.e. that the aliasing
couldn't be determined, when comparing two global values and at least
one is a GlobalAlias. In the future we might improve this with a
deeper analysis to look at the aliasee for the GlobalAlias etc. But
that is a bit more complicated considering that we could have
'local_unnamed_addr' and situations with several 'alias' variables.

Fixes PR51878.

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

3 years ago[mlir] Convert ConstShapeOp to a static tensor type.
Adrian Kuegel [Tue, 5 Oct 2021 09:10:42 +0000 (11:10 +0200)]
[mlir] Convert ConstShapeOp to a static tensor type.

ConstShapeOp knows its shape, so it should also have a static tensor type.

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

3 years ago[AMDGPU][GlobalISel] Fix legalization of G_UMULH
Jay Foad [Fri, 1 Oct 2021 12:30:42 +0000 (13:30 +0100)]
[AMDGPU][GlobalISel] Fix legalization of G_UMULH

Scalarize before narrowing because the narrowing implementation does not
work on vectors. This matches what we do for regular G_MUL.

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

3 years ago[Support] Change fatal_error_handler_t to take a const char* instead of std::string
Simon Pilgrim [Tue, 5 Oct 2021 09:51:28 +0000 (10:51 +0100)]
[Support] Change fatal_error_handler_t to take a const char* instead of std::string

https://commondatastorage.googleapis.com/chromium-browser-clang/llvm-include-analysis.html

Excessive use of the <string> header has a massive impact on compile time; its most commonly included via the ErrorHandling.h header, which has to be included in many key headers, impacting many source files that have no need for std::string.

As an initial step toward removing the <string> include from ErrorHandling.h, this patch proposes to update the fatal_error_handler_t handler to just take a raw const char* instead.

The next step will be to remove the report_fatal_error std::string variant, which will involve a lot of cleanup and better use of Twine/StringRef.

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

3 years ago[GlobalISel] Simplify narrowScalarMul. NFC.
Jay Foad [Tue, 5 Oct 2021 09:47:54 +0000 (10:47 +0100)]
[GlobalISel] Simplify narrowScalarMul. NFC.

Remove some redundancy because the source and result types of any
multiply are always the same.

3 years ago[ARM] Reset speculation-hardening-sls.ll test checks.
David Green [Tue, 5 Oct 2021 09:51:18 +0000 (10:51 +0100)]
[ARM] Reset speculation-hardening-sls.ll test checks.

The commit e497b12a69604b6d691312a30f6b86da4f18f7f8 went and regenerated
all the checks lines in the Arm speculation-hardening-sls.ll test in a
way that removed most of the important checks. This just resets them
back to how they were before, with the single character fix to change:
; NOHARDENARM:     {{bxge lr$}}
to
; NOHARDENARM:     {{bxgt lr$}}

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

3 years ago[MLIR] Add an option to disable `maxIterations` in greedy pattern rewrites
Frederik Gossen [Mon, 4 Oct 2021 14:42:24 +0000 (16:42 +0200)]
[MLIR] Add an option to disable `maxIterations` in greedy pattern rewrites

This option is needed for passes that are known to reach a fix point, but may
need many iterations depending on the size of the input IR.

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

3 years ago[AArch64] Make speculation-hardening-sls.ll x16 test more robust
David Green [Tue, 5 Oct 2021 09:32:30 +0000 (10:32 +0100)]
[AArch64] Make speculation-hardening-sls.ll x16 test more robust

As suggested in D110830, this copies the Arm backend method of testing
function calls through specific registers, using inline assembly to
force the variable into x16 to check that the __llvm_slsblr_thunk calls
do not use a register that may be clobbered by the linker.

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

3 years agoAArch64+GISel: legalize vector remainder operations.
Tim Northover [Thu, 23 Sep 2021 10:31:03 +0000 (11:31 +0100)]
AArch64+GISel: legalize vector remainder operations.

3 years agoRevert "[fir] Split FIROptimizer lib into several smaller libraries"
Valentin Clement [Tue, 5 Oct 2021 09:19:26 +0000 (11:19 +0200)]
Revert "[fir] Split FIROptimizer lib into several smaller libraries"

This reverts commit c02a8cdda8733aac26481b6819a4eef000ee91c8.

3 years ago[AMDGPU] Pre-commit test for D111126 (NFC)
Carl Ritson [Tue, 5 Oct 2021 09:02:56 +0000 (18:02 +0900)]
[AMDGPU] Pre-commit test for D111126 (NFC)

3 years ago[fir] Split FIROptimizer lib into several smaller libraries
Valentin Clement [Tue, 5 Oct 2021 09:00:46 +0000 (11:00 +0200)]
[fir] Split FIROptimizer lib into several smaller libraries

Partition libFIROptimizer into smaller libraries that reflect the
structure. Adapt potential problems.

This patch is part of the upstreaming effort from fir-dev branch. It's a
building stone to upstreaming transformations.

Reviewed By: schweitz

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

Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
3 years agoRevert "[lldb] Refactor variable parsing"
Pavel Labath [Tue, 5 Oct 2021 08:37:52 +0000 (10:37 +0200)]
Revert "[lldb] Refactor variable parsing"

This commit has introduced test failures in internal google tests.
Working theory is they are caused by a genuine problem in the patch
which gets tripped by some debug info from system libraries.

Reverting while we try to reproduce the problem in a self-contained
fashion.

This reverts commit 601168e42037ac4433e74b920bb22f76d59ba420.

3 years ago[mlir][Linalg] NFC - Add support to specify that a tensor value is known to bufferize...
Nicolas Vasilache [Tue, 5 Oct 2021 06:58:53 +0000 (06:58 +0000)]
[mlir][Linalg] NFC - Add support to specify that a tensor value is known to bufferize to writeable memory

This change allows better interop with external clients of comprehensive bufferization functions
but is otherwise NFC for the MLIR pass itself.

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

3 years agoRevert "[fir] Split FIROptimizer lib into several smaller libraries"
Valentin Clement [Tue, 5 Oct 2021 08:16:19 +0000 (10:16 +0200)]
Revert "[fir] Split FIROptimizer lib into several smaller libraries"

This reverts commit c2eff3d5b931191d77fe391f93e50283a4c88739.

3 years ago[Support] Trim #include after b06df22
Sam McCall [Tue, 5 Oct 2021 07:58:17 +0000 (09:58 +0200)]
[Support] Trim #include after b06df22

3 years ago[libcxx] [test] Move a missed test to ctime.timespec.compile.pass.cpp
Martin Storsjö [Fri, 27 Aug 2021 10:10:19 +0000 (10:10 +0000)]
[libcxx] [test] Move a missed test to ctime.timespec.compile.pass.cpp

This was missed in ec574f5da463d303a3771597c233e52d2429db67. TIME_UTC
is a define that goes along with timespec_get. The testcase that it is
moved to is only run for >= C++17, so the surrounding ifdef guard
can be dropped.

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

3 years ago[libcxx] Don't autodetect pthreads on MinGW
Martin Storsjö [Fri, 1 Oct 2021 20:44:17 +0000 (23:44 +0300)]
[libcxx] Don't autodetect pthreads on MinGW

e9ee517930f76a972fcda00d9dd0466db80d60f7 added support for using
winpthreads on Windows, enabled if `__WINPTHREADS_VERSION` was
defined (i.e. if winpthreads headers have been included before
including libcxx `__config`). This was fragile (libcxx changed
behaviour depending on what headers had been included externally
before), and was changed in a1bc823a59d5b6f310bdf6c7c7b62ec71b87d1aa
to use pthreads on Windows whenever the pthread.h header was
available.

This is also fragile; pthread.h might be unavailable while building
libcxx but installed later, and available when users include the
libcxx headers.

In practice, in every modern setup for building libcxx for Windows
I've seen, users end up manually configuring it with
`LIBCXX_HAS_WIN32_THREAD_API=ON`, as the users may have winpthreads
installed (for other libraries/projects to use) while wanting to
build libcxx with the default win32 threading.

Don't automatically pick up pthreads on Windows even if the header
is available. Instead require the user to configure the libcxx
build with `LIBCXX_HAS_PTHREAD_API=ON` if that's desired.

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

3 years ago[runtimes] Set a default value for LLVM_LIT_ARGS
Martin Storsjö [Fri, 1 Oct 2021 19:30:55 +0000 (22:30 +0300)]
[runtimes] Set a default value for LLVM_LIT_ARGS

This matches the value used in
libcxx/cmake/Modules/HandleOutOfTreeLLVM.cmake.

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

3 years ago[fir] Split FIROptimizer lib into several smaller libraries
Valentin Clement [Tue, 5 Oct 2021 07:27:10 +0000 (09:27 +0200)]
[fir] Split FIROptimizer lib into several smaller libraries

Partition libFIROptimizer into smaller libraries that reflect the
structure. Adapt potential problems.

This patch is part of the upstreaming effort from fir-dev branch. It's a
building stone to upstreaming transformations.

Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
Reviewed By: schweitz

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

3 years ago[AArch64][GlobalISel] Legalize G_VECREDUCE_AND.
Amara Emerson [Tue, 5 Oct 2021 04:47:04 +0000 (21:47 -0700)]
[AArch64][GlobalISel] Legalize G_VECREDUCE_AND.

These are handled identically to the already handled G_VECREDUCE_OR instructions.

3 years ago[LiveIntervals] Fix verification of early-clobbered segments
Jay Foad [Mon, 4 Oct 2021 15:25:41 +0000 (16:25 +0100)]
[LiveIntervals] Fix verification of early-clobbered segments

Enable verification of live intervals immediately after computing them
(when -early-live-intervals is used) and fix a problem that that
provokes: currently the verifier insists that a segment that ends at an
early-clobber slot must be followed by another segment starting at the
same slot. But before TwoAddressInstruction runs, the equivalent
condition is: a segment that ends at an early-clobber slot must have its
last use tied to an early-clobber def. That condition is harder to check
here, so for now just disable this check until tied operands have been
rewritten.

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

3 years ago[lldb] Remove some anonymous namespaces
Pavel Labath [Tue, 5 Oct 2021 06:29:16 +0000 (08:29 +0200)]
[lldb] Remove some anonymous namespaces

.. and reduce the scope of others. They don't follow llvm coding
standards (which say they should be used only when the same effect
cannot be achieved with the static keyword), and they set a bad example.

3 years agoRevert "[clang-repl] Allow loading of plugins in clang-repl."
Vassil Vassilev [Tue, 5 Oct 2021 06:10:38 +0000 (06:10 +0000)]
Revert "[clang-repl] Allow loading of plugins in clang-repl."

This reverts commit 81fb640f83b6a5d099f9124739ab3049be79ea56 due to bot failures:
https://lab.llvm.org/buildbot#builders/57/builds/10807

3 years ago[clang-repl] Allow loading of plugins in clang-repl.
Vassil Vassilev [Sat, 25 Sep 2021 17:30:49 +0000 (17:30 +0000)]
[clang-repl] Allow loading of plugins in clang-repl.

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

3 years ago[ELF][test][NFC] Make a test standard compliant
Igor Kudrin [Tue, 5 Oct 2021 04:40:02 +0000 (11:40 +0700)]
[ELF][test][NFC] Make a test standard compliant

PT_LOAD segments in the program header must be sorted by their virtual
addresses, so they should be defined in a similar order as the
associated sections.

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

3 years ago[gn build] Port cfef1803dd83
LLVM GN Syncbot [Tue, 5 Oct 2021 04:34:07 +0000 (04:34 +0000)]
[gn build] Port cfef1803dd83

3 years ago[GlobalISel] Port over the SelectionDAG stack protector codegen feature.
Amara Emerson [Sun, 26 Sep 2021 05:55:37 +0000 (22:55 -0700)]
[GlobalISel] Port over the SelectionDAG stack protector codegen feature.

This is a port of the feature that allows the StackProtector pass to omit
checking code for stack canary checks, and rely on SelectionDAG to do it at a
later stage. The reasoning behind this seems to be to prevent the IR checking
instructions from hindering tail-call optimizations during codegen.

Here we allow GlobalISel to also use that scheme. Doing so requires that we
do some analysis using some factored-out code to determine where to generate
code for the epilogs.

Not every case is handled in this patch since we don't have support for all
targets that exercise different stack protector schemes.

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

3 years ago[llvm-profgen] Filter out invalid debug line
wlei [Sat, 2 Oct 2021 00:20:56 +0000 (17:20 -0700)]
[llvm-profgen] Filter out invalid debug line

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

3 years ago[llvm-profgen] Add duplication factor for line-number based profile
wlei [Fri, 1 Oct 2021 23:58:59 +0000 (16:58 -0700)]
[llvm-profgen] Add duplication factor for line-number based profile

This change adds duplication factor multiplier while accumulating body samples for line-number based profile. The body sample count will be `duplication-factor * count`. Base discriminator and duplication factor is decoded from the raw discriminator, this requires some refactor works.

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

3 years ago[CSSPGO] Rename the field of SampleContextFrame
wlei [Fri, 1 Oct 2021 23:51:38 +0000 (16:51 -0700)]
[CSSPGO] Rename the field of SampleContextFrame

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

3 years ago[flang] Remove incorrect unit test
Craig Rasmussen [Tue, 5 Oct 2021 01:22:42 +0000 (18:22 -0700)]
[flang] Remove incorrect unit test

Any test of the team_number intrinsic function will apparently
fail because it doesn't have access to ISO_FORTRAN_ENV when
called.

3 years agoRevert "Revert "[GlobalISel][IRTranslator] Emit trap intrinsic for "unreachable"""
Amara Emerson [Mon, 4 Oct 2021 23:59:47 +0000 (16:59 -0700)]
Revert "Revert "[GlobalISel][IRTranslator] Emit trap intrinsic for "unreachable"""

This reverts commit d95cd81141a4e398e0d3337cb2e6617281d06278.

The selector sometimes leaves unreachable blocks unselected because it uses a
postorder traversal for the block ordering.

With the trap intrinsics now being emitted, these blocks are no longer empty and
the unselected G_INTRINSIC instructions survive past selection. To fix this,
keep track of which blocks are selected and later delete any blocks that weren't
selected.

3 years ago[Object][WebAssemlby] Report function types (signatures). NFC
Sam Clegg [Mon, 4 Oct 2021 23:47:59 +0000 (16:47 -0700)]
[Object][WebAssemlby] Report function types (signatures). NFC

This simplifies the code in a number of ways and avoids
having to track functions and their types separately.

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

3 years ago[RISCV] Add riscv64 command line to hoist-global-addr-base.ll. NFC
Craig Topper [Mon, 4 Oct 2021 23:52:22 +0000 (16:52 -0700)]
[RISCV] Add riscv64 command line to hoist-global-addr-base.ll. NFC

3 years ago[flang] runtime: fix formatted real input regression w/ spaces
peter klausler [Wed, 29 Sep 2021 17:19:21 +0000 (10:19 -0700)]
[flang] runtime: fix formatted real input regression w/ spaces

Blank input fields must be interpreted as zero, including the case of
virutal space characters generated from record padding at the end of
an input record.  This stopped working sometime in the past few months
for real input (not sure when); here's a fix.

This bug was breaking FCVS test fm111.

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

3 years agoRevert "[clang][Fuchsia] Re-enable compiler-rt tests in runtimes build"
Leonard Chan [Mon, 4 Oct 2021 23:11:12 +0000 (16:11 -0700)]
Revert "[clang][Fuchsia] Re-enable compiler-rt tests in runtimes build"

This reverts commit 8480063f25b8527d935722769d54d47f0c0d5689.

We're seeing some test failures on our builders.

3 years ago[NFC] Add more comments about not using make_unique to pass managers/adaptors
Arthur Eubanks [Mon, 4 Oct 2021 23:10:37 +0000 (16:10 -0700)]
[NFC] Add more comments about not using make_unique to pass managers/adaptors

These were missed in D110784.

3 years agoRevert "[GlobalISel][IRTranslator] Emit trap intrinsic for "unreachable""
Amara Emerson [Mon, 4 Oct 2021 22:44:27 +0000 (15:44 -0700)]
Revert "[GlobalISel][IRTranslator] Emit trap intrinsic for "unreachable""

This reverts commit 019041bec32400928ec57b7e3dc1352d896aa5b6.

It broke some bots.

3 years ago[libc++] Rename the 'libc++' Lit feature to 'llvm-libc++'
Louis Dionne [Thu, 30 Sep 2021 18:53:45 +0000 (14:53 -0400)]
[libc++] Rename the 'libc++' Lit feature to 'llvm-libc++'

This is to simplify an upcoming change where we distinguish between
flavors of libc++ by adding an apple-libc++ Lit feature.

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