Changes

Summary

  1. [X86] Tighten up some inline assembly constraint handling. (details)
  2. [mlir][NFC] Cleanup: Move helper functions to StaticValueUtils (details)
  3. llvm-dwarfdump: Print warnings on invalid DWARF (details)
  4. Fix lld testsuite after llvm-dwarfdump now errors on invalid DWARF (details)
  5. [lld/mac] Don't fold UNWIND_X86_64_MODE_STACK_IND unwind entries (details)
  6. [Orc][examples] LLJITWithRemoteDebugger: fix CMake when utils are not built (details)
  7. [Analysis] improve function signature checking for calloc (details)
  8. [InstCombine][test] add tests for min/max intrinsics with select operand; NFC (details)
  9. [VPlan] Track both incoming values for first-order recurrence phis. (details)
  10. [LoadStoreVectorizer] Support opaque pointers (details)
  11. [MemCpyOpt] Support opaque pointers (details)
  12. [InstCombine] hoist min/max intrinsics above select with constant op (details)
  13. [MemCpyOpt] Handle unusual memcpy element type (details)
  14. [clang-format] Fix the issue that empty lines being removed at the beginning of namespace (details)
  15. [Bazel] Update for 0813700de1 (details)
  16. [DSE] Support opaque pointers (details)
  17. Revert "[RISCV] Use zexti32/sexti32 in srliw/sraiw isel patterns to improve usage of those instructions." (details)
  18. [MemCpyOpt] Preserve address space (details)
  19. [DSE] Preserve address space (details)
  20. [BitCode] Add noprofile to getAttrFromCode() (details)
  21. [RISCV] Add tests for __builtin_parity idiom. (details)
  22. PR37255: DebugInfo: LTO with -g inlined into -gmlt combined with Split DWARF without CU cross-references (details)
  23. PR50708: Update link to Intel SIMD ABI (details)
  24. Remove XFAIL flag from sanitize-coverage-old-pm.c (details)
  25. [M68k][GloballSel] Formal arguments lowering in IRTranslator (details)
  26. Tag sanitize-coverage-old-pm.c unsupported on arm 32 bit (details)
  27. [LLDB] Silence warnings in cli-wrapper-mpxtable.cpp (details)
  28. [PowerPC] Add XL Compat fetch builtins (details)
  29. [LoopDeletion] Benefit from branches by undef conditions when symbolically executing 1st iteration (details)
Commit 81f6d7c082e8438d81e2b85605458deae71bbab9 by craig.topper
[X86] Tighten up some inline assembly constraint handling.

Don't allow vectors to split into GPRs for 'r' and other scalar
constraints. Prevents assertion in getCopyToPartsVector.

Makes PR50907 give a better error instead of crashing.
The file was modifiedllvm/lib/Target/X86/X86ISelLowering.cpp
The file was addedllvm/test/CodeGen/X86/pr50907.ll
Commit 0813700de1af72173ad18202fcbd3eafce90d184 by springerm
[mlir][NFC] Cleanup: Move helper functions to StaticValueUtils

Reduce code duplication: Move various helper functions, that are duplicated in TensorDialect, MemRefDialect, LinalgDialect, StandardDialect, into a new StaticValueUtils.cpp.

Differential Revision: https://reviews.llvm.org/D104687
The file was modifiedmlir/lib/Conversion/StandardToLLVM/StandardToLLVM.cpp
The file was modifiedmlir/lib/Dialect/Tensor/IR/TensorOps.cpp
The file was modifiedmlir/include/mlir/Interfaces/ViewLikeInterface.td
The file was addedmlir/lib/Dialect/Utils/StaticValueUtils.cpp
The file was modifiedmlir/lib/Dialect/MemRef/IR/CMakeLists.txt
The file was modifiedmlir/lib/Dialect/Linalg/IR/LinalgOps.cpp
The file was modifiedmlir/include/mlir/Dialect/Linalg/IR/LinalgOps.td
The file was addedmlir/include/mlir/Dialect/Utils/StaticValueUtils.h
The file was modifiedmlir/lib/Dialect/Linalg/Transforms/Vectorization.cpp
The file was modifiedmlir/include/mlir/Dialect/Linalg/Transforms/Transforms.h
The file was modifiedmlir/include/mlir/Dialect/StandardOps/IR/Ops.h
The file was modifiedmlir/include/mlir/Interfaces/ViewLikeInterface.h
The file was modifiedmlir/lib/Dialect/StandardOps/IR/Ops.cpp
The file was modifiedmlir/lib/Dialect/Linalg/Transforms/ComprehensiveBufferize.cpp
The file was modifiedmlir/lib/Dialect/Tensor/IR/CMakeLists.txt
The file was modifiedmlir/lib/Dialect/MemRef/IR/MemRefOps.cpp
The file was modifiedmlir/lib/Dialect/Utils/CMakeLists.txt
Commit c19a28919fc969a68401079532fafa6b1e44b6f4 by jan.kratochvil
llvm-dwarfdump: Print warnings on invalid DWARF

