SuccessChanges

Summary

  1. [lldb/DWARF] More DW_AT_const_value fixes (details)
  2. [obj2yaml] - Cleanup error reporting (remove Error.cpp/.h files) (details)
  3. Copy m_plan_is_for_signal_trap member. (details)
  4. [libunwind] Convert x86, x86_64, arm64 register restore functions to C calling convention and name mangling (details)
  5. [gn build] Port 357dc1ed125 (details)
  6. [RDA] Don't visit the BB of the instruction in getReachingUniqueMIDef (details)
  7. [llvm-readobj/elf][test] - Add testing for EM_* specific OS/ABI values. (details)
  8. [llvm-readobj][test] - Commit trivial.obj.elf-amdhsa-gfx803 binary back. (details)
  9. [ARM] Increase MVE gather/scatter cost by MVECostFactor. (details)
  10. [llvm/Object] - Make dyn_cast<XCOFFObjectFile> work as it should. (details)
  11. [mlir][PDL] Add a PDL Interpreter Dialect (details)
  12. [Scheduling] Implement a new way to cluster loads/stores (details)
  13. [DWARFYAML] Make the unit_length and header_length fields optional. (details)
  14. [AMDGPU][GlobalISel] Eliminate barrier if workgroup size is not greater than wavefront size (details)
  15. GlobalISel: Combine G_ADD of G_PTRTOINT to G_PTR_ADD (details)
  16. AMDGPU/GlobalISel: Tolerate negated control flow intrinsic outputs (details)
  17. Add clang-cl "vctoolsdir" option to specify the location of the msvc toolchain (details)
  18. AMDGPU: Use Subtarget reference in SIInstrInfo (details)
  19. [Support] Allow printing the stack trace only for a given depth (details)
Commit 82982304d7095891b10faacdbf9b4eb73e92a92f by pavel
[lldb/DWARF] More DW_AT_const_value fixes

This fixes several issues in handling of DW_AT_const_value attributes:
- the first is that the size of the data given by data forms does not
  need to match the size of the underlying variable. We already had the
  case to handle this for DW_FORM_(us)data -- this extends the handling
  to other data forms. The main reason this was not picked up is because
  clang uses leb forms in these cases while gcc prefers the fixed-size
  ones.
- The handling of DW_AT_strp form was completely broken -- we would end
  up using the pointer value as the result. I've reorganized this code
  so that it handles all string forms uniformly.
- In case of a completely bogus form we would crash due to
  strlen(nullptr).

Depends on D86311.

Differential Revision: https://reviews.llvm.org/D86348
The file was modifiedlldb/test/Shell/SymbolFile/DWARF/DW_AT_const_value.s
The file was modifiedlldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
The file was addedlldb/test/Shell/SymbolFile/DWARF/DW_AT_const_value-bitfields.s
Commit 357dc1ed125e4bf55f1e99fb141fc054c285edbf by grimar
[obj2yaml] - Cleanup error reporting (remove Error.cpp/.h files)

This removes Error.cpp/.h files from obj2yaml.
These files are not needed because we are
using `Error`s instead of error codes widely and do
not need a logic related to obj2yaml specific
error codes anymore.

I had to adjust just a few lines of tool's code
to remove remaining dependencies.

Differential revision: https://reviews.llvm.org/D86536
The file was modifiedllvm/tools/obj2yaml/dwarf2yaml.cpp
The file was modifiedllvm/tools/obj2yaml/macho2yaml.cpp
The file was modifiedllvm/tools/obj2yaml/CMakeLists.txt
The file was removedllvm/tools/obj2yaml/Error.h
The file was modifiedllvm/tools/obj2yaml/elf2yaml.cpp
The file was modifiedllvm/tools/obj2yaml/obj2yaml.cpp
The file was removedllvm/tools/obj2yaml/Error.cpp
The file was modifiedllvm/tools/obj2yaml/minidump2yaml.cpp
Commit 642cb7865f35ad7dbac78d716fcddaff561e8639 by benny.kra
Copy m_plan_is_for_signal_trap member.

Otherwise it would stay uninitialized. Found by msan.
The file was modifiedlldb/include/lldb/Symbol/UnwindPlan.h
Commit e524daa7e8719f4b43e6ebcf25fd4e7d74c5d1c4 by martin
[libunwind] Convert x86, x86_64, arm64 register restore functions to C calling convention and name mangling

Currently, the assembly functions for restoring register state have
been direct implementations of the Registers_*::jumpto() method
(contrary to the functions for saving register state, which are
implementations of the extern C function __unw_getcontext). This has
included having the assembly function name match the C++ mangling of
that method name (and having the function match the C++ member
function calling convention). To simplify the interface of the assembly
implementations, make the functions have C calling conventions and
name mangling.

