platform/upstream/llvm.git
2 years ago[AArch64] Fix unused variable warning with NDEBUG, NFC
Reid Kleckner [Wed, 1 Dec 2021 17:27:44 +0000 (09:27 -0800)]
[AArch64] Fix unused variable warning with NDEBUG, NFC

2 years ago[Clang][VE] Fix toolchain test when -DCLANG_DEFAULT_LINKER=lld in use
Simon Moll [Wed, 1 Dec 2021 17:03:14 +0000 (18:03 +0100)]
[Clang][VE] Fix toolchain test when -DCLANG_DEFAULT_LINKER=lld in use

The CLANG_DEFAULT_LINKER flag overrides the default toolchain linker.
VE strictly requires 'nld' to be the default linker.  This causes a test
failure in test/Driver/ve-toolchain.cpp when configured with
CLANG_DEFAULT_LINKER!=ld

  Failure in clang-ppc64le-rhel
  (https://lab.llvm.org/buildbot/#/builders/57/builds/12628)

Until default linker selection with CLANG_DEFAULT_LINKER!=ld is fixed
proper, we manually specify '-fuse-ld=ld' (ie the toolchain default
linker) in the ve-toolchain tests.

2 years ago[SelectionDAG] Add pattern to haveNoCommonBitsSet
Omer Aviram [Wed, 1 Dec 2021 17:03:22 +0000 (12:03 -0500)]
[SelectionDAG] Add pattern to haveNoCommonBitsSet

Correctly identify the following pattern, which has no common bits: (X & ~M) op (Y & M).

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

2 years agoRevert "tsan: new runtime (v3)"
Dmitry Vyukov [Wed, 1 Dec 2021 16:55:14 +0000 (17:55 +0100)]
Revert "tsan: new runtime (v3)"

This reverts commit 66d4ce7e26a5ab00f7e4946b6e1bac8f805010fa.

Chromium tests started failing:
https://bugs.chromium.org/p/chromium/issues/detail?id=1275581

2 years ago[mlir][ods] AttrOrTypeGen uses Class
Mogball [Tue, 30 Nov 2021 14:09:00 +0000 (14:09 +0000)]
[mlir][ods] AttrOrTypeGen uses Class

AttrOrType def generator uses `Class` code gen helper,
instead of naked raw_ostream.

Depends on D113714 and D114807

Reviewed By: rriddle

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

2 years ago[llvm][stlextras] Add const methods to concat_range and enumerator
Mogball [Tue, 30 Nov 2021 14:08:40 +0000 (14:08 +0000)]
[llvm][stlextras] Add const methods to concat_range and enumerator

Reviewed By: jpienaar

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

2 years ago[libc++][format][1/6] Reduce binary size.
Mark de Wever [Sat, 4 Sep 2021 11:26:58 +0000 (13:26 +0200)]
[libc++][format][1/6] Reduce binary size.

This removes the `format_args_t` from `<format>` and adjusts the type of
the `format_args` for the `vformat_to` overloads.

The `format_context` uses a `back_insert_iterator<string>` therefore the
new `output_iterator` function uses a `string` as its temporary storage
buffer. This isn't ideal. The next patches in this series will improve
this. These improvements make it easy to also improve `format_to_n` and
`formatted_size`.

This addresses P2216 `6. Binary size`.
P2216 `5. Compile-time checks` are not part of this change.

Implements parts of:
- P2216 std::format improvements

Depends on D103670

Reviewed By: ldionne, #libc

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

2 years ago[mlir][Vector] Thread 0-d vectors through vector.transfer ops
Nicolas Vasilache [Wed, 1 Dec 2021 15:48:17 +0000 (15:48 +0000)]
[mlir][Vector] Thread 0-d vectors through vector.transfer ops

This revision adds 0-d vector support to vector.transfer ops.
In the process, numerous cleanups are applied, in particular around normalizing
and reducing the number of builders.

Reviewed By: ThomasRaoux, springerm

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

2 years ago[OpenMP][FIX] SPMDzation guarding needs to account for all reaching kernels
Joseph Huber [Wed, 1 Dec 2021 14:53:41 +0000 (09:53 -0500)]
[OpenMP][FIX] SPMDzation guarding needs to account for all reaching kernels

If two reaching kernels disagree on the execution mode we cannot guard a
function right now. Ensure we do not as we otherwise will cause a
deadlock.

Reviewed By: JonChesterfield

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

2 years ago[X86] combinePMULH - recognise 'cheap' trunctions via PACKS/PACKUS as well as SEXT...
Simon Pilgrim [Wed, 1 Dec 2021 16:37:39 +0000 (16:37 +0000)]
[X86] combinePMULH - recognise 'cheap' trunctions via PACKS/PACKUS as well as SEXT/ZEXT

combinePMULH currently only truncates vXi32/vXi64 multiplies to PMULHW/PMULUW if the source operands are SEXT/ZEXT instructions for a 'free' truncation.

But we can generalize this to any source operand with sufficient leading sign/zero bits that would allow PACKS/PACKUS to be used as a 'cheap' truncation.

This helps us avoid the wider multiplies, in exchange for truncation on both source operands instead of the result.

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

2 years ago[VE] Remove switch with only default case statement to fix MSVC warning. NFC.
Simon Pilgrim [Wed, 1 Dec 2021 14:36:06 +0000 (14:36 +0000)]
[VE] Remove switch with only default case statement to fix MSVC warning. NFC.

2 years ago[VE][NFC] Use POSIX-compatible stream redirection
Simon Moll [Wed, 1 Dec 2021 16:25:29 +0000 (17:25 +0100)]
[VE][NFC] Use POSIX-compatible stream redirection

Drop Bash-style stream redirect in favor of POSIX stream redirection to
fix spurious test failures on Windows.

Failure:
https://lab.llvm.org/buildbot/#/builders/123/builds/7509/steps/8/logs/stdio

2 years ago[SLP]Improve cost model for the shuffled extracts.
Alexey Bataev [Fri, 12 Nov 2021 17:09:15 +0000 (09:09 -0800)]
[SLP]Improve cost model for the shuffled extracts.

Improved the calculation of the shuffled extracts, where possible. Need
to calculate the cost for the extracted scalars if some users are not
insertelements + improved the total estimation of the shuffled scalars
used in insertelements build vectors.

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

2 years ago[libc++] Fix `uniform_int_distribution` for 128-bit result type
Fabian Wolff [Wed, 1 Dec 2021 16:01:06 +0000 (11:01 -0500)]
[libc++] Fix `uniform_int_distribution` for 128-bit result type

Fixes https://llvm.org/PR51520. The problem is that `uniform_int_distribution`
currently uses an unsigned integer with at most 64 bits internally, which
is then casted to the desired result type. If the result type is `int64_t`,
this will produce a negative number if the most significant bit is set,
but if the result type is `__int128_t`, the value remains non-negative
and will be out of bounds for the example in PR#51520. (The reason why
it also seems to work if the upper or lower bound is changed is
because the branch at [1] will then no longer be taken, and proper
rejection sampling takes place.)

