Skip to content

Conversation

@bubblepipe
Copy link

@bubblepipe bubblepipe commented Aug 1, 2025

LLVM 21.0.0 RC2 Migration Notes

This document tracks important changes made during the upgrade from LLVM 21-init to RC2.

RISC-V Backend Changes

CONFIG Instruction Encoding Fix

Issue: The CONFIG_LD, CONFIG_ST, CONFIG_EX, and CONFIG_NORM instructions in RISCVInstrInfoBuddyExt.td had identical encodings (all using func7=0b0000000), causing TableGen disassembler conflicts.

Fix: Assigned unique func7 values to each instruction:

  • CONFIG_LD: func7 = 0b0010110 (was 0b0000000)
  • CONFIG_ST: func7 = 0b0010111 (was 0b0000000)
  • CONFIG_EX: func7 = 0b0011000 (was 0b0000000)
  • CONFIG_NORM: func7 = 0b0011001 (was 0b0000000)

File: /repo/buddy-mlir/backend/llvm/lib/Target/RISCV/RISCVInstrInfoBuddyExt.td

API Changes

Cast Operations

  • Changed from .cast<Type>() to llvm::cast<Type>() throughout the codebase

ConstantOp Parameter Order

  • ConstantFloatOp: Changed from (loc, value, type) to (loc, type, value)
  • ConstantIntOp: Changed from (loc, value, type) to (loc, type, value)

TransferReadOp Signature

  • Added required padding parameter (use /*padding=*/std::nullopt if not needed)

ForOp and YieldOp

  • Changed from std::nullopt to ValueRange{} for empty value ranges

Integrated Test Changes

  • Removed affine-loop-fusion pass in examples/BuddyNext/next-rope.mlir as this pass causes wrong result being produced.

Build System Changes

CMakeLists.txt Updates

Multiple LLVM source files were removed or renamed:

  • Removed: TargetIntrinsicInfo.cpp
  • Removed: VPlanHCFGBuilder.cpp
  • Renamed: EHContGuardCatchret.cppEHContGuardTargets.cpp
  • Renamed: ExpandLargeFpConvert.cppExpandFp.cpp
  • Renamed: VectorBuilder.cppVectorTypeUtils.cpp

RISC-V Backend TableGen

  • Added missing TableGen directive: tablegen(LLVM RISCVGenSDNodeInfo.inc -gen-sd-node-info), this file is now required by RISCVSelectionDAGInfo.h

@bubblepipe bubblepipe marked this pull request as ready for review August 2, 2025 06:24
@bubblepipe bubblepipe marked this pull request as draft August 2, 2025 06:29
the backend/llvm/lib/Target/RISCV/CMakeLists.txt file where the LLVMBuddyRISCVDesc target was incorrectly listing CodeGen files instead of MCTargetDesc files.
@bubblepipe bubblepipe marked this pull request as ready for review August 4, 2025 17:46
@WuXintong123
Copy link
Collaborator

WuXintong123 commented Aug 5, 2025

This part of the work is already included in upgrading llvm to main and will be merged into the main branch when it's done.
If you want to continue this part, you can discuss it together in #526 or contact me at [email protected] . @bubblepipe @zhanghb97

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants