LLVM/project 8da4903offload/liboffload/include/generated OffloadAPI.h OffloadEntryPoints.inc, offload/liboffload/src OffloadImpl.cpp

Reland of #108413: [Offload] Introduce offload-tblgen and initial new API implementation (#118503)

This is another attempt to reland the changes from #108413

The previous two attempts introduced regressions and were reverted. This
PR has been more thoroughly tested with various configurations so
shouldn't cause any problems this time. If anyone is aware of any likely
remaining problems then please let me know.

The changes are identical other than the fixes contained in the last 5
commits.

---


### New API

Previous discussions at the LLVM/Offload meeting have brought up the
need for a new API for exposing the functionality of the plugins. This

    [31 lines not shown]
DeltaFile
+610-0offload/liboffload/include/generated/OffloadAPI.h
+441-0offload/liboffload/include/generated/OffloadEntryPoints.inc
+428-0offload/liboffload/include/generated/OffloadPrint.hpp
+247-0offload/liboffload/src/OffloadImpl.cpp
+229-0offload/tools/offload-tblgen/APIGen.cpp
+227-0offload/tools/offload-tblgen/RecordTypes.hpp
+2,182-050 files not shown
+4,920-256 files

LLVM/project c9fbabfclang/docs ReleaseNotes.rst, clang/lib/ASTMatchers ASTMatchersInternal.cpp

