SuccessChanges

Summary

  1. [JSON] Display errors associated with Paths in context (details)
  2. [libunwind] Combine dl_iterate_phdr codepaths for DWARF and EHABI (details)
  3. [libunwind] Optimize dl_iterate_phdr's findUnwindSectionsByPhdr (details)
  4. [JSON] Add error reporting to fromJSON and ObjectMapper (details)
  5. Fix LLDB tweak in 62a47e994fcf5b73e29547d26cd9676b30cb69a3 (details)
  6. [libc++] Fix spurious test failure in -fno-exceptions (details)
  7. [clangd] Improve bad-RPC-payload error messages slightly (details)
  8. [CGProfile] don't emit cgprofile entry if called function is dllimport (details)
  9. Explicitly specify CMAKE_AR in WinMsvc.cmake (details)
  10. Utility: ignore OS version on non-Darwin targets in `ArchSpec` (details)
  11. [X86] Add TDX instructions. (details)
  12. [X86] Parse data32 call in .code16 as CALLpcrel32 (details)
  13. Revert "[NewPM] Add callbacks to PassBuilder to run before/after parsing a pass" (details)
  14. [AMDGPU] Consider all SGPR uses as unique in constant bus verify (details)
  15. [NFC] Remove unnecessary default constructors (details)
  16. [GlobalISel][AMDGPU] Lower G_SMULH/G_UMULH (details)
  17. [lld-macho] Initial support for common symbols (details)
  18. [lld-macho] Implement and test resolution of common symbols (details)
  19. [lld-macho] Emit indirect symbol table (details)
  20. [lld-macho] Ignore `-mllvm` and its argument (details)
  21. [lld-macho] Support -weak_lx, -weak_library, -weak_framework (details)
  22. [lld-macho][NFC] Refactor syslibroot / library path lookup (details)
  23. [lld-macho][NFC] Make `!= nullptr` implicit (details)
  24. [IRSim] Adding structural comparison to IRSimilarityCandidate. (details)
  25. Revert "[IRSim] Adding structural comparison to IRSimilarityCandidate." (details)
  26. [IRSim] Adding structural comparison to IRSimilarityCandidate. (details)
  27. [Power10]  Implement custom codegen for the vec_replace_elt and vec_replace_unaligned builtins. (details)
  28. [dwarfdump] Warn for tags with DW_CHILDREN_yes but no children. (details)
  29. DebugInfo: Filter DWARFv5 TUs out of the debug_info unit list when CUs requested (details)
  30. [IRSim][NFC] Removing warning from IRSimilarityIdentifier (details)
  31. [DWARFYAML] Make the ExtLen field of extended opcodes optional. (details)
Commit 38de1c33a8374bb16abfb024a973d851c170bafc by sam.mccall
[JSON] Display errors associated with Paths in context

When an error occurs processing a JSON object, seeing the actual
surrounding data helps. Dumping just the node where the problem
was identified can be too much or too little information.

printErrorContext() shows the error message in its context, as a comment.
JSON values along the path to the broken place are shown in some detail,
the rest of the document is elided. For example:

```
{
  "credentials": [
    {
      "username": /* error: expected string */ 42,
      "password": "secret"
    },
    { ... }
  ]
  "backups": { ... }
}
```

Differential Revision: https://reviews.llvm.org/D88103
The file was modifiedllvm/lib/Support/JSON.cpp
The file was modifiedllvm/include/llvm/Support/JSON.h
The file was modifiedllvm/unittests/Support/JSONTest.cpp
Commit b16d6653c01cee37f51a98dd4092c4ef302c47a5 by rprichard
[libunwind] Combine dl_iterate_phdr codepaths for DWARF and EHABI

dl_iterate_phdr is used to search for unwind info provided by either
PT_GNU_EH_FRAME or PT_ARM_EXIDX. Most of the code between the two is
the same, so combine them, and factor out what's different into
checkForUnwindInfoSegment.

Details:
- The FrameHeaderCache can now be enabled for ARM EHABI.
- findUnwindSectionsByPhdr now finds the last PT_ARM_EXIDX rather than
   the first. There should only be one segment.