llvm-dwarfdump was silent even when the format of DWARF was invalid
and/or llvm-dwarfdump did not understand/support some of the constructs.
This can be pretty confusing as llvm-dwarfdump is a tool for DWARF
producers+consumers development.

Review comments also by @dblaikie.

Reviewed By: jhenderson

Differential Revision: https://reviews.llvm.org/D104271
The file was modifiedllvm/include/llvm/DebugInfo/DWARF/DWARFDebugAbbrev.h
The file was modifiedllvm/lib/DebugInfo/DWARF/DWARFUnit.cpp
The file was addedllvm/test/tools/llvm-dwarfdump/X86/debug-entry-invalid.s
The file was modifiedllvm/include/llvm/DebugInfo/DWARF/DWARFContext.h
The file was modifiedllvm/include/llvm/DebugInfo/DWARF/DWARFUnit.h
The file was modifiedllvm/lib/DebugInfo/DWARF/DWARFDebugAbbrev.cpp
The file was modifiedllvm/lib/DebugInfo/DWARF/DWARFDebugInfoEntry.cpp
Commit a7afaf901914aeade4e2b356c608d0f97150d769 by jan.kratochvil
Fix lld testsuite after llvm-dwarfdump now errors on invalid DWARF

D104271 broke buildbots for lld/test/ELF/non-abs-reloc.s .
The file was modifiedlld/test/ELF/non-abs-reloc.s
Commit 0f24ffcdfa9bb2b6380cedbb24f16d4ab9920dd7 by thakis
[lld/mac] Don't fold UNWIND_X86_64_MODE_STACK_IND unwind entries

libunwind uses unwind info to find the function address belonging
to the current instruction pointer. libunwind/src/CompactUnwinder.hpp's
step functions read functionStart for UNWIND_X86_64_MODE_STACK_IND
(and for nothing else), so these encodings need a dedicated entry
per function, so that the runtime can get the stacksize off the
`subq` instrunction in the function's prologue.

This matches ld64.

(CompactUnwinder.hpp from https://opensource.apple.com/source/libunwind/
also reads functionStart in a few more cases if `SUPPORT_OLD_BINARIES` is set,
but it defaults to 0, and ld64 seems to not worry about these additional
cases.)

Related upstream bug: https://crbug.com/1220175

Differential Revision: https://reviews.llvm.org/D104978
The file was modifiedlld/MachO/UnwindInfoSection.cpp
The file was addedlld/test/MachO/compact-unwind-stack-ind.s
Commit f45eee270671ec9440766f15e44e74a2118f2d31 by Stefan Gränitz
[Orc][examples] LLJITWithRemoteDebugger: fix CMake when utils are not built
The file was modifiedllvm/examples/OrcV2Examples/LLJITWithRemoteDebugging/CMakeLists.txt
Commit 7414bbebc2895a1ac6c87e4ed83a4c3338fe6911 by spatel
[Analysis] improve function signature checking for calloc

This would crash later if we thought the parameters were
valid for the standard library call as shown in:
https://llvm.org/PR50846
The file was modifiedllvm/lib/Analysis/TargetLibraryInfo.cpp
The file was addedllvm/test/Transforms/InstCombine/calloc-mismatch.ll
Commit 1729d6be07ff60369d98d0ece0724751b66d0f91 by spatel
[InstCombine][test] add tests for min/max intrinsics with select operand; NFC
The file was modifiedllvm/test/Transforms/InstCombine/select-min-max.ll
Commit f1a64302725cc36e7796f327375b9e939e3a339e by flo
[VPlan] Track both incoming values for first-order recurrence phis.

This patch updates VPWidenPHI recipes for first-order recurrences to
also track the incoming value from the back-edge. Similar to D99294,
which did the same for reductions.

Reviewed By: Ayal

Differential Revision: https://reviews.llvm.org/D104197
The file was modifiedllvm/test/Transforms/LoopVectorize/vplan-sink-scalars-and-merge.ll
The file was modifiedllvm/lib/Transforms/Vectorize/LoopVectorize.cpp
The file was modifiedllvm/lib/Transforms/Vectorize/VPRecipeBuilder.h
The file was modifiedllvm/test/Transforms/LoopVectorize/first-order-recurrence-sink-replicate-region.ll
The file was modifiedllvm/lib/Transforms/Vectorize/VPlan.h
Commit a9129f8964ed8521f7cd0b25a6a6c6c1ce27fe19 by nikita.ppv
[LoadStoreVectorizer] Support opaque pointers

There are remaining redundant bitcasts.
The file was modifiedllvm/lib/Transforms/Vectorize/LoadStoreVectorizer.cpp
The file was addedllvm/test/Transforms/LoadStoreVectorizer/X86/opaque-ptr.ll
Commit 81fcdae68c5ff656c30032fd26c6a21af4c51dbb by nikita.ppv
[MemCpyOpt] Support opaque pointers
The file was modifiedllvm/lib/Transforms/Scalar/MemCpyOptimizer.cpp
The file was modifiedllvm/lib/IR/IRBuilder.cpp
The file was modifiedllvm/test/Transforms/MemCpyOpt/memset-memcpy-redundant-memset.ll
Commit 153da08a6cd7feea6644b3191019573d70a5bbd3 by spatel
[InstCombine] hoist min/max intrinsics above select with constant op

This is an extension of the handling for unary intrinsics and
follows the logic that we use for binary ops.

We don't canonicalize to min/max intrinsics yet, but this might
help unlock other folds seen in D98152.
The file was modifiedllvm/lib/Transforms/InstCombine/InstructionCombining.cpp
The file was modifiedllvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
The file was modifiedllvm/test/Transforms/InstCombine/select-min-max.ll
Commit f025053977f330152da081b7060a5d9cba0a9e22 by nikita.ppv
[MemCpyOpt] Handle unusual memcpy element type

Apparently, it is legal to use memcpy/memset with pointer types
other than i8*. Prior to 81fcdae68c5ff656c30032fd26c6a21af4c51dbb
this case was silently miscompiled, as the i8 offset calculation
was performed on some other type. Now it would crash due to a
type mismatch. Fix this by inserting an explicit bitcast to i8*.
The file was modifiedllvm/lib/Transforms/Scalar/MemCpyOptimizer.cpp
The file was modifiedllvm/test/Transforms/MemCpyOpt/memset-memcpy-redundant-memset.ll
Commit e5a8f230c765aebff34221cb3e084316496fc08e by mydeveloperday
[clang-format] Fix the issue that empty lines being removed at the beginning of namespace

This is a bug fix of https://bugs.llvm.org/show_bug.cgi?id=50116

Reviewed By: MyDeveloperDay

Differential Revision: https://reviews.llvm.org/D104044
The file was modifiedclang/lib/Format/UnwrappedLineFormatter.cpp
The file was modifiedclang/lib/Format/UnwrappedLineFormatter.h
The file was modifiedclang/unittests/Format/FormatTest.cpp
Commit 09ac97ce350316b95b8cddb796d52f71b6f68296 by gcmn
[Bazel] Update for 0813700de1

Updates Bazel BUILD files for changes in
https://github.com/llvm/llvm-project/commit/0813700de1

Differential Revision: https://reviews.llvm.org/D104990
The file was modifiedutils/bazel/llvm-project-overlay/mlir/BUILD.bazel
Commit f00941e061f39646b05fcab93f892fc793845da1 by nikita.ppv
[DSE] Support opaque pointers

For the start shortening optimization, always use a i8 type for
the GEP, as it is a raw offset calculation.

Handling of non-i8* memset/memcpy arguments requires insertion
of casts. These cases were previously miscompiled, as the offset
calculation was performed on the wrong type.
The file was modifiedllvm/lib/Transforms/Scalar/DeadStoreElimination.cpp
The file was modifiedllvm/test/Transforms/DeadStoreElimination/OverwriteStoreBegin.ll
Commit 010f0f000f1f6a5461ac96ad075030a2fd7bb720 by craig.topper
Revert "[RISCV] Use zexti32/sexti32 in srliw/sraiw isel patterns to improve usage of those instructions."

I thought this might help with another optimization I was
thinking about, but I don't think it will. So it just wastes
compile time calling computeKnownBits for no benefit.

This reverts commit 81b2f95971edd47a0057ac4a77b674d7ea620c01.
The file was modifiedllvm/test/CodeGen/RISCV/rvv/fixed-vectors-ctlz.ll
The file was modifiedllvm/test/CodeGen/RISCV/alu8.ll
The file was modifiedllvm/test/CodeGen/RISCV/rv64zbp.ll
The file was modifiedllvm/test/CodeGen/RISCV/rv64zbb-zbp.ll
The file was modifiedllvm/test/CodeGen/RISCV/urem-vector-lkk.ll
The file was modifiedllvm/test/CodeGen/RISCV/vec3-setcc-crash.ll
The file was modifiedllvm/test/CodeGen/RISCV/rv64i-exhaustive-w-insts.ll
The file was modifiedllvm/test/CodeGen/RISCV/bswap-ctlz-cttz-ctpop.ll
The file was modifiedllvm/test/CodeGen/RISCV/copysign-casts.ll
The file was modifiedllvm/test/CodeGen/RISCV/urem-seteq-illegal-types.ll
The file was modifiedllvm/lib/Target/RISCV/RISCVInstrInfo.td
The file was modifiedllvm/test/CodeGen/RISCV/div.ll
The file was modifiedllvm/test/CodeGen/RISCV/urem-lkk.ll
The file was modifiedllvm/test/CodeGen/RISCV/rv64zbb.ll
Commit 9aa951e80e72decd95c7d972e1e0dde24260d336 by nikita.ppv
[MemCpyOpt] Preserve address space

Preserve address space when generating the cast to i8*.
The file was modifiedllvm/lib/Transforms/Scalar/MemCpyOptimizer.cpp
The file was modifiedllvm/test/Transforms/MemCpyOpt/memset-memcpy-redundant-memset.ll
Commit e81702912e6247c3adeb7e0c8416d6251d3b452a by nikita.ppv
[DSE] Preserve address space

Preserve address space when inserting i8* cast.
The file was modifiedllvm/lib/Transforms/Scalar/DeadStoreElimination.cpp
The file was modifiedllvm/test/Transforms/DeadStoreElimination/OverwriteStoreBegin.ll
Commit 4ae0ab095bf97123c2d2a6aa2e82dcc25cf040f1 by nathan
[BitCode] Add noprofile to getAttrFromCode()

After D104475 / D104658, building the Linux kernel with ThinLTO is
broken:

ld.lld: error: Unknown attribute kind (73) (Producer: 'LLVM13.0.0git'
Reader: 'LLVM 13.0.0git')

getAttrFromCode() has never handled this attribute so it is written
during the ThinLTO phase but it cannot be handled during the linking
phase.

Add noprofile to getAttrFromCode() so that disassembly works properly.

Reviewed By: MaskRay

Differential Revision: https://reviews.llvm.org/D104995
The file was modifiedllvm/lib/Bitcode/Reader/BitcodeReader.cpp
The file was modifiedllvm/test/Bitcode/attributes.ll
Commit 4c92e31dd0f1bd152eda883af20ff7fbcaa14945 by craig.topper
[RISCV] Add tests for __builtin_parity idiom.

We use (and (ctpop X), 1) to represent parity.

The generated code for i32 parity on RV64 has more instructions than
necessary which I hope to improve in a followup patch.

Also add missing test for i64 ctpop.
The file was modifiedllvm/test/CodeGen/RISCV/bswap-ctlz-cttz-ctpop.ll
Commit 1b112c80a68697687189ddf5bb01b2edacb618af by dblaikie
PR37255: DebugInfo: LTO with -g inlined into -gmlt combined with Split DWARF without CU cross-references

A combination of features ^ that lead to a mismatch of expectations
about how a subprogram definition DIE would be produced with/without a
declaration when taking full -g debug info and inlining it into a -gmlt
CU - specifically when using Split DWARF that doesn't support cross-CU
references, so we have to put the -g debug info into the -gmlt CU, which
gets confusing about which mode is respected.

