Clear InsnToMemAcc map in ScopDetection after each runOnFunction

Otherwise, instructions in different functions that share the same pointer (due
to earlier modifications), might get assigned incorrect memory access
information (belonging to instructions in previous functions), which can result
in arbitrary memory corruption and assertion failures.

This fixes llvm.org/PR23160 and possibly also llvm.org/PR23167.

Note: InsnToMemAcc is a global variable that should never have existed in the
first place. We will clean this up in a subsequent patch.

Reported-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
Debugged-by: Johannes Doerfert <doerfert@cs.uni-saarland.de>
llvm-svn: 235254
This commit is contained in:
Tobias Grosser 2015-04-18 11:01:25 +00:00
parent 5df7c1a4eb
commit 4b6aa6eb8e
1 changed files with 1 additions and 0 deletions

View File

@ -1084,6 +1084,7 @@ void ScopDetection::releaseMemory() {
ValidRegions.clear();
RejectLogs.clear();
NonAffineSubRegionMap.clear();
InsnToMemAcc.clear();
// Do not clear the invalid function set.
}