- The dso_base and text_segment_length fields of UnwindInfoSections
   are now needed for dl_iterate_phdr when using EHABI, to hold the
   low and high PC values for a cache entry.

Reviewed By: compnerd, danielkiss, #libunwind, saugustine

Differential Revision: https://reviews.llvm.org/D87880
The file was modifiedlibunwind/test/frameheadercache_test.pass.cpp
The file was modifiedlibunwind/src/AddressSpace.hpp
Commit 881aba7071c6e4cc2417e875ca5027ec7c0a92a3 by rprichard
[libunwind] Optimize dl_iterate_phdr's findUnwindSectionsByPhdr

Currently, findUnwindSectionsByPhdr is slightly micro-optimized for the
case where the first callback has the target address, and is otherwise
very inefficient -- it decodes .eh_frame_hdr even when no PT_LOAD
matches the PC. (If the FrameHeaderCache is enabled, then the
micro-optimization only helps the first time unwind info is looked up.)

Instead, it makes more sense to optimize for the case where the
callback *doesn't* find the target address, so search for a PT_LOAD
segment first, and only look for the unwind info section if a matching
PT_LOAD is found.

This change helps on an Android benchmark with 100 shared objects,
where the DSO at the end of the dl_iterate_phdr list throws 10000
exceptions. Assuming the frame cache is disabled, this change cuts
about 30-40% off the benchmark's runtime.

Reviewed By: compnerd, saugustine, #libunwind

Differential Revision: https://reviews.llvm.org/D87881
The file was modifiedlibunwind/src/AddressSpace.hpp
Commit fa69b608063eecba76fb35d167b063cbfe532c28 by sam.mccall
[JSON] Add error reporting to fromJSON and ObjectMapper

Translating between JSON objects and C++ strutctures is common.
From experience in clangd, fromJSON/ObjectMapper work well and save a lot of
code, but aren't adopted elsewhere at least partly due to total lack of error
reporting beyond "ok"/"bad".

The recently-added error model should be rich enough for most applications.
It requires tracking the path within the root object and reporting local
errors at appropriate places.
To do this, we exploit the fact that the call graph of recursive
parse functions mirror the structure of the JSON itself.
The current path is represented as a linked list of segments, each of which is
on the stack as a parameter. Concretely, fromJSON now looks like:
  bool fromJSON(const Value&, T&, Path);

Beyond the signature change, this is reasonably unobtrusive: building
the path segments is mostly handled by ObjectMapper and the vector<T> fromJSON.
However the root caller of fromJSON must now create a Root object to
store the errors, which is a little clunky.

I've added high-level parse<T>(StringRef) -> Expected<T>, but it's not
general enough to be the primary interface I think (at least, not usable in
clangd).

All existing users (mostly just clangd) are updated in this patch,
making this change backwards-compatible is a bit hairy.

Differential Revision: https://reviews.llvm.org/D88103
The file was modifiedclang-tools-extra/clangd/Protocol.h
The file was modifiedllvm/lib/Analysis/TFUtils.cpp
The file was modifiedclang-tools-extra/clangd/Protocol.cpp
The file was modifiedclang-tools-extra/clangd/ClangdLSPServer.h
The file was modifiedclang-tools-extra/clangd/ClangdLSPServer.cpp
The file was modifiedlldb/source/Utility/StructuredData.cpp
The file was modifiedllvm/include/llvm/Support/JSON.h
The file was modifiedclang-tools-extra/clangd/index/Index.cpp
The file was modifiedclang-tools-extra/clangd/benchmarks/IndexBenchmark.cpp
The file was modifiedllvm/unittests/Support/JSONTest.cpp
The file was modifiedclang-tools-extra/clangd/index/Index.h
Commit 751f5c81468966d921ad54827d27ff19aa43af8e by sam.mccall
Fix LLDB tweak in 62a47e994fcf5b73e29547d26cd9676b30cb69a3
The file was modifiedlldb/source/Utility/StructuredData.cpp
Commit 23291e8ec7e8f54db56ff77b61313e9d55a23861 by Louis Dionne
[libc++] Fix spurious test failure in -fno-exceptions
The file was modifiedlibcxx/test/std/containers/sequences/vector/vector.modifiers/resize_not_move_insertable.fail.cpp
Commit 2bd5e3fb3cc032f90447067d38c48c75b23f32c5 by sam.mccall
[clangd] Improve bad-RPC-payload error messages slightly
The file was modifiedclang-tools-extra/clangd/ClangdLSPServer.h
Commit f5435399e823746bbe1737b95c853d77a42e1ac3 by zequanwu
[CGProfile] don't emit cgprofile entry if called function is dllimport

