Fix Mem2Reg check on end_borrows of store_borrow

Instead of checking if the end_borrow is ending the lifetime of the store_borrow of the asi under consideration,
this code was checking if the store_borrow source is the runningValue which is incorrect in cases where a store_borrow
src to another destination gets replaced during mem2reg. This PR fixes the issue.
This commit is contained in:
Meghana Gupta
2022-09-08 11:38:11 -07:00
parent aec29cc9a7
commit b47230135a
2 changed files with 28 additions and 0 deletions

View File

@@ -1826,6 +1826,9 @@ void MemoryToRegisters::removeSingleBlockAllocation(AllocStackInst *asi) {
if (!sbi) {
continue;
}
if (sbi->getDest() != asi) {
continue;
}
if (!runningVals.hasValue()) {
continue;
}