SuccessChanges

Summary

  1. [dfsan] Update memset and dfsan_(set|add)_label with origin tracking (details)
  2. [libc] Add exhaustive test for sqrtf. (details)
  3. [libc] Add a standalone flavor of an equivalent of std::string_view. (details)
  4. [RISCV] Add vadd with mask and without mask builtin. (details)
  5. [WPD] Fix handling of pure virtual base class (details)
  6. [ThinLTO] Make cloneUsedGlobalVariables deterministic (details)
  7. Fix unstable SmallPtrSet iteration issues due to collectUsedGlobalVariables (details)
  8. collectUsedGlobalVariables: migrate SmallPtrSetImpl overload to SmallVecImpl overload after D97128 (details)
  9. [AArch64][GlobalISel] Correct function evaluation order in applyINS (details)
  10. [NFC] Make TrailingObjects non-copyable/non-movable (details)
  11. [mlir][Inliner] Keep the number of async pass managers constant (details)
  12. [mlir] ExecutionEngine needs special handling for COFF binaries (details)
  13. Revert "[Driver][Windows] Support per-target runtimes dir layout for profile instr generate" (details)
  14. [SimplifyCFG] Update passingValueIsAlwaysUndefined to check more attributes (details)
  15. [LoopNest] Use `getUniqueSuccessor()` instead when checking empty blocks (details)
  16. Add more historic DWARF vendor extensions (details)
  17. [Debug-Info][NFC] move emitDwarfUnitLength to MCStreamer class (details)
  18. [mlir][Inliner] Don't optimize callees in async mode if there is only one to optimize (details)
  19. [lld-macho] Use full input file name in invalid relocation error message (details)
  20. [lld-macho] Fix semantics & add tests for ARM64 GOT/TLV relocs (details)
  21. [lld-macho] Check for arch compatibility when loading ObjFiles and TBDs (details)
  22. [lld-macho] Better deduplication of personality pointers (details)
  23. Revert "Add more historic DWARF vendor extensions" (details)
  24. [XCOFF] add C_FILE symbol at index 0 of symbol table. (details)
  25. [AArch64][GlobalISel][PostSelectOpt] Constrain reg operands after mutating instructions. (details)
  26. [HIP] Fix managed variable linkage (details)
Commit a05aa0dd5ef8f5633d49192f32a3d0b4653b8a0c by jianzhouzh
[dfsan] Update memset and dfsan_(set|add)_label with origin tracking

This is a part of https://reviews.llvm.org/D95835.

Reviewed-by: morehouse

Differential Revision: https://reviews.llvm.org/D97302
The file was modifiedllvm/test/Instrumentation/DataFlowSanitizer/memset.ll
The file was modifiedllvm/test/Instrumentation/DataFlowSanitizer/basic.ll
The file was modifiedcompiler-rt/lib/dfsan/dfsan.cpp
The file was addedllvm/test/Instrumentation/DataFlowSanitizer/origin_mem_intrinsic.ll
The file was modifiedllvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp
Commit b79507a4acad4114ab0fde3babd81551b214e65b by lntue
[libc] Add exhaustive test for sqrtf.

Differential Revision: https://reviews.llvm.org/D96985
The file was modifiedlibc/test/src/math/CMakeLists.txt
The file was modifiedlibc/test/CMakeLists.txt
The file was modifiedlibc/cmake/modules/LLVMLibCTestRules.cmake
The file was addedlibc/test/src/math/exhaustive/sqrtf_test.cpp
The file was addedlibc/test/src/math/exhaustive/CMakeLists.txt
Commit dbb131d53aacabdf5d85299e447a970a0280b127 by sivachandra
[libc] Add a standalone flavor of an equivalent of std::string_view.

This class is to serve as a replacement for llvm::StringRef as part of
the plans to limit dependency on other parts of LLVM. One use of
llvm::StringRef in MPFRWrapper has been replaced with the new class.

Reviewed By: lntue

