================
@@ -1089,10 +1089,10 @@ void
SIFixSGPRCopies::lowerVGPR2SGPRCopies(MachineFunction &MF) {
}
LLVM_DEBUG(dbgs() << "V2S copy " << *C.Copy
<< " is being turned to VALU\n");
+ Copies.insert(C.Copy);
// TODO: MapVector::erase is inefficient. Do bulk removal with remove_if
// instead.
V2SCopies.erase(C.ID);
- Copies.insert(C.Copy);
----------------
sfu2 wrote:
`C.Copy` is valid if `CurInfoIt` valid, which is then fetched from `V2SCopies`.
By reordering`Copies.insert(C.Copy)` we can ensure that our reference `C` will
not become dangling after `V2SCopies.erase(C.ID)`.
https://github.com/llvm/llvm-project/pull/174702
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits