Changes

Summary

  1. [ARM] Strengthen fpclamptosat.ll triple to attempt to fix buildbot errors. NFC (details)
  2. [DAG] Apply clang-format to visitMSTORE + visitMLOAD. NFC. (details)
  3. [DAGCombiner] When combining REM ensure optimized div nodes are unique (details)
  4. [LICM] Support opaque pointers in scalar promotion (details)
  5. [X86] Add some basic fptosi/fptoui saturate vector tests (details)
  6. [clang][ARM] removing branch protection error cmdline test (details)
  7. Fixed a memory leak in the PDLToPDLInterp RootOrderingTest. (details)
  8. [LICM] Hoist LOAD without sinking the STORE (details)
  9. Revert "[LICM] Hoist LOAD without sinking the STORE" (details)
  10. [ARM] Implement BTI placement pass for PACBTI-M (details)
  11. [gn build] Port f5f28d5b0ce7 (details)
  12. [Dexter] Add DexDeclareAddress command and address function (details)
  13. [libcxx][test][NFC] Extend get_allocator() testing for containers (details)
  14. Fix a violated precondition in clang-format. (details)
  15. [gn build] (manually) port 94d5f2afbef0 (details)
  16. [clang-cl] Set _MSVC_LANG to 202002L with /std:c++20 (details)
  17. [VE] Make VE official (details)
  18. [Dexter] Fix address_printing test by requiring lldb (details)
  19. [BasicAA] Add strncpy libfunc tests. (details)
  20. [BasicAA] Add memset_chk libfunc tests. (details)
  21. [SLP][NFC]Add a test for inserting into constant undef vector, NFC. (details)
  22. Revert "[Flang] Replace notifyMatchFailure with TODO hard failures" (details)
  23. [LV] Move code from vectorizeMemoryInstruction to recipe's execute(). (details)
  24. Revert "[ARM] Teach getIntImmCostInst about the cost of saturating fp converts" (details)
  25. [mlir][linalg] Disable tensor-matmul test under asan (details)
  26. [Verifier] Make matrix intrinsic verification compatible with opaque pointers (details)
Commit 0e98659ea1193ca55d469101a629b7f6d2ce1d9f by david.green
[ARM] Strengthen fpclamptosat.ll triple to attempt to fix buildbot errors. NFC
The file was modifiedllvm/test/CodeGen/ARM/fpclamptosat.ll
Commit 9981dd142f18f38f5f1744a7d0fd2348ed6411f8 by llvm-dev
[DAG] Apply clang-format to visitMSTORE + visitMLOAD. NFC.