Differential Revision: https://reviews.llvm.org/D97330
The file was modifiedlibc/utils/MPFRWrapper/CMakeLists.txt
The file was modifiedlibc/utils/CPP/CMakeLists.txt
The file was addedlibc/utils/CPP/StringView.h
The file was modifiedlibc/test/utils/CPP/CMakeLists.txt
The file was addedlibc/test/utils/CPP/stringview_test.cpp
The file was modifiedlibc/utils/MPFRWrapper/MPFRUtils.cpp
Commit 1a35a1b0748639a0014eb8aec1a9c36e330c5316 by kai.wang
[RISCV] Add vadd with mask and without mask builtin.

Demonstrate how to add RISC-V V builtins and lower them to IR intrinsics for V extension.

Authored-by: Roger Ferrer Ibanez <rofirrim@gmail.com>
Co-Authored-by: Hsiangkai Wang <kai.wang@sifive.com>

Differential Revision: https://reviews.llvm.org/D93446
The file was modifiedclang/lib/CodeGen/CodeGenFunction.h
The file was addedclang/include/clang/Basic/BuiltinsRISCV.def
The file was modifiedclang/include/clang/Basic/TargetBuiltins.h
The file was addedclang/test/CodeGen/RISCV/vadd.c
The file was modifiedclang/include/clang/Basic/DiagnosticSemaKinds.td
The file was modifiedclang/lib/Basic/Targets/RISCV.h
The file was modifiedclang/include/clang/module.modulemap
The file was modifiedclang/lib/CodeGen/CGBuiltin.cpp
The file was modifiedclang/include/clang/Sema/Sema.h
The file was modifiedclang/lib/Basic/Targets/RISCV.cpp
The file was modifiedclang/lib/Sema/SemaChecking.cpp
Commit 0a5949dcfa31d599353fb4ccf4d207bdae7c7281 by tejohnson
[WPD] Fix handling of pure virtual base class

The fix in 3c4c205060c9398da705eb71b63ddd8a04999de9 caused an assert in
the case of a pure virtual base class. In that case, the vTableFuncs
list on the summary will be empty, so we were hitting the new assert
that the linkage type was not available_externally.

In the case of pure virtual, we do not want to assert, and additionally
need to set VS so that we don't treat it conservatively and quit the
analysis of the type id early.

This exposed a pre-existing issue where we were not updating the vcall
visibility on pure virtual functions when whole program visibility was
specified. We were skipping updating the visibility on any global vars
that didn't have any vTableFuncs, which meant all pure virtual were not
updated, and the later analysis would block any devirtualization of
calls that had a type id used on those pure virtual vtables (see the
handling in the other code modified in this patch). Simply remove that
check. It will mean that we may update the vcall visibility on global
vars that aren't vtables, but that setting is ignored for any global
vars that didn't have type metadata anyway.

Added a new test case that asserted without removing the assert, and
that requires the other fixes in this patch (updateVCallVisibilityInIndex
and not skipping all vtables without virtual funcs) to get a successful
devirtualization with index-only WPD. I added cases to test hybrid and
regular LTO for completeness, although those already worked without the
fixes here.

With this final fix, a clang multistage bootstrap with WPD builds and
runs all tests successfully.

Differential Revision: https://reviews.llvm.org/D97126
The file was modifiedllvm/lib/Transforms/IPO/WholeProgramDevirt.cpp
The file was addedllvm/test/ThinLTO/X86/devirt_pure_virtual_base.ll
Commit 3adb89bb9f8e73c82787babb2f877fece7394770 by i
[ThinLTO] Make cloneUsedGlobalVariables deterministic

Iterating on `SmallPtrSet<GlobalValue *, 8>` with more than 8 elements
is not deterministic. Use a SmallVector instead because `Used` is guaranteed to contain unique elements.

While here, decrease inline element counts from 8 to 4. The number of
`llvm.used`/`llvm.compiler.used` elements is usually 0 or 1. For full
LTO/hybrid LTO, the number may be large, so we need to be careful.

According to tejohnson's analysis https://reviews.llvm.org/D97128#2582399 , 4 is
good for a large project with WholeProgramDevirt, when available_externally
vtables are placed in the llvm.compiler.used set.

