SuccessChanges

Summary

  1. [OpenMP] Take elf_common.c as a interface library (details)
  2. [RISCV] Add scalable vector vselect ISel patterns (details)
  3. clang: Always pass PowerPC endian information to GNU as (details)
  4. Update syntax for tensor and memref types to match parser. (details)
  5. [RISCV] Use vmv.v.i vd, 0 instead of vmv.v.x vd, x0 for llvm.riscv.vfmv.v.f with 0.0 (details)
  6. [SimplifyCFG] SwitchToLookupTable(): don't insert a DomTree edge that already exists (details)
  7. [SimplifyCFG] SimplifyBranchOnICmpChain(): don't insert a DomTree edge that already exists (details)
  8. [SimplifyCFG] FoldValueComparisonIntoPredecessors(): don't insert a DomTree edge if it already exists (details)
  9. [NFCI][Utils/Local] removeUnreachableBlocks(): cleanup support for lazy DomTreeUpdater (details)
  10. [SimplifyCFGPass] mergeEmptyReturnBlocks(): skip blocks scheduled for removal as per DomTreeUpdater (details)
  11. [SimplifyCFGPass] iterativelySimplifyCFG(): support lazy DomTreeUpdater (details)
  12. ADT: Fix pointer comparison UB in SmallVector (details)
Commit a81c68ae6be58efa24e2573e155d5ef20260399b by tianshilei1992
[OpenMP] Take elf_common.c as a interface library

For now `elf_common.c` is taken as a common part included into
different plugin implementations directly via
`#include "../../common/elf_common.c"`, which is not a best practice. Since it
is simple enough such that we don't need to create a real library for it, we just
take it as a interface library so that other targets can link it directly. Another
advantage of this method is, we don't need to add the folder into header search
path which can potentially pollute the search path.

VE and AMD platforms have not been tested because I don't have target machines.

Reviewed By: JonChesterfield

Differential Revision: https://reviews.llvm.org/D94443
The file was modifiedopenmp/libomptarget/plugins/amdgpu/src/rtl.cpp
The file was modifiedopenmp/libomptarget/plugins/generic-elf-64bit/src/rtl.cpp
The file was modifiedopenmp/libomptarget/plugins/CMakeLists.txt
The file was modifiedopenmp/libomptarget/plugins/ve/src/rtl.cpp
The file was addedopenmp/libomptarget/plugins/common/elf_common/elf_common.h
The file was modifiedopenmp/libomptarget/plugins/cuda/CMakeLists.txt
The file was modifiedopenmp/libomptarget/plugins/ve/CMakeLists.txt
The file was addedopenmp/libomptarget/plugins/common/elf_common/CMakeLists.txt
The file was modifiedopenmp/libomptarget/plugins/cuda/src/rtl.cpp
The file was modifiedopenmp/libomptarget/plugins/amdgpu/CMakeLists.txt
The file was addedopenmp/libomptarget/plugins/common/CMakeLists.txt
The file was removedopenmp/libomptarget/plugins/common/elf_common.c
Commit 9ecc991c559663bd4e3e06a18ba708e0e29c891b by fraser
[RISCV] Add scalable vector vselect ISel patterns

Reviewed By: craig.topper

Differential Revision: https://reviews.llvm.org/D94294
The file was addedllvm/test/CodeGen/RISCV/rvv/vselect-int-rv64.ll
The file was addedllvm/test/CodeGen/RISCV/rvv/vselect-fp-rv32.ll
The file was modifiedllvm/lib/Target/RISCV/RISCVInstrInfoVSDPatterns.td
The file was addedllvm/test/CodeGen/RISCV/rvv/vselect-int-rv32.ll
The file was addedllvm/test/CodeGen/RISCV/rvv/vselect-fp-rv64.ll
Commit 0a23fbd28c7509f2f980946091e6055bf27164d2 by ndesaulniers
clang: Always pass PowerPC endian information to GNU as

When building a 64-bit big endian PowerPC Linux kernel with a 64-bit
little endian PowerPC target, the 32-bit vDSO errors:

