Files
Mergen/scripts/rewrite/instruction_microtests.json
T
yusufcanislek 33f24ed0fc Fix InstructionCache DenseMap corruption: empty/tombstone keys were identical
The InstructionKey::InstructionKeyInfo had getEmptyKey() and getTombstoneKey()
both returning InstructionKey(nullptr, nullptr). LLVM DenseMap requires these
to be distinct sentinel values. This violated the DenseMap contract, causing
bucket corruption during copy/iteration (the old FIXME about 'last item
corrupted').

Fix: use reinterpret_cast sentinel pointers -1 and -2, matching LLVM convention.
Also cleaned up the non-const copy constructor (removed dead local copy and
stale FIXME comment).

Also adds:
- switch_sparse.asm test (non-consecutive case values: 10, 50, 200, 1000)
- calc_cout.cpp test (skipped - documents inline policy limitation with STL)
- C++ compilation support in build_samples.cmd
- Skip mechanism for manifest entries (skip: true + skip_reason)
- Fix test.py update-golden to not run determinism check before updating

68 pattern checks, 40 golden hashes, 108 handler microtests — all green.
2026-03-06 00:47:45 +03:00

111 lines
3.2 KiB
JSON

{
"samples": [
{
"name": "branch",
"symbol": "branch_target",
"patterns": ["select i1", "mul i32 %0, 3", "add i32 %0, 100", "xor i32"]
},
{
"name": "stack",
"symbol": "stack_target",
"patterns": ["ret i64 1717986918"]
},
{
"name": "indirect",
"symbol": "jump_target",
"patterns": ["ret i64 53"]
},
{
"name": "instr_add",
"symbol": "instr_add_target",
"patterns": ["ret i64 12"]
},
{
"name": "instr_sub",
"symbol": "instr_sub_target",
"patterns": ["ret i64 42"]
},
{
"name": "instr_xor",
"symbol": "instr_xor_target",
"patterns": ["ret i64 90"]
},
{
"name": "instr_rol",
"symbol": "instr_rol_target",
"patterns": ["ret i64 34"]
},
{
"name": "nested_branch",
"symbol": "nested_branch_target",
"patterns": ["icmp slt i32 %0, 11", "icmp slt i32 %0, 21", "select i1", "i64 200, i64 300", "i64 100"]
},
{
"name": "loop_simple",
"symbol": "loop_simple_target",
"patterns": ["ret i64 6"]
},
{
"name": "bitchain",
"symbol": "bitchain_target",
"patterns": ["ret i64 4090"]
},
{
"name": "multi_arg",
"symbol": "multi_arg_target",
"patterns": ["trunc i64 %RCX to i32", "trunc i64 %RDX to i32", "add i32", "mul i32", "zext i32"]
},
{
"name": "diamond",
"symbol": "diamond_target",
"patterns": ["and i32 %0, 1", "icmp eq i32", "select i1", "mul i32 %0, 3"]
},
{
"name": "cmov_chain",
"symbol": "cmov_chain_target",
"patterns": ["icmp sgt i32 %0, 10", "select i1", "i64 250, i64 150"]
},
{
"name": "calc_grade",
"symbol": "calc_grade",
"patterns": ["icmp slt i32 %0, 90", "icmp slt i32 %0, 80", "icmp slt i32 %0, 70", "phi i64", "ret i64 %common.ret.op"]
},
{
"name": "calc_mixed",
"symbol": "calc_mixed",
"patterns": ["icmp slt i32 %0, 101", "select i1", "mul i32", "ret i64"]
},
{
"name": "calc_fib",
"symbol": "calc_fib",
"patterns": ["ret i64 13"]
},
{
"name": "calc_sum_array",
"symbol": "calc_sum_array",
"patterns": ["ret i64 150"]
},
{
"name": "switch_3way",
"symbol": "switch_3way_target",
"patterns": ["switch i32 %0", "i32 1, label", "i32 2, label", "i32 3, label", "phi i64", "[ 100,", "[ 200,", "[ 300,", "[ 999,"]
},
{
"name": "calc_switch",
"symbol": "calc_switch",
"patterns": ["switch i32 %0", "i32 1, label", "i32 2, label", "i32 3, label", "i32 4, label", "i32 5, label", "phi i64"]
},
{
"name": "switch_sparse",
"symbol": "switch_sparse_target",
"patterns": ["switch i32 %0", "i32 10, label", "i32 50, label", "i32 200, label", "i32 1000, label", "phi i64", "[ 11,", "[ 55,", "[ 222,", "[ 1337,", "[ 4294967295,"]
},
{
"name": "calc_cout",
"symbol": "calc_cout",
"skip": true,
"skip_reason": "Statically-linked STL (cout) inlined by lifter; GEPTracker UNREACHABLE on complex library code. Blocked on inline policy improvements (Phase 2).",
"patterns": []
}
]
}