From 6eed618909571ee525cb5217665f8555d7c5a0a7 Mon Sep 17 00:00:00 2001 From: Jade Abraham Date: Mon, 16 Dec 2024 10:59:02 -0800 Subject: [PATCH 1/3] prevent dead stores due to heapify pass Signed-off-by: Jade Abraham --- compiler/passes/parallel.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/compiler/passes/parallel.cpp b/compiler/passes/parallel.cpp index 8016b9b611f7..7f32482485e7 100644 --- a/compiler/passes/parallel.cpp +++ b/compiler/passes/parallel.cpp @@ -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"); From 2c53452d060556866d8fcbcfcc44102a160a6cc7 Mon Sep 17 00:00:00 2001 From: Jade Abraham Date: Mon, 16 Dec 2024 10:59:29 -0800 Subject: [PATCH 2/3] make sure these tests run with `-multilocale` Signed-off-by: Jade Abraham --- test/extern/ferguson/NUMLOCALES | 1 + 1 file changed, 1 insertion(+) create mode 100644 test/extern/ferguson/NUMLOCALES diff --git a/test/extern/ferguson/NUMLOCALES b/test/extern/ferguson/NUMLOCALES new file mode 100644 index 000000000000..0cfbf08886fc --- /dev/null +++ b/test/extern/ferguson/NUMLOCALES @@ -0,0 +1 @@ +2 From 632b6e55ad373f04a9c66afceeed77ee49bfe13a Mon Sep 17 00:00:00 2001 From: Jade Abraham Date: Mon, 16 Dec 2024 11:04:11 -0800 Subject: [PATCH 3/3] fix typo Signed-off-by: Jade Abraham --- compiler/passes/parallel.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/passes/parallel.cpp b/compiler/passes/parallel.cpp index 7f32482485e7..d9f191c058d3 100644 --- a/compiler/passes/parallel.cpp +++ b/compiler/passes/parallel.cpp @@ -1145,7 +1145,7 @@ 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)) { + if (call->isPrimitive(PRIM_ZERO_VARIABLE)) { // aftering zeroing the value, we need to set it back // otherwise its a dead store call->getStmtExpr()->insertAfter(