adding extra test

This commit is contained in:
Jakub Doka 2024-11-12 12:54:36 +01:00
parent f1deab11c9
commit c701eb7b6d
No known key found for this signature in database
GPG key ID: C6E9A89936B8C143
3 changed files with 18 additions and 25 deletions

View file

@ -1092,6 +1092,23 @@ main := fn(): uint {
} }
``` ```
#### memory_swap
```hb
U := struct {u: uint, v: uint, g: uint}
main := fn(): uint {
a := decide(0)
b := decide(1)
c := a
a = b
b = c
return b.u + a.u
}
decide := fn(u: uint): U return .(u, 0, 0)
```
#### wide_ret #### wide_ret
```hb ```hb
OemIdent := struct { OemIdent := struct {

View file

@ -1107,18 +1107,11 @@ impl Nodes {
} }
} }
K::Stre => { K::Stre => {
if target == 79 {
std::dbg!(std::backtrace::Backtrace::capture());
}
let &[_, value, region, store, ..] = self[target].inputs.as_slice() else { let &[_, value, region, store, ..] = self[target].inputs.as_slice() else {
unreachable!() unreachable!()
}; };
if self[value].kind == Kind::Load && self[value].inputs[1] == region { if self[value].kind == Kind::Load && self[value].inputs[1] == region {
if target == 79 {
std::dbg!(1);
}
return Some(store); return Some(store);
} }
@ -1137,9 +1130,6 @@ impl Nodes {
'eliminate: { 'eliminate: {
if self[target].outputs.is_empty() { if self[target].outputs.is_empty() {
if target == 79 {
std::dbg!(2);
}
break 'eliminate; break 'eliminate;
} }
@ -1149,9 +1139,6 @@ impl Nodes {
for &ele in self[value].outputs.clone().iter().filter(|&&n| n != target) { for &ele in self[value].outputs.clone().iter().filter(|&&n| n != target) {
self[ele].peep_triggers.push(target); self[ele].peep_triggers.push(target);
} }
if target == 79 {
std::dbg!(3);
}
break 'eliminate; break 'eliminate;
} }
@ -1160,9 +1147,6 @@ impl Nodes {
}; };
if self[stack].ty != self[value].ty || self[stack].kind != Kind::Stck { if self[stack].ty != self[value].ty || self[stack].kind != Kind::Stck {
if target == 79 {
std::dbg!(3);
}
break 'eliminate; break 'eliminate;
} }
@ -1187,9 +1171,6 @@ impl Nodes {
} }
let Some(index) = unidentifed.iter().position(|&n| n == contact_point) let Some(index) = unidentifed.iter().position(|&n| n == contact_point)
else { else {
if target == 79 {
std::dbg!(5);
}
break 'eliminate; break 'eliminate;
}; };
if self[self[cursor].inputs[1]].kind == Kind::Load if self[self[cursor].inputs[1]].kind == Kind::Load
@ -1198,9 +1179,6 @@ impl Nodes {
== self.aclass_index(self[n].inputs[2]).0 == self.aclass_index(self[n].inputs[2]).0
}) })
{ {
if target == 79 {
std::dbg!(6);
}
break 'eliminate; break 'eliminate;
} }
unidentifed.remove(index); unidentifed.remove(index);
@ -1214,9 +1192,6 @@ impl Nodes {
} }
if !unidentifed.is_empty() { if !unidentifed.is_empty() {
if target == 79 {
std::dbg!(7);
}
break 'eliminate; break 'eliminate;
} }
@ -4828,6 +4803,7 @@ mod tests {
fb_driver; fb_driver;
// Purely Testing Examples; // Purely Testing Examples;
memory_swap;
very_nested_loops; very_nested_loops;
generic_type_mishap; generic_type_mishap;
storing_into_nullable_struct; storing_into_nullable_struct;

View file