8000 bit provenance pass by cfbolz · Pull Request #141 · can-lehmann/metajit.cpp · GitHub
[go: up one dir, main page]

Skip to content

bit provenance pass - #141

Merged
cfbolz merged 24 commits into
mainfrom
cf-bit-provenance
Oct 26, 2026
Merged

cfbolz merged 24 commits into
mainfrom
cf-bit-provenance

Conversation

@cfbolz
@cfbolz cfbolz commented Oct 26, 2026
Copy link
Copy Markdown
Collaborator

No description provided.

@github-actions
Copy link
Copy Markdown

Coverage

File Lines Functions Branches
bitprovenance.hpp 🟢 97.78% 🟢 100.00% 🟡 81.53%
genext.hpp 🟡 71.23% 🟡 86.89% 🟡 72.56%
jitir.hpp 🟡 72.96% 🟡 79.45% 🟡 71.67%
jitir_llvmapi.hpp 🔴 54.74% 🟡 80.00% 🔴 50.00%
llvmgen.hpp 🟢 90.72% 🟢 90.00% 🟡 81.82%
lowerllvm.hpp 🔴 69.57% 🟡 87.50% 🔴 50.49%
x86gen.hpp 🟢 90.23% 🟡 86.93% 🟡 84.66%
x86insts.inc.hpp 🟡 84.66% - -
TOTAL 🟡 75.70% 🟡 81.57% 🟡 76.47%
Diff Coverage

Diff Coverage

Diff: origin/main...HEAD, staged and unstaged changes

  • bitprovenance.hpp (97.8%): Missing lines 251-252,395-396,411-412,427-428,492-493,530-531
  • jitir.hpp (100%)

Summary

  • Total: 576 lines
  • Missing: 12 lines
  • Coverage: 97%

bitprovenance.hpp

