Skip to content

Commit

Permalink
prevent dead stores due to heapify pass
Browse files Browse the repository at this point in the history
Signed-off-by: Jade Abraham <[email protected]>
  • Loading branch information
jabraham17 committed Dec 16, 2024
1 parent a8bd684 commit 6eed618
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions compiler/passes/parallel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1145,6 +1145,12 @@ makeHeapAllocations() {
call->getStmtExpr()->insertBefore(new DefExpr(tmp));
call->getStmtExpr()->insertBefore(new CallExpr(PRIM_MOVE, tmp, new CallExpr(PRIM_GET_MEMBER_VALUE, use->symbol(), heapType->getField(1))));
use->replace(new SymExpr(tmp));
if (call-isPrimitive(PRIM_ZERO_VARIABLE)) {
// aftering zeroing the value, we need to set it back
// otherwise its a dead store
call->getStmtExpr()->insertAfter(
new CallExpr(PRIM_SET_MEMBER, use->symbol(), heapType->getField(1), tmp));
}
}
} else if (use->parentExpr)
INT_FATAL(var, "unexpected case");
Expand Down

0 comments on commit 6eed618

Please sign in to comment.