9 Commits

Author SHA1 Message Date
Patrice Blin be910da926 fix: prevent out-of-bounds access in SplitBasicBlock::split
When a basic block has exactly as many instructions as splitN (e.g. 2
instructions with default splitN=2), the bound check `splitN > curr->size()`
was false so splitN was not capped. The `test` vector only has `curr->size()-1`
entries, causing an out-of-bounds access on `test[i]` and a crash.

Change `>` to `>=` so splitN is correctly capped to `curr->size()-1`.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-09 14:37:30 +01:00
Axel Cohen fff24c7a15 BasicBlock: add a workaround for a segfault after splitBasicBlock for functions with a probe-stack 2022-05-03 15:11:52 +02:00
Patrice Blin 835c5bcbda compatibility: fix headers ordering for llvm 12
In CryptoUtils.h some macro name ("S") conflict with templates in llvm
headers. Putting aside the name of this macro, including internal
headers before llvm's would only cause use troubles.
2022-03-17 18:31:37 +01:00
Patrice Blin 5481d0338a split: invalidate CFG analyses if changes are made
If we don't returns 'true', implicitly, it let means the previous
analyses can be preserved which is not the case as split is performing
CFG changes.

In this case it caused and error when used with clang -fpass-plugin=

Error: SplitBasicBlockPass does not invalidate CFG analyses but CFG changes detected in function @NewTreeNode:
Different number of non-leaf basic blocks: before=0, after=2
Non-leaf block entry.split<0x55c11c3331d0> is added (1 successors)
Non-leaf block entry<0x55c11c2934c0> is added (1 successors)
fatal error: error in backend: CFG unexpectedly changed by SplitBasicBlockPass
clang-13: error: clang frontend command failed with exit code 70 (use -v to see invocation)
clang version 13.0.0 (https://github.com/llvm/llvm-project.git f6b09e394a5fad4b33f8746195377f4f638e2c8d)
2022-03-17 18:31:37 +01:00
Patrice Blin 43ea2d9892 split: always obfuscate split with the new pass manager 2022-03-17 18:31:37 +01:00
Axel Cohen ca475e72a1 Register passes with new format as a single plugin 2021-10-14 10:25:20 +02:00
Patrice Blin 9b414c34e9 NewPM: port SplitBasicBlocks passe
based on
llvm:9ccf13c36d1c450bc9a74bd04c9730df56f8bd73
2021-10-14 10:25:20 +02:00
Axel Cohen d4bab31e09 Apply clang-format with llvm style 2021-10-13 18:16:41 +02:00
Axel Cohen b5920e9b10 Reorganize sources and generate an out of tree library 2021-10-13 18:15:35 +02:00