Index: llvm/lib/Target/AMDGPU/AMDGPURegisterBankInfo.cpp =================================================================== --- llvm/lib/Target/AMDGPU/AMDGPURegisterBankInfo.cpp +++ llvm/lib/Target/AMDGPU/AMDGPURegisterBankInfo.cpp @@ -3512,7 +3512,8 @@ DstBank = SrcBank; unsigned Size = getSizeInBits(MI.getOperand(0).getReg(), MRI, *TRI); - if (cannotCopy(*DstBank, *SrcBank, Size)) + if (MI.getOpcode() != AMDGPU::G_FREEZE && + cannotCopy(*DstBank, *SrcBank, Size)) return getInvalidInstructionMapping(); const ValueMapping &ValMap = getValueMapping(0, Size, *DstBank); Index: llvm/test/CodeGen/AMDGPU/GlobalISel/regbankselect-freeze.mir =================================================================== --- llvm/test/CodeGen/AMDGPU/GlobalISel/regbankselect-freeze.mir +++ llvm/test/CodeGen/AMDGPU/GlobalISel/regbankselect-freeze.mir @@ -49,6 +49,29 @@ ... +--- +name: test_freeze_s1_sgpr_to_sgpr +legalized: true +body: | + bb.0: + liveins: $sgpr0 + + ; CHECK-LABEL: name: test_freeze_s1_sgpr_to_sgpr + ; CHECK: liveins: $sgpr0 + ; CHECK-NEXT: {{ $}} + ; CHECK-NEXT: [[COPY:%[0-9]+]]:sgpr(s32) = COPY $sgpr0 + ; CHECK-NEXT: [[TRUNC:%[0-9]+]]:sgpr(s1) = G_TRUNC [[COPY]](s32) + ; CHECK-NEXT: [[FREEZE:%[0-9]+]]:sgpr(s1) = G_FREEZE [[TRUNC]] + ; CHECK-NEXT: [[ANYEXT:%[0-9]+]]:sgpr(s32) = G_ANYEXT [[FREEZE]](s1) + ; CHECK-NEXT: $sgpr0 = COPY [[ANYEXT]](s32) + %0:_(s32) = COPY $sgpr0 + %1:_(s1) = G_TRUNC %0(s32) + %2:_(s1) = G_FREEZE %1 + %3:_(s32) = G_ANYEXT %2(s1) + $sgpr0 = COPY %3(s32) + +... + --- name: test_freeze_s1_vcc legalized: true