Differential Revision: https://reviews.llvm.org/D97128
The file was modifiedllvm/lib/IR/Module.cpp
The file was modifiedllvm/include/llvm/IR/Module.h
The file was modifiedllvm/lib/Transforms/IPO/ThinLTOBitcodeWriter.cpp
Commit ed02f52d288fb4d8f9049868afa6af84a980cbc3 by i
Fix unstable SmallPtrSet iteration issues due to collectUsedGlobalVariables

While here, decrease inline element counts from 8 to 4. See D97128 for the choice.

Depends on D97128 (which added a new SmallVecImpl overload for collectUsedGlobalVariables).

Reviewed By: tejohnson

Differential Revision: https://reviews.llvm.org/D97139
The file was modifiedllvm/lib/Transforms/IPO/LowerTypeTests.cpp
The file was modifiedllvm/lib/Bitcode/Writer/BitcodeWriter.cpp
Commit ef312951fd6b4a255baf3cff27439c9ed8751651 by i
collectUsedGlobalVariables: migrate SmallPtrSetImpl overload to SmallVecImpl overload after D97128

And delete the SmallPtrSetImpl overload.

While here, decrease inline element counts from 8 to 4. See D97128 for the choice.

Reviewed By: tejohnson

Differential Revision: https://reviews.llvm.org/D97257
The file was modifiedllvm/lib/Transforms/IPO/Internalize.cpp
The file was modifiedllvm/lib/Transforms/IPO/GlobalOpt.cpp
The file was modifiedllvm/include/llvm/IR/Module.h
The file was modifiedllvm/include/llvm/Transforms/Utils/FunctionImportUtils.h
The file was modifiedllvm/lib/IR/Module.cpp
The file was modifiedllvm/lib/Object/IRSymtab.cpp
The file was modifiedllvm/lib/Analysis/ModuleSummaryAnalysis.cpp
Commit daf7d7f0dc283873f40f3500b20f02bc2cde701d by Jessica Paquette
[AArch64][GlobalISel] Correct function evaluation order in applyINS

The order in which the nested calls to Builder.buildWhatever are
evaluated in differs between GCC and Clang.

This caused a bot failure because the MIR in the testcase was
coming out in a different order than expected.

Rather than using nested calls, pull them out in order to fix the
order of evaluation.
The file was modifiedllvm/lib/Target/AArch64/GISel/AArch64PostLegalizerLowering.cpp
Commit af4451eb4f38ce492ca38add91c8378f32b93eca by erich.keane
[NFC] Make TrailingObjects non-copyable/non-movable

This got me pretty recently... TrailingObjects cannot be copied or
moved, since they need to be pre-allocated. This patch deletes the copy
and move operations (plus re-adds the default ctor).

Differential Revision: https://reviews.llvm.org/D97324
The file was modifiedllvm/include/llvm/Support/TrailingObjects.h
Commit 16a50c9e642fd085e5ceb68c403b71b5b2e0607c by riddleriver
[mlir][Inliner] Keep the number of async pass managers constant

This prevents a bug in the pass instrumentation implementation where the main thread would end up with a different pass manager in different runs of the pass.
The file was modifiedmlir/lib/Transforms/Inliner.cpp
Commit 3c4cdd0b6a6fd760707be9b5dec32378ec55c549 by kern.handa
[mlir] ExecutionEngine needs special handling for COFF binaries

Reviewed By: mehdi_amini

Differential Revision: https://reviews.llvm.org/D97141
The file was modifiedmlir/lib/ExecutionEngine/ExecutionEngine.cpp
Commit ab5b00ada9e77437ed2c76f73cfb8481bb9826a5 by thakis
Revert "[Driver][Windows] Support per-target runtimes dir layout for profile instr generate"

This reverts commit 7f9d5d6e444c91ce6f2e377b312ac573dfc6779a.
Breaks check-clang everywhere, see https://reviews.llvm.org/D96638#2583608
The file was modifiedclang/lib/Driver/ToolChains/BareMetal.cpp
The file was modifiedclang/test/Driver/sanitizer-ld.c
The file was modifiedclang/test/Driver/instrprof-ld.c
The file was modifiedclang/include/clang/Driver/ToolChain.h
The file was modifiedclang/lib/Driver/ToolChains/BareMetal.h
The file was modifiedclang/test/Driver/cl-options.c
The file was modifiedclang/lib/Driver/ToolChain.cpp
The file was modifiedclang/test/Driver/fsanitize.c
Commit 56d228a14e3631de157ae98dd61d21193e4502d5 by aqjune
[SimplifyCFG] Update passingValueIsAlwaysUndefined to check more attributes