This fixes building the library in with a MSVC C++ ABI with clang-cl,
which uses a significantly different method name mangling scheme.
(The library might not be of much use as C++ exception unwinder in such
an environment, but the libunwind.h interface for stepwise unwinding
still is usable, as is the _Unwind_Backtrace function.)

Differential Revision: https://reviews.llvm.org/D86041
The file was modifiedlibunwind/src/UnwindRegistersRestore.S
The file was modifiedlibunwind/src/Registers.hpp
Commit fc13d3d50e60e67b485720d5b2d049e8699249cc by llvmgnsyncbot
[gn build] Port 357dc1ed125
The file was modifiedllvm/utils/gn/secondary/llvm/tools/obj2yaml/BUILD.gn
Commit 85dd852a0d46684883fe3b4b19e780ba5d915b06 by samuel.tebbs
[RDA] Don't visit the BB of the instruction in getReachingUniqueMIDef

If the basic block of the instruction passed to getUniqueReachingMIDef
is a transitive predecessor of itself and has a definition of the
register, the function will return that definition even if it is after
the instruction given to the function. This patch stops the function
from scanning the instruction's basic block to prevent this.

Differential Revision: https://reviews.llvm.org/D86607
The file was modifiedllvm/lib/CodeGen/ReachingDefAnalysis.cpp
Commit cbedbd12e9837e049f0a936636a82ff39b75692b by grimar
[llvm-readobj/elf][test] - Add testing for EM_* specific OS/ABI values.

We have no tests for OS/ABI values specific to
EM_TI_C6000, ELFOSABI_AMDGPU_MESA3D and ELFOSABI_ARM machines.

Also, related arrays in the code are not grouped together.
(That is why such testing was missed I guess).

The patch fixes that all.

Differential revision: https://reviews.llvm.org/D86341
The file was modifiedllvm/tools/llvm-readobj/ELFDumper.cpp
The file was removedllvm/test/tools/llvm-readobj/ELF/Inputs/trivial.obj.elf-amdhsa-gfx803
The file was modifiedllvm/test/tools/llvm-readobj/ELF/file-header-os-abi.test
Commit 4b5460762a9634ba6a96b9589e11a1f7a9beaa3f by grimar
[llvm-readobj][test] - Commit trivial.obj.elf-amdhsa-gfx803 binary back.

It was removed in rGcbedbd12e9837e049f0a936636a82ff39b75692b by mistake.
The file was addedllvm/test/tools/llvm-readobj/ELF/Inputs/trivial.obj.elf-amdhsa-gfx803
Commit 677c1590c03474c8238fbc21b9c0dae9b5e5f4d2 by david.green
[ARM] Increase MVE gather/scatter cost by MVECostFactor.

MVE Gather scatter codegeneration is looking a lot better than it used
to, but still has some issues. The instructions we currently model as 1
cycle per element, which is a bit low for some cases. Increasing the
cost by the MVECostFactor brings them in-line with our other instruction
costs. This will have the effect of only generating then when the extra
benefit is more likely to overcome some of the issues. Notably in
running out of registers and vectorizing loops that could otherwise be
SLP vectorized.

In the short-term whilst we look at other ways of dealing with those
more directly, we can increase the costs of gathers to make them more
likely to be beneficial when created.

Differential Revision: https://reviews.llvm.org/D86444
The file was modifiedllvm/lib/Target/ARM/ARMTargetTransformInfo.cpp
The file was modifiedllvm/test/Transforms/LoopVectorize/ARM/pointer_iv.ll
The file was modifiedllvm/test/Analysis/CostModel/ARM/mve-gather-scatter-cost.ll
Commit 92c527e5a2b49fb1213ceda97738d4caf414666a by grimar
[llvm/Object] - Make dyn_cast<XCOFFObjectFile> work as it should.

Currently, `dyn_cast<XCOFFObjectFile>` always does cast and returns a pointer,
even when we pass `ELF`/`Wasm`/`Mach-O` or `COFF` instead of `XCOFF`.

It happens because `XCOFFObjectFile` class does not implement `classof`.
I've fixed it and added a unit test.

Differential revision: https://reviews.llvm.org/D86542
The file was modifiedllvm/include/llvm/Object/XCOFFObjectFile.h
The file was modifiedllvm/unittests/Object/XCOFFObjectFileTest.cpp
Commit d289a97f91443177b605926668512479c2cee37b by riddleriver
[mlir][PDL] Add a PDL Interpreter Dialect

The PDL Interpreter dialect provides a lower level abstraction compared to the PDL dialect, and is targeted towards low level optimization and interpreter code generation. The dialect operations encapsulates low-level pattern match and rewrite "primitives", such as navigating the IR (Operation::getOperand), creating new operations (OpBuilder::create), etc. Many of the operations within this dialect also fuse branching control flow with some form of a predicate comparison operation. This type of fusion reduces the amount of work that an interpreter must do when executing.

