[llvm] [CodeGen][ARM] Test validity of SubRC + SubReg in shouldRewriteCopySrc (PR #159600)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 18 17:50:20 PDT 2025
================
@@ -700,6 +700,11 @@ class LLVM_ABI TargetRegisterInfo : public MCRegisterInfo {
unsigned DefSubReg,
const TargetRegisterClass *SrcRC,
unsigned SrcSubReg) const {
+ // Validate that SrcRC and SrcSubReg is actually a valid combination.
+ const TargetRegisterClass *SubRC = getSubClassWithSubReg(SrcRC, SrcSubReg);
+ if (!SubRC || SubRC != SrcRC)
+ return false;
----------------
arsenm wrote:
Looking at this again, this does feel like the wrong place to handle this. This should either be sunk into findCommonRegClass, or pulled out into the caller. Did you find the place that originated the SrcRC + SubReg combination? Did it happen to be from the UncoalescableRewriter?
https://github.com/llvm/llvm-project/pull/159600
More information about the llvm-commits
mailing list