LLVM/project 5752fb8llvm/test/tools/llvm-extract recursive.ll verify-input.ll, llvm/tools/llvm-extract llvm-extract.cpp

llvm-extract: Fix not verifying input file (#225378)

Copy the behavior from opt, and add a -disable-verify flag.
DeltaFile
+24-0llvm/test/tools/llvm-extract/verify-input.ll
+10-4llvm/test/tools/llvm-extract/recursive.ll
+11-0llvm/tools/llvm-extract/llvm-extract.cpp
+45-43 files

LLVM/project c4045dbclang/docs ReleaseNotes.md, clang/test/Sema compare.c

Revert "[Clang] Fix assertion "unsigned range includes negative?" in AnalyzeComparison during Sema of vector comparison with mismatched signed/unsigned types and __builtin_convertvector " (#225389)

Reverts llvm/llvm-project#182627

Post-commit CI found issues:
https://lab.llvm.org/buildbot/#/builders/225/builds/19103
DeltaFile
+2-60clang/test/Sema/compare.c
+0-5clang/docs/ReleaseNotes.md
+2-652 files

LLVM/project 25aac60llvm/utils/lit/lit TestRunner.py, llvm/utils/lit/lit/builtin_commands cat.py diff.py

[lit] Use text mode when opening text files on z/OS (#217434)

On z/OS, we rely on autoconversion to read files correctly, and this
requires files to be opened as text.

The following change https://github.com/llvm/llvm-project/pull/208024
changed the streams to be read and piped as binary resulting in some
test regressions due to unreadable output. This patch restores the
functionality of opening and reading as a text stream.
DeltaFile
+14-2llvm/utils/lit/lit/builtin_commands/diff.py
+11-2llvm/utils/lit/lit/builtin_commands/cat.py
+3-1llvm/utils/lit/lit/TestRunner.py
+28-53 files

LLVM/project 435e0fdllvm/test/Analysis/UniformityAnalysis/AMDGPU control-flow-intrinsics.ll branch-after-join.ll

AMDGPU: Use subarch triples in uniformity analysis tests
DeltaFile
+2-2llvm/test/Analysis/UniformityAnalysis/AMDGPU/inline-asm.ll
+1-1llvm/test/Analysis/UniformityAnalysis/AMDGPU/control-flow-intrinsics.ll
+1-1llvm/test/Analysis/UniformityAnalysis/AMDGPU/branch-after-join.ll
+1-1llvm/test/Analysis/UniformityAnalysis/AMDGPU/b42473-r1-crash.ll
+1-1llvm/test/Analysis/UniformityAnalysis/AMDGPU/atomics.ll
+1-1llvm/test/Analysis/UniformityAnalysis/AMDGPU/always_uniform.ll
+7-728 files not shown
+35-3534 files

LLVM/project 96f08d9llvm/lib/Target/PISA PISAInstructionSelector.cpp, llvm/test/CodeGen/PISA/GlobalISel inst-select-build-vector-v64.mir inst-select-constant-float-type.mir

Add PISAInstructionSelector

Add the PISAInstructionSelector, the final Subtarget/TargetMachine
wiring, and selection tests.
DeltaFile
+1,794-0llvm/lib/Target/PISA/PISAInstructionSelector.cpp
+103-0llvm/test/CodeGen/PISA/GlobalISel/inst-select-cttz.mir
+103-0llvm/test/CodeGen/PISA/GlobalISel/inst-select-ctlz.mir
+41-0llvm/test/CodeGen/PISA/GlobalISel/inst-select-debug-trace.mir
+36-0llvm/test/CodeGen/PISA/GlobalISel/inst-select-constant-float-type.mir
+24-0llvm/test/CodeGen/PISA/GlobalISel/inst-select-build-vector-v64.mir
+2,101-03 files not shown
+2,112-39 files

LLVM/project 71183callvm/lib/Target/PISA PISAInstructionSelector.cpp, llvm/test/CodeGen/PISA/GlobalISel inst-select-ctlz.mir inst-select-constant-float-type.mir

Apply fixes following review comments in earlier PRs
DeltaFile
+192-134llvm/lib/Target/PISA/PISAInstructionSelector.cpp
+30-0llvm/test/CodeGen/PISA/GlobalISel/inst-select-fcanonicalize.mir
+2-5llvm/test/CodeGen/PISA/GlobalISel/inst-select-debug-trace.mir
+1-1llvm/test/CodeGen/PISA/GlobalISel/inst-select-ctlz.mir
+1-1llvm/test/CodeGen/PISA/GlobalISel/inst-select-constant-float-type.mir
+1-1llvm/test/CodeGen/PISA/GlobalISel/inst-select-build-vector-v64.mir
+227-1421 files not shown
+228-1437 files

LLVM/project b4ced13llvm/lib/Target/PISA PISAInstructionSelector.cpp

Add getAPFloatFromSize helper
DeltaFile
+14-0llvm/lib/Target/PISA/PISAInstructionSelector.cpp
+14-01 files

LLVM/project dfd6ce3llvm/lib/Target/PISA PISAInstructionSelector.cpp, llvm/test/CodeGen/PISA/GlobalISel inst-select-unknown-fence.ll

Use MI.emitGenericError for an unsupported fence syncscope
DeltaFile
+21-0llvm/test/CodeGen/PISA/GlobalISel/inst-select-unknown-fence.ll
+4-2llvm/lib/Target/PISA/PISAInstructionSelector.cpp
+25-22 files

LLVM/project cec2eebclang/docs ReleaseNotes.md, clang/test/Sema compare.c

[Clang] Fix assertion "unsigned range includes negative?" in AnalyzeComparison during Sema of vector comparison with mismatched signed/unsigned types and __builtin_convertvector  (#182627)

The ``TryGetExprRange`` function now checks if the operand is an unsigned
vector when computing the ranges.

Fixes #173614
DeltaFile
+60-2clang/test/Sema/compare.c
+5-0clang/docs/ReleaseNotes.md
+65-22 files

LLVM/project 3bdb62ellvm/lib/Target/PISA PISAPreLegalizerCombiner.cpp, llvm/test/CodeGen/PISA/GlobalISel prelegalizer-i1.mir

Fix PISAPreLegalizerCombiner
DeltaFile
+27-0llvm/test/CodeGen/PISA/GlobalISel/prelegalizer-i1.mir
+5-6llvm/lib/Target/PISA/PISAPreLegalizerCombiner.cpp
+32-62 files

LLVM/project c3ea7c1llvm/lib/IR Constants.cpp, llvm/test/CodeGen/AMDGPU lower-lds-struct-aa.ll lower-kernel-and-module-lds.ll

[IR] Add ConstantExpr::getGetElementPtr() accepting DataLayout (#224652)

This overload takes GEP indices but produces a canonical i8 GEP in
ptradd representation. This is intended as a simple migration path for
places currently using `ConstantExpr::getGetElementPtr()` which cannot
be trivially replaced by `ConstantExpr::getPtrAdd()`.

This method is fallible, because something like `(getelementptr i32, ptr
@p, i64 CONST_EXPR)` can't be represented in ptradd form, because there
is no multiply constant expression. Not supporting this for constant
expressions is intentional, as we would not be able to emit a
relocatable expression for this anyway.

I have migrated a couple of sample usages in this PR. These are all
simple usages where the fallibility is not relevant.

The further plan here is to migrate everything (including IRBuilder) to
this new API, and then deprecated the one without the DataLayout
argument.
DeltaFile
+64-66llvm/test/CodeGen/AMDGPU/machine-sink-temporal-divergence-swdev407790.ll
+76-0llvm/lib/IR/Constants.cpp
+55-0llvm/unittests/IR/ConstantsTest.cpp
+8-8llvm/test/CodeGen/AMDGPU/amdgpu-sw-lower-lds-static-lds-test-memintrinsic-asan.ll
+6-6llvm/test/CodeGen/AMDGPU/lower-lds-struct-aa.ll
+6-6llvm/test/CodeGen/AMDGPU/lower-kernel-and-module-lds.ll
+215-8649 files not shown
+367-21755 files

LLVM/project 7b05596llvm/lib/Target/AMDGPU AMDGPUInstCombineIntrinsic.cpp, llvm/test/Transforms/InstCombine/AMDGPU llvm.amdgcn.dot.ll

[AMDGPU][InstCombine] Fold zero dot operands to accumulator

Fold AMDGPU dot intrinsics when either operand is zero.

`dot(a, 0) = 0` and `dot(0, b) = 0`, so replace the intrinsic with its accumulator.
This avoids unrelated clamp and add/sub reassociation cases.
DeltaFile
+15-30llvm/test/Transforms/InstCombine/AMDGPU/llvm.amdgcn.dot.ll
+3-0llvm/lib/Target/AMDGPU/AMDGPUInstCombineIntrinsic.cpp
+18-302 files

LLVM/project 7d40782llvm/lib/Target/AMDGPU AMDGPUInstCombineIntrinsic.cpp

Add comment
DeltaFile
+1-0llvm/lib/Target/AMDGPU/AMDGPUInstCombineIntrinsic.cpp
+1-01 files

LLVM/project 481cacellvm/lib/Target/AMDGPU AMDGPUInstCombineIntrinsic.cpp, llvm/test/Transforms/InstCombine/AMDGPU llvm.amdgcn.dot.ll

[AMDGPU][InstCombine] Canonicalize dot constant operands

Move constant dot product source operands to the right hand side
and add tests for signed and unsigned dot intrinsics.
DeltaFile
+12-12llvm/test/Transforms/InstCombine/AMDGPU/llvm.amdgcn.dot.ll
+9-0llvm/lib/Target/AMDGPU/AMDGPUInstCombineIntrinsic.cpp
+21-122 files

LLVM/project d398cafllvm/lib/Target/AMDGPU AMDGPUInstCombineIntrinsic.cpp, llvm/test/Transforms/InstCombine/AMDGPU llvm.amdgcn.dot.ll

[AMDGPU][InstCombine] Fold constant add/sub into the dot accumulator

`amdgcn.{s,u}dot{2,4,8}(a, b, C) +/- K -> dot(a, b, C +/- K)` when both the
accumulator C and K are constants. The new constant is computed with
wrapping APInt arithmetic to match the non-clamping accumulate.

Only applies when clamp is false (the saturating accumulate does not
reassociate) and the dot has a single use. K - dot is left alone since it
would need the dot product negated.
DeltaFile
+33-66llvm/test/Transforms/InstCombine/AMDGPU/llvm.amdgcn.dot.ll
+38-0llvm/lib/Target/AMDGPU/AMDGPUInstCombineIntrinsic.cpp
+71-662 files

LLVM/project 8fec02cllvm/lib/Target/AMDGPU AMDGPUInstCombineIntrinsic.cpp

Update code
DeltaFile
+4-14llvm/lib/Target/AMDGPU/AMDGPUInstCombineIntrinsic.cpp
+4-141 files

LLVM/project bd04937llvm/lib/Target/AMDGPU AMDGPUInstCombineIntrinsic.cpp

Update
DeltaFile
+3-3llvm/lib/Target/AMDGPU/AMDGPUInstCombineIntrinsic.cpp
+3-31 files

LLVM/project db283f6llvm/lib/Target/AMDGPU AMDGPUInstCombineIntrinsic.cpp

Update for comments
DeltaFile
+3-3llvm/lib/Target/AMDGPU/AMDGPUInstCombineIntrinsic.cpp
+3-31 files

LLVM/project 922809acmake/Modules GetTripleCMakeSystemName.cmake, llvm/include/llvm/TargetParser TripleName.def

TargetParser: Move triple to CMake system name mapping into CMake

Reimplement the triple -> CMAKE_SYSTEM_NAME derivation added in #208773
entirely in CMake, dropping the Python script it introduced.

The previous mechanism widened TRIPLE_OS/TRIPLE_ENV in TripleName.def with
a CMake system name column and parsed it from a Python helper invoked by
CMake at configure time. Two problems motivated this rework:

 - The CMake system name is a property of CMake (and can vary by CMake
   version), not of llvm::Triple, so it does not belong in the shared
   triple name table. The C++ never consumed the added column.
 - Invoking Python from CMake at configure time is an unwanted build
   dependency, and the Python-driven lit test broke Windows bots where the
   interpreter path contains a space.

Revert the TripleName.def/Triple.cpp column back to the two-argument
macros, delete the Python script and its unittest, and reimplement the
mapping as a self-contained pure-CMake module. The classification still

    [6 lines not shown]
DeltaFile
+110-118llvm/include/llvm/TargetParser/TripleName.def
+208-0llvm/test/tools/TargetParser/get-triple-cmake-system-name.cmake
+0-206llvm/test/tools/TargetParser/get_triple_system_name_test.py
+147-15cmake/Modules/GetTripleCMakeSystemName.cmake
+0-148llvm/utils/get_triple_system_name.py
+5-4llvm/test/tools/TargetParser/get-triple-system-name.test
+470-4913 files not shown
+476-4959 files

LLVM/project aff1ba1llvm/lib/Target/X86 X86InstrInfo.cpp, llvm/test/CodeGen/X86 lzcnt-cmp-null-deref.mir

[X86] Fix null dereference in optimizeCompareInstr after lzcnt/tzcnt (#224282)

#210069 added `LTZCNTInst` to the exit condition of the backward scan of
`optimizeCompareInstr()`:

```c++
    if (MI || Sub || LTZCNTInst)
      break;
```

but it assigns `MI = LTZCNTInst` only inside the *forward* scan's
"EFLAGS is
used by this instruction" branch. When the forward scan never reaches
that
branch, both `MI` and `Sub` stay null.
However later code was built on the idea that one of them is not null.
 
Added a MIR test that would crash before but gets fixed by this
additional check.

Used AI for code review and comment/PR/test formatting/writing
DeltaFile
+54-0llvm/test/CodeGen/X86/lzcnt-cmp-null-deref.mir
+11-0llvm/lib/Target/X86/X86InstrInfo.cpp
+65-02 files

LLVM/project f7b5b43llvm/test/tools/llvm-extract recursive.ll verify-input.ll, llvm/tools/llvm-extract llvm-extract.cpp

llvm-extract: Fix not verifying input file

Copy the behavior from opt, and add a -disable-verify flag.
DeltaFile
+24-0llvm/test/tools/llvm-extract/verify-input.ll
+10-4llvm/test/tools/llvm-extract/recursive.ll
+11-0llvm/tools/llvm-extract/llvm-extract.cpp
+45-43 files

LLVM/project dc3d1a8llvm/lib/Transforms/Vectorize SLPVectorizer.cpp, llvm/test/Transforms/SLPVectorizer/X86 reduction-same-vals-i1.ll

[SLP]Fix APInt assertion in emitReusedOps for narrow types

The repeat count of a reused scalar may not fit the reduction element
type (e.g. count 2 in i1), tripping the APInt isUIntN assertion when
building the to-mul scale constant. Truncate the count to the element
bitwidth; the modular reduction arithmetic keeps the result equivalent.

Fixes #225279

Reviewers: 

Pull Request: https://github.com/llvm/llvm-project/pull/225376
DeltaFile
+23-0llvm/test/Transforms/SLPVectorizer/X86/reduction-same-vals-i1.ll
+5-1llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
+28-12 files

LLVM/project b5b5930llvm/test/CodeGen/PISA asm-printer-unsupported-vector-hint-fp128.ll

Add asm-printer-unsupported-vector-hint-fp128.ll test
DeltaFile
+11-0llvm/test/CodeGen/PISA/asm-printer-unsupported-vector-hint-fp128.ll
+11-01 files

LLVM/project e2e49e7flang/lib/Semantics resolve-names.cpp, flang/test/Semantics/CUDA cuda-pinned-implicit-modfile.cuf

[flang][cuda] Record implicit pinned attribution in module files

Under -gpu=mem:pinned an unattributed ALLOCATABLE is attributed as pinned by
the compiler, the same way -gpu=mem:managed attributes one as managed, but
only the latter recorded that it had done so. The module file therefore spelled
an implicitly applied PINNED the same as one the user wrote, and a reader
treated it as a user requirement: adding -gpu=mem:pinned to a module's build
rejected its OpenACC-only consumers over an attribute the user never wrote.

Record the attribution for pinned as well, so it is written as
PINNED(IMPLICIT) and consumers can tell the two apart.
DeltaFile
+42-0flang/test/Semantics/CUDA/cuda-pinned-implicit-modfile.cuf
+3-1flang/lib/Semantics/resolve-names.cpp
+45-12 files

LLVM/project 11b427bflang/docs ModFiles.md, flang/include/flang/Parser parse-tree.h

[flang][cuda] Record implicit managed attribution in module files (#224601)

An implicit attribute the compiler applied under `-gpu=mem:managed` is
written into the module file the same way a user-written one is, so a
reader cannot tell them apart. It then treats the attribute as a user
requirement: allocating such a component in a DEVICE object is rejected,
and the memory space the user did ask for on the object no longer wins.

Spell the distinction in the module file as `MANAGED(IMPLICIT)`,
modelled on `INTENT(IN)`: CUDA-data-attr gains an optional parenthesized
qualifier, carried by a new CUDADataAttrSpec parse-tree node in AttrSpec
and ComponentAttrSpec. ATTRIBUTES(...) keeps the bare attribute, so the
qualifier cannot be written there.

The attribute itself is still written out, so a component keeps the same
memory space no matter which options a consumer is compiled with.

Also stop an implicitly applied attribute from making a module a definer
of CUDA symbols. Without this, adding `-gpu=mem:managed` to a module's
build rejects its OpenACC-only consumers over an attribute the user
never wrote.
DeltaFile
+90-0flang/test/Semantics/CUDA/cuda-managed-implicit-modfile.cuf
+29-9flang/lib/Semantics/resolve-names.cpp
+23-3flang/lib/Semantics/mod-file.cpp
+22-1flang/docs/ModFiles.md
+13-2flang/include/flang/Parser/parse-tree.h
+11-2flang/lib/Parser/Fortran-parsers.cpp
+188-175 files not shown
+207-2211 files

LLVM/project 3260594llvm/test/CodeGen/PISA asm-printer-special-globals.ll

Add asm-printer-special-globals.ll to test isIgnoredIntrinsicGlobal
DeltaFile
+48-0llvm/test/CodeGen/PISA/asm-printer-special-globals.ll
+48-01 files

LLVM/project 50f8187llvm/lib/Transforms/Vectorize SLPVectorizer.cpp, llvm/test/Transforms/SLPVectorizer/X86 runtime-alias-checks.ll

[SLP]Fix SCEV type mismatch when a checked base crosses a cross-width addrspacecast

getUnderlyingObject strips addrspacecast, so a base object can have a
different address type than the access pointer, mixing SCEV types in the
bounds computation.

Fixes #225280

Reviewers: 

Pull Request: https://github.com/llvm/llvm-project/pull/225374
DeltaFile
+62-0llvm/test/Transforms/SLPVectorizer/X86/runtime-alias-checks.ll
+6-0llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
+68-02 files

LLVM/project aea9d3fclang/test/Sema constant-builtins-2.c

[clang][bytecode] Add a bytecode RUN line for constant-builtins-2.c (#225305)

So changes to this file correctly trigger changes to the bytecode
interpreter.
DeltaFile
+1-0clang/test/Sema/constant-builtins-2.c
+1-01 files

LLVM/project 207eb29llvm/lib/Target/PISA PISAAsmPrinter.cpp, llvm/test/CodeGen/PISA asm-printer-annotation-globals.ll

Remove the user scan and add a test
DeltaFile
+19-0llvm/test/CodeGen/PISA/asm-printer-annotation-globals.ll
+0-18llvm/lib/Target/PISA/PISAAsmPrinter.cpp
+19-182 files

LLVM/project 0c660acllvm/lib/Target/PISA PISAAsmPrinter.cpp

Document why AsmPrinter::emitGlobalConstant is not used
DeltaFile
+4-0llvm/lib/Target/PISA/PISAAsmPrinter.cpp
+4-01 files