An example of this representation is shown below:

```mlir
// The following high level PDL pattern:
pdl.pattern : benefit(1) {
  %resultType = pdl.type
  %inputOperand = pdl.input
  %root, %results = pdl.operation "foo.op"(%inputOperand) -> %resultType
  pdl.rewrite %root {
    pdl.replace %root with (%inputOperand)
  }
}

// May be represented in the interpreter dialect as follows:
module {
  func @matcher(%arg0: !pdl.operation) {
    pdl_interp.check_operation_name of %arg0 is "foo.op" -> ^bb2, ^bb1
  ^bb1:
    pdl_interp.return
  ^bb2:
    pdl_interp.check_operand_count of %arg0 is 1 -> ^bb3, ^bb1
  ^bb3:
    pdl_interp.check_result_count of %arg0 is 1 -> ^bb4, ^bb1
  ^bb4:
    %0 = pdl_interp.get_operand 0 of %arg0
    pdl_interp.is_not_null %0 : !pdl.value -> ^bb5, ^bb1
  ^bb5:
    %1 = pdl_interp.get_result 0 of %arg0
    pdl_interp.is_not_null %1 : !pdl.value -> ^bb6, ^bb1
  ^bb6:
    pdl_interp.record_match @rewriters::@rewriter(%0, %arg0 : !pdl.value, !pdl.operation) : benefit(1), loc([%arg0]), root("foo.op") -> ^bb1
  }
  module @rewriters {
    func @rewriter(%arg0: !pdl.value, %arg1: !pdl.operation) {
      pdl_interp.replace %arg1 with(%arg0)
      pdl_interp.return
    }
  }
}
```

Differential Revision: https://reviews.llvm.org/D84579
The file was modifiedmlir/include/mlir/IR/Attributes.h
The file was addedmlir/include/mlir/Dialect/PDLInterp/IR/PDLInterp.h
The file was modifiedmlir/lib/Dialect/CMakeLists.txt
The file was addedmlir/test/Dialect/PDLInterp/ops.mlir
The file was addedmlir/include/mlir/Dialect/PDLInterp/IR/PDLInterpOps.td
The file was modifiedmlir/test/Dialect/PDL/ops.mlir
The file was addedmlir/include/mlir/Dialect/PDLInterp/IR/CMakeLists.txt
The file was modifiedmlir/lib/Dialect/PDL/IR/PDL.cpp
The file was modifiedmlir/lib/Parser/AttributeParser.cpp
The file was modifiedmlir/lib/Parser/Parser.cpp
The file was modifiedmlir/test/Dialect/PDL/invalid.mlir
The file was modifiedmlir/include/mlir/Dialect/PDL/IR/PDLBase.td
The file was modifiedmlir/lib/IR/Builders.cpp
The file was modifiedmlir/lib/Parser/Parser.h
The file was modifiedmlir/include/mlir/InitAllDialects.h
The file was modifiedmlir/include/mlir/IR/Builders.h
The file was modifiedmlir/include/mlir/Dialect/PDL/IR/PDLOps.td
The file was addedmlir/include/mlir/Dialect/PDLInterp/CMakeLists.txt
The file was modifiedmlir/tools/mlir-tblgen/OpFormatGen.cpp
The file was modifiedmlir/lib/Dialect/Linalg/Transforms/Vectorization.cpp
The file was addedmlir/lib/Dialect/PDLInterp/CMakeLists.txt
The file was modifiedmlir/include/mlir/Dialect/CMakeLists.txt
The file was addedmlir/lib/Dialect/PDLInterp/IR/PDLInterp.cpp
The file was addedmlir/lib/Dialect/PDLInterp/IR/CMakeLists.txt
The file was modifiedmlir/include/mlir/IR/OpImplementation.h
Commit ebf3b188c6edcce7e90ddcacbe7c51c90d95b0ac by qshanz
[Scheduling] Implement a new way to cluster loads/stores

Before calling target hook to determine if two loads/stores are clusterable,
we put them into different groups to avoid fake cluster due to dependency.
For now, we are putting the loads/stores into the same group if they have
the same predecessor. We assume that, if two loads/stores have the same
predecessor, it is likely that, they didn't have dependency for each other.

However, one SUnit might have several predecessors and for now, we just
pick up the first predecessor that has non-data/non-artificial dependency,
which is too arbitrary. And we are struggling to fix it.

So, I am proposing some better implementation.
1. Collect all the loads/stores that has memory info first to reduce the complexity.
2. Sort these loads/stores so that we can stop the seeking as early as possible.
3. For each load/store, seeking for the first non-dependency instruction with the
   sorted order, and check if they can cluster or not.

Reviewed By: Jay Foad

