Repository navigation
bit provenance pass - #141
Merged
Merged
Conversation
Coverage
Diff CoverageDiff CoverageDiff: origin/main...HEAD, staged and unstaged changes
Summary
bitprovenance.hppLines 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); |
Coverage
Diff CoverageDiff CoverageDiff: origin/main...HEAD, staged and unstaged changes
Summary
|
can-lehmann
requested changes
Oct 26, 2026
Coverage
Diff CoverageDiff CoverageDiff: origin/main...HEAD, staged and unstaged changes
Summary
|
Coverage
Diff CoverageDiff CoverageDiff: origin/main...HEAD, staged and unstaged changes
Summary
|
Coverage
Diff CoverageDiff CoverageDiff: origin/main...HEAD, staged and unstaged changes
Summary
|
878D
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.