Skip to content

[SILOpt] fix the ASAN issue in the new pass completely. #8712

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 12, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions lib/SIL/SILBasicBlock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,16 +90,14 @@ void SILBasicBlock::remove(SILInstruction *I) {
InstList.remove(I);
}

/// Returns the iterator following the erased instruction, STL-style.
/// Returns the iterator following the erased instruction.
SILBasicBlock::iterator SILBasicBlock::erase(SILInstruction *I) {
// Notify the delete handlers that this instruction is going away.
getModule().notifyDeleteHandlers(&*I);
auto *F = getParent();
// LLVM does not currently implement ilist::erase correctly. Compensate.
iterator next = std::next(SILBasicBlock::iterator(I));
InstList.erase(I);
auto nextIter = InstList.erase(I);
F->getModule().deallocateInst(I);
return next;
return nextIter;
}

/// This method unlinks 'self' from the containing SILFunction and deletes it.
Expand Down
2 changes: 2 additions & 0 deletions lib/SILOptimizer/Mandatory/AccessMarkerElimination.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,12 @@ struct AccessMarkerElimination : SILModuleTransform {
if (auto beginAccess = dyn_cast<BeginAccessInst>(inst)) {
beginAccess->replaceAllUsesWith(beginAccess->getSource());
II = BB.erase(beginAccess);
continue;
}
if (auto endAccess = dyn_cast<EndAccessInst>(inst)) {
assert(endAccess->use_empty());
II = BB.erase(endAccess);
continue;
}
}
}
Expand Down
1 change: 0 additions & 1 deletion test/SILOptimizer/access_marker_elim.sil
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
// RUN: %target-sil-opt -enforce-exclusivity=checked -emit-sorted-sil -access-marker-elim %s | %FileCheck %s
// REQUIRES: rdar:31550303 OSS Swift CI ASAN bot fails on AccessMarker tests.

sil_stage raw

Expand Down
1 change: 0 additions & 1 deletion test/SILOptimizer/access_marker_mandatory.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
// RUN: %target-swift-frontend -parse-as-library -Xllvm -sil-full-demangle -enforce-exclusivity=checked -emit-sil %s | %FileCheck %s
// REQUIRES: rdar:31550303 OSS Swift CI ASAN bot fails on AccessMarker tests.

public struct S {
var i: Int
Expand Down