[compiler-rt] 120e630 - [libFuzzer] Remove unused helper `GetPreviousInstructionPc` (#228453)
via llvm-commits
llvm-commits at lists.llvm.org
Sat Oct 3 19:01:17 PDT 2026
Author: Rong "Mantle" Bao
Date: 2026-10-03T19:01:05-07:00
New Revision: 120e630a18f842bccfea855dae30d7279aa33df5
URL: https://github.com/llvm/llvm-project/commit/120e630a18f842bccfea855dae30d7279aa33df5
DIFF: https://github.com/llvm/llvm-project/commit/120e630a18f842bccfea855dae30d7279aa33df5.diff
LOG: [libFuzzer] Remove unused helper `GetPreviousInstructionPc` (#228453)
This function hasn't been used since 2891b257c24c ("[libFuzzer] remove
stale code"), and it contains a typo in the RISCV #ifdef arm. Removing
this altogether.
This was found when surveying RISCV-specific code in [a downstream
project](https://searchfox.org/firefox-main/rev/084057e952e7dbf376f6c3765ad242aec3785dc6/tools/fuzzing/libfuzzer/FuzzerTracePC.cpp#141)
that vendored libFuzzer.
Added:
Modified:
compiler-rt/lib/fuzzer/FuzzerTracePC.cpp
Removed:
################################################################################
diff --git a/compiler-rt/lib/fuzzer/FuzzerTracePC.cpp b/compiler-rt/lib/fuzzer/FuzzerTracePC.cpp
index d439ec2f0982d..a5976db3f801a 100644
--- a/compiler-rt/lib/fuzzer/FuzzerTracePC.cpp
+++ b/compiler-rt/lib/fuzzer/FuzzerTracePC.cpp
@@ -128,25 +128,6 @@ void TracePC::HandleCallerCallee(uintptr_t Caller, uintptr_t Callee) {
ValueProfileMap.AddValueModPrime(Idx);
}
-/// \return the address of the previous instruction.
-/// Note: the logic is copied from `sanitizer_common/sanitizer_stacktrace.h`
-inline ALWAYS_INLINE uintptr_t GetPreviousInstructionPc(uintptr_t PC) {
-#if defined(__arm__)
- // T32 (Thumb) branch instructions might be 16 or 32 bit long,
- // so we return (pc-2) in that case in order to be safe.
- // For A32 mode we return (pc-4) because all instructions are 32 bit long.
- return (PC - 3) & (~1);
-#elif defined(__sparc__) || defined(__mips__)
- return PC - 8;
-#elif defined(__riscv__)
- return PC - 2;
-#elif defined(__i386__) || defined(__x86_64__) || defined(_M_IX86) || defined(_M_X64)
- return PC - 1;
-#else
- return PC - 4;
-#endif
-}
-
/// \return the address of the next instruction.
/// Note: the logic is copied from `sanitizer_common/sanitizer_stacktrace.cpp`
ALWAYS_INLINE uintptr_t TracePC::GetNextInstructionPc(uintptr_t PC) {
More information about the llvm-commits
mailing list