Is there any bug in Register Coalescer in LLVM12.0.1?

there has one statement : if (BValNo->def != CopyIdx) return false;
in adjustCopiesBackFrom function.
Howere, there has one assert ‘assert(BValNo != nullptr && BValNo->def == CopyIdx);’ in
removeCopyByCommutionDef. this two statement seems contradictory.

      bool Changed = adjustCopiesBackFrom(CP, CopyMI);
      bool Shrink = false;
      if (!Changed)
        std::tie(Changed, Shrink) = removeCopyByCommutingDef(CP, CopyMI);