The bigger issue here is probably that `uniform_int_distribution` can be
instantiated with `__int128_t` but will silently produce incorrect results
(only the lowest 64 bits can ever be set). libstdc++ also supports `__int128_t`
as a result type, so I have simply extended the maximum width of the
internal intermediate result type.

[1]: https://github.com/llvm/llvm-project/blob/6d28dffb6/libcxx/include/__random/uniform_int_distribution.h#L266-L267

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

2 years ago[PowerPC][AIX] Add toc-data support for 64-bit AIX small code model.
Yousuf Ali [Tue, 30 Nov 2021 18:43:14 +0000 (13:43 -0500)]
[PowerPC][AIX] Add toc-data support for 64-bit AIX small code model.

The patch expands the existing 32-bit toc-data attribute support to 64-bit.
In both 32-bit and 64-bit it is supported for small code model only.

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

2 years ago[SLP]Introduce isUndefVector function to check for undef vectors.
Alexey Bataev [Wed, 1 Dec 2021 12:58:18 +0000 (04:58 -0800)]
[SLP]Introduce isUndefVector function to check for undef vectors.

Undefined vector might be not only the UndefValue, but also it can be
a constant vector with undef ot poison elements, need to check for this
kind of undef too.

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

2 years ago[AArch64][SVE] Duplicate FP_EXTEND/FP_TRUNC -> LOAD/STORE dag combines
Bradley Smith [Fri, 26 Nov 2021 12:01:22 +0000 (12:01 +0000)]
[AArch64][SVE] Duplicate FP_EXTEND/FP_TRUNC -> LOAD/STORE dag combines

By duplicating these dag combines we can bypass the legality checks that
they do, this allows us to perform these combines on larger than legal
fixed types, which in turn allows us to bring the same benefits D114580
brought but to larger than legal fixed types.

Depends on D114580

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

2 years ago[SLP]Improve vectorization of cmp instructions sequences.
Alexey Bataev [Tue, 16 Nov 2021 19:05:19 +0000 (11:05 -0800)]
[SLP]Improve vectorization of cmp instructions sequences.

Final attempt to vectorize bundles of comptatible cmp instructions after
all other instructions processing.

Metric: SLP.NumVectorInstructions

Program                                                                             results results0 diff
        test-suite :: MultiSource/Benchmarks/mediabench/g721/g721encode/encode.test    1.00    5.00  400.0%
                              test-suite :: MultiSource/Benchmarks/PAQ8p/paq8p.test    8.00   11.00   37.5%
                    test-suite :: MultiSource/Benchmarks/Olden/voronoi/voronoi.test   20.00   26.00   30.0%
                test-suite :: External/SPEC/CINT2017rate/525.x264_r/525.x264_r.test 1344.00 1648.00   22.6%
               test-suite :: External/SPEC/CINT2017speed/625.x264_s/625.x264_s.test 1344.00 1648.00   22.6%
                              test-suite :: MultiSource/Benchmarks/Olden/bh/bh.test  102.00  124.00   21.6%
                test-suite :: MultiSource/Benchmarks/DOE-ProxyApps-C/CoMD/CoMD.test  118.00  133.00   12.7%
          test-suite :: External/SPEC/CFP2017speed/638.imagick_s/638.imagick_s.test 3233.00 3554.00    9.9%
           test-suite :: External/SPEC/CFP2017rate/538.imagick_r/538.imagick_r.test 3233.00 3554.00    9.9%
                        test-suite :: MultiSource/Benchmarks/Olden/power/power.test   64.00   70.00    9.4%
           test-suite :: External/SPEC/CFP2017rate/526.blender_r/526.blender_r.test 7879.00 8604.00    9.2%
           test-suite :: MultiSource/Benchmarks/Prolangs-C/simulator/simulator.test   50.00   54.00    8.0%
                        test-suite :: MultiSource/Applications/sqlite3/sqlite3.test   27.00   29.00    7.4%
             test-suite :: External/SPEC/CFP2017rate/510.parest_r/510.parest_r.test 8345.00 8955.00    7.3%
     test-suite :: MultiSource/Benchmarks/Prolangs-C/TimberWolfMC/timberwolfmc.test  694.00  738.00    6.3%
                        test-suite :: MultiSource/Benchmarks/MallocBench/gs/gs.test  361.00  382.00    5.8%
                      test-suite :: MultiSource/Benchmarks/7zip/7zip-benchmark.test  409.00  430.00    5.1%
     test-suite :: External/SPEC/CINT2017speed/600.perlbench_s/600.perlbench_s.test  140.00  147.00    5.0%
      test-suite :: External/SPEC/CINT2017rate/500.perlbench_r/500.perlbench_r.test  140.00  147.00    5.0%
             test-suite :: External/SPEC/CFP2017rate/511.povray_r/511.povray_r.test 4013.00 4206.00    4.8%
                       test-suite :: MultiSource/Applications/JM/ldecod/ldecod.test  966.00 1011.00    4.7%
                           test-suite :: SingleSource/Benchmarks/Misc/oourafft.test   65.00   68.00    4.6%
                            test-suite :: MultiSource/Benchmarks/Bullet/bullet.test 4219.00 4381.00    3.8%
                    test-suite :: MultiSource/Benchmarks/tramp3d-v4/tramp3d-v4.test 1911.00 1973.00    3.2%
      test-suite :: External/SPEC/CINT2017rate/531.deepsjeng_r/531.deepsjeng_r.test   62.00   64.00    3.2%
     test-suite :: External/SPEC/CINT2017speed/631.deepsjeng_s/631.deepsjeng_s.test   62.00   64.00    3.2%
                 test-suite :: External/SPEC/CINT2017speed/602.gcc_s/602.gcc_s.test  852.00  877.00    2.9%
                  test-suite :: External/SPEC/CINT2017rate/502.gcc_r/502.gcc_r.test  852.00  877.00    2.9%
                       test-suite :: MultiSource/Applications/JM/lencod/lencod.test 1624.00 1668.00    2.7%
                         test-suite :: MultiSource/Benchmarks/McCat/18-imp/imp.test   39.00   40.00    2.6%
test-suite :: MultiSource/Benchmarks/MiBench/consumer-typeset/consumer-typeset.test  613.00  624.00    1.8%
      test-suite :: MultiSource/Benchmarks/MiBench/consumer-lame/consumer-lame.test  378.00  383.00    1.3%
      test-suite :: MultiSource/Benchmarks/MiBench/consumer-jpeg/consumer-jpeg.test  293.00  295.00    0.7%
            test-suite :: MultiSource/Benchmarks/mediabench/jpeg/jpeg-6a/cjpeg.test  297.00  299.00    0.7%
      test-suite :: External/SPEC/CINT2017rate/523.xalancbmk_r/523.xalancbmk_r.test 5522.00 5534.00    0.2%
     test-suite :: External/SPEC/CINT2017speed/623.xalancbmk_s/623.xalancbmk_s.test 5522.00 5534.00    0.2%

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