This is a simple patch to update SimplifyCFG's passingValueIsAlwaysUndefined to inspect more attributes.

A new function `CallBase::isPassingUndefUB` checks attributes that imply noundef.

Reviewed By: spatel

Differential Revision: https://reviews.llvm.org/D97244
The file was modifiedllvm/include/llvm/IR/InstrTypes.h
The file was modifiedllvm/lib/Transforms/Utils/SimplifyCFG.cpp
The file was modifiedllvm/test/Transforms/SimplifyCFG/UnreachableEliminate.ll
Commit 98c6110d9bdda166a6093f8fdf1320b5f477ecbe by tu.da.wei
[LoopNest] Use `getUniqueSuccessor()` instead when checking empty blocks

Blocks that contain only a single branch instruction to the next block can be skipped in analyzing the loop-nest structure.
This is currently done by `getSingleSuccessor()`.
However, the branch instruction might have multiple targets which happen to all be the same.
In this case, the block should still be considered as empty and skipped.

An example is `test/Transforms/LoopInterchange/update-condbranch-duplicate-successors.ll` (the LIT test for this patch is modified from it as well).

Reviewed By: Whitney

Differential Revision: https://reviews.llvm.org/D97286
The file was modifiedllvm/lib/Analysis/LoopNestAnalysis.cpp
The file was addedllvm/test/Analysis/LoopNestAnalysis/duplicate-successors.ll
Commit c4a91444689455a35db1e7f50bcd876a3eb86126 by Adrian Prantl
Add more historic DWARF vendor extensions

The maintainer of libdwarf kindly provided this patch with a bunch of
historic DWARF extensions that are missing from Dwarf.def. This list
is helpful to avoid potential conflicts in the user-defined vendor
extension space in the future.

Patch by David Anderson!

Differential Revision: https://reviews.llvm.org/D97242
The file was modifiedllvm/include/llvm/BinaryFormat/Dwarf.h
The file was modifiedllvm/include/llvm/BinaryFormat/Dwarf.def
Commit be5d92e37e4fe0b7ba2f5658fa828c1c39988374 by czhengsz
[Debug-Info][NFC] move emitDwarfUnitLength to MCStreamer class

We may need to do some customization for DWARF unit length in DWARF
section headers for some targets for some code generation path.

For example, for XCOFF in assembly path, AIX assembler does not require
the debug section containing its debug unit length in the header.

Move emitDwarfUnitLength to MCStreamer class so that we can do
customization in different Streamers

Reviewed By: ikudrin

Differential Revision: https://reviews.llvm.org/D95932
The file was modifiedllvm/include/llvm/MC/MCStreamer.h
The file was modifiedllvm/include/llvm/CodeGen/AsmPrinter.h
The file was modifiedllvm/unittests/CodeGen/AsmPrinterDwarfTest.cpp
The file was modifiedllvm/lib/MC/MCStreamer.cpp
The file was modifiedllvm/lib/CodeGen/AsmPrinter/AsmPrinterDwarf.cpp
Commit 59f0e4627a5e8789c9ab997cd13f96600848fea8 by riddleriver
[mlir][Inliner] Don't optimize callees in async mode if there is only one to optimize

This avoids unnecessary async overhead in situations that won't benefit from it.
The file was modifiedmlir/lib/Transforms/Inliner.cpp
Commit e5d780e049c275b628461c043fa5953ecd4f16e0 by jezng
[lld-macho] Use full input file name in invalid relocation error message

Just something I noticed while debugging arm relocations...

Reviewed By: #lld-macho, thakis

Differential Revision: https://reviews.llvm.org/D97078
The file was modifiedlld/MachO/InputFiles.cpp
The file was modifiedlld/test/MachO/invalid/invalid-relocation-pcrel.yaml
Commit 5e851733c5b603bec962bb4c5cf9d5cc93d88175 by jezng
[lld-macho] Fix semantics & add tests for ARM64 GOT/TLV relocs