Differential Revision: https://reviews.llvm.org/D88127
The file was modifiedllvm/test/Instrumentation/cgprofile.ll
The file was modifiedllvm/lib/Transforms/Instrumentation/CGProfile.cpp
Commit ee7ee71f40e904a8380d6439ac4741304b4a2dfd by smeenai
Explicitly specify CMAKE_AR in WinMsvc.cmake

As of cmake 3.18, cmake changes how it searches for compilers for
Windows (see
https://gitlab.kitware.com/cmake/cmake/-/commit/55196a1440e26917d40e6a7a3eb8d9fb323fa657)
and now finds llvm-ar instead of llvm-lib as CMAKE_AR. This explicitly
specifies CMAKE_AR as llvm-lib so the correct program is found.

Reviewed By: smeenai

Differential Revision: https://reviews.llvm.org/D88176
The file was modifiedllvm/cmake/platforms/WinMsvc.cmake
The file was modifiedllvm/cmake/modules/LLVMExternalProjectUtils.cmake
Commit 92d42b32a9b7a085fd200a56022724a77cf12a2d by Saleem Abdulrasool
Utility: ignore OS version on non-Darwin targets in `ArchSpec`

The OS version field is generally not very helpful for non-Darwin
targets.  On Linux, it identifies the kernel version which moves
out-of-sync with the userspace.  On Windows, this field actually ends up
corresponding to the Visual Studio toolset version instead of the OS
version.  Consider non-Darwin targets without an OS version to be fully
specified.

Differential Revision: https://reviews.llvm.org/D88181
Reviewed By: Jonas Devlieghere, Dave Lee
The file was modifiedlldb/source/Utility/ArchSpec.cpp
Commit bc7f6c6dd8252370e6b485b8193093004644a16d by freddy.ye
[X86] Add TDX instructions.

For more details about these instructions, please refer to the latest TDX document: https://software.intel.com/content/www/us/en/develop/articles/intel-trust-domain-extensions.html

Reviewed By: craig.topper

Differential Revision: https://reviews.llvm.org/D88006
The file was modifiedllvm/test/MC/X86/x86-32-coverage.s
The file was modifiedllvm/test/MC/Disassembler/X86/x86-64.txt
The file was modifiedllvm/lib/Target/X86/X86InstrInfo.td
The file was addedllvm/lib/Target/X86/X86InstrTDX.td
The file was modifiedllvm/test/MC/Disassembler/X86/x86-32.txt
The file was modifiedllvm/test/MC/X86/x86-64.s
Commit 3d38a975d72c8711a123d1862e517bcbdab7d700 by i
[X86] Parse data32 call in .code16 as CALLpcrel32

Used by kexec-tools (PR46942)
In GNU as, tc-i386.c:output_jump uses 4-byte immediate if a data32 prefix is present.

Reviewed By: craig.topper

Differential Revision: https://reviews.llvm.org/D88137
The file was modifiedllvm/test/MC/X86/data-prefix-fail.s
The file was modifiedllvm/lib/Target/X86/AsmParser/X86AsmParser.cpp
The file was modifiedllvm/test/MC/X86/x86-16.s
Commit 29aaa188480e59f136330d77d255453e8d744b32 by aeubanks
Revert "[NewPM] Add callbacks to PassBuilder to run before/after parsing a pass"

This reverts commit 111aa4e36614d9a056cf5040d4d7bbfddeb9ebb2.
The file was modifiedllvm/tools/opt/NewPMDriver.cpp
The file was modifiedllvm/include/llvm/Passes/PassBuilder.h
The file was modifiedllvm/lib/Passes/PassBuilder.cpp
The file was modifiedllvm/tools/llvm-opt-fuzzer/llvm-opt-fuzzer.cpp
The file was modifiedllvm/unittests/IR/PassBuilderCallbacksTest.cpp
The file was modifiedpolly/lib/Support/RegisterPasses.cpp
Commit 1e0500d4f7f19b3eae0f9b6f05591a40188d8d99 by carl.ritson
[AMDGPU] Consider all SGPR uses as unique in constant bus verify

Fix the verifier so that overlapping SGPR operands are counted
independently.  We cannot assume that overlapping SGPR accesses
only count as a single constant bus use.
The exception is implicit uses which do not add to constant bus
usage (only) when overlapping.

Reviewed By: rampitec

Differential Revision: https://reviews.llvm.org/D87748
The file was addedllvm/test/CodeGen/AMDGPU/verify-constant-bus-violations.mir
The file was modifiedllvm/lib/Target/AMDGPU/SIInstrInfo.cpp
Commit 714075f9c1ac50cde20e21e559f0e29fdc848bf1 by aeubanks
[NFC] Remove unnecessary default constructors
The file was modifiedllvm/include/llvm/Passes/StandardInstrumentations.h
Commit 41d6669f1f16cc2f6cd0faf2c58447d1aa2072fa by Pushpinder.Singh
[GlobalISel][AMDGPU] Lower G_SMULH/G_UMULH

Reviewed By: arsenm, foad

Differential Revision: https://reviews.llvm.org/D85653
The file was modifiedllvm/test/CodeGen/AMDGPU/GlobalISel/legalize-smulh.mir
The file was modifiedllvm/include/llvm/CodeGen/GlobalISel/LegalizerHelper.h
The file was modifiedllvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp
The file was modifiedllvm/lib/Target/AMDGPU/AMDGPULegalizerInfo.cpp
The file was modifiedllvm/test/CodeGen/AMDGPU/GlobalISel/legalize-umulh.mir
Commit 63ace77962543f961f1d566dd1243b1fb37129ef by jezng
[lld-macho] Initial support for common symbols

On Unix, it is traditionally allowed to write variable definitions without
initialization expressions (such as "int foo;") to header files. These are
called tentative definitions.

The compiler creates common symbols when it sees tentative definitions. When
linking the final binary, if there are remaining common symbols after name
resolution is complete, the linker converts them to regular defined symbols in
a `__common` section.

This diff implements most of that functionality, though we do not yet handle
the case where there are both common and non-common definitions of the same
symbol.

Reviewed By: #lld-macho, gkm

Differential Revision: https://reviews.llvm.org/D86909
The file was modifiedlld/MachO/SyntheticSections.h
The file was addedlld/test/MachO/common-symbol-coalescing.s
The file was modifiedlld/MachO/SymbolTable.h
The file was modifiedlld/MachO/Driver.cpp
The file was modifiedlld/MachO/Symbols.h
The file was modifiedlld/MachO/InputFiles.cpp
The file was modifiedlld/MachO/SymbolTable.cpp
Commit cd7cb0c30305501982ba37b4905bb264b3539ad0 by jezng
[lld-macho] Implement and test resolution of common symbols

Handle the case where there are both common and non-common definitions
of the same symbol. Add a bunch of tests to ensure compatibility with ld64.

Reviewed By: #lld-macho, gkm

Differential Revision: https://reviews.llvm.org/D86910
The file was modifiedlld/MachO/SymbolTable.cpp
The file was addedlld/test/MachO/common-symbol-resolution.s
The file was modifiedlld/test/MachO/nonweak-definition-override.s
Commit 5d26bd3b75538515194d9e54c76e723524c1ac18 by jezng
[lld-macho] Emit indirect symbol table

Makes it a little easier to read objdump's disassembly.

Reviewed By: #lld-macho, gkm

Differential Revision: https://reviews.llvm.org/D87178
The file was modifiedlld/MachO/SyntheticSections.cpp
The file was modifiedlld/MachO/OutputSection.h
The file was modifiedlld/MachO/SyntheticSections.h
The file was modifiedlld/MachO/Symbols.h
The file was modifiedlld/MachO/Writer.cpp
The file was addedlld/test/MachO/indirect-symtab.s
Commit 79412d6ca772c1c3913030cfef4b17f4afac110d by jezng
[lld-macho] Ignore `-mllvm` and its argument

Test Plan:

Reviewed By: #lld-macho, compnerd, MaskRay

Differential Revision: https://reviews.llvm.org/D87803
The file was modifiedlld/MachO/Options.td
The file was modifiedlld/test/MachO/silent-ignore.test
Commit 98f03908d07d06c74be5547cc0436bd89186cae2 by jezng
[lld-macho] Support -weak_lx, -weak_library, -weak_framework

They cause their corresponding libraries / frameworks to be loaded via
`LC_LOAD_WEAK_DYLIB` instead of `LC_LOAD_DYLIB`.

Reviewed By: #lld-macho, gkm

Differential Revision: https://reviews.llvm.org/D87929
The file was modifiedlld/MachO/InputFiles.h
The file was modifiedlld/MachO/Driver.cpp
The file was modifiedlld/MachO/Options.td
The file was modifiedlld/MachO/Writer.cpp
The file was addedlld/test/MachO/weak-import.s
Commit ca8752a793f1576b666fb22a74278d44725138f1 by jezng
[lld-macho][NFC] Refactor syslibroot / library path lookup

* Move computation of systemLibraryRoots into a separate function, so we
  can add more functionality to it without things becoming unwieldy
* Have `getSearchPaths` and related functions return by value instead of
  by output parameter. NRVO should ensure that performance is unaffected.

Reviewed By: #lld-macho, smeenai

Differential Revision: https://reviews.llvm.org/D87959
The file was modifiedlld/MachO/Driver.cpp
Commit 9c70281497730a7dc7df43435bf570bef1108454 by jezng
[lld-macho][NFC] Make `!= nullptr` implicit
The file was modifiedlld/MachO/OutputSegment.cpp
The file was modifiedlld/MachO/InputFiles.cpp
The file was modifiedlld/MachO/Driver.cpp
Commit b27db2bb68163fa5bcb4a8f631a305eb5adb44e5 by andrew.litteken
[IRSim] Adding structural comparison to IRSimilarityCandidate.

Just because sequences of instructions are similar to one another,
doesn't mean they are doing the same thing.

This introduces a structural check for the IRSimilarityCandidate that
compares two IRSimilarityCandidates against one another, and in each
instruction creates a mapping between the operands and results, or
checks that the existing mapping is valid.  If this check passes, it
means we have structurally similar IRSimilarityCandidates.

Tests for whether the candidates are found in
unittests/Analysis/IRSimilarityIdentifierTest.cpp.
The file was modifiedllvm/include/llvm/Analysis/IRSimilarityIdentifier.h
The file was modifiedllvm/unittests/Analysis/IRSimilarityIdentifierTest.cpp
The file was modifiedllvm/lib/Analysis/IRSimilarityIdentifier.cpp
Commit 0a8e097e72dfc148df1d9345aba52e75cdc5aa50 by andrew.litteken
Revert "[IRSim] Adding structural comparison to IRSimilarityCandidate."

This reverts commit b27db2bb68163fa5bcb4a8f631a305eb5adb44e5.
The file was modifiedllvm/unittests/Analysis/IRSimilarityIdentifierTest.cpp
The file was modifiedllvm/include/llvm/Analysis/IRSimilarityIdentifier.h
The file was modifiedllvm/lib/Analysis/IRSimilarityIdentifier.cpp
Commit d1aa143aa84e20a8cdef24a0b5ccf70941884534 by andrew.litteken
[IRSim] Adding structural comparison to IRSimilarityCandidate.

Just because sequences of instructions are similar to one another,
doesn't mean they are doing the same thing.

This introduces a structural check for the IRSimilarityCandidate that
compares two IRSimilarityCandidates against one another, and in each
instruction creates a mapping between the operands and results, or
checks that the existing mapping is valid.  If this check passes, it
means we have structurally similar IRSimilarityCandidates.

Tests for whether the candidates are found in
unittests/Analysis/IRSimilarityIdentifierTest.cpp.

Recommit of: b27db2bb68163fa5bcb4a8f631a305eb5adb44e5 for Differential
URL.

Differential Revision: https://reviews.llvm.org/D86971
The file was modifiedllvm/include/llvm/Analysis/IRSimilarityIdentifier.h
The file was modifiedllvm/unittests/Analysis/IRSimilarityIdentifierTest.cpp
The file was modifiedllvm/lib/Analysis/IRSimilarityIdentifier.cpp
Commit 6b136b19cbe4e96adea63b75f1f2f76ec25c708e by amy.kwan1
[Power10]  Implement custom codegen for the vec_replace_elt and vec_replace_unaligned builtins.

This patch implements custom codegen for the vec_replace_elt and
vec_replace_unaligned builtins.

These builtins map to the @llvm.ppc.altivec.vinsw and @llvm.ppc.altivec.vinsd
intrinsics depending on the arguments. The main motivation for doing custom
codegen for these intrinsics is because there are float and double versions of
the builtin. Normally, the converting the float to an integer would be done via
fptoui in the IR. This is incorrect as fptoui truncates the value and we must
ensure the value is not truncated. Therefore, we provide custom codegen to utilize
bitcast instead as bitcasts do not truncate.

Differential Revision: https://reviews.llvm.org/D83500
The file was modifiedclang/lib/Sema/SemaChecking.cpp
The file was modifiedclang/lib/CodeGen/CGBuiltin.cpp
The file was modifiedclang/include/clang/Basic/BuiltinsPPC.def
The file was modifiedclang/lib/Headers/altivec.h
The file was modifiedclang/test/CodeGen/builtins-ppc-p10vector.c
The file was addedclang/test/CodeGen/builtins-ppc-vec-ins-error.c
Commit e1ef7183c6f008fa13cbe273500b020c4fad1252 by Jonas Devlieghere
[dwarfdump] Warn for tags with DW_CHILDREN_yes but no children.

Flag DIEs that have DW_CHILDREN_yes set in their abbreviation but don't
actually have any children.

rdar://59809554

Differential revision: https://reviews.llvm.org/D88048
The file was addedllvm/test/tools/llvm-dwarfdump/X86/no-children.yaml
The file was modifiedllvm/test/tools/llvm-dwarfdump/X86/verify_die_ranges.s
The file was modifiedllvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp
The file was modifiedllvm/test/DebugInfo/X86/skeleton-unit-verify.s
Commit 0328feb086fca6ed8e57265aa073d7600ac9079c by dblaikie
DebugInfo: Filter DWARFv5 TUs out of the debug_info unit list when CUs requested

Since DWARFv5 places TUs in debug_info, some of DWARFContext's APIs have
become a bit erroneous, including TUs in the CU list by accident.
Correct that by providing compile_units (& dwo_compile_units) that
filter out the type units from the debug_info units.

Differential Revision: https://reviews.llvm.org/D87935
The file was modifiedllvm/lib/DebugInfo/DWARF/DWARFContext.cpp
The file was modifiedllvm/include/llvm/DebugInfo/DWARF/DWARFUnit.h
The file was modifiedllvm/include/llvm/DebugInfo/DWARF/DWARFContext.h
The file was modifiedllvm/include/llvm/DebugInfo/DWARF/DWARFDebugMacro.h
The file was modifiedllvm/lib/DebugInfo/DWARF/DWARFDebugMacro.cpp
Commit beeceb92c082ce13807504b1e8f0567bf91d17ea by andrew.litteken
[IRSim][NFC] Removing warning from IRSimilarityIdentifier
The file was modifiedllvm/lib/Analysis/IRSimilarityIdentifier.cpp
Commit 505ac22f1a1ada261280d979862d8af541016f77 by Xing
[DWARFYAML] Make the ExtLen field of extended opcodes optional.

This patch makes the 'ExtLen' field of extended opcodes optional. We
don't need to manually calculate it in the future.

Reviewed By: jhenderson, MaskRay

Differential Revision: https://reviews.llvm.org/D88136
The file was modifiedllvm/lib/ObjectYAML/DWARFYAML.cpp
The file was modifiedllvm/test/tools/yaml2obj/ELF/DWARF/debug-line.yaml
The file was modifiedllvm/include/llvm/ObjectYAML/DWARFYAML.h
The file was modifiedllvm/lib/ObjectYAML/DWARFEmitter.cpp
The file was modifiedllvm/tools/obj2yaml/dwarf2yaml.cpp