2 years ago[Verifier] Make matrix intrinsic verification compatible with opaque pointers
Nikita Popov [Wed, 1 Dec 2021 15:08:44 +0000 (16:08 +0100)]
[Verifier] Make matrix intrinsic verification compatible with opaque pointers

Don't check the pointer element type for opaque pointers.

2 years ago[mlir][linalg] Disable tensor-matmul test under asan
Stephan Herhut [Wed, 1 Dec 2021 09:38:12 +0000 (10:38 +0100)]
[mlir][linalg] Disable tensor-matmul test under asan

The test is currently leaky. Disabling it to make the bots green.

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

2 years agoRevert "[ARM] Teach getIntImmCostInst about the cost of saturating fp converts"
David Green [Wed, 1 Dec 2021 15:25:19 +0000 (15:25 +0000)]
Revert "[ARM] Teach getIntImmCostInst about the cost of saturating fp converts"

This reverts commit 6d41de380f223c8da02fd4d6a7f7dd1e7a404a24 as the
windows bots are not happy, in a way I do not understand. Revert whilst
we figure out what is wrong.

2 years ago[LV] Move code from vectorizeMemoryInstruction to recipe's execute().
Florian Hahn [Wed, 1 Dec 2021 14:56:51 +0000 (14:56 +0000)]
[LV] Move code from vectorizeMemoryInstruction to recipe's execute().

The code in widenMemoryInstruction has already been transitioned
to only rely on information provided by VPWidenMemoryInstructionRecipe
directly.

Moving the code directly to VPWidenMemoryInstructionRecipe::execute
completes the transition for the recipe.

It provides the following advantages:

1. Less indirection, easier to see what's going on.
2. Removes accesses to fields of ILV.

2) in particular ensures that no dependencies on
fields in ILV for vector code generation are re-introduced.

Reviewed By: Ayal

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

2 years agoRevert "[Flang] Replace notifyMatchFailure with TODO hard failures"
Kiran Chandramohan [Wed, 1 Dec 2021 14:23:48 +0000 (14:23 +0000)]
Revert "[Flang] Replace notifyMatchFailure with TODO hard failures"

This reverts commit 46fd7fd7b342039b59ec534bab8b93fa5d34f6e2.

2 years ago[SLP][NFC]Add a test for inserting into constant undef vector, NFC.
Alexey Bataev [Wed, 1 Dec 2021 14:20:35 +0000 (06:20 -0800)]
[SLP][NFC]Add a test for inserting into constant undef vector, NFC.

2 years ago[BasicAA] Add memset_chk libfunc tests.
Florian Hahn [Wed, 1 Dec 2021 14:15:46 +0000 (14:15 +0000)]
[BasicAA] Add memset_chk libfunc tests.

2 years ago[BasicAA] Add strncpy libfunc tests.
Florian Hahn [Wed, 1 Dec 2021 14:15:40 +0000 (14:15 +0000)]
[BasicAA] Add strncpy libfunc tests.

2 years ago[Dexter] Fix address_printing test by requiring lldb
Stephen Tozer [Wed, 1 Dec 2021 14:03:53 +0000 (14:03 +0000)]
[Dexter] Fix address_printing test by requiring lldb

Fixes a failure on the llvm-clang-x86_64-sie-ubuntu-fast buildbot caused
by the test requiring lldb (with the standard dexter lit config), but
not including a "Requires: lldb" clause.

2 years ago[VE] Make VE official
Simon Moll [Wed, 1 Dec 2021 12:21:39 +0000 (13:21 +0100)]
[VE] Make VE official

Add VE to the list of official targets.

Proposal: https://lists.llvm.org/pipermail/llvm-dev/2021-November/153571.html

Reviewed By: rengolin

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

2 years ago[clang-cl] Set _MSVC_LANG to 202002L with /std:c++20
Nico Weber [Wed, 1 Dec 2021 13:35:32 +0000 (08:35 -0500)]
[clang-cl] Set _MSVC_LANG to 202002L with /std:c++20

MSVC says this should be 202002L for /std:c++20, and of VS16.11
that's indeed the case (older versions warn that they don't
understand /std:c++20, and then cl.exe defaults to C++14 and
sets _MSVC_LANG to 201402 accordingly).

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

2 years ago[gn build] (manually) port 94d5f2afbef0
Nico Weber [Wed, 1 Dec 2021 13:53:49 +0000 (08:53 -0500)]
[gn build] (manually) port 94d5f2afbef0

2 years agoFix a violated precondition in clang-format.
Manuel Klimek [Wed, 1 Dec 2021 13:37:10 +0000 (14:37 +0100)]
Fix a violated precondition in clang-format.

Make sure we do not try to change line comments that are non-regular, i.e. do
not start with "//" or "#". This can for example happen when "//" is
broken into two lines with an escaped newline.

2 years ago[libcxx][test][NFC] Extend get_allocator() testing for containers
Konstantin Boyarinov [Wed, 1 Dec 2021 13:04:59 +0000 (16:04 +0300)]
[libcxx][test][NFC] Extend get_allocator() testing for containers

Add dedicated tests for get_allocator() method for sequence, ordered and
unordered associative containers including constness coverage.

Reviewed by: ldionne, Mordante, rarutyun, #libc

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

2 years ago[Dexter] Add DexDeclareAddress command and address function
Stephen Tozer [Wed, 1 Dec 2021 13:00:22 +0000 (13:00 +0000)]
[Dexter] Add DexDeclareAddress command and address function

This patch adds a new dexter command, DexDeclareAddress, which is used
to test the relative values of pointer variables. The motivation for
adding this command is to allow meaningful assertions to be made about
pointers that go beyond checking variable availability and null
equality.

The full explanation and syntax is in Commands.md.

Reviewed By: Orlando

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

2 years ago[gn build] Port f5f28d5b0ce7
LLVM GN Syncbot [Wed, 1 Dec 2021 12:55:06 +0000 (12:55 +0000)]
[gn build] Port f5f28d5b0ce7

2 years ago[ARM] Implement BTI placement pass for PACBTI-M
Ties Stuij [Wed, 1 Dec 2021 12:44:09 +0000 (12:44 +0000)]
[ARM] Implement BTI placement pass for PACBTI-M

This patch implements a new MachineFunction in the ARM backend for
placing BTI instructions. It is similar to the existing AArch64
aarch64-branch-targets pass.

BTI instructions are inserted into basic blocks that:
- Have their address taken
- Are the entry block of a function, if the function has external
  linkage or has its address taken
- Are mentioned in jump tables
- Are exception/cleanup landing pads

