Skip to content

Commit

Permalink
[xlscc] Don't const-prop so much during short circuiting.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 681159199
  • Loading branch information
grebe authored and copybara-github committed Oct 1, 2024
1 parent 33ef64f commit ebd1582
Showing 1 changed file with 0 additions and 23 deletions.
23 changes: 0 additions & 23 deletions xls/contrib/xlscc/translator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4600,17 +4600,6 @@ class ShortCircuitVisitor : public xls::DfsVisitorWithDefault {
return std::nullopt;
}

absl::Status HandleParam(xls::Param* param) final {
// Don't bother evaluating parameters as it will always fail.
return absl::OkStatus();
}

absl::Status HandleLiteral(xls::Literal* literal) final {
// Don't bother evaluating literals as we'd just replace them with another
// literal.
return absl::OkStatus();
}

absl::Status HandleNaryAnd(xls::NaryOp* op) final {
xls::IrInterpreter ir_interpreter;
absl::Status status = op->Accept(&ir_interpreter);
Expand Down Expand Up @@ -4698,18 +4687,6 @@ class ShortCircuitVisitor : public xls::DfsVisitorWithDefault {
return absl::OkStatus();
}
absl::Status DefaultHandler(xls::Node* node) final {
if (node->users().empty()) {
// Don't bother evaluating nodes with no users
return absl::OkStatus();
}
xls::IrInterpreter ir_interpreter;
absl::Status status = node->Accept(&ir_interpreter);
if (status.ok()) {
const xls::Value& value = ir_interpreter.ResolveAsValue(node);
XLS_ASSIGN_OR_RETURN(xls::Node * replacement,
node->ReplaceUsesWithNew<xls::Literal>(value));
rewrites_[node] = replacement;
}
return absl::OkStatus();
}

Expand Down

0 comments on commit ebd1582

Please sign in to comment.