Lines 247-256

  247     Mapping transfer_lt_s(const Mapping& right, LtSInst* inst) const {
  248       assert(valid() && right.valid());
  249       uint64_t number;
  250       if (!right.constant(type_width(inst->arg(1)->type()), number) || number != 0) {
! 251         return opaque(inst);
! 252       }
  253       Mapping result;
  254       result.source = source;
  255       result.bits[0] = bits[type_width(inst->arg(0)->type()) - 1];
  256       result.normalize(1);

Lines 391-400

  391   Mapping transfer(Inst* inst) {
  392     size_t width = type_width(inst->type());
  393     if (inst->has_side_effect() || dynamic_cast<LoadInst*>(inst) || inst->arg_count() == 0 ||
  394         !is_int_or_bool(inst->arg(0)->type())) {
! 395       return opaque(inst);
! 396     }
  397     Mapping a = get(inst->arg(0));
  398     if (dynamic_cast<ResizeUInst*>(inst)) {
  399       return a.transfer_resize(type_width(inst->arg(0)->type()), width, ResizeKind::Unsigned);
  400     }

Lines 407-416

  407     if (dynamic_cast<BitReverseInst*>(inst)) {
  408       return a.transfer_bit_reverse(width);
  409     }
  410     if (inst->arg_count() < 2 || !is_int_or_bool(inst->arg(1)->type())) {
! 411       return opaque(inst);
! 412     }
  413     Mapping b = get(inst->arg(1));
  414     if (AndInst* and_inst = dynamic_cast<AndInst*>(inst)) {
  415       return a.transfer_and(b, and_inst);
  416     }

Lines 423-432

  423     uint64_t number = 0;
  424     if (dynamic_cast<ShlInst*>(inst) || dynamic_cast<ShrUInst*>(inst) ||
  425         dynamic_cast<ShrSInst*>(inst)) {
  426       if (!b.constant(width, number)) {
! 427         return opaque(inst);
! 428       }
  429       ShiftKind kind = dynamic_cast<ShlInst*>(inst) ? ShiftKind::Left :
  430                        dynamic_cast<ShrUInst*>(inst) ? ShiftKind::RightUnsigned :
  431                        ShiftKind::RightSigned;
  432       return a.transfer_shift(width, number, kind);

Lines 488-497

  488     while (first < width && !reference(mapping.bits[first])) {
  489       first++;
  490     }
  491     if (first == width) {
! 492       return nullptr;
! 493     }
  494     if (value == mapping.source) {
  495       if (auto shift = input.match_shift(mapping, width, first, mapping.bits[first] & 63)) {
  496         return build_shift_replacement(inst, value, *shift);
  497       }

Lines 526-535

  526   }
  527 
  528   Value* find_replacement(Block* block, Inst* inst, const Mapping& mapping) {
  529     if (inst->has_side_effect() || inst->is_terminator() || dynamic_cast<LoadInst*>(inst)) {
! 530       return nullptr;
! 531     }
  532     _builder.move_before(block, inst);
  533     uint64_t number;
  534     if (mapping.constant(type_width(inst->type()), number)) {
  535       return _builder.build_const(inst->type(), number);

@github-actions
Copy link
Copy Markdown

Coverage

File Lines Functions Branches
bitprovenance.hpp 🟢 100.00% 🟢 100.00% 🟡 83.11%
genext.hpp 🟡 71.23% 🟡 86.89% 🟡 72.56%
jitir.hpp 🟡 72.98% 🟡 79.45% 🟡 71.61%
jitir_llvmapi.hpp 🔴 54.74% 🟡 80.00% 🔴 50.00%
llvmgen.hpp 🟢 90.72% 🟢 90.00% 🟡 81.82%
lowerllvm.hpp 🔴 69.57% 🟡 87.50% 🔴 50.49%
x86gen.hpp 🟢 90.23% 🟡 86.93% 🟡 84.66%
x86insts.inc.hpp 🟡 84.66% - -
TOTAL 🟡 75.79% 🟡 81.57% 🟡 76.50%
Diff Coverage

Diff Coverage

Diff: origin/main...HEAD, staged and unstaged changes

  • bitprovenance.hpp (100%)
  • jitir.hpp (100%)

Summary

  • Total: 574 lines
  • Missing: 0 lines
  • Coverage: 100%

Comment thread bitprovenance.hpp Resolved
Comment thread bitprovenance.hpp Resolved
Comment thread bitprovenance.hpp Resolved
Comment thread bitprovenance.hpp Resolved
Comment thread bitprovenance.hpp Resolved
Comment thread jitir.tmpl.hpp Resolved
Comment thread jitir.tmpl.hpp Resolved
Comment thread bitprovenance.hpp Resolved
@github-actions
Copy link
Copy Markdown

Coverage

File Lines Functions Branches
bitprovenance.hpp 🟢 100.00% 🟢 100.00% 🟡 82.13%
genext.hpp 🟡 71.23% 🟡 86.89% 🟡 72.56%
jitir.hpp 🟡 73.07% 🟡 79.45% 🟡 71.70%
jitir_llvmapi.hpp 🔴 54.74% 🟡 80.00% 🔴 50.00%
llvmgen.hpp 🟢 90.72% 🟢 90.00% 🟡 81.82%
lowerllvm.hpp 🔴 69.57% 🟡 87.50% 🔴 50.49%
x86gen.hpp 🟢 90.23% 🟡 86.93% 🟡 84.66%
x86insts.inc.hpp 🟡 84.66% - -
TOTAL 🟡 75.86% 🟡 81.62% 🟡 76.51%
Diff Coverage

Diff Coverage

Diff: origin/main...HEAD, staged and unstaged changes

  • bitprovenance.hpp (100%)
  • jitir.hpp (100%)

Summary

  • Total: 582 lines
  • Missing: 0 lines
  • Coverage: 100%

@github-actions
Copy link
Copy Markdown

Coverage

File Lines Functions Branches
bitprovenance.hpp 🟢 100.00% 🟢 100.00% 🟡 82.13%
genext.hpp 🟡 71.23% 🟡 86.89% 🟡 72.56%
jitir.hpp 🟡 73.07% 🟡 79.45% 🟡 71.70%
jitir_llvmapi.hpp 🔴 54.74% 🟡 80.00% 🔴 50.00%
llvmgen.hpp 🟢 90.72% 🟢 90.00% 🟡 81.82%
lowerllvm.hpp 🔴 69.57% 🟡 87.50% 🔴 50.49%
x86gen.hpp 🟢 90.23% 🟡 86.93% 🟡 84.66%
x86insts.inc.hpp 🟡 84.66% - -
TOTAL 🟡 75.86% 🟡 81.62% 🟡 76.51%
Diff Coverage

Diff Coverage

Diff: origin/main...HEAD, staged and unstaged changes

  • bitprovenance.hpp (100%)
  • jitir.hpp (100%)

Summary

  • Total: 582 lines
  • Missing: 0 lines
  • Coverage: 100%

@github-actions
Copy link
Copy Markdown

Coverage

File Lines Functions Branches
bitprovenance.hpp 🟢 100.00% 🟢 100.00% 🟡 82.13%
genext.hpp 🟡 71.23% 🟡 86.89% 🟡 72.56%
jitir.hpp 🟡 72.98% 🟡 79.45% 🟡 71.59%
jitir_llvmapi.hpp 🔴 54.74% 🟡 80.00% 🔴 50.00%
llvmgen.hpp 🟢 90.72% 🟢 90.00% 🟡 81.82%
lowerllvm.hpp 🔴 69.57% 🟡 87.50% 🔴 50.49%
x86gen.hpp 🟢 90.23% 🟡 86.93% 🟡 84.66%
x86insts.inc.hpp 🟡 84.66% - -
TOTAL 🟡 75.81% 🟡 81.62% 🟡 76.45%
Diff Coverage

Diff Coverage

Diff: origin/main...HEAD, staged and unstaged changes

  • bitprovenance.hpp (100%)
  • jitir.hpp (100%)

Summary

  • Total: 582 lines
  • Missing: 0 lines
  • Coverage: 100%

878D
@cfbolz
cfbolz merged commit 6d40c97 into main Oct 26, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

0