Each BTI instructions is placed in the beginning of a BB after the
so-called meta instructions (e.g. exception handler labels).

Each outlining candidate and the outlined function need to be in agreement about
whether BTI placement is enabled or not. If branch target enforcement is
disabled for a function, the outliner should not covertly enable it by emitting
a call to an outlined function, which begins with BTI.

The cost mode of the outliner is adjusted to account for the extra BTI
instructions in the outlined function.

The ARM Constant Islands pass will maintain the count of the jump tables, which
reference a block. A `BTI` instruction is removed from a block only if the
reference count reaches zero.

PAC instructions in entry blocks are replaced with PACBTI instructions (tests
for this case will be added in a later patch because the compiler currently does
not generate PAC instructions).

The ARM Constant Island pass is adjusted to handle BTI
instructions correctly.

Functions with static linkage that don't have their address taken can
still be called indirectly by linker-generated veneers and thus their
entry points need be marked with BTI or PACBTI.

The changes are tested using "LLVM IR -> assembly" tests, jump tables
also have a MIR test. Unfortunately it is not possible add MIR tests
for exception handling and computed gotos because of MIR parser
limitations.

This patch is part of a series that adds support for the PACBTI-M extension of
the Armv8.1-M architecture, as detailed here:

https://community.arm.com/arm-community-blogs/b/architectures-and-processors-blog/posts/armv8-1-m-pointer-authentication-and-branch-target-identification-extension

The PACBTI-M specification can be found in the Armv8-M Architecture Reference
Manual:

https://developer.arm.com/documentation/ddi0553/latest

The following people contributed to this patch:

- Mikhail Maltsev
- Momchil Velikov
- Ties Stuij

Reviewed By: ostannard

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

2 years agoRevert "[LICM] Hoist LOAD without sinking the STORE"
Djordje Todorovic [Wed, 1 Dec 2021 12:39:26 +0000 (04:39 -0800)]
Revert "[LICM] Hoist LOAD without sinking the STORE"

This reverts commit ecb9d8e4e3c4623c2edcd2c50727103927d31508.

I'll reland this as soon as the failing tests are fixed/updated.

2 years ago[LICM] Hoist LOAD without sinking the STORE
Djordje Todorovic [Wed, 1 Dec 2021 12:21:10 +0000 (04:21 -0800)]
[LICM] Hoist LOAD without sinking the STORE

When doing load/store promotion within LICM, if we
cannot prove that it is safe to sink the store we won't
hoist the load, even though we can prove the load could
be dereferenced and moved outside the loop. This patch
implements the load promotion by moving it in the loop
preheader by inserting proper PHI in the loop. The store
is kept as is in the loop. By doing this, we avoid doing
the load from a memory location in each iteration.

Please consider this small example:

loop {
  var = *ptr;
  if (var) break;
  *ptr= var + 1;
}
After this patch, it will be:

var0 = *ptr;
loop {
  var1 = phi (var0, var2);
  if (var1) break;
  var2 = var1 + 1;
  *ptr = var2;
}
This addresses some problems from [0].

[0] https://bugs.llvm.org/show_bug.cgi?id=51193

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

2 years agoFixed a memory leak in the PDLToPDLInterp RootOrderingTest.
Stanislav Funiak [Wed, 1 Dec 2021 12:10:37 +0000 (17:40 +0530)]
Fixed a memory leak in the PDLToPDLInterp RootOrderingTest.

RootOrderingTest is a low-level unit test that creates values and uses them as vertices in a directed graph. These vertices were created using `builder.create`, but never freed, due to my insufficient understanding of the MLIR infrastructure.

Reviewed By: mehdi_amini, bondhugula, rriddle

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

2 years ago[clang][ARM] removing branch protection error cmdline test
Ties Stuij [Wed, 1 Dec 2021 12:04:08 +0000 (12:04 +0000)]
[clang][ARM] removing branch protection error cmdline test

