[llvm] [AMDGPU] Allow folding of non-subregs through REG_SEQUENCE (PR #151033)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Fri Sep 19 19:14:19 PDT 2025
================
@@ -712,8 +713,12 @@ bool SIFoldOperandsImpl::updateOperand(FoldCandidate &Fold) const {
TII->getRegClass(MI->getDesc(), Fold.UseOpNo, TRI)) {
const TargetRegisterClass *NewRC =
TRI->getRegClassForReg(*MRI, New->getReg());
- const TargetRegisterClass *ConstrainRC =
- TRI->findCommonRegClass(OpRC, Old.getSubReg(), NewRC, New->getSubReg());
+
+ const TargetRegisterClass *ConstrainRC = OpRC;
+ if (New->getSubReg())
+ ConstrainRC =
+ TRI->getMatchingSuperRegClass(NewRC, OpRC, New->getSubReg());
+
----------------
arsenm wrote:
Can this be pre-committed as NFC
https://github.com/llvm/llvm-project/pull/151033
More information about the llvm-commits
mailing list