[llvm] [AMDGPU] Assert that we can find subregs in copyPhysReg. NFC. (PR #70332)
Jay Foad via llvm-commits
llvm-commits at lists.llvm.org
Thu Oct 26 07:37:31 PDT 2023
================
@@ -742,23 +742,27 @@ static void expandSGPRCopy(const SIInstrInfo &TII, MachineBasicBlock &MBB,
for (unsigned Idx = 0; Idx < BaseIndices.size(); ++Idx) {
int16_t SubIdx = BaseIndices[Idx];
- Register Reg = RI.getSubReg(DestReg, SubIdx);
+ Register DestSubReg = RI.getSubReg(DestReg, SubIdx);
+ Register SrcSubReg = RI.getSubReg(SrcReg, SubIdx);
+ assert(DestSubReg && SrcSubReg && "Failed to find subregs!");
----------------
jayfoad wrote:
I did wonder about adding a new variant of `getSubReg(MCRegister, unsigned)` that does the assert for you, but I couldn't think of a good name for it.
https://github.com/llvm/llvm-project/pull/70332
More information about the llvm-commits
mailing list