SuccessChanges

Summary

  1. [AMDGPU] Support disassembly for AMDGPU kernel descriptors (details)
  2. [clang-tidy] Fix linking for FrontendOpenMP (details)
  3. Add an option for unrolling loops up to a factor. (details)
  4. LiveRegUnits.h - reduce MachineRegisterInfo.h include. NFC. (details)
  5. [WebAssembly] Fix fixEndsAtEndOfFunction for try-catch (details)
  6. GlobalISel: Combine `op undef, x` to 0 (details)
  7. [ARM] Follow AACPS standard for volatile bit-fields access width (details)
  8. [GVN] Add testcase that uses masked loads and stores, NFC (details)
  9. Add more explicit error message when creating a type or attribute for an unregistered dialect (NFC) (details)
  10. [sanitizers] Remove unneeded MaybeCall*DefaultOptions() and nullptr checks (details)
  11. RISCVMatInt.h - remove unnecessary includes. NFCI. (details)
  12. CFGUpdate.h - remove unused APInt include. NFCI. (details)
  13. Revert "[ARM] Follow AACPS standard for volatile bit-fields access width" (details)
  14. Add detailed reference for the SearchableTables backend. (details)
  15. [X86] SSE4_A should only imply SSE3 not SSSE3 in the frontend. (details)
  16. [Coroutine] Make dealing with alloca spills more robust (details)
  17. [InstCombine] Fold abs of known negative operand (details)
  18. [InstCombine] Test comparison of abs with int min (NFC) (details)
  19. [InstCombine] Fold comparison of abs with int min (details)
  20. Update clang/test/Driver/darwin-infer-simulator-sdkroot.c (details)
  21. [llvm-install-name-tool] Add a test with multiple input files (details)
  22. [LLD][ELF] Fix performance of MarkLive::scanEhFrameSection (details)
  23. [UnifyFunctionExitNodes] Remove unused getters, NFC (details)
  24. Retry of D84974 (details)
Commit 487a80531006add8102d50dbcce4b6fd729ab1f6 by RonakNilesh.Chauhan
[AMDGPU] Support disassembly for AMDGPU kernel descriptors

Decode AMDGPU Kernel descriptors as assembler directives.

Reviewed By: scott.linder, jhenderson, kzhuravl

Differential Revision: https://reviews.llvm.org/D80713
The file was modifiedllvm/tools/llvm-objdump/llvm-objdump.cpp
The file was addedllvm/test/tools/llvm-objdump/ELF/AMDGPU/kd-zeroed-gfx9.s
The file was modifiedllvm/include/llvm/Support/AMDHSAKernelDescriptor.h
The file was addedllvm/test/tools/llvm-objdump/ELF/AMDGPU/kd-sgpr.s
The file was addedllvm/test/tools/llvm-objdump/ELF/AMDGPU/kd-vgpr.s
The file was modifiedllvm/lib/Target/AMDGPU/Disassembler/AMDGPUDisassembler.cpp
The file was modifiedllvm/test/CodeGen/AMDGPU/nop-data.ll
The file was addedllvm/test/tools/llvm-objdump/ELF/AMDGPU/kd-zeroed-raw.s
The file was addedllvm/test/tools/llvm-objdump/ELF/AMDGPU/kd-failure.s
The file was modifiedllvm/lib/Target/AMDGPU/Disassembler/AMDGPUDisassembler.h
The file was addedllvm/test/tools/llvm-objdump/ELF/AMDGPU/kd-zeroed-gfx10.s
Commit 71133e8b5bceaf68a2cee59af371df570a1aed79 by aheejin
[clang-tidy] Fix linking for FrontendOpenMP

Without this, builds with `-DBUILD_SHARED_LIBS=ON` fail.
The file was modifiedclang-tools-extra/clang-tidy/altera/CMakeLists.txt
Commit e2394245eb28695d5eed5d7c015e99141993c723 by Lubomir.Litchev
Add an option for unrolling loops up to a factor.

Currently, there is no option to allow for unrolling a loop up to a specific factor (specified by the user).
The code for doing that is there and there are benefits when unrolling is done  to smaller loops (smaller than the factor specified).

Reviewed By: bondhugula