This patch comes down on respecting the CU the debug info is emitted
into, rather than preserving the full debug info when it's emitted into
the gmlt CU.
The file was addedllvm/test/DebugInfo/X86/split-dwarf-cross-cu-gmlt-g.ll
The file was modifiedllvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp
The file was modifiedllvm/lib/CodeGen/AsmPrinter/DwarfUnit.h
Commit 5c2ade03ea8722846dff6f87c67630d703c61c09 by dblaikie
PR50708: Update link to Intel SIMD ABI
The file was modifiedllvm/docs/LangRef.rst
Commit 3a6599b7bd0fe4fe579e0abd9bd882ea964dd627 by omair.javaid
Remove XFAIL flag from sanitize-coverage-old-pm.c

This test has started passing consistently on 32bit arm where underlying
core is reported as Armv7 or Thumbv7.
However it still fails intermittently on 32bit AArch32 reported as Armv8l.

https://lab.llvm.org/buildbot/#/builders/190/builds/20
https://lab.llvm.org/buildbot/#/builders/170/builds/41
The file was modifiedclang/test/CodeGen/sanitize-coverage-old-pm.c
Commit 8f43407a07f015ca9a7543c6a0b5bde3918f9a0e by minyihh
[M68k][GloballSel] Formal arguments lowering in IRTranslator

Implementation of formal arguments lowering in the IRTranslator for the
M68k backend

Differential Revision: https://reviews.llvm.org/D104542
The file was modifiedllvm/lib/Target/M68k/M68kISelLowering.h
The file was modifiedllvm/test/CodeGen/M68k/GlobalISel/irtranslator-ret.ll
The file was modifiedllvm/lib/Target/M68k/GlSel/M68kCallLowering.h
The file was modifiedllvm/lib/Target/M68k/GlSel/M68kCallLowering.cpp
The file was modifiedllvm/lib/Target/M68k/M68kISelLowering.cpp
Commit 2ddca686ee8fd73d4b6630b60794be82caa4c311 by omair.javaid
Tag sanitize-coverage-old-pm.c unsupported on arm 32 bit

This test is again failing across multiple bots and passing on others
there is no reliable way to enable it for some of the bots while
disabling for the unsupported ones. Tagging it as unsupported across all
types of Arm 32 bit cores.
The file was modifiedclang/test/CodeGen/sanitize-coverage-old-pm.c
Commit 0f32d0034c7b9751b1ce7a89469328ac932faab8 by omair.javaid
[LLDB] Silence warnings in cli-wrapper-mpxtable.cpp

cli-wrapper-mpxtable.cpp was emitting warnings from printfs of
uint64_t on 32 bit arm build. This patch makes affected printfs
in cli-wrapper-mpxtable.cpp portable accross targets variants.
The file was modifiedlldb/tools/intel-features/intel-mpx/cli-wrapper-mpxtable.cpp
Commit eb237ffca821839374574b2195c865765ebf5d09 by Jinsong Ji
[PowerPC] Add XL Compat fetch builtins

Prototype
```
unsigned int __fetch_and_add (volatile unsigned int* addr, unsigned int
val);
unsigned long __fetch_and_addlp (volatile unsigned long* addr, unsigned
long val);
```
Ref:
https://www.ibm.com/docs/en/xl-c-and-cpp-linux/16.1.1?topic=functions-fetch

Reviewed By: #powerpc, w2yehia, lkail

Differential Revision: https://reviews.llvm.org/D104991
The file was modifiedclang/include/clang/Basic/BuiltinsPPC.def
The file was modifiedclang/lib/CodeGen/CGBuiltin.cpp
The file was addedclang/test/CodeGen/builtins-ppc-xlcompat-fetch.c
The file was modifiedclang/lib/Basic/Targets/PPC.cpp
The file was addedclang/test/CodeGen/builtins-ppc-xlcompat-fetch-error.c
Commit 7c73c2ede8088802adb8191d05cad09e3ad88539 by mkazantsev
[LoopDeletion] Benefit from branches by undef conditions when symbolically executing 1st iteration

We can exploit branches by `undef` condition. Frankly, the LangRef says that
such branches are UB, so we can assume that all outgoing edges of such blocks
are dead.

However, from practical perspective, we know that this is not supported correctly
in some other places. So we are being conservative about it.

Branch by undef is treated in the following way:
- If it is a loop-exiting branch, we always assume it exits the loop;
- If not, we arbitrarily assume it takes `true` value.

Differential Revision: https://reviews.llvm.org/D104689
Reviewed By: nikic
The file was modifiedllvm/test/Transforms/LoopDeletion/eval_first_iteration.ll
The file was modifiedllvm/lib/Transforms/Scalar/LoopDeletion.cpp