Differential Revision: https://reviews.llvm.org/D85517
The file was modifiedllvm/lib/CodeGen/MachineScheduler.cpp
The file was modifiedllvm/test/CodeGen/AArch64/aarch64-stp-cluster.ll
The file was modifiedllvm/test/CodeGen/AMDGPU/callee-special-input-vgprs.ll
The file was modifiedllvm/test/CodeGen/AMDGPU/max.i16.ll
The file was modifiedllvm/test/CodeGen/AMDGPU/stack-realign.ll
The file was modifiedllvm/include/llvm/CodeGen/ScheduleDAGInstrs.h
Commit 8daa3264a3329ad34a0b210afdd8699f27d66db2 by Xing
[DWARFYAML] Make the unit_length and header_length fields optional.

This patch makes the unit_length and header_length fields of line tables
optional. yaml2obj is able to infer them for us.

Reviewed By: jhenderson

Differential Revision: https://reviews.llvm.org/D86590
The file was modifiedllvm/test/tools/yaml2obj/ELF/DWARF/debug-line.yaml
The file was modifiedllvm/unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp
The file was modifiedllvm/lib/ObjectYAML/DWARFYAML.cpp
The file was modifiedllvm/include/llvm/ObjectYAML/DWARFYAML.h
The file was modifiedllvm/tools/obj2yaml/dwarf2yaml.cpp
The file was modifiedllvm/lib/ObjectYAML/DWARFEmitter.cpp
Commit 831457c6d59edb0e381917b35ca6099f9b86c6e8 by jay.foad
[AMDGPU][GlobalISel] Eliminate barrier if workgroup size is not greater than wavefront size

If a workgroup size is known to be not greater than wavefront size
the s_barrier instruction is not needed since all threads are guaranteed
to come to the same point at the same time.

This is the same optimization that was implemented for SelectionDAG in
D31731.

Differential Revision: https://reviews.llvm.org/D86609
The file was modifiedllvm/test/CodeGen/AMDGPU/barrier-elimination.ll
The file was modifiedllvm/lib/Target/AMDGPU/AMDGPUInstructionSelector.h
The file was modifiedllvm/lib/Target/AMDGPU/AMDGPUInstructionSelector.cpp
Commit eb074088c983ce6f255e0e83babdd32a4f2dd457 by Matthew.Arsenault
GlobalISel: Combine G_ADD of G_PTRTOINT to G_PTR_ADD

This produces less work for addressing mode matching. I think this is
safe since I don't think machine IR is supposed to give the same
aliasing properties as getelementptr in the IR.
The file was modifiedllvm/include/llvm/CodeGen/GlobalISel/CombinerHelper.h
The file was modifiedllvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp
The file was addedllvm/test/CodeGen/AMDGPU/GlobalISel/combine-add-to-ptradd.mir
The file was modifiedllvm/include/llvm/Target/GlobalISel/Combine.td
Commit 21ccedc24fc49b43e84095b4773f8aa86c366dac by Matthew.Arsenault
AMDGPU/GlobalISel: Tolerate negated control flow intrinsic outputs

If the condition output is negated, swap the branch targets. This is
similar to what SelectionDAG does for when SelectionDAGBuilder
decides to invert the condition and swap the branches.

This is leaving behind a dead constant def for some reason.
The file was modifiedllvm/lib/Target/AMDGPU/AMDGPULegalizerInfo.cpp
The file was modifiedllvm/test/CodeGen/AMDGPU/GlobalISel/legalize-amdgcn.if-invalid.mir
The file was modifiedllvm/test/CodeGen/AMDGPU/GlobalISel/legalize-brcond.mir
Commit 08704714421086e775a297339fc60963cc07eec9 by hans
Add clang-cl "vctoolsdir" option to specify the location of the msvc toolchain

Add an option to directly specify where the msvc toolchain lives for
clang-cl and avoid unwanted file and registry probes.

Differential revision: https://reviews.llvm.org/D85998
The file was modifiedclang/test/Driver/cl-options.c
The file was modifiedclang/lib/Driver/ToolChains/MSVC.cpp
The file was modifiedclang/include/clang/Driver/Options.td
Commit ff34116cf022ca010d60b972dae55016cd5f7478 by Matthew.Arsenault
AMDGPU: Use Subtarget reference in SIInstrInfo
The file was modifiedllvm/lib/Target/AMDGPU/SIInstrInfo.cpp
Commit a7da7e421c54e0053628f18f3750d4a8588cd627 by alexandre.ganea
[Support] Allow printing the stack trace only for a given depth

Differential Revision: https://reviews.llvm.org/D85458
The file was modifiedllvm/lib/Support/Windows/Signals.inc
The file was modifiedllvm/include/llvm/Support/Signals.h
The file was modifiedllvm/lib/Support/Unix/Signals.inc
The file was modifiedllvm/unittests/Support/CrashRecoveryTest.cpp