Skip to content

Commit 518f8f7

Browse files
committed
[region-isolation] Fix asan error.
rdar://126060540
1 parent 2ee26d9 commit 518f8f7

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

lib/SILOptimizer/Utils/PartitionUtils.cpp

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -999,8 +999,10 @@ void IsolationHistory::pushRemoveLastElementFromRegion(Element element) {
999999

10001000
void IsolationHistory::pushRemoveElementFromRegion(
10011001
Element otherElementInOldRegion, Element element) {
1002-
head = new (factory->allocator) Node(Node::RemoveElementFromRegion, head,
1003-
element, {otherElementInOldRegion});
1002+
unsigned size = Node::totalSizeToAlloc<Element>(1);
1003+
void *mem = factory->allocator.Allocate(size, alignof(Node));
1004+
head = new (mem) Node(Node::RemoveElementFromRegion, head, element,
1005+
{otherElementInOldRegion});
10041006
}
10051007

10061008
void IsolationHistory::pushMergeElementRegions(Element elementToMergeInto,
@@ -1027,8 +1029,9 @@ void IsolationHistory::pushCFGHistoryJoin(Node *otherNode) {
10271029

10281030
// Otherwise, create a node that joins our true head and other node as a side
10291031
// path we can follow.
1030-
head = new (factory->allocator)
1031-
Node(Node(Node::CFGHistoryJoin, head, otherNode));
1032+
unsigned size = Node::totalSizeToAlloc<Element>(0);
1033+
void *mem = factory->allocator.Allocate(size, alignof(Node));
1034+
head = new (mem) Node(Node(Node::CFGHistoryJoin, head, otherNode));
10321035
}
10331036

10341037
IsolationHistory::Node *IsolationHistory::pop() {

0 commit comments

Comments
 (0)