Skip to content

Conversation

@wujingyue
Copy link
Collaborator

No description provided.

@github-actions
Copy link

Description

  • Replaced manual operand replacement with OptOutMutator

  • Simplified input and output handling in cloneWithNewOperands

Changes walkthrough

Relevant files
Enhancement
lowering.cpp
Use OptOutMutator for operand replacement                               

csrc/host_ir/lowering.cpp

  • Removed manual operand replacement logic
  • Introduced OptOutMutator for operand replacement
  • Simplified loop for handling inputs and outputs
  • +13/-20 

    PR Reviewer Guide

    Here are some key observations to aid the review process:

    🧪 No relevant tests
    ⚡ Recommended focus areas for review
    Possible Issue

    The mutateExprOutputsOnly method is called after mutate, which might lead to unexpected behavior or double mutation of the expression outputs.

    mutator.mutate(e);
    return mutator.mutateExprOutputsOnly(e);
    Code Duplication

    The logic for handling inputs and outputs is similar. Consider refactoring to avoid code duplication.

    for (auto* input : e->inputs()) {
      Val* new_input = getOrDefault(replacement_map, input);
      if (new_input != nullptr) {
        mutator.registerMutation(input, new_input);
      }
    }
    for (auto* output : e->outputs()) {
      Val* new_output = getOrDefault(replacement_map, output);
      if (new_output != nullptr) {
        mutator.registerMutation(output, new_output);
      }
    }

    Base automatically changed from wjy/replace to main November 17, 2025 16:10
    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