```
$ make ARCH=powerpc CC=clang CROSS_COMPILE=powerpc64le-linux-gnu- \
       pseries_defconfig arch/powerpc/kernel/vdso32/
ld.lld: error: arch/powerpc/kernel/vdso32/sigtramp.o is incompatible with elf32-powerpc
ld.lld: error: arch/powerpc/kernel/vdso32/gettimeofday.o is incompatible with elf32-powerpc
ld.lld: error: arch/powerpc/kernel/vdso32/datapage.o is incompatible with elf32-powerpc
ld.lld: error: arch/powerpc/kernel/vdso32/cacheflush.o is incompatible with elf32-powerpc
ld.lld: error: arch/powerpc/kernel/vdso32/note.o is incompatible with elf32-powerpc
ld.lld: error: arch/powerpc/kernel/vdso32/getcpu.o is incompatible with elf32-powerpc
ld.lld: error: arch/powerpc/kernel/vdso32/vgettimeofday.o is incompatible with elf32-powerpc
...
```

This happens because the endian information is missing from the call to
the assembler, even though it was explicitly passed to clang. See the
below example.

```
$ echo | clang --target=powerpc64le-linux-gnu \
               --prefix=/usr/bin/powerpc64le-linux-gnu- \
               -no-integrated-as -m32 -mbig-endian -### -x c -c -
".../clang-12" "-cc1" "-triple" "powerpc-unknown-linux-gnu" ...
...
  "/usr/bin/powerpc64le-linux-gnu-as" "-a32" "-mppc" "-many" "-o" "-.o" "/tmp/--e69e28.s"
```

clang sets the right target with -m32 and -mbig-endian but -mbig-endian
does not make it to the assembler, resulting in a 32-bit little endian
binary. This differs from the little endian targets, which always pass
-mlittle-endian.

```
$ echo | clang --target=powerpc64-linux-gnu \
               --prefix=/usr/bin/powerpc64-linux-gnu- \
               -no-integrated-as -m32 -mlittle-endian -### -x c -c -
".../clang-12" "-cc1" "-triple" "powerpcle-unknown-linux-gnu" ...
...
"/usr/bin/powerpc64-linux-gnu-as" "-a32" "-mppc" "-mlittle-endian" "-many" "-o" "-.o" "/tmp/--405dbd.s"
```

Do the same thing for the big endian targets so that there is no more
error. This matches GCC's behavior, where -mbig and -mlittle are always
passed along to GNU as.

```
$ echo | powerpc64-linux-gcc -### -x c -c -
...
.../powerpc64-linux/bin/as -a64 -mpower4 -many -mbig -o -.o /tmp/ccVn7NAm.s
...

$ echo | powerpc64le-linux-gcc -### -x c -c -
...
.../powerpc64le-linux/bin/as -a64 -mpower8 -many -mlittle -o -.o /tmp/ccPN9ato.s
...
```

Reviewed By: nickdesaulniers, MaskRay

Differential Revision: https://reviews.llvm.org/D94442
The file was modifiedclang/test/Driver/ppc-features.cpp
The file was modifiedclang/lib/Driver/ToolChains/Gnu.cpp
Commit 762ffc95550c32606e771b630fcab2e521873419 by joker.eph
Update syntax for tensor and memref types to match parser.

Based on the comments in lib/Parser/TypeParser.cpp on the
parseMemRefType and parseTensorType functions.

Reviewed By: mehdi_amini

Differential Revision: https://reviews.llvm.org/D94262
The file was modifiedmlir/lib/Parser/TypeParser.cpp
The file was modifiedmlir/docs/LangRef.md
Commit 278a3ea1b27089dbc7060e02f612c8a3bf137bb2 by craig.topper
[RISCV] Use vmv.v.i vd, 0 instead of vmv.v.x vd, x0 for llvm.riscv.vfmv.v.f with 0.0

This matches what we use for integer 0. It's also consistent with
the scalar 'mv' pseudo that uses addi rather than add with x0.
The file was modifiedllvm/test/CodeGen/RISCV/rvv/vfmv.v.f-rv32.ll
The file was modifiedllvm/lib/Target/RISCV/RISCVInstrInfoVPseudos.td
The file was modifiedllvm/test/CodeGen/RISCV/rvv/vfmv.v.f-rv64.ll
Commit c22bc5f1f8b295674aa3a62dced8a39ad3d2aa02 by lebedev.ri
[SimplifyCFG] SwitchToLookupTable(): don't insert a DomTree edge that already exists