Reduce diff in D114582
The file was modifiedllvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
Commit 0eb1efb92c3078789242d89a1e914d968cf1297f by bradley.smith
[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
The file was modifiedllvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
The file was addedllvm/test/CodeGen/AArch64/sve-srem-combine-loop.ll
Commit 1e1a8be21fce994737bd3b58e705c6bc837d3760 by nikita.ppv
[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.
The file was addedllvm/test/Transforms/LICM/scalar-promote-opaque-ptrs.ll
The file was modifiedllvm/lib/Transforms/Scalar/LICM.cpp
Commit 4f7d397b6dbf39222dff03143af8482901d0a5b8 by llvm-dev
[X86] Add some basic fptosi/fptoui saturate vector tests
The file was addedllvm/test/CodeGen/X86/fptoui-sat-vector-128.ll
The file was addedllvm/test/CodeGen/X86/fptosi-sat-vector-128.ll
Commit 5b4746f94aed5548cd918357299c585a89e3b524 by ties.stuij
[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.
The file was removedclang/test/Frontend/arm-invalid-branch-protection.c
Commit 810b2849181fb2b248b1d5f586cede6618ca7120 by uday
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
The file was modifiedmlir/unittests/Conversion/PDLToPDLInterp/RootOrderingTest.cpp
Commit ecb9d8e4e3c4623c2edcd2c50727103927d31508 by djtodoro
[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
The file was modifiedllvm/test/Transforms/InstMerge/st_sink_bugfix_22613.ll
The file was modifiedllvm/lib/Transforms/Utils/SSAUpdater.cpp
The file was modifiedllvm/test/Transforms/LICM/scalar-promote-memmodel.ll
The file was modifiedllvm/test/Transforms/LICM/promote-capture.ll
The file was addedllvm/test/Transforms/LICM/hoist-load-without-store.ll
The file was modifiedllvm/test/Transforms/LICM/scalar-promote.ll
The file was modifiedllvm/include/llvm/Transforms/Utils/SSAUpdater.h
The file was modifiedllvm/lib/Transforms/Scalar/LICM.cpp
Commit 72f9f066df1707753d1754803f08c64d304de84c by djtodoro
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.
The file was modifiedllvm/lib/Transforms/Utils/SSAUpdater.cpp
The file was modifiedllvm/test/Transforms/LICM/scalar-promote-memmodel.ll
The file was modifiedllvm/include/llvm/Transforms/Utils/SSAUpdater.h
The file was modifiedllvm/test/Transforms/LICM/promote-capture.ll
The file was modifiedllvm/test/Transforms/LICM/scalar-promote.ll
The file was modifiedllvm/test/Transforms/InstMerge/st_sink_bugfix_22613.ll
The file was modifiedllvm/lib/Transforms/Scalar/LICM.cpp
The file was removedllvm/test/Transforms/LICM/hoist-load-without-store.ll
Commit f5f28d5b0ce76af8f6944774aa73bad9e328b020 by ties.stuij
[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
The file was modifiedllvm/lib/Target/ARM/ARM.h
The file was modifiedllvm/lib/Target/ARM/ARMBaseInstrInfo.h
The file was modifiedllvm/lib/Target/ARM/ARMTargetMachine.cpp
The file was addedllvm/test/CodeGen/Thumb2/bti-outliner-1.ll
The file was modifiedllvm/lib/Target/ARM/ARMConstantIslandPass.cpp
The file was modifiedllvm/lib/Target/ARM/CMakeLists.txt
The file was modifiedllvm/lib/CodeGen/TargetInstrInfo.cpp
The file was addedllvm/lib/Target/ARM/ARMBranchTargets.cpp
The file was addedllvm/test/CodeGen/Thumb2/bti-entry-blocks.ll
The file was modifiedllvm/include/llvm/CodeGen/TargetInstrInfo.h
The file was addedllvm/test/CodeGen/Thumb2/bti-outliner-cost-2.ll
The file was modifiedllvm/lib/Target/ARM/ARMBaseInstrInfo.cpp
The file was addedllvm/test/CodeGen/Thumb2/bti-indirect-branches.ll
The file was modifiedllvm/lib/CodeGen/MachineOutliner.cpp
The file was addedllvm/test/CodeGen/Thumb2/bti-const-island.mir
The file was addedllvm/test/CodeGen/Thumb2/bti-outliner-2.ll
The file was addedllvm/test/CodeGen/Thumb2/bti-const-island-multiple-jump-tables.mir
The file was addedllvm/test/CodeGen/Thumb2/bti-jump-table.mir
The file was modifiedllvm/test/CodeGen/ARM/O3-pipeline.ll
The file was addedllvm/test/CodeGen/Thumb2/bti-outliner-cost-1.ll
Commit dee85a4ffaad070000c9672a6ce67e36082e0176 by llvmgnsyncbot
[gn build] Port f5f28d5b0ce7
The file was modifiedllvm/utils/gn/secondary/llvm/lib/Target/ARM/BUILD.gn
Commit 0428d44d4cfafe55fd13679cf16f6b099cbb0e61 by stephen.tozer
[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
The file was modifiedcross-project-tests/debuginfo-tests/dexter/dex/command/commands/DexExpectWatchBase.py
The file was modifiedcross-project-tests/debuginfo-tests/dexter/dex/heuristic/Heuristic.py
The file was addedcross-project-tests/debuginfo-tests/dexter/feature_tests/commands/perfect/dex_declare_address/multiple_address.cpp
The file was addedcross-project-tests/debuginfo-tests/dexter/feature_tests/commands/penalty/missing_dex_address.cpp
The file was modifiedcross-project-tests/debuginfo-tests/dexter/dex/command/ParseCommand.py
The file was modifiedcross-project-tests/debuginfo-tests/dexter/Commands.md
The file was addedcross-project-tests/debuginfo-tests/dexter/feature_tests/commands/perfect/dex_declare_address/address_hit_count.cpp
The file was addedcross-project-tests/debuginfo-tests/dexter/feature_tests/commands/perfect/dex_declare_address/identical_address.cpp
The file was addedcross-project-tests/debuginfo-tests/dexter/feature_tests/subtools/test/address_printing.cpp
The file was addedcross-project-tests/debuginfo-tests/dexter/dex/command/commands/DexDeclareAddress.py
The file was addedcross-project-tests/debuginfo-tests/dexter/feature_tests/commands/perfect/dex_declare_address/expression_address.cpp
The file was addedcross-project-tests/debuginfo-tests/dexter/feature_tests/commands/perfect/dex_declare_address/self_comparison.cpp
The file was addedcross-project-tests/debuginfo-tests/dexter/feature_tests/subtools/test/err_undeclared_addr.cpp
The file was addedcross-project-tests/debuginfo-tests/dexter/feature_tests/commands/perfect/dex_declare_address/address_after_ref.cpp
The file was addedcross-project-tests/debuginfo-tests/dexter/feature_tests/subtools/test/err_duplicate_address.cpp
The file was addedcross-project-tests/debuginfo-tests/dexter/feature_tests/commands/perfect/dex_declare_address/offset_address.cpp
Commit 8d25da78aad91635f78225edd972feb2de7228cd by ruslan.arutyunyan
[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
The file was addedlibcxx/test/std/containers/associative/set/get_allocator.pass.cpp
The file was addedlibcxx/test/std/containers/sequences/vector/get_allocator.pass.cpp
The file was addedlibcxx/test/std/containers/sequences/list/get_allocator.pass.cpp
The file was addedlibcxx/test/std/containers/unord/unord.map/get_allocator.pass.cpp
The file was addedlibcxx/test/std/containers/unord/unord.set/get_allocator.pass.cpp
The file was addedlibcxx/test/std/containers/associative/multimap/get_allocator.pass.cpp
The file was addedlibcxx/test/std/containers/associative/multiset/get_allocator.pass.cpp
The file was addedlibcxx/test/std/containers/associative/map/get_allocator.pass.cpp
The file was addedlibcxx/test/std/containers/unord/unord.multimap/get_allocator.pass.cpp
The file was addedlibcxx/test/std/containers/sequences/deque/get_allocator.pass.cpp
The file was addedlibcxx/test/std/containers/sequences/vector.bool/get_allocator.pass.cpp
The file was addedlibcxx/test/std/containers/unord/unord.multiset/get_allocator.pass.cpp
The file was addedlibcxx/test/std/containers/sequences/forwardlist/get_allocator.pass.cpp
Commit 4dcfae6a003aa541600e5af42c0bec5d8e1abef0 by klimek
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.
The file was modifiedclang/lib/Format/ContinuationIndenter.cpp
The file was modifiedclang/unittests/Format/FormatTestComments.cpp
Commit 9a3b357e2b85bed74449b3c64ec24e1c6184590c by thakis
[gn build] (manually) port 94d5f2afbef0
The file was modifiedllvm/utils/gn/secondary/clang/test/BUILD.gn
Commit 3f643f166494826144bad05eaa3ae14508788df6 by thakis
[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
The file was modifiedclang/test/Preprocessor/predefined-win-macros.c
The file was modifiedclang/lib/Basic/Targets/OSTargets.cpp
Commit a9d1d00b865ab6f6e75dcd649362a7c5cf01d168 by simon.moll
[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
The file was modifiedllvm/CMakeLists.txt
Commit f0eef1d21203ed679f66b887025cb4a0cbbcbdb6 by stephen.tozer
[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.
The file was modifiedcross-project-tests/debuginfo-tests/dexter/feature_tests/subtools/test/address_printing.cpp
Commit c6bd63803f62e4d8b723c692add7d940c72e07dd by flo
[BasicAA] Add strncpy libfunc tests.
The file was modifiedllvm/test/Analysis/BasicAA/libfuncs.ll
Commit 524ad6babb8ef3d3e5fa97aac9f24a2513e17e2b by flo
[BasicAA] Add memset_chk libfunc tests.
The file was modifiedllvm/test/Analysis/BasicAA/libfuncs.ll
Commit e28174cf5648d66b6e6157917167e4de36c65cd3 by a.bataev
[SLP][NFC]Add a test for inserting into constant undef vector, NFC.
The file was addedllvm/test/Transforms/SLPVectorizer/X86/insert-element-build-vector-const-undef.ll
Commit 003c9c7457d08888be5deeca7eee84ab5f110bf6 by kiran.chandramohan
Revert "[Flang] Replace notifyMatchFailure with TODO hard failures"

This reverts commit 46fd7fd7b342039b59ec534bab8b93fa5d34f6e2.
The file was modifiedflang/lib/Optimizer/CodeGen/CodeGen.cpp
The file was removedflang/test/Fir/Todo/gentypedesc.fir
The file was removedflang/test/Fir/Todo/dispatch.fir
The file was removedflang/test/Fir/Todo/emboxproc.fir
The file was removedflang/test/Fir/Todo/unboxproc.fir
The file was modifiedflang/test/lit.cfg.py
The file was removedflang/test/Fir/Todo/select_case_with_character.fir
The file was removedflang/test/Fir/Todo/end.fir
The file was removedflang/test/Fir/Todo/len_param_index.fir
The file was modifiedflang/test/CMakeLists.txt
The file was removedflang/test/Fir/Todo/boxproc_host.fir
The file was removedflang/test/Fir/Todo/dispatch_table.fir
The file was removedflang/test/Fir/Todo/global_len.fir
The file was modifiedflang/test/Fir/convert-to-llvm-invalid.fir
Commit e44298a8f8af4f19662aa17fa7a4b3c90ac11376 by flo
[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
The file was modifiedllvm/lib/Transforms/Vectorize/LoopVectorize.cpp
Commit 13e66c070bdb4edb660b8372791ce52a661ba138 by david.green
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.
The file was modifiedllvm/lib/Target/ARM/ARMTargetTransformInfo.cpp
The file was modifiedllvm/test/CodeGen/ARM/fpclamptosat.ll
Commit 9fce961d2f47579981898ddd23ad804bb1477286 by herhut
[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
The file was modifiedmlir/test/Integration/Dialect/Linalg/CPU/test-tensor-matmul.mlir
Commit 9687c13174147b34d4e04a69665265b8dfe21572 by nikita.ppv
[Verifier] Make matrix intrinsic verification compatible with opaque pointers

Don't check the pointer element type for opaque pointers.
The file was modifiedllvm/lib/IR/Verifier.cpp
The file was addedllvm/test/Verifier/matrix-intrinsics-opaque-ptrs.ll