[sancov] Generalize the code to get the previous instruction to multiple architectures
authorGeorge Karpenkov <ekarpenkov@apple.com>
Wed, 10 Oct 2018 00:57:24 +0000 (00:57 +0000)
committerGeorge Karpenkov <ekarpenkov@apple.com>
Wed, 10 Oct 2018 00:57:24 +0000 (00:57 +0000)
commitea13613572db918380b21c34a755abc3531a39a4
treed156e2ef3d7b830c52968ba8eb2e7e840ea0a51d
parent285ae0c07b20b25725963e11f65fbb53b5110edc
[sancov] Generalize the code to get the previous instruction to multiple architectures

sancov subtracts one from the address to get the previous instruction,
which makes sense on x86_64, but not on other platforms.
This change ensures that the offset is correct for different platforms.
The logic for computing the offset is copied from sanitizer_common.

Differential Revision: https://reviews.llvm.org/D53039

llvm-svn: 344103
llvm/tools/sancov/sancov.cpp