SI is the terminator of BB, so the edge we are adding obviously already existed.

Indeed, this change does not have a test coverage change.
This failure has been exposed in an existing test coverage
by a follow-up patch that switches to lazy domtreeupdater mode,
and removes domtree verification from
SimplifyCFGOpt::simplifyOnce()/SimplifyCFGOpt::run(),
IOW it does not appear feasible to add dedicated test coverage here.
The file was modifiedllvm/lib/Transforms/Utils/SimplifyCFG.cpp
Commit c0de0a1b72c08783141c430b583e04e5107ebc0a by lebedev.ri
[SimplifyCFG] SimplifyBranchOnICmpChain(): don't insert a DomTree edge that already exists

BB was already always branching to EdgeBB, there is no edge to add.

Indeed, this change does not have a test coverage change.
This failure has been exposed in an existing test coverage
by a follow-up patch that switches to lazy domtreeupdater mode,
and removes domtree verification from
SimplifyCFGOpt::simplifyOnce()/SimplifyCFGOpt::run(),
IOW it does not appear feasible to add dedicated test coverage here.
The file was modifiedllvm/lib/Transforms/Utils/SimplifyCFG.cpp
Commit f9ba34770638389ee9b251f6ab801c7411601c77 by lebedev.ri
[SimplifyCFG] FoldValueComparisonIntoPredecessors(): don't insert a DomTree edge if it already exists

When we are adding edges to the terminator and potentially turning it
into a switch (if it wasn't already), it is possible that the
case we're adding will share it's destination with one of the
preexisting cases, in which case there is no domtree edge to add.

Indeed, this change does not have a test coverage change.
This failure has been exposed in an existing test coverage
by a follow-up patch that switches to lazy domtreeupdater mode,
and removes domtree verification from
SimplifyCFGOpt::simplifyOnce()/SimplifyCFGOpt::run(),
IOW it does not appear feasible to add dedicated test coverage here.
The file was modifiedllvm/lib/Transforms/Utils/SimplifyCFG.cpp
Commit 90a92f8b4d783cb08443a22f0dd2fa3adcb43807 by lebedev.ri
[NFCI][Utils/Local] removeUnreachableBlocks(): cleanup support for lazy DomTreeUpdater

When DomTreeUpdater is in lazy update mode, the blocks
that were scheduled to be removed, won't be removed
until the updates are flushed, e.g. by asking
DomTreeUpdater for a up-to-date DomTree.

From the function's current code, it is pretty evident
that the support for the lazy mode is an afterthought,
see e.g. how we roll-back NumRemoved statistic..

So instead of considering all the unreachable blocks
as the blocks-to-be-removed, simply additionally skip
all the blocks that are already scheduled to be removed
The file was modifiedllvm/lib/Transforms/Utils/Local.cpp
Commit 81afeacd379f160495718438d6dd5e9b848a169d by lebedev.ri
[SimplifyCFGPass] mergeEmptyReturnBlocks(): skip blocks scheduled for removal as per DomTreeUpdater

Thus supporting lazy DomTreeUpdater mode,
where the domtree updates (and thus block removals)
aren't applied immediately, but are delayed
until last possible moment.
The file was modifiedllvm/lib/Transforms/Scalar/SimplifyCFGPass.cpp
Commit ec8a6c11db4102ec249ce90084b3f615c5de15e5 by lebedev.ri
[SimplifyCFGPass] iterativelySimplifyCFG(): support lazy DomTreeUpdater

This boils down to how we deal with early-increment iterator
over function's basic blocks: not only we need to early-increment,
after that we also need to skip all the blocks
that are scheduled for removal, as per DomTreeUpdater.
The file was modifiedllvm/lib/Transforms/Scalar/SimplifyCFGPass.cpp
Commit 5ccff5aaa68ab789834c4463ce05b05e57593b34 by Duncan P. N. Exon Smith
ADT: Fix pointer comparison UB in SmallVector

The standard requires comparisons of pointers to unrelated storage to
use `std::less`. Split out some helpers that do that and update all the
code that was comparing using `<` and friends (mostly assertions).

Differential Revision: https://reviews.llvm.org/D93777
The file was modifiedllvm/include/llvm/ADT/SmallVector.h