[sancov] Add SPARC support for getPreviousInstructionPc

The SPARC and MIPS branching operations have a branch delay slot, 4 more bytes occupied.

Depends on D120381

Reviewed By: ro, MaskRay

Differential Revision: https://reviews.llvm.org/D120451
This commit is contained in:
Xiaodong Liu 2022-02-27 19:10:51 +00:00 committed by Fangrui Song
parent 319265328c
commit f6cb59d35f
1 changed files with 1 additions and 1 deletions

View File

@ -695,7 +695,7 @@ static uint64_t getPreviousInstructionPc(uint64_t PC,
Triple TheTriple) {
if (TheTriple.isARM())
return (PC - 3) & (~1);
if (TheTriple.isMIPS())
if (TheTriple.isMIPS() || TheTriple.isSPARC())
return PC - 8;
if (TheTriple.isRISCV())
return PC - 2;