@@ -2434,7 +2434,7 @@ void MachineVerifier::visitMachineInstrBefore(const MachineInstr *MI) {
24342434 const MachineOperand &LaneMaskOp = MI->getOperand (2 );
24352435 const Register SrcReg = SrcOp.getReg ();
24362436 const LaneBitmask LaneMask = LaneMaskOp.getLaneMask ();
2437- LaneBitmask SrcMaxLanemask = LaneBitmask::getAll ();
2437+ LaneBitmask SrcMaxLaneMask = LaneBitmask::getAll ();
24382438
24392439 if (DstOp.getSubReg ())
24402440 report (" COPY_LANEMASK must not use a subregister index" , &DstOp, 0 );
@@ -2448,15 +2448,22 @@ void MachineVerifier::visitMachineInstrBefore(const MachineInstr *MI) {
24482448 if (SrcReg.isPhysical ()) {
24492449 const TargetRegisterClass *SrcRC = TRI->getMinimalPhysRegClass (SrcReg);
24502450 if (SrcRC)
2451- SrcMaxLanemask = SrcRC->getLaneMask ();
2451+ SrcMaxLaneMask = SrcRC->getLaneMask ();
24522452 } else {
2453- SrcMaxLanemask = MRI->getMaxLaneMaskForVReg (SrcReg);
2453+ SrcMaxLaneMask = MRI->getMaxLaneMaskForVReg (SrcReg);
24542454 }
24552455
2456- // If LaneMask is equal to OR greater than the SrcMaxLanemask, it
2457- // impliess COPY_LANEMASK is trying to copy all lanes.
2458- if (SrcMaxLanemask <= LaneMask)
2459- report (" COPY_LANEMASK cannot read all lanes" , MI);
2456+ // COPY_LANEMASK should be used only for partial copy. For full
2457+ // copy, one should strictly use the COPY instruction.
2458+ if (SrcMaxLaneMask == LaneMask)
2459+ report (" COPY_LANEMASK cannot be used to do full copy" , MI);
2460+
2461+ // If LaneMask is equal to OR greater than the SrcMaxLaneMask, it
2462+ // implies COPY_LANEMASK is attempting to read from the lanes that
2463+ // don't exists in the source register.
2464+ if (SrcMaxLaneMask < LaneMask)
2465+ report (" COPY_LANEMASK attempts to read from the lanes that "
2466+ " don't exist in the source register" , MI);
24602467
24612468 break ;
24622469 }
0 commit comments