[llvm] [AMDGPU][True16][CodeGen] Implement sgpr folding in true16 (PR #128929)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 20 01:14:34 PDT 2025
================
@@ -1040,6 +1053,14 @@ void SIFoldOperandsImpl::foldOperand(
}
}
+ // Allow immediates COPYd into sgpr_lo16 to be further folded while
+ // still being legal if not further folded
+ if (DestRC == &AMDGPU::SGPR_LO16RegClass) {
+ assert(ST->useRealTrue16Insts());
+ MRI->setRegClass(DestReg, &AMDGPU::SGPR_32RegClass);
----------------
arsenm wrote:
You should not modify the register class of the value until fully committing the rewrite of the instruction. This is speculatively modifying the class, so we may change the class and then not perform the fold based on the below conditions
https://github.com/llvm/llvm-project/pull/128929
More information about the llvm-commits
mailing list