I've adjusted the RelocAttrBits to better fit the semantics of
the relocations. In particular:

1. *_UNSIGNED relocations are no longer marked with the `TLV` bit, even
   though they can occur within TLV sections. Instead the `TLV` bit is
   reserved for relocations that can reference thread-local symbols, and
   *_UNSIGNED relocations have their own `UNSIGNED` bit. The previous
   implementation caused TLV and regular UNSIGNED semantics to be
   conflated, resulting in rebase opcodes being incorrectly emitted for TLV
   relocations.

2. I've added a new `POINTER` bit to denote non-relaxable GOT
   relocations. This distinction isn't important on x86 -- the GOT
   relocations there are either relaxable or non-relaxable loads -- but
   arm64 has `GOT_LOAD_PAGE21` which loads the page that the referent
   symbol is in (regardless of whether the symbol ends up in the GOT). This
   relocation must reference a GOT symbol (so must have the `GOT` bit set)
   but isn't itself relaxable (so must not have the `LOAD` bit). The
   `POINTER` bit is used for relocations that *must* reference a GOT
   slot.

3. A similar situation occurs for TLV relocations.

4. ld64 supports both a pcrel and an absolute version of
   ARM64_RELOC_POINTER_TO_GOT. But the semantics of the absolute version
   are pretty weird -- it results in the value of the GOT slot being
   written, rather than the address. (That means a reference to a
   dynamically-bound slot will result in zeroes being written.) The
   programs I've tried linking don't use this form of the relocation, so
   I've dropped our partial support for it by removing the relevant
   RelocAttrBits.

Reviewed By: alexshap

Differential Revision: https://reviews.llvm.org/D97031
The file was modifiedlld/MachO/Target.h
The file was modifiedlld/MachO/InputSection.cpp
The file was addedlld/test/MachO/arm64-reloc-tlv-load.s
The file was modifiedlld/MachO/Arch/ARM64.cpp
The file was modifiedlld/MachO/Writer.cpp
The file was modifiedlld/MachO/Target.cpp
The file was addedlld/test/MachO/arm64-reloc-pointer-to-got.s
The file was addedlld/test/MachO/arm64-reloc-got-load.s
The file was modifiedlld/MachO/InputFiles.cpp
The file was modifiedlld/MachO/Arch/X86_64.cpp
Commit 4752cdc9a20abb5fbb2a255011417b8a77e4c31e by jezng
[lld-macho] Check for arch compatibility when loading ObjFiles and TBDs

The silent failures had confused me a few times.

I haven't added a similar check for platform yet as we don't yet have logic to
infer the platform automatically, and so adding that check would require
updating dozens of test files.

Reviewed By: #lld-macho, thakis, alexshap

Differential Revision: https://reviews.llvm.org/D97209
The file was addedlld/test/MachO/invalid/Inputs/libincompatible.tbd
The file was modifiedlld/MachO/InputFiles.cpp
The file was addedlld/test/MachO/invalid/incompatible-arch.s
The file was addedlld/test/MachO/invalid/incompatible-arch-tapi.s
The file was modifiedlld/test/MachO/Inputs/MacOSX.sdk/usr/lib/libc++.tbd
The file was modifiedlld/test/MachO/header.s
Commit 4a5e111aea7ac78190211a2549f8d0d53ee2f01d by jezng
[lld-macho] Better deduplication of personality pointers

{D95809} introduced a mechanism for synthetic symbol creation of personality
pointers. When multiple section relocations referred to the same personality
pointer, it would deduplicate them. However, it neglected to consider that we
could have symbol relocations that also refer to the same personality pointer.
This diff fixes it.

In practice, this mix of relocations arises when there is a statically-linked
personality routine that is referenced from multiple object files. Within the
same object file, it will be referred to via section relocations, but
(obviously) other object files will refer to it via symbol relocations. Failing
to deduplicate these references resulted in us going over the
3-personality-pointer limit when linking some larger applications.

Fixes llvm.org/PR48389.

Reviewed By: #lld-macho, thakis, alexshap

Differential Revision: https://reviews.llvm.org/D97245
The file was modifiedlld/test/MachO/compact-unwind.s
The file was modifiedlld/MachO/UnwindInfoSection.cpp
Commit f14a14dd2564703db02f80c00db8ae492b594f77 by thakis
Revert "Add more historic DWARF vendor extensions"

This reverts commit c4a91444689455a35db1e7f50bcd876a3eb86126.
Breaks check-llvm everywhere, see https://reviews.llvm.org/D97242#2583716
The file was modifiedllvm/include/llvm/BinaryFormat/Dwarf.h
The file was modifiedllvm/include/llvm/BinaryFormat/Dwarf.def
Commit 71a39862475e1d192d41d335452267590103acfc by czhengsz
[XCOFF] add C_FILE symbol at index 0 of symbol table.

This is for XCOFF DWARF support.

Seems when DWARF debug is enable, symbol 0 has special usage
for AIX binder. At least, symbol 0 can not be the .text
section. Otherwise, we get some binding time error.

Add correct C_FILE symbol at index 0 here to make AIX binder
work.

Reviewed By: hubert.reinterpretcast

Differential Revision: https://reviews.llvm.org/D97117
The file was modifiedllvm/test/CodeGen/PowerPC/aix-overflow-toc.py
The file was modifiedllvm/test/CodeGen/PowerPC/aix-func-dsc-gen.ll
The file was modifiedllvm/test/CodeGen/PowerPC/aix-weak.ll
The file was modifiedllvm/test/CodeGen/PowerPC/aix-extern-weak.ll
The file was modifiedllvm/lib/MC/XCOFFObjectWriter.cpp
The file was modifiedllvm/test/CodeGen/PowerPC/aix-xcoff-explicit-section.ll
The file was modifiedllvm/test/CodeGen/PowerPC/aix-extern.ll
The file was modifiedllvm/test/CodeGen/PowerPC/aix-llvm-intrinsic.ll
The file was modifiedllvm/test/CodeGen/PowerPC/aix-xcoff-lcomm.ll
The file was modifiedllvm/test/CodeGen/PowerPC/aix-xcoff-symbol-rename.ll
The file was modifiedllvm/test/CodeGen/PowerPC/aix-xcoff-reloc.ll
The file was modifiedllvm/test/CodeGen/PowerPC/aix-xcoff-rodata.ll
The file was modifiedllvm/test/CodeGen/PowerPC/aix-xcoff-data.ll
The file was modifiedllvm/test/CodeGen/PowerPC/aix-user-defined-memcpy.ll
The file was modifiedllvm/test/CodeGen/PowerPC/aix-xcoff-data-sections.ll
Commit eb55203e009ec98351f2be6e5655b7178b604920 by Amara Emerson
[AArch64][GlobalISel][PostSelectOpt] Constrain reg operands after mutating instructions.

The non-flag setting variants of instructions may have different regclass
requirements. If so, we need to constrain them.

Differential Revision: https://reviews.llvm.org/D97343
The file was addedllvm/test/CodeGen/AArch64/GlobalISel/postselectopt-constrain-new-regop.mir
The file was modifiedllvm/lib/Target/AArch64/GISel/AArch64PostSelectOptimize.cpp
Commit a3ce7f5cd2ae236bec7752e343f4b63ddda7ebe7 by Yaxun.Liu
[HIP] Fix managed variable linkage

Currently managed variables are emitted as undefined symbols, which
causes difficulty for diagnosing undefined symbols for non-managed
variables.

This patch transforms managed variables in device compilation so that
they can be emitted as normal variables.

Reviewed by: Artem Belevich

Differential Revision: https://reviews.llvm.org/D96195
The file was modifiedclang/test/CodeGenCUDA/device-var-linkage.cu
The file was modifiedclang/lib/CodeGen/CodeGenModule.cpp
The file was modifiedclang/test/CodeGenCUDA/managed-var.cu
The file was modifiedclang/lib/CodeGen/CGCUDANV.cpp
The file was modifiedllvm/lib/IR/ReplaceConstant.cpp
The file was modifiedclang/lib/CodeGen/CGCUDARuntime.h