LLVM/project 5c213a9clang/lib/AST/ByteCode InterpBuiltin.cpp, clang/test/AST/ByteCode builtin-align-cxx.cpp

[clang][bytecode] Fix crash on __builtin_align_up with one-past-end pointers (#178652)

## Summary
Fix assertion failure when evaluating
`__builtin_align_up`/`__builtin_align_down`/`__builtin_is_aligned` with
one-past-end pointers like `&array[size]`.

## Root Cause
`getIndex()` calls `getOffset()` which asserts when `Offset ==
PastEndMark`. This happens for one-past-end element pointers.

## Fix
Check `isElementPastEnd()` before calling `getIndex()`. For past-end
pointers, use `getNumElems()` instead which gives the correct index
value.

## Test
Added test cases in `builtin-align-cxx.cpp` for one-past-end pointer
alignment.

Fixes #178647
DeltaFile
+4-1clang/lib/AST/ByteCode/InterpBuiltin.cpp
+3-0clang/test/AST/ByteCode/builtin-align-cxx.cpp
+7-12 files

LLVM/project f162306llvm/lib/Transforms/InstCombine InstCombineCasts.cpp, llvm/test/Transforms/InstCombine bitcast-select-const-vector.ll copysign.ll

InstCombine: Fold bitcast of vector with constant to scalar

Fold bitcast (select cond, val, const) ->
  select cond, (bitcast val), (bitcast const)

Rocm device libs has an unfortunate amount of code that does bithacking
on the sign bit of double values by casting to <2 x i32> and operation
on the high element. This breaks value tracking optimizations on the
fp value.

The existing transform would only do this if the input to the select was
also a bitcast with a single use, and if it didn't convert between vector
and scalar.
DeltaFile
+58-0llvm/test/Transforms/InstCombine/bitcast-select-const-vector.ll
+8-1llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp
+3-4llvm/test/Transforms/InstCombine/copysign.ll
+3-3llvm/test/Transforms/InstCombine/fold-bin-operand.ll
+72-84 files

LLVM/project 8904aa4mlir/include/mlir/Dialect/SCF/IR SCFOps.td, mlir/include/mlir/Interfaces ControlFlowInterfaces.td

[mlir][Interfaces] Add `mustProgress` interface method + folding pattern
DeltaFile
+73-30mlir/lib/Interfaces/ControlFlowInterfaces.cpp
+51-0mlir/test/Dialect/SCF/canonicalize.mlir
+45-3mlir/lib/Dialect/SCF/IR/SCF.cpp
+38-0mlir/lib/Dialect/UB/IR/UBOps.cpp
+11-6mlir/include/mlir/Dialect/SCF/IR/SCFOps.td
+12-0mlir/include/mlir/Interfaces/ControlFlowInterfaces.td
+230-397 files not shown
+264-4513 files

LLVM/project 871e165mlir/include/mlir/Dialect/SCF/IR SCFOps.td, mlir/include/mlir/Dialect/UB/IR UBOps.h

[mlir][Interfaces] Add `mustProgress` interface method + folding pattern
DeltaFile
+73-30mlir/lib/Interfaces/ControlFlowInterfaces.cpp
+51-0mlir/test/Dialect/SCF/canonicalize.mlir
+45-3mlir/lib/Dialect/SCF/IR/SCF.cpp
+38-0mlir/lib/Dialect/UB/IR/UBOps.cpp
+11-6mlir/include/mlir/Dialect/SCF/IR/SCFOps.td
+12-0mlir/include/mlir/Dialect/UB/IR/UBOps.h
+230-397 files not shown
+262-4313 files

LLVM/project 09c4046llvm/utils/gn/secondary/clang-tools-extra/clang-tidy/modernize BUILD.gn

[gn build] Port 8c575312fc49
DeltaFile
+1-0llvm/utils/gn/secondary/clang-tools-extra/clang-tidy/modernize/BUILD.gn
+1-01 files

LLVM/project 8c57531clang-tools-extra/clang-tidy/modernize UseStructuredBindingCheck.cpp UseStructuredBindingCheck.h, clang-tools-extra/docs ReleaseNotes.rst

[clang-tidy] Add new check `modernize-use-structured-binding` (#158462)

This check detect code which can be transfered to c++17 structured
binding, and provides fix-it.

Limitations:

1. Ignore variables with attributes or qualifiers except `const` and `&`
since it's not very common:
```
static auto pair = getPair(); // no warning from this check
static int b = pair.first;
static int c = pair.second;
```
2. Some possibly convertable case:

(1)
```
const auto& results = mapping.try_emplace("hello!"); 

    [27 lines not shown]
DeltaFile
+883-0clang-tools-extra/test/clang-tidy/checkers/modernize/use-structured-binding.cpp
+405-0clang-tools-extra/clang-tidy/modernize/UseStructuredBindingCheck.cpp
+83-0clang-tools-extra/docs/clang-tidy/checks/modernize/use-structured-binding.rst
+62-0clang-tools-extra/test/clang-tidy/checkers/modernize/Inputs/use-structured-binding/fake_std_pair_tuple.h
+34-0clang-tools-extra/clang-tidy/modernize/UseStructuredBindingCheck.h
+6-0clang-tools-extra/docs/ReleaseNotes.rst
+1,473-03 files not shown
+1,478-09 files

LLVM/project c84b4c0mlir/include/mlir/Bindings/Python IRCore.h

Narrow down crash on Windows CI...
DeltaFile
+1-1mlir/include/mlir/Bindings/Python/IRCore.h
+1-11 files

LLVM/project e6fc15emlir/include/mlir-c/Dialect Transform.h, mlir/lib/Bindings/Python DialectTransform.cpp

Proper MemoryEffectsOpInterface impl for rewriting transform op
DeltaFile
+14-0mlir/lib/Bindings/Python/DialectTransform.cpp
+10-0mlir/lib/CAPI/Dialect/Transform.cpp
+8-0mlir/include/mlir-c/Dialect/Transform.h
+8-0mlir/test/python/dialects/transform_op_interface.py
+40-04 files

LLVM/project 7955e47mlir/lib/Bindings/Python IRInterfaces.cpp

Opview from memoryeffectsinterface
DeltaFile
+5-1mlir/lib/Bindings/Python/IRInterfaces.cpp
+5-11 files

LLVM/project a5ccedamlir/python/mlir/dialects ext.py

Formatting
DeltaFile
+0-2mlir/python/mlir/dialects/ext.py
+0-21 files

LLVM/project 0cd0c11mlir/include/mlir/Bindings/Python IRCore.h, mlir/lib/IR OperationSupport.cpp

Address Pragma's comments
DeltaFile
+8-4mlir/python/mlir/dialects/ext.py
+1-1mlir/lib/IR/OperationSupport.cpp
+1-1mlir/include/mlir/Bindings/Python/IRCore.h
+10-63 files

LLVM/project 3124b82mlir/include/mlir-c IR.h, mlir/include/mlir-c/Dialect Transform.h

Forgo MlirOpResult type -> keep to documented practice
DeltaFile
+8-3mlir/lib/CAPI/Dialect/Transform.cpp
+0-9mlir/lib/CAPI/IR/IR.cpp
+2-2mlir/lib/Bindings/Python/DialectTransform.cpp
+0-4mlir/include/mlir-c/IR.h
+1-1mlir/include/mlir-c/Dialect/Transform.h
+0-1mlir/include/mlir/Bindings/Python/IRCore.h
+11-201 files not shown
+11-217 files

LLVM/project 57e046emlir/lib/Bindings/Python DialectTransform.cpp, mlir/python/mlir/dialects ext.py

Formatting and minor load change
DeltaFile
+3-9mlir/python/mlir/dialects/ext.py
+6-3mlir/lib/Bindings/Python/DialectTransform.cpp
+9-122 files

LLVM/project 3b0ecd2mlir/include/mlir-c/Dialect Transform.h, mlir/lib/Bindings/Python DialectTransform.cpp

New rewriter test and general cleanup
DeltaFile
+96-35mlir/test/python/dialects/transform_op_interface.py
+18-5mlir/lib/Bindings/Python/DialectTransform.cpp
+7-0mlir/lib/CAPI/Dialect/Transform.cpp
+5-0mlir/include/mlir-c/Dialect/Transform.h
+126-404 files

LLVM/project 9eedb87mlir/test/python/dialects transform_op_interface.py

More tests
DeltaFile
+285-14mlir/test/python/dialects/transform_op_interface.py
+285-141 files

LLVM/project 5d7aaebmlir/python/mlir/dialects ext.py, mlir/test/python/dialects transform_op_interface.py

Another ext.py fix
DeltaFile
+2-2mlir/python/mlir/dialects/ext.py
+1-1mlir/test/python/dialects/transform_op_interface.py
+3-32 files

LLVM/project c772675mlir/test/python/dialects transform_op_interface.py

Add docstrings to tests
DeltaFile
+23-2mlir/test/python/dialects/transform_op_interface.py
+23-21 files

LLVM/project 47ba0e3mlir/include/mlir-c/Dialect Transform.h, mlir/test/python/dialects transform_op_interface.py

Format fix
DeltaFile
+8-4mlir/test/python/dialects/transform_op_interface.py
+1-1mlir/include/mlir-c/Dialect/Transform.h
+9-52 files

LLVM/project e536ce9mlir/lib/Bindings/Python DialectTransform.cpp Globals.cpp, mlir/python/mlir/dialects ext.py

Switch to op def DSL and add more tests
DeltaFile
+235-350mlir/test/python/dialects/transform_op_interface.py
+25-12mlir/python/mlir/dialects/ext.py
+12-4mlir/lib/Bindings/Python/DialectTransform.cpp
+1-2mlir/lib/Bindings/Python/Globals.cpp
+273-3684 files

LLVM/project 6ede52fmlir/include/mlir-c/Dialect Transform.h, mlir/lib/Bindings/Python DialectTransform.cpp IRInterfaces.cpp

[MLIR][Python] Expose TransformOpInterface and MemoryEffectsOpInterfaces

Enables implementing these two interfaces from Python through defining
the relevant methods on a Python class which then serve as callbacks for
a new FallbackModel C++ class that acts as a "trampoline" to Python for
when the Interface's methods are called from C++. Like in the C++
codebase, these FallbackModels are a late-binding mechanism which can be
attached to an operation after its definition.
DeltaFile
+252-0mlir/test/python/dialects/transform_op_interface.py
+248-2mlir/lib/Bindings/Python/DialectTransform.cpp
+196-0mlir/lib/CAPI/Dialect/Transform.cpp
+55-128mlir/lib/Bindings/Python/IRInterfaces.cpp
+156-0mlir/lib/Bindings/Python/IRInterfaces.h
+135-0mlir/include/mlir-c/Dialect/Transform.h
+1,042-13014 files not shown
+1,345-19420 files

LLVM/project c489637mlir/include/mlir/Bindings/Python IRCore.h

Narrow down crash on Windows CI...
DeltaFile
+1-1mlir/include/mlir/Bindings/Python/IRCore.h
+1-11 files

LLVM/project 532d96fclang-tools-extra/clangd/index/remote Client.cpp, clang-tools-extra/clangd/index/remote/monitor Monitor.cpp

[clangd] fix compilation errors with newer versions of gRPC (#67258)

in recent versions of gRPC, header files with prefix `grpc++` are
deprecated.

gRPC headers in include/grpc++ are deprecated since gRPC 1.10.0
https://github.com/grpc/grpc/releases/tag/v1.10.0 , this PR should close
https://github.com/clangd/clangd/issues/1603

Co-authored-by: Thibault Monnier <97551402+Thibault-Monnier at users.noreply.github.com>
DeltaFile
+3-3clang-tools-extra/clangd/index/remote/server/Server.cpp
+1-1clang-tools-extra/clangd/index/remote/Client.cpp
+1-1clang-tools-extra/clangd/index/remote/monitor/Monitor.cpp
+5-53 files

LLVM/project e1e9b0cllvm/include/llvm/IR IRBuilder.h

[NFC] To fix comment in the code as getIntN no longer does truncation. (#178834)

The comment of `getIntN` says it may truncate the result. However, PR
#171456 changed the default of truncation of `ConstantInt::get` to
false, so it no longer truncates. Fix the comments to reflect the
change.
DeltaFile
+1-2llvm/include/llvm/IR/IRBuilder.h
+1-21 files

LLVM/project b6d6af9clang/test/SemaCXX warn-thread-safety-analysis.cpp

Thread Safety Analysis: Add test for alias reassignment through pointer-to-pointer (#179028)

Alias reassignment through pointer-to-pointer (nor ptr-to-ptr-to-ptr...)
does not invalidate an alias for now. While this may result in either
false positives or negatives, there's rarely a good reason not to just
do direct assignment within the same scope.

For the time being, we retain this as a deliberate "escape hatch":
specifically, this may be used to help the alias analysis to "see
through" complex helper macros that e.g. read a value (such as a
pointer) via inline assembly or other opaque helpers [1].

Add a test to document the current behaviour.

NFC.

[1] https://lore.kernel.org/all/20260130132951.2714396-1-elver@google.com/
DeltaFile
+21-0clang/test/SemaCXX/warn-thread-safety-analysis.cpp
+21-01 files

LLVM/project 012d973mlir/lib/Conversion/PDLToPDLInterp PDLToPDLInterp.cpp, mlir/test/Conversion/PDLToPDLInterp pdl-to-pdl-interp-rewriter.mlir

[mlir][PDL] PDLToPDLInterp: Use the pdl pattern name in the generated rewriter. (#149481)

Before, the rewriters generated by `convert-pdl-to-pdl-interp` had a
generic `"pdl_generated_rewriter"` name. With this change, the name from
the original pdl pattern is kept for the rewriter. This makes it easier
to relate the two.

---------

Co-authored-by: Mehdi Amini <joker-eph at gmail.com>
DeltaFile
+27-0mlir/test/Conversion/PDLToPDLInterp/pdl-to-pdl-interp-rewriter.mlir
+5-2mlir/lib/Conversion/PDLToPDLInterp/PDLToPDLInterp.cpp
+32-22 files

LLVM/project dd89c40llvm/test/CodeGen/AArch64 ptrauth-intrinsic-auth-resign-with-blend.ll

Add crash reproducer as a test case
DeltaFile
+27-0llvm/test/CodeGen/AArch64/ptrauth-intrinsic-auth-resign-with-blend.ll
+27-01 files

LLVM/project 317f7d4llvm/lib/DWARFCFIChecker DWARFCFIState.cpp, llvm/lib/DebugInfo/CodeView DebugStringTableSubsection.cpp

[perf] Replace copy-assign by move-assign in llvm/lib/DWARFCFIChecker… (#178174)

… and llvm/lib/DebugInfo/*
DeltaFile
+1-1llvm/lib/DWARFCFIChecker/DWARFCFIState.cpp
+1-1llvm/lib/DebugInfo/CodeView/DebugStringTableSubsection.cpp
+2-22 files

LLVM/project c700c2dllvm/lib/Analysis ValueTracking.cpp, llvm/test/Transforms/Attributor/AMDGPU nofpclass-amdgcn-trig-preop.ll

AMDGPU: Implement computeKnownFPClass for llvm.amdgcn.trig.preop

Surprisingly this doesn't consider the special cases, and literally
just extracts the exponent and proceeds as normal.
DeltaFile
+12-0llvm/test/Transforms/Attributor/AMDGPU/nofpclass-amdgcn-trig-preop.ll
+4-0llvm/lib/Analysis/ValueTracking.cpp
+16-02 files

LLVM/project c9a865allvm/lib/Target/AMDGPU AMDGPUInstCombineIntrinsic.cpp, llvm/test/Transforms/InstCombine/AMDGPU amdgcn-intrinsics.ll

AMDGPU: Fix incorrect fold of undef for llvm.amdgcn.trig.preop

We were folding undef inputs to qnan which is incorrect. The instruction
never returns nan. Out of bounds segment select will return 0, so fold
undef segment to 0.
DeltaFile
+29-28llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-intrinsics.ll
+18-18llvm/lib/Target/AMDGPU/AMDGPUInstCombineIntrinsic.cpp
+47-462 files

LLVM/project 02d786fflang/test/Integration/OpenMP map-types-and-sizes.f90, mlir/lib/Target/LLVMIR/Dialect/OpenMP OpenMPToLLVMIRTranslation.cpp

[OpenMP][MLIR] Modify lowering OpenMP Dialect lowering to support attach mapping

This PR adjusts the LLVM-IR lowering to support the new attach map type that the runtime
uses to link data and pointer together, this swaps the mapping from the older
OMP_MAP_PTR_AND_OBJ map type in most cases and allows slightly more complicated ref_ptr/ptee
and attach semantics.
DeltaFile
+292-220mlir/lib/Target/LLVMIR/Dialect/OpenMP/OpenMPToLLVMIRTranslation.cpp
+364-0mlir/test/Target/LLVMIR/omptarget-host-ref-semantics.mlir
+100-115flang/test/Integration/OpenMP/map-types-and-sizes.f90
+32-48mlir/test/Target/LLVMIR/omptarget-record-type-with-ptr-member-host.mlir
+70-0offload/test/offloading/fortran/map_attach_always.f90
+55-0offload/test/offloading/fortran/map_attach_never.f90
+913-38310 files not shown
+1,047-42516 files