Differential Revision: https://reviews.llvm.org/D87111
The file was modifiedmlir/test/lib/Transforms/TestLoopUnrolling.cpp
The file was modifiedmlir/include/mlir/Dialect/Affine/Passes.td
The file was modifiedmlir/lib/Dialect/Affine/Transforms/LoopUnroll.cpp
The file was modifiedmlir/lib/Transforms/Utils/LoopUtils.cpp
The file was modifiedmlir/test/Dialect/SCF/loop-unroll.mlir
The file was modifiedmlir/include/mlir/Dialect/Affine/Passes.h
Commit 3c83b967cf223ce6a2e0813e48b64f7689512f20 by llvm-dev
LiveRegUnits.h - reduce MachineRegisterInfo.h include. NFC.

We only need to include MachineInstrBundle.h, but exposes an implicit dependency in MachineOutliner.h.

Also, remove duplicate includes from LiveRegUnits.cpp + MachineOutliner.cpp.
The file was modifiedllvm/lib/CodeGen/MachineOutliner.cpp
The file was modifiedllvm/lib/CodeGen/LiveRegUnits.cpp
The file was modifiedllvm/include/llvm/CodeGen/MachineOutliner.h
The file was modifiedllvm/include/llvm/CodeGen/LiveRegUnits.h
Commit d25c17f3175b344420c1f30040b206a47a512c9d by aheejin
[WebAssembly] Fix fixEndsAtEndOfFunction for try-catch

When the function return type is non-void and `end` instructions are at
the very end of a function, CFGStackify's `fixEndsAtEndOfFunction`
function fixes the corresponding block/loop/try's type to match the
function's return type. This is applied to consecutive `end` markers at
the end of a function. For example, when the function return type is
`i32`,
```
block i32    ;; return type is fixed to i32
  ...
  loop i32   ;; return type is fixed to i32
    ...
  end_loop
end_block
end_function
```

But try-catch is a little different, because it consists of two parts:
a try part and a catch part, and both parts' return type should satisfy
the function's return type. Which means,
```
try i32      ;; return type is fixed to i32
  ...
  block i32  ;; this should be changed i32 too!
    ...
  end_block
catch
  ...
end_try
end_function
```
As you can see in this example, it is not sufficient to only `end`
instructions at the end of a function; in case of `try`, we should
check instructions before `catch`es, in case their corresponding `try`'s
type has been fixed.

This changes `fixEndsAtEndOfFunction`'s algorithm to use a worklist
that contains a reverse iterator, each of which is a starting point for
a new backward `end` instruction search.

Fixes https://bugs.llvm.org/show_bug.cgi?id=47413.

Reviewed By: dschuff, tlively

Differential Revision: https://reviews.llvm.org/D87207
The file was modifiedllvm/lib/Target/WebAssembly/WebAssemblyCFGStackify.cpp
The file was modifiedllvm/test/CodeGen/WebAssembly/cfg-stackify-eh.ll
Commit 1242dd330d9054a57c1403f16d5487f9e3a3a92f by vkeles
GlobalISel: Combine `op undef, x` to 0

https://reviews.llvm.org/D86611
The file was modifiedllvm/include/llvm/CodeGen/GlobalISel/CombinerHelper.h
The file was modifiedllvm/include/llvm/Target/GlobalISel/Combine.td
The file was addedllvm/test/CodeGen/AArch64/GlobalISel/combine-shl.mir
The file was modifiedllvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp
Commit 514df1b2bb1ecd1a33327001ea38a347fd2d0380 by ties.stuij
[ARM] Follow AACPS standard for volatile bit-fields access width

This patch resumes the work of D16586.
According to the AAPCS, volatile bit-fields should
be accessed using containers of the widht of their
declarative type. In such case:
```
struct S1 {
  short a : 1;
}
```
should be accessed using load and stores of the width
(sizeof(short)), where now the compiler does only load
the minimum required width (char in this case).
However, as discussed in D16586,
that could overwrite non-volatile bit-fields, which
conflicted with C and C++ object models by creating
data race conditions that are not part of the bit-field,
e.g.
```
struct S2 {
  short a;
  int  b : 16;
}
```
Accessing `S2.b` would also access `S2.a`.

