Skip to content

Commit

Permalink
chapter11: check for cproj instead of proj in idealize_if
Browse files Browse the repository at this point in the history
  • Loading branch information
RobertObkircher committed Jan 15, 2025
1 parent e2586a3 commit 7d0fb93
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/sea_of_nodes/nodes/idealize.rs
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,7 @@ impl<'t> Nodes<'t> {
let if_pred = self.inputs[d][1]?;
if_pred.add_dep(node, self);
if if_pred == pred {
if let Op::Proj(p) = &self[prior] {
if let Op::CProj(p) = &self[prior] {
let value = if p.index == 0 {
self.types.ty_int_one
} else {
Expand Down
2 changes: 1 addition & 1 deletion src/sea_of_nodes/nodes/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ impl<'t> Op<'t> {
pub fn label(&self) -> Cow<str> {
Borrowed(match self {
Op::Constant(ty) => return Owned(format!("#{ty}")),
Op::XCtrl => "XCtrl",
Op::XCtrl => "Xctrl",
Op::Return => "Return",
Op::Start { .. } => "Start",
Op::Add => "Add",
Expand Down
1 change: 0 additions & 1 deletion src/sea_of_nodes/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ impl<'s, 't> Parser<'s, 't> {
nodes.start = Start::new(&[types.ty_ctrl, arg], &mut nodes);

let stop = Stop::new(&mut nodes);
nodes.ty[stop] = Some(types.ty_bot); // differs from java; ensures that it isn't dead

nodes.zero = Constant::new(types.ty_int_zero, &mut nodes)
.peephole(&mut nodes)
Expand Down

0 comments on commit 7d0fb93

Please sign in to comment.