[ASTMatcher] Fix redundant macro expansion checks in getExpansionLocOfMacro (#117143)

A performance issue was descibed in #114521 

**Root Cause**: The function getExpansionLocOfMacro is responsible for
finding the expansion location of macros. When dealing with macro
parameters, it recursively calls itself to check the expansion of macro
arguments. This recursive logic redundantly checks previous macro
expansions, leading to significant performance degradation when macros
are heavily nested.
Solution
**Modification**: Track already processed macros during recursion.
Implementation Details:
Introduced a data structure to record processed macros.
Before each recursive call, check if the macro has already been
processed to avoid redundant calculations.
**Testing**: 
1. refer to #114521 
Finder->addMatcher(expr(isExpandedFromMacro("NULL")).bind("E"), this);

    [4 lines not shown]
DeltaFile
+22-6clang/lib/ASTMatchers/ASTMatchersInternal.cpp
+2-0clang/docs/ReleaseNotes.rst
+24-62 files

LLVM/project 17cfd01llvm/docs AMDGPUUsage.rst

[AMDGPU][Doc] Add `gfx950` to `gfx9-4-generic` in the document
DeltaFile
+1-1llvm/docs/AMDGPUUsage.rst
+1-11 files

LLVM/project 866b9f4llvm/lib/Target/SystemZ SystemZTargetTransformInfo.cpp, llvm/test/Analysis/CostModel/SystemZ vector-reductions.ll reduce-add.ll

[SystemZ] Add realistic cost estimates for vector reduction intrinsics (#118319)

This PR adds more realistic cost estimates for these reduction
intrinsics

- `llvm.vector.reduce.umax`
- `llvm.vector.reduce.umin`
- `llvm.vector.reduce.smax`
- `llvm.vector.reduce.smin`
- `llvm.vector.reduce.fadd`
- `llvm.vector.reduce.fmul`
- `llvm.vector.reduce.fmax`
- `llvm.vector.reduce.fmin`
- `llvm.vector.reduce.fmaximum`
- `llvm.vector.reduce.fminimum`
- `llvm.vector.reduce.mul
`
The pre-existing cost estimates for `llvm.vector.reduce.add` are moved
to `getArithmeticReductionCosts` to reduce complexity in

    [10 lines not shown]
DeltaFile
+411-0llvm/test/Transforms/SLPVectorizer/SystemZ/reductions-fmin-fmax.ll
+376-0llvm/test/Analysis/CostModel/SystemZ/vector-reductions.ll
+188-0llvm/test/Transforms/SLPVectorizer/SystemZ/reductions-fmul.ll
+188-0llvm/test/Transforms/SLPVectorizer/SystemZ/reductions-fadd.ll
+0-128llvm/test/Analysis/CostModel/SystemZ/reduce-add.ll
+75-18llvm/lib/Target/SystemZ/SystemZTargetTransformInfo.cpp
+1,238-1461 files not shown
+1,245-1467 files

LLVM/project c7babfaoffload/DeviceRTL CMakeLists.txt

[Offload] Find libc relative to DeviceRTL path (#118497)

This was discussed as a potential solution in
https://github.com/llvm/llvm-project/pull/118173
DeltaFile
+2-2offload/DeviceRTL/CMakeLists.txt
+2-21 files

LLVM/project 9ad09b2llvm/lib/Target/AMDGPU AMDGPUCodeGenPrepare.cpp

[AMDGPU] Refine AMDGPUCodeGenPrepareImpl class. NFC. (#118461)

Use references instead of pointers for most state, initialize it all in
the constructor, and common up some of the initialization between the
legacy and new pass manager paths.
DeltaFile
+91-107llvm/lib/Target/AMDGPU/AMDGPUCodeGenPrepare.cpp
+91-1071 files

LLVM/project af35e21flang/unittests/Runtime CommandTest.cpp

[flang] Update CommandTest for AIX (NFC) (#118403)

With the change in commit e335563, the behavior for `ECLGeneralErrorCommandErrorSync` 
on AIX is the same as on Linux.
DeltaFile
+0-3flang/unittests/Runtime/CommandTest.cpp
+0-31 files

LLVM/project 874b4fbllvm/lib/Target/SPIRV SPIRVEmitIntrinsics.cpp SPIRVModuleAnalysis.cpp, llvm/test/CodeGen/SPIRV/extensions SPV_INTEL_optnone.ll SPV_EXT_optnone.ll

[SPIR-V] Fix emission of debug and annotation instructions and add SPV_EXT_optnone SPIR-V extension (#118402)

This PR fixes:
* emission of OpNames (added newly inserted internal intrinsics and
basic blocks)
* emission of function attributes (SRet is added)
* implementation of SPV_INTEL_optnone so that it emits OptNoneINTEL
Function Control flag, and add implementation of the SPV_EXT_optnone
SPIR-V extension.
DeltaFile
+33-28llvm/lib/Target/SPIRV/SPIRVEmitIntrinsics.cpp
+31-5llvm/lib/Target/SPIRV/SPIRVModuleAnalysis.cpp
+9-14llvm/test/CodeGen/SPIRV/extensions/SPV_INTEL_optnone.ll
+20-0llvm/test/CodeGen/SPIRV/extensions/SPV_EXT_optnone.ll
+15-5llvm/lib/Target/SPIRV/SPIRVCallLowering.cpp
+8-6llvm/lib/Target/SPIRV/SPIRVModuleAnalysis.h
+116-589 files not shown
+146-7215 files

LLVM/project 4e6f812mlir/include/mlir-c/Dialect LLVM.h, mlir/include/mlir/Dialect/LLVMIR LLVMEnums.td

[mlir][llvm] Align linkage enum order with LLVM (NFC) (#118484)

This change doesn't introduce any functional differences but aligns the
implementation more closely with LLVM's representation. Previously, the
code generated a lookup table to map MLIR enums to LLVM enums due to the
lack of one-to-one correspondence. With this refactoring, the generated
code now casts directly from one enum to another.
DeltaFile
+21-21mlir/include/mlir/Dialect/LLVMIR/LLVMEnums.td
+9-9mlir/include/mlir-c/Dialect/LLVM.h
+30-302 files

LLVM/project db4cbe5llvm/lib/Target/SPIRV SPIRVEmitIntrinsics.cpp, llvm/test/CodeGen/SPIRV/pointers tangled-ret.ll

[SPIR-V] Fix generation of invalid SPIR-V in cases of of bitcasts between pointers and multiple null pointers used in the input LLVM IR (#118298)

This PR resolved the following issues:
(1) There are rare but possible cases when there are bitcasts between
pointers intertwined in a sophisticated way with loads, stores, function
calls and other instructions that are part of type deduction. In this
case we must account for inserted bitcasts between pointers rather than
just ignore them.
(2) Null pointers have the same constant representation but different
types. Type info from Intrinsic::spv_track_constant() refers to the
opaque (untyped) pointer, so that each MF/v-reg pair would fall into the
same Const record in Duplicate Tracker and would be represented by a
single OpConstantNull instruction, unless we use precise pointee type
info. We must be able to distinguish one constant (null) pointer from
another to avoid generating invalid code with inconsistent types of
operands.
DeltaFile
+4,673-0llvm/test/CodeGen/SPIRV/validate/sycl-tangle-group-algorithms.ll
+235-0llvm/test/CodeGen/SPIRV/pointers/tangled-ret.ll
+45-18llvm/lib/Target/SPIRV/SPIRVEmitIntrinsics.cpp
+6-5llvm/test/CodeGen/SPIRV/transcoding/OpPhi_ArgumentsPlaceholders.ll
+4,959-234 files

LLVM/project 10223c7llvm/lib/Transforms/Scalar ConstraintElimination.cpp, llvm/test/Transforms/ConstraintElimination gep-arithmetic.ll

[ConstraintElim] Use nusw flag for GEP decomposition

Check for nusw instead of inbounds when decomposing GEPs.

In this particular case, we can also look through multiple nusw
flags, because we will ultimately be working in the unsigned
constraint system.
DeltaFile
+65-0llvm/test/Transforms/ConstraintElimination/gep-arithmetic.ll
+5-5llvm/lib/Transforms/Scalar/ConstraintElimination.cpp
+70-52 files

LLVM/project a7fda0ellvm/lib/Transforms/Vectorize VPlan.h VPlanRecipes.cpp

[VPlan] Introduce VPScalarPHIRecipe, use for can & EVL IV codegen (NFC). (#114305)

Introduce a general recipe to generate a scalar phi. Lower
VPCanonicalIVPHIRecipe and VPEVLBasedIVRecipe to VPScalarIVPHIrecipe
before plan execution, avoiding the need for duplicated ::execute
implementations. There are other cases that could benefit, including
in-loop reduction phis and pointer induction phis.

Builds on a similar idea as
https://github.com/llvm/llvm-project/pull/82270.

PR: https://github.com/llvm/llvm-project/pull/114305
DeltaFile
+47-5llvm/lib/Transforms/Vectorize/VPlan.h
+22-19llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp
+21-0llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp
+8-8llvm/lib/Transforms/Vectorize/VPlanAnalysis.cpp
+3-4llvm/lib/Transforms/Vectorize/VPlan.cpp
+3-0llvm/lib/Transforms/Vectorize/VPlanTransforms.h
+104-362 files not shown
+106-368 files

LLVM/project c7e1468llvm/test/CodeGen/SPIRV/debug-info debug-type-basic.ll

[SPIR-V] Add XFAIL to the broken test (#118487)

The test case llvm/test/CodeGen/SPIRV/debug-info/debug-type-basic.ll
fails due to https://github.com/llvm/llvm-project/issues/118011
DeltaFile
+3-0llvm/test/CodeGen/SPIRV/debug-info/debug-type-basic.ll
+3-01 files

LLVM/project 57907c1clang-tools-extra/clang-tidy/bugprone ReturnConstRefFromParameterCheck.cpp, clang-tools-extra/docs ReleaseNotes.rst

[clang-tidy] ignore `[[clang::lifetimebound]]` param in return-const-ref-from-parameter (#118315)

Fixed #117696
DeltaFile
+20-9clang-tools-extra/docs/clang-tidy/checks/bugprone/return-const-ref-from-parameter.rst
+11-1clang-tools-extra/clang-tidy/bugprone/ReturnConstRefFromParameterCheck.cpp
+6-0clang-tools-extra/test/clang-tidy/checkers/bugprone/return-const-ref-from-parameter.cpp
+2-1clang-tools-extra/docs/ReleaseNotes.rst
+39-114 files

LLVM/project 8c749fflldb/source/Plugins/SymbolFile/DWARF DebugNamesDWARFIndex.cpp, lldb/test/Shell/SymbolFile/DWARF/x86 find-basic-type.cpp

[lldb] Fix "exact match" debug_names type queries (#118465)

.. in the global namespace

The problem was the interaction of #116989 with an optimization in
GetTypesWithQuery. The optimization was only correct for non-exact
matches, but that didn't matter before this PR due to the "second layer
of defense". After that was removed, the query started returning more
types than it should.
DeltaFile
+8-0lldb/test/Shell/SymbolFile/DWARF/x86/find-basic-type.cpp
+1-1lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp
+9-12 files

LLVM/project 487099cclang-tools-extra/docs/clang-tidy/checks/bugprone return-const-ref-from-parameter.rst

fix format
DeltaFile
+2-1clang-tools-extra/docs/clang-tidy/checks/bugprone/return-const-ref-from-parameter.rst
+2-11 files

LLVM/project 82f24c9clang-tools-extra/clang-tidy/bugprone ReturnConstRefFromParameterCheck.cpp, clang-tools-extra/docs ReleaseNotes.rst

[clang-tidy] ignore `[[clang::lifetimebound]]` param in return-const-ref-from-parameter
DeltaFile
+19-9clang-tools-extra/docs/clang-tidy/checks/bugprone/return-const-ref-from-parameter.rst
+11-1clang-tools-extra/clang-tidy/bugprone/ReturnConstRefFromParameterCheck.cpp
+6-0clang-tools-extra/test/clang-tidy/checkers/bugprone/return-const-ref-from-parameter.cpp
+2-1clang-tools-extra/docs/ReleaseNotes.rst
+38-114 files

LLVM/project 7802fb5clang/lib/AST/ByteCode Compiler.cpp, clang/test/AST/ByteCode vectors.cpp

[clang][bytecode] Fix `__extension__` handling for vector operators (#118482)

Don't reject them, but delegate to the subexpression.
DeltaFile
+3-0clang/lib/AST/ByteCode/Compiler.cpp
+1-0clang/test/AST/ByteCode/vectors.cpp
+4-02 files

LLVM/project e1cb316clang/docs ReleaseNotes.rst, clang/lib/AST CXXInheritance.cpp DeclCXX.cpp

Reapply "[clang] Fix name lookup for dependent bases" (#118003)

Unlike the previous version
(https://github.com/llvm/llvm-project/pull/114978), this patch also
removes an unnecessary assert that causes Clang to crash when compiling
such tests. (clang/lib/AST/DeclCXX.cpp)

https://lab.llvm.org/buildbot/#/builders/52/builds/4021

```c++
template <class T> 
class X {
public:
  X() = default;
  virtual ~X() = default;

  virtual int foo(int x, int y, T &entry) = 0;

  void bar() {

    [19 lines not shown]
DeltaFile
+46-2clang/test/CXX/drs/cwg5xx.cpp
+12-6clang/lib/AST/CXXInheritance.cpp
+3-0clang/docs/ReleaseNotes.rst
+0-2clang/lib/AST/DeclCXX.cpp
+1-1clang/www/cxx_dr_status.html
+62-115 files

LLVM/project 2a0ee09llvm/lib/Analysis IVDescriptors.cpp, llvm/lib/Transforms/Vectorize VPlanRecipes.cpp

IVDesc: strip redundant arg in getOpcode call (NFC) (#118476)

DeltaFile
+5-6llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp
+1-1llvm/lib/Analysis/IVDescriptors.cpp
+6-72 files

LLVM/project ff0babcclang/lib/AST/ByteCode Compiler.cpp, clang/test/AST/ByteCode literals.cpp

[clang][bytecode] Fix discarded pointer subtractions (#118477)

We need to pop the value.
DeltaFile
+4-1clang/lib/AST/ByteCode/Compiler.cpp
+2-0clang/test/AST/ByteCode/literals.cpp
+6-12 files

LLVM/project 8884d37llvm/lib/CodeGen MLRegAllocEvictAdvisor.cpp

MLRegAlloc: Do not use float to count number of used registers
DeltaFile
+4-5llvm/lib/CodeGen/MLRegAllocEvictAdvisor.cpp
+4-51 files

LLVM/project 51a895allvm/include/llvm/IR CmpPredicate.h Instructions.h, llvm/lib/Analysis InstructionSimplify.cpp

IR: introduce struct with CmpInst::Predicate and samesign (#116867)

Introduce llvm::CmpPredicate, an abstraction over a floating-point
predicate, and a pack of an integer predicate with samesign information,
in order to ease extending large portions of the codebase that take a
CmpInst::Predicate to respect the samesign flag.

We have chosen to demonstrate the utility of this new abstraction by
migrating parts of ValueTracking, InstructionSimplify, and InstCombine
from CmpInst::Predicate to llvm::CmpPredicate. There should be no
functional changes, as we don't perform any extra optimizations with
samesign in this patch, or use CmpPredicate::getMatching.

The design approach taken by this patch allows for unaudited callers of
APIs that take a llvm::CmpPredicate to silently drop the samesign
information; it does not pose a correctness issue, and allows us to
migrate the codebase piece-wise.
DeltaFile
+47-55llvm/lib/Analysis/InstructionSimplify.cpp
+62-0llvm/include/llvm/IR/CmpPredicate.h
+34-5llvm/include/llvm/IR/Instructions.h
+16-19llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
+19-3llvm/lib/IR/Instructions.cpp
+22-0llvm/unittests/IR/InstructionsTest.cpp
+200-827 files not shown
+228-11113 files

LLVM/project f335364llvm/lib/Transforms/InstCombine InstCombineCompares.cpp, llvm/test/Transforms/InstCombine icmp-gep.ll

[InstCombine] Support gep nuw in icmp folds (#118472)

Unsigned icmp of gep nuw folds to unsigned icmp of offsets. Unsigned
icmp of gep nusw nuw folds to unsigned samesign icmp of offsets.

Proofs: https://alive2.llvm.org/ce/z/VEwQY8
DeltaFile
+75-0llvm/test/Transforms/InstCombine/icmp-gep.ll
+27-9llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
+102-92 files

LLVM/project 81d82caclang/lib/Driver/ToolChains Flang.cpp, flang/test/Driver pp-fixed-form.f90

[flang] Treat pre-processed input as fixed (#117563)

Fixes an issue introduced by

9fb2db1e1f42 [flang] Retain spaces when preprocessing fixed-form source

Where flang -fc1 fails to parse preprocessor output because it now
remains in fixed form.
DeltaFile
+19-0flang/test/Driver/pp-fixed-form.f90
+7-0clang/lib/Driver/ToolChains/Flang.cpp
+26-02 files

LLVM/project a639312compiler-rt/lib/builtins/cpu_model x86.c, llvm/lib/TargetParser Host.cpp

[X86] Fix typo of gracemont (#118486)

DeltaFile
+1-1llvm/lib/TargetParser/Host.cpp
+1-1compiler-rt/lib/builtins/cpu_model/x86.c
+2-22 files

LLVM/project 4a6ecd3llvm/lib/Target/SPIRV SPIRVBuiltins.td SPIRVBuiltins.cpp, llvm/test/CodeGen/SPIRV/extensions/SPV_INTEL_media_block_io builtin-op-wrappers.ll cl_intel_media_block_io.ll

Add support for SPIR-V extension: SPV_INTEL_media_block_io (#118024)

This changes implements SPV_INTEL_media_block_io extension in SPIR-V
backend.
DeltaFile
+115-0llvm/test/CodeGen/SPIRV/extensions/SPV_INTEL_media_block_io/builtin-op-wrappers.ll
+115-0llvm/test/CodeGen/SPIRV/extensions/SPV_INTEL_media_block_io/cl_intel_media_block_io.ll
+19-5llvm/lib/Target/SPIRV/SPIRVBuiltins.td
+19-5llvm/lib/Target/SPIRV/SPIRVBuiltins.cpp
+7-0llvm/lib/Target/SPIRV/SPIRVModuleAnalysis.cpp
+6-0llvm/lib/Target/SPIRV/SPIRVInstrInfo.td
+281-103 files not shown
+286-119 files

LLVM/project 5f99eb9llvm/lib/Target/SPIRV SPIRVInstructionSelector.cpp SPIRVLegalizerInfo.cpp, llvm/test/CodeGen/SPIRV/pointers variables-storage-class.ll global-addrspacecast.ll

[SPIR-V] Fixup storage class for global private (#118318)

Re-land of #116636
Adds a new address spaces: hlsl_private. Variables with such address
space will be emitted with a Private storage class.
This is useful for variables global to a SPIR-V module, since up to now,
they were still emitted with a Function storage class, which is wrong.

---------

Signed-off-by: Nathan Gauër <brioche at google.com>
DeltaFile
+19-11llvm/lib/Target/SPIRV/SPIRVInstructionSelector.cpp
+17-5llvm/test/CodeGen/SPIRV/pointers/variables-storage-class.ll
+17-0llvm/test/CodeGen/SPIRV/pointers/global-addrspacecast.ll
+10-7llvm/lib/Target/SPIRV/SPIRVLegalizerInfo.cpp
+15-0llvm/test/CodeGen/SPIRV/pointers/variables-storage-class-vk.ll
+4-0llvm/lib/Target/SPIRV/SPIRVUtils.cpp
+82-231 files not shown
+86-237 files

LLVM/project 8075445llvm/test/Transforms/LoopVectorize load-deref-pred-align.ll load-deref-pred-neg-off.ll

[LoopVectorize] Add tests for dereferenceable loads in more loops (#118470)

* Adds tests for strided accesses.
* Adds tests for reverse loops.

As part of this I've moved one of the negative tests from
load-deref-pred-align.ll into a new file
(load-deref-pred-neg-off.ll) because the pointer type had a
size of 16 bits and I realised it's probably not sensible for
allocas that are >16 bits in size!
DeltaFile
+428-99llvm/test/Transforms/LoopVectorize/load-deref-pred-align.ll
+104-0llvm/test/Transforms/LoopVectorize/load-deref-pred-neg-off.ll
+532-992 files

LLVM/project 61c2ac0clang/lib/AST/ByteCode InterpBuiltin.cpp, clang/test/AST/ByteCode builtin-functions.cpp

Revert "[clang][bytecode] Handle __builtin_wcslen (#118446)"

This reverts commit 89a0ee89973c3d213c4bc11c26b41eab67e06da0.

This breaks builders:
https://lab.llvm.org/buildbot/#/builders/13/builds/3885
DeltaFile
+0-12clang/test/AST/ByteCode/builtin-functions.cpp
+1-3clang/lib/AST/ByteCode/InterpBuiltin.cpp
+1-152 files