The AAPCS Release 2020Q2
(https://documentation-service.arm.com/static/5efb7fbedbdee951c1ccf186?token=)
section 8.1 Data Types, page 36, "Volatile bit-fields -
preserving number and width of container accesses" has been
updated to avoid conflict with the C++ Memory Model.
Now it reads in the note:
```
This ABI does not place any restrictions on the access widths of bit-fields where the container
overlaps with a non-bit-field member or where the container overlaps with any zero length bit-field
placed between two other bit-fields. This is because the C/C++ memory model defines these as being
separate memory locations, which can be accessed by two threads simultaneously. For this reason,
compilers must be permitted to use a narrower memory access width (including splitting the access into
multiple instructions) to avoid writing to a different memory location. For example, in
struct S { int a:24; char b; }; a write to a must not also write to the location occupied by b, this requires at least two
memory accesses in all current Arm architectures. In the same way, in struct S { int a:24; int:0; int b:8; };,
writes to a or b must not overwrite each other.
```

Patch D16586 was updated to follow such behavior by verifying that we
only change volatile bit-field access when:
- it won't overlap with any other non-bit-field member
- we only access memory inside the bounds of the record
- avoid overlapping zero-length bit-fields.

Regarding the number of memory accesses, that should be preserved, that will
be implemented by D67399.

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

The following people contributed to this patch:
- Diogo Sampaio
- Ties Stuij
The file was modifiedclang/lib/CodeGen/CGRecordLayoutBuilder.cpp
The file was modifiedclang/lib/Frontend/CompilerInvocation.cpp
The file was modifiedclang/test/CodeGen/aapcs-bitfield.c
The file was modifiedclang/include/clang/Driver/Options.td
The file was modifiedclang/lib/CodeGen/CGExpr.cpp
The file was modifiedclang/test/CodeGen/bitfield-2.c
The file was modifiedclang/include/clang/Basic/CodeGenOptions.def
The file was modifiedclang/lib/CodeGen/CGRecordLayout.h
Commit d0ccfcb040c684e91d8b5fe5111ba7f4ec7e019a by kparzysz
[GVN] Add testcase that uses masked loads and stores, NFC
The file was addedllvm/test/Transforms/GVN/masked-load-store.ll
Commit 97e77ac0ed80877cda58b1dddf98890cc7b0d167 by joker.eph
Add more explicit error message when creating a type or attribute for an unregistered dialect (NFC)

Differential Revision: https://reviews.llvm.org/D87177
The file was modifiedmlir/include/mlir/IR/AttributeSupport.h
The file was modifiedmlir/include/mlir/IR/TypeSupport.h
The file was modifiedmlir/lib/Support/StorageUniquer.cpp
The file was modifiedmlir/include/mlir/Support/StorageUniquer.h
Commit 2d7fd38cf7db18edbbfa0e6dfb7454a255171867 by i
[sanitizers] Remove unneeded MaybeCall*DefaultOptions() and nullptr checks

D28596 added SANITIZER_INTERFACE_WEAK_DEF which can guarantee `*_default_options` are always defined.
The weak attributes on the `__{asan,lsan,msan,ubsan}_default_options` declarations can thus be removed.

`MaybeCall*DefaultOptions` no longer need nullptr checks, so their call sites can just be replaced by `__*_default_options`.

Reviewed By: #sanitizers, vitalybuka

Differential Revision: https://reviews.llvm.org/D87175
The file was modifiedcompiler-rt/lib/ubsan/ubsan_flags.cpp
The file was modifiedcompiler-rt/lib/tsan/rtl/tsan_flags.cpp
The file was modifiedcompiler-rt/lib/asan/asan_flags.cpp
The file was modifiedcompiler-rt/lib/msan/msan_interface_internal.h
The file was modifiedcompiler-rt/lib/lsan/lsan_common.cpp
The file was modifiedcompiler-rt/lib/asan/asan_interface_internal.h
The file was modifiedcompiler-rt/lib/hwasan/hwasan.cpp
The file was modifiedcompiler-rt/lib/cfi/cfi.cpp
The file was modifiedcompiler-rt/lib/msan/msan.cpp
The file was modifiedcompiler-rt/lib/ubsan/ubsan_flags.h
The file was modifiedcompiler-rt/lib/lsan/lsan.cpp
Commit 0dacf3b5ac3a8c4079b781c788f758709345883f by llvm-dev
RISCVMatInt.h - remove unnecessary includes. NFCI.

Add APInt forward declaration and move include to RISCVMatInt.cpp
The file was modifiedllvm/lib/Target/RISCV/Utils/RISCVMatInt.h
The file was modifiedllvm/lib/Target/RISCV/Utils/RISCVMatInt.cpp
Commit cd5c5c484830e65854cc12cb64a0feb0a9060734 by llvm-dev
CFGUpdate.h - remove unused APInt include. NFCI.
The file was modifiedllvm/include/llvm/Support/CFGUpdate.h
Commit d6f3f612318f31c46b95dd62eee45a75397ccfcf by ties.stuij
Revert "[ARM] Follow AACPS standard for volatile bit-fields access width"

This reverts commit 514df1b2bb1ecd1a33327001ea38a347fd2d0380.

Some of the buildbots got llvm-lit errors on CodeGen/volatile.c
The file was modifiedclang/lib/CodeGen/CGExpr.cpp
The file was modifiedclang/test/CodeGen/aapcs-bitfield.c
The file was modifiedclang/test/CodeGen/bitfield-2.c
The file was modifiedclang/include/clang/Driver/Options.td
The file was modifiedclang/lib/CodeGen/CGRecordLayoutBuilder.cpp
The file was modifiedclang/lib/Frontend/CompilerInvocation.cpp
The file was modifiedclang/include/clang/Basic/CodeGenOptions.def
The file was modifiedclang/lib/CodeGen/CGRecordLayout.h
Commit 1f870bd9284ad55dff96ab6f99afd92fd5f294be by paul
Add detailed reference for the SearchableTables backend.
The file was modifiedllvm/docs/TableGen/BackEnds.rst
Commit e6bb4c8e7b3e27f214c9665763a2dd09aa96a5ac by craig.topper
[X86] SSE4_A should only imply SSE3 not SSSE3 in the frontend.

SSE4_1 and SSE4_2 due imply SSSE3. So I guess I got confused when
switching the code to being table based in D83273.

Fixes PR47464
The file was modifiedclang/test/Preprocessor/predefined-arch-macros.c
The file was modifiedllvm/lib/Support/X86TargetParser.cpp
Commit 59a467ee4faeee5b569960e53a76a0311d050d18 by xun
[Coroutine] Make dealing with alloca spills more robust

D66230 attempted to fix a problem where when there are allocas used before CoroBegin.
It keeps allocas and their uses stay in put if there are no escapse/changes to the data before CoroBegin.
Unfortunately that's incorrect.
Consider this code:

%var = alloca i32
%1 = getelementptr .. %var; stays put
%f = call i8* @llvm.coro.begin
store ... %1
After this fix, %1 will now stay put, however if a store happens after coro.begin and hence modifies the content, this change will not be reflected in the coroutine frame (and will eventually be DCEed).
To generalize the problem, if any alias ptr is created before coro.begin for an Alloca and that alias ptr is latter written into after coro.begin, it will lead to incorrect behavior.

There are also a few other minor issues, such as incorrect dominate condition check in the ptr visitor, unhandled memory intrinsics and etc.
Ths patch attempts to fix some of these issue, and make it more robust to deal with aliases.

While visiting through the alloca pointer, we also keep track of all aliases created that will be used after CoroBegin. We track the offset of each alias, and then reacreate these aliases after CoroBegin using these offset.
It's worth noting that this is not perfect and there will still be cases we cannot handle. I think it's impractical to handle all cases given the current design.
This patch makes it more robust and should be a pure win.
In the meantime, we need to think about what how to completely elimiante these issues, likely through the route as @rjmccall mentioned in D66230.

Differential Revision: https://reviews.llvm.org/D86859
The file was modifiedllvm/test/Transforms/Coroutines/coro-param-copy.ll
The file was modifiedllvm/lib/Transforms/Coroutines/CoroFrame.cpp
Commit e97f3b1b4327f9db0ca12cdd7157c304ad206802 by nikita.ppv
[InstCombine] Fold abs of known negative operand

If we know that the abs operand is known negative, we can replace
it with a neg.

To avoid computing known bits twice, I've removed the fold for the
non-negative case from InstSimplify. Both the non-negative and the
negative case are handled by InstCombine now, with one known bits call.

Differential Revision: https://reviews.llvm.org/D87196
The file was modifiedllvm/test/Transforms/InstCombine/abs-intrinsic.ll
The file was modifiedllvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
The file was modifiedllvm/test/Transforms/InstSimplify/abs_intrinsic.ll
The file was modifiedllvm/lib/Analysis/InstructionSimplify.cpp
Commit 6eef387ddd863db1afe044e208bbff4366d5dac2 by nikita.ppv
[InstCombine] Test comparison of abs with int min (NFC)
The file was modifiedllvm/test/Transforms/InstCombine/abs-intrinsic.ll
Commit f6b87da0c73fcf7f8f051151ce62d2e07a466a8e by nikita.ppv
[InstCombine] Fold comparison of abs with int min

If the abs is poisoning, this is already folded to true/false.
For non-poisoning abs, we can convert this to a comparison with
the operand.
The file was modifiedllvm/test/Transforms/InstCombine/abs-intrinsic.ll
The file was modifiedllvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
Commit d95ef009bd502a1c2c82952d4fa6fd1db836cef9 by Azharuddin Mohammed
Update clang/test/Driver/darwin-infer-simulator-sdkroot.c

- Fix it to work on Apple Silicon
- Add testcases for simulators running on Apple Silicon
The file was modifiedclang/test/Driver/darwin-infer-simulator-sdkroot.c
Commit ce49b7d9ca01f4abbba1e5a00339d539b0ea563e by alexshap
[llvm-install-name-tool] Add a test with multiple input files

This diff adds a test which checks the error-message when multiple input files
are passed to llvm-install-name-tool.

Test plan: make check-all

Differential revision: https://reviews.llvm.org/D87268
The file was modifiedllvm/test/tools/llvm-objcopy/tool-help-message.test
Commit 863aa0a37bd1a57b0720eda6d646f9abd51bf6c2 by andrew.ng
[LLD][ELF] Fix performance of MarkLive::scanEhFrameSection

MarkLive::scanEhFrameSection is used to retain personality/LSDA
functions when --gc-sections is enabled.

Improve its performance by only iterating over the .eh_frame relocations
that need to be resolved for an EhSectionPiece. This optimization makes
the same assumption as elsewhere in LLD that the .eh_frame relocations
are sorted by r_offset.

This appears to be a performance regression introduced in commit
e6c24299d237 (https://reviews.llvm.org/D59800).

This change has been seen to reduce link time by up to ~50%.

Differential Revision: https://reviews.llvm.org/D87245
The file was modifiedlld/ELF/MarkLive.cpp
Commit 17dce2fe43c9d3335d64936ece576b0e36d8fe31 by david.stenberg
[UnifyFunctionExitNodes] Remove unused getters, NFC

The get{Return,Unwind,Unreachable}Block functions in
UnifyFunctionExitNodes have not been used for many years,
so just remove them.

Reviewed By: bjope

Differential Revision: https://reviews.llvm.org/D87078
The file was modifiedllvm/include/llvm/Transforms/Utils/UnifyFunctionExitNodes.h
The file was modifiedllvm/lib/Transforms/Utils/UnifyFunctionExitNodes.cpp
Commit 5b2b4f331d78f326e5e29166bec5ad92c864343d by walter erquinigo
Retry of D84974

The test is being disabled on Linux, as lldb-vscode has a bug with
--wait-for on LInux.
I'm also fixing some compilation warnings.
The file was addedlldb/test/API/tools/lldb-vscode/runInTerminal/Makefile
The file was modifiedlldb/tools/lldb-vscode/package.json
The file was modifiedlldb/tools/lldb-vscode/JSONUtils.cpp
The file was modifiedlldb/tools/lldb-vscode/JSONUtils.h
The file was addedlldb/test/API/tools/lldb-vscode/runInTerminal/main.c
The file was modifiedlldb/tools/lldb-vscode/VSCode.h
The file was modifiedlldb/tools/lldb-vscode/lldb-vscode.cpp
The file was modifiedlldb/tools/lldb-vscode/VSCode.cpp
The file was modifiedlldb/packages/Python/lldbsuite/test/tools/lldb-vscode/lldbvscode_testcase.py
The file was addedlldb/test/API/tools/lldb-vscode/runInTerminal/TestVSCode_runInTerminal.py
The file was modifiedlldb/packages/Python/lldbsuite/test/tools/lldb-vscode/vscode.py