This test which was just introduced in the PACBTI-M frontend
patch (https://reviews.llvm.org/D112421) is currently failing on some
platforms. Removing temporarily.

2 years ago[X86] Add some basic fptosi/fptoui saturate vector tests
Simon Pilgrim [Wed, 1 Dec 2021 12:03:30 +0000 (12:03 +0000)]
[X86] Add some basic fptosi/fptoui saturate vector tests

2 years ago[LICM] Support opaque pointers in scalar promotion
Nikita Popov [Wed, 1 Dec 2021 11:40:40 +0000 (12:40 +0100)]
[LICM] Support opaque pointers in scalar promotion

Make sure that all pointers have the same load/store access type,
rather than comparing pointer element types.

2 years ago[DAGCombiner] When combining REM ensure optimized div nodes are unique
Bradley Smith [Mon, 29 Nov 2021 16:54:01 +0000 (16:54 +0000)]
[DAGCombiner] When combining REM ensure optimized div nodes are unique

The REM DAG combine uses the visitDivLike functions to try and get an
optimized DIV node to provide better codegen, however in some cases this
visitDivLike call ends up in the BuildSDIVPow2 target hook, which in
turn sometimes will return the same node passed in to indicate not to
change it. The REM DAG combine does not anticipate this and creates a
cycle in the DAG because of it.

Fix this by ensuring any such optimized div node returned is distinct
from the node being combined.

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

2 years ago[DAG] Apply clang-format to visitMSTORE + visitMLOAD. NFC.
Simon Pilgrim [Wed, 1 Dec 2021 11:23:47 +0000 (11:23 +0000)]
[DAG] Apply clang-format to visitMSTORE + visitMLOAD. NFC.

Reduce diff in D114582

2 years ago[ARM] Strengthen fpclamptosat.ll triple to attempt to fix buildbot errors. NFC
David Green [Wed, 1 Dec 2021 11:11:09 +0000 (11:11 +0000)]
[ARM] Strengthen fpclamptosat.ll triple to attempt to fix buildbot errors. NFC

2 years ago[ARM] emit PACBTI-M build attributes
Ties Stuij [Wed, 1 Dec 2021 10:52:31 +0000 (10:52 +0000)]
[ARM] emit PACBTI-M build attributes

This patch is part of a series that adds support for the PACBTI-M extension of
the Armv8.1-M architecture, as detailed here:

https://community.arm.com/arm-community-blogs/b/architectures-and-processors-blog/posts/armv8-1-m-pointer-authentication-and-branch-target-identification-extension

The PACBTI-M specification can be found in the Armv8-M Architecture Reference
Manual:

https://developer.arm.com/documentation/ddi0553/latest

The following people contributed to this patch:

- Victor Campos
- Ties Stuij

Reviewed By: ostannard

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

2 years agoFix segfault in clang-format.
Manuel Klimek [Wed, 1 Dec 2021 10:56:51 +0000 (11:56 +0100)]
Fix segfault in clang-format.

Fix bug where we'd read past the end of the tokens after merging _T
macro strings.

2 years ago[IRBuilder] Remove deprecated methods
Nikita Popov [Wed, 1 Dec 2021 10:53:17 +0000 (11:53 +0100)]
[IRBuilder] Remove deprecated methods

Remove deprecated methods that are incompatible with opaque
pointers. These have all been deprecated at some point prior to
the LLVM 13 release.

2 years ago[IR] Remove deprecated GetElementPtrInst constructors
Nikita Popov [Wed, 1 Dec 2021 10:41:59 +0000 (11:41 +0100)]
[IR] Remove deprecated GetElementPtrInst constructors

Remove deprecated constructors that are incompatible with opaque
pointers. These have been deprecated since before the LLVM 13
release.

2 years ago[ARM] add common parts for PACBTI-M support in the backend
Ties Stuij [Wed, 1 Dec 2021 10:48:30 +0000 (10:48 +0000)]
[ARM] add common parts for PACBTI-M support in the backend

This patch encapsulates decision logic about when and how to generate
PAC/BTI related code. It's a part shared by PAC-RET, BTI placement,
build attribute emission, etc, so it make sense committing it
separately in order to unblock the aforementioned parts, which can
proceed concurrently.

This patch adds a few member functions to `ARMFunctionInfo`, which are currently
unused, therefore there is no testing for them at the moment. This code is
tested in follow-up PAC/BTI code gen patches.

This patch is part of a series that adds support for the PACBTI-M extension of
the Armv8.1-M architecture, as detailed here:

https://community.arm.com/arm-community-blogs/b/architectures-and-processors-blog/posts/armv8-1-m-pointer-authentication-and-branch-target-identification-extension

The PACBTI-M specification can be found in the Armv8-M Architecture Reference
Manual:

https://developer.arm.com/documentation/ddi0553/latest

The following people contributed to this patch:

- Momchil Velikov
- Ties Stuij

Reviewed By: danielkiss

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

2 years ago[clang][ARM] emit PACBTI-M feature defines
Ties Stuij [Wed, 1 Dec 2021 10:39:23 +0000 (10:39 +0000)]
[clang][ARM] emit PACBTI-M feature defines

emit __ARM_FEATURE_BTI_DEFAULT and __ARM_FEATURE_PAC_DEFAULT defines when those
features have been enabled

This patch is part of a series that adds support for the PACBTI-M extension of
the Armv8.1-M architecture, as detailed here:

https://community.arm.com/arm-community-blogs/b/architectures-and-processors-blog/posts/armv8-1-m-pointer-authentication-and-branch-target-identification-extension

The PACBTI-M specification can be found in the Armv8-M Architecture Reference
Manual:

https://developer.arm.com/documentation/ddi0553/latest

The following people contributed to this patch:

- Victor Campos
- Ties Stuij

Reviewed By: ostannard

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

2 years ago[IR] Assert on getPointerElementType() on opaque pointer (NFC)
Nikita Popov [Wed, 1 Dec 2021 10:33:52 +0000 (11:33 +0100)]
[IR] Assert on getPointerElementType() on opaque pointer (NFC)

Previously this simply crashed.

2 years ago[clang][ARM] PACBTI-M frontend support
Ties Stuij [Wed, 1 Dec 2021 10:22:19 +0000 (10:22 +0000)]
[clang][ARM] PACBTI-M frontend support

Handle branch protection option on the commandline as well as a function
attribute. One patch for both mechanisms, as they use the same underlying
parsing mechanism.

These are recorded in a set of LLVM IR module-level attributes like we do for
AArch64 PAC/BTI (see https://reviews.llvm.org/D85649):

- command-line options are "translated" to module-level LLVM IR
  attributes (metadata).

- functions have PAC/BTI specific attributes iff the
  __attribute__((target("branch-protection=...))) was used in the function
  declaration.

- command-line option -mbranch-protection to armclang targeting Arm,
following this grammar:

branch-protection ::= "-mbranch-protection=" <protection>
protection ::=  "none" | "standard" | "bti" [ "+" <pac-ret-clause> ]
                | <pac-ret-clause> [ "+" "bti"]
pac-ret-clause ::= "pac-ret" [ "+" <pac-ret-option> ]
pac-ret-option ::= "leaf" ["+" "b-key"] | "b-key" ["+" "leaf"]

b-key is simply a placeholder to make it consistent with AArch64's
version. In Arm, however, it triggers a warning informing that b-key is
unsupported and a-key will be selected instead.

- Handle _attribute_((target(("branch-protection=..."))) for AArch32 with the
same grammer as the commandline options.

This patch is part of a series that adds support for the PACBTI-M extension of
the Armv8.1-M architecture, as detailed here:

https://community.arm.com/arm-community-blogs/b/architectures-and-processors-blog/posts/armv8-1-m-pointer-authentication-and-branch-target-identification-extension

The PACBTI-M specification can be found in the Armv8-M Architecture Reference
Manual:

https://developer.arm.com/documentation/ddi0553/latest

The following people contributed to this patch:

- Momchil Velikov
- Victor Campos
- Ties Stuij

Reviewed By: vhscampos

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

2 years ago[ARM] Teach getIntImmCostInst about the cost of saturating fp converts
David Green [Wed, 1 Dec 2021 10:25:52 +0000 (10:25 +0000)]
[ARM] Teach getIntImmCostInst about the cost of saturating fp converts

Given a min(max(fptosi, INT_MIN), INT_MAX) with the correct constants,
we can now generate a fptosi.sat. But in the arm backend, the constant
can be treated as high cost, pulling it out of the basic block in a way
that the DAG combine can no longer see it. This teaches it again that it
is a low cost constant, not worth hoisting out.

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

2 years agoFix clang-format bug when handling conflict markers.
Manuel Klimek [Wed, 1 Dec 2021 10:19:19 +0000 (11:19 +0100)]
Fix clang-format bug when handling conflict markers.

Previously, clang-format would not correctly identify preprocessor
directives directly following a conflict marker, which would result in
violating the formatter's invariants.

The provided test fails in assert mode before this change.

2 years agoRevert "[Sema] check PseudoObject when rebuilding CXXOperatorCallExpr in template...
Jeroen Dobbelaere [Wed, 1 Dec 2021 10:18:30 +0000 (11:18 +0100)]
Revert "[Sema] check PseudoObject when rebuilding CXXOperatorCallExpr in template instantiation"

This reverts commit 0c047a8e13320fb8e9dabbf7a3c6a00fe81198c7.

A number of buildbots started failing. Reverting for now.

2 years ago[BuildLibCalls] Add argmemonly, writeonly, nounwind to memset_chk.
Florian Hahn [Wed, 1 Dec 2021 10:06:20 +0000 (10:06 +0000)]
[BuildLibCalls] Add argmemonly, writeonly, nounwind to memset_chk.

The memset_chk library function should match memset's attributes with
respect of memory effects (argmemonly, writeonly). It also does not
raise exceptions. It may not return, in case it aborts the program.

Reviewed By: efriedma

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

2 years ago[ARM] Fix some identing in ARMAsmPrinter::emitInstruction, NFC
David Green [Wed, 1 Dec 2021 10:08:37 +0000 (10:08 +0000)]
[ARM] Fix some identing in ARMAsmPrinter::emitInstruction, NFC

2 years ago[Sema] check PseudoObject when rebuilding CXXOperatorCallExpr in template instantiation
Jeroen Dobbelaere [Tue, 30 Nov 2021 09:40:33 +0000 (10:40 +0100)]
[Sema] check PseudoObject when rebuilding CXXOperatorCallExpr in template instantiation

The invocation of a unary or binary operator for type-dependent expressions is represented as a CXXOperatorCallExpr. Upon template instantiation, TreeTransform::RebuildCXXOperatorCallExpr checks for the case of an overloaded operator, but not for a (non-ObjC) PseudoObject, and will directly create a UnaryOperator or BinaryOperator.

Generalizing commit 0f99537ecac40 from @akyrtzi to handle non-ObjC pseudo objects (and also handle the case of unary pseudo object inc/dec).

This fixes https://bugs.llvm.org/show_bug.cgi?id=51855

Reviewed By: rnk

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

2 years ago[mlir][linalg][bufferize] CallOps do not bufferize to memory writes
Matthias Springer [Wed, 1 Dec 2021 09:45:27 +0000 (18:45 +0900)]
[mlir][linalg][bufferize] CallOps do not bufferize to memory writes

However, since CallOps have no aliasing OpResults, their OpOperands always bufferize out-of-place.

This change removes `bufferizesToMemoryWrite` from `CallOpInterface`. This method was called, but its return value did not matter.

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

2 years ago[OpenMP][IRBuilder] Fix createSections
Shraiysh Vaishay [Wed, 1 Dec 2021 07:52:56 +0000 (13:22 +0530)]
[OpenMP][IRBuilder] Fix createSections

Fix for the case when there are no instructions in the entry basic block before the call
to `createSections`

Reviewed By: Meinersbur

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

2 years ago[LoopUnrollRuntime] Remove unnecessary pointer BECount check (NFC)
Nikita Popov [Wed, 1 Dec 2021 09:32:37 +0000 (10:32 +0100)]
[LoopUnrollRuntime] Remove unnecessary pointer BECount check (NFC)

BECounts are guaranteed to be integers nowadays.

2 years ago[SCEV] Track backedge taken count users (NFCI)
Nikita Popov [Mon, 29 Nov 2021 20:02:37 +0000 (21:02 +0100)]
[SCEV] Track backedge taken count users (NFCI)

Track which SCEVs are used as ExactNotTaken counts in
BackedgeTakenInfo structures, so we can directly determine which
loops need to be invalidated, rather than iterating over all BECounts.

This gives a small compile-time improvement on average, but the
motivation here is more to ensure there are no degenerate cases,
if the number of backedge taken counts is large.

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

2 years agoAdd 'LLVM_DEFAULT_TARGET_TRIPLE' to the documented list of CMake variables
Dylan McKay [Wed, 1 Dec 2021 08:33:31 +0000 (21:33 +1300)]
Add 'LLVM_DEFAULT_TARGET_TRIPLE' to the documented list of CMake variables

I always forget this variable, and the distinction between
'LLVM_TARGET_ARCH', and this variable is only documented on the 'cross
compiling' page, which I never spot and always end up searching through
the codebase for.

This patch adds the variable to the Sphinx CMake documentation so that
it is easily findable in the official LLVM docs.

Reviewed By: probinson

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

2 years ago[mlir] Add a helper for TiledLoopOp to get an operand tied to the bbArg.
Alexander Belyaev [Wed, 1 Dec 2021 08:29:45 +0000 (09:29 +0100)]
[mlir] Add a helper for TiledLoopOp to get an operand tied to the bbArg.

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

2 years ago[DSE] Allow DSE to optimize MemorySSA by default.
Florian Hahn [Wed, 1 Dec 2021 08:29:23 +0000 (08:29 +0000)]
[DSE] Allow DSE to optimize MemorySSA by default.

This allows for better optimization of 'stores-of-existing-values' and
possibly helps passes further down the pipeline.

Reviewed By: asbirlea

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

2 years ago[libc] Add _64 element to aarch64
Guillaume Chatelet [Wed, 1 Dec 2021 08:19:32 +0000 (08:19 +0000)]
[libc] Add _64 element to aarch64

2 years ago[Flang] Replace notifyMatchFailure with TODO hard failures
Kiran Chandramohan [Wed, 1 Dec 2021 08:10:27 +0000 (08:10 +0000)]
[Flang] Replace notifyMatchFailure with TODO hard failures

For unimplemented patterns we revert to using TODO hard failures instead of
notifyMatchFailure.

For fir.select_type revert to using mlir::emiterror.
For the fir.embox TODO on a type with len params we cannot add a test since the type cannot be converted to llvm.

Adding negative tests using not and checking for the error message.
TODO exits with an error in a build without assertion but aborts in a
build with assertions. Abort requires using not with the --crash
option. The two different usages of not is handled by using a custom
command %not_todo_cmd which is converted to not or not --crash
depending on the presence or absence of assertions. Using llvm-config
to check the presence of assertions.

Reviewed By: clementval, awarzynski

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

2 years ago[Coroutines] Make suspend_always in test noexcept (NFC)
Chuanqi Xu [Wed, 1 Dec 2021 08:16:14 +0000 (16:16 +0800)]
[Coroutines] Make suspend_always in test noexcept (NFC)

2 years ago[fir] Add fir reduction builder
Valentin Clement [Wed, 1 Dec 2021 07:59:52 +0000 (08:59 +0100)]
[fir] Add fir reduction builder

This patch introduces a bunch of builder functions
to create function calls to runtime reduction functions.

This patch is part of the upstreaming effort from fir-dev branch.

This patch failed previously because a macro was missing.

Reviewed By: awarzynski

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

Co-authored-by: Jean Perier <jperier@nvidia.com>
Co-authored-by: mleair <leairmark@gmail.com>
2 years ago[NPM] Fix LoopNestPasses in -print-pipeline-passes
Markus Lavin [Wed, 1 Dec 2021 06:39:40 +0000 (07:39 +0100)]
[NPM] Fix LoopNestPasses in -print-pipeline-passes

Fix printing of LoopNestPasses when using the opt pipeline printer
option -print-pipeline-passes.

Reviewed By: aeubanks

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

2 years ago[mlir] Make sure linearizeCollapsedDims doesn't drop input map dims
Thomas Raoux [Wed, 1 Dec 2021 06:51:12 +0000 (22:51 -0800)]
[mlir] Make sure linearizeCollapsedDims doesn't drop input map dims

The new affine map generated by linearizeCollapsedDims should not drop
dimensions. We need to make sure we create a map with at least as many
dimensions as the source map. This prevents
FoldProducerReshapeOpByLinearization from generating invalid IR.

This solves regression in IREE due to https://github.com/llvm/llvm-project/commit/e4e4da86aff5606ef792d987a3ec85639219228c

Reviewed By: mravishankar

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

This reverts commit 9a844c2a9b5c09b4c35d573394a99ab860621581.

2 years agoRevert "[mlir] Make sure linearizeCollapsedDims doesn't drop input map dims"
MaheshRavishankar [Wed, 1 Dec 2021 06:43:46 +0000 (22:43 -0800)]
Revert "[mlir] Make sure linearizeCollapsedDims doesn't drop input map dims"

This reverts commit bc38673e4de50b995f4bc46d1a4b0ad95bef2356.

2 years ago[mlir] Make sure linearizeCollapsedDims doesn't drop input map dims
MaheshRavishankar [Wed, 1 Dec 2021 06:37:24 +0000 (22:37 -0800)]
[mlir] Make sure linearizeCollapsedDims doesn't drop input map dims

The new affine map generated by linearizeCollapsedDims should not drop
dimensions. We need to make sure we create a map with at least as many
dimensions as the source map. This prevents
FoldProducerReshapeOpByLinearization from generating invalid IR.

This solves regression in IREE due to https://github.com/llvm/llvm-project/commit/e4e4da86aff5606ef792d987a3ec85639219228c

Reviewed By: mravishankar

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

2 years ago[clang-offload-bundler] Reuse original file extension for device archive member
Sergey Dmitriev [Wed, 1 Dec 2021 04:23:00 +0000 (20:23 -0800)]
[clang-offload-bundler] Reuse original file extension for device archive member

This patch changes clang-offload-bundler to use the original file extension for
the device archive member when unbundling archives instead of printing a warning
and defaulting to ".o".

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

2 years ago[Legalizer] Avoid expansion to BR_CC if illegal
Qiu Chaofan [Wed, 1 Dec 2021 04:22:21 +0000 (12:22 +0800)]
[Legalizer] Avoid expansion to BR_CC if illegal

Reviewed By: craig.topper

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

2 years ago[sanitizer] Add delta compression stack depot
Vitaly Buka [Mon, 22 Nov 2021 05:54:08 +0000 (21:54 -0800)]
[sanitizer] Add delta compression stack depot

Compress by factor 4x, takes about 10ms per 8 MiB block.

Depends on D114498.

Reviewed By: morehouse

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

2 years ago[memprof] Align each rawprofile section to 8b.
Snehasish Kumar [Tue, 30 Nov 2021 23:56:17 +0000 (15:56 -0800)]
[memprof] Align each rawprofile section to 8b.

The first 8b of each raw profile section need to be aligned to 8b since
the first item in each section is a u64 count of the number of items in
the section.
Summary of changes:
* Assert alignment when reading counts.
* Update test to check alignment, relax some size checks to allow padding.
* Update raw binary inputs for llvm-profdata tests.

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

2 years ago[lldb] Temporarily skip TestTsanBasic on Darwin
Jonas Devlieghere [Wed, 1 Dec 2021 04:11:12 +0000 (20:11 -0800)]
[lldb] Temporarily skip TestTsanBasic on Darwin

See ongoing discussion in https://reviews.llvm.org/D112603.

2 years ago[X86] Pre-commit tests to show the problem of SQRT when `RefinementSteps` = 0. NFC
Phoebe Wang [Wed, 1 Dec 2021 03:51:43 +0000 (11:51 +0800)]
[X86] Pre-commit tests to show the problem of SQRT when `RefinementSteps` = 0. NFC

2 years ago[mlir] Update accessors prefixed form (NFC)
Jacques Pienaar [Wed, 1 Dec 2021 03:42:37 +0000 (19:42 -0800)]
[mlir] Update accessors prefixed form (NFC)

2 years ago[sanitizer] Add compress_stack_depot flag
Vitaly Buka [Wed, 24 Nov 2021 00:31:26 +0000 (16:31 -0800)]
[sanitizer] Add compress_stack_depot flag

Depends on D114494.

Reviewed By: morehouse

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

2 years ago[RISCV] Teach RISCVTargetLowering::shouldSinkOperands to handle udiv/sdiv/urem/srem.
Craig Topper [Wed, 1 Dec 2021 02:40:57 +0000 (18:40 -0800)]
[RISCV] Teach RISCVTargetLowering::shouldSinkOperands to handle udiv/sdiv/urem/srem.

The V extension supports .vx instructions for integer division and
remainder so we should sink splats for that operand.

2 years ago[libcxx][doc] Document recent spaceship projects progress
Kent Ross [Wed, 1 Dec 2021 02:46:37 +0000 (18:46 -0800)]
[libcxx][doc] Document recent spaceship projects progress

Update a couple authors, differentials, and completed projects for operator<=> implementation

Reviewed By: #libc, Mordante, Quuxplusone, ldionne

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

2 years agoAdd toggling for -fnew-infallible/-fno-new-infallible
modimo [Wed, 1 Dec 2021 01:18:58 +0000 (17:18 -0800)]
Add toggling for -fnew-infallible/-fno-new-infallible

Allow toggling of -fnew-infallible so last instance takes precedence

Testing:
ninja check-all

Reviewed By: bruno

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

2 years ago[test] Avoid dumping .o in source tree (expand-pseudos.ll)
Mircea Trofin [Wed, 1 Dec 2021 00:55:40 +0000 (16:55 -0800)]
[test] Avoid dumping .o in source tree (expand-pseudos.ll)

Piping the input to llc avoids that (i.e. llc .... < %s vs llc ... %s)

2 years ago[NFC][sanitizer] Add entry point for compression
Vitaly Buka [Wed, 24 Nov 2021 00:28:26 +0000 (16:28 -0800)]
[NFC][sanitizer] Add entry point for compression

Add Compression::Test type which just pretends packing,
but does nothing useful. It's only called from test for now.

Depends on D114493.

Reviewed By: kstoimenov

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

2 years ago[mlir][sparse] added sparse out element wise mult integration test
Aart Bik [Tue, 30 Nov 2021 22:28:58 +0000 (14:28 -0800)]
[mlir][sparse] added sparse out element wise mult integration test

Reviewed By: bixia

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

2 years ago[llvm-profgen] Truncate the context with zero probe ID
wlei [Fri, 19 Nov 2021 21:57:05 +0000 (13:57 -0800)]
[llvm-profgen] Truncate the context with zero probe ID

Due to the debug info merging, there may have some contexts with zero probe id, we should truncate the context to avoid misleading pre-inliner.

Reviewed By: hoy, wenlei

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

2 years ago[ObjectYAML/obj2yaml/yaml2obj][MachO] Support indirect symbol table
Vincent Lee [Tue, 23 Nov 2021 03:56:56 +0000 (19:56 -0800)]
[ObjectYAML/obj2yaml/yaml2obj][MachO] Support indirect symbol table

Tools such as `llvm-objdump` or `llvm-readobj` support indirect symbol
tables. Here, support it for `obj2yaml` and `yaml2obj`.

Reviewed By: jhenderson, drodriguez

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

2 years ago[FS-AFDO][llvm-profgen] Generate profile with FS-AFDO discriminator
wlei [Thu, 4 Nov 2021 07:08:37 +0000 (00:08 -0700)]
[FS-AFDO][llvm-profgen] Generate profile with FS-AFDO discriminator

In order to support generating profile  with FS discriminator, three kind of changes are done in llvm-profgen:

1) Dissassemble .rodata section to check if FS discriminator var ('"__llvm_fs_discriminator__"') exists and set the corresponding flag in the binary.

2) Change the discriminator decoding in `getBaseDiscriminator` and `getDuplicationFactor`.

3) set true for `FunctionSamples::ProfileIsFS` to enable FS functionality in ProfileData.

Reviewed By: xur, hoy, wenlei

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

2 years ago[runtimes][openmp] Change to not treat ARCH-unknown-linux-gnu as errors
Kazushi (Jam) Marukawa [Sun, 21 Nov 2021 16:01:50 +0000 (01:01 +0900)]
[runtimes][openmp] Change to not treat ARCH-unknown-linux-gnu as errors

When OpenMP is compiled as a part runtimes for multiple targets, openmp
is compiled under build/runtimes/runtimes-arch-unknown-linux-gnu-bins
directory.  Old implementation treats this directory name as errors.
This patch adds a guard like "[Uu]known[^-]".

Reviewed By: jdoerfert

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

2 years ago[mlir][sparse] fix typos in integration tests
Aart Bik [Tue, 30 Nov 2021 22:08:41 +0000 (14:08 -0800)]
[mlir][sparse] fix typos in integration tests

Reviewed By: bixia, wrengr

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

2 years ago[flang] Rearrange prototype & code placement of IsCoarray()
Peter Klausler [Thu, 18 Nov 2021 19:48:42 +0000 (11:48 -0800)]
[flang] Rearrange prototype & code placement of IsCoarray()

A quick fix last week to the shared library build caused
the predicate IsCoarray(const Symbol &) to be moved from
Semantics to Evaluate.  This patch completes that move in
a way that properly combines the existing IsCoarray() tests
for expressions and other object with the test for a symbol.

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

2 years agoRevert "[MLIR] Update Vector To LLVM conversion to be aware of assume_alignment"
Stephen Neuendorffer [Tue, 30 Nov 2021 22:37:30 +0000 (14:37 -0800)]
Revert "[MLIR] Update Vector To LLVM conversion to be aware of assume_alignment"

This reverts commit 29a50c5864ddab283c1ff38694fb5926ce37b39a.

After LLVM lowering, the original patch incorrectly moved alignment
information across an unconstrained GEP operation.  This is only correct
for some index offsets in the GEP.  It seems that the best approach is,
in fact, to rely on LLVM to propagate information from the llvm.assume()
to users.

Thanks to Thomas Raoux for catching this.

2 years ago[Clang] Add option to disable -mconstructor-aliases with -mno-constructor-aliases
modimo [Tue, 30 Nov 2021 23:11:57 +0000 (15:11 -0800)]
[Clang] Add option to disable -mconstructor-aliases with -mno-constructor-aliases

We've found that when profiling, counts are only generated for the real definition of constructor aliases (C2 in mangled name). However, when compiling the C1 version is present at the callsite and leads to a lack of counts due to this aliasing. This causes us to miss out on inlining an otherwise hot constructor.

-mconstructor-aliases is AFAICT an optimization, so having a disabling flag if wanted seems valuable.

Testing:
ninja check-all

Reviewed By: wenlei

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

2 years ago[NFC][regalloc] Factor accesses to ExtraRegInfo
Mircea Trofin [Tue, 30 Nov 2021 01:18:29 +0000 (17:18 -0800)]
[NFC][regalloc] Factor accesses to ExtraRegInfo

We'll move ExtraRegInfo to the RegAllocEvictionAdvisor subsequently.
This change prepares for that by factoring all accesses.

RFC: https://lists.llvm.org/pipermail/llvm-dev/2021-November/153639.html

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

2 years agoBig-endian version of vpermxor
Tarique Islam [Tue, 30 Nov 2021 22:41:55 +0000 (22:41 +0000)]
Big-endian version of vpermxor

A big-endian version of vpermxor, named vpermxor_be, is added to LLVM
and Clang. vpermxor_be can be called directly on both the little-endian
and the big-endian platforms.

Reviewed By: nemanjai

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

2 years ago[TSan][Darwin] Avoid crashes due to interpreting non-zero shadow content as a pointer
Julian Lettner [Tue, 30 Nov 2021 20:12:14 +0000 (12:12 -0800)]
[TSan][Darwin] Avoid crashes due to interpreting non-zero shadow content as a pointer

We would like to use TLS to store the ThreadState object (or at least a
reference ot it), but on Darwin accessing TLS via __thread or manually
by using pthread_key_* is problematic, because there are several places
where interceptors are called when TLS is not accessible (early process
startup, thread cleanup, ...).

Previously, we used a "poor man's TLS" implementation, where we use the
shadow memory of the pointer returned by pthread_self() to store a
pointer to the ThreadState object.

The problem with that was that certain operations can populate shadow
bytes unbeknownst to TSan, and we later interpret these non-zero bytes
as the pointer to our ThreadState object and crash on when dereferencing
the pointer.

This patch changes the storage location of our reference to the
ThreadState object to "real" TLS.  We make this work by artificially
keeping this reference alive in the pthread_key destructor by resetting
the key value with pthread_setspecific().

This change also fixes the issue were the ThreadState object is
re-allocated after DestroyThreadState() because intercepted functions
can still get called on the terminating thread after the
THREAD_TERMINATE event.

Radar-Id: rdar://problem/72010355

Reviewed By: dvyukov

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

2 years ago[OpenMP][libomp][doc] Add environment variables documentation
Jonathan Peyton [Fri, 19 Nov 2021 22:22:21 +0000 (16:22 -0600)]
[OpenMP][libomp][doc] Add environment variables documentation

Add documentation for the environment variables for libomp

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

2 years ago[flang] Define & implement a lowering support API IsContiguous() in runtime
Peter Klausler [Fri, 26 Nov 2021 19:39:31 +0000 (11:39 -0800)]
[flang] Define & implement a lowering support API IsContiguous() in runtime

Create a new flang/runtime/support.cpp module to hold miscellaneous
runtime APIs to support lowering, and define an API IsContiguous() to
wrap the member function predicate Descriptor::IsContiguous().
And do a little clean-up of other API headers that don't need to expose
Runtime/descriptor.h.

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