Commit 3ce636cb authored by Jeff Smits's avatar Jeff Smits

Fix ordering of value space in ctree_opt

parent 34ed3262
[root]
name = "strs"
version = "0.1.0"
dependencies = [
"aterm 0.20.0 (registry+https://github.com/rust-lang/crates.io-index)",
"fnv 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
"linked-hash-map 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
"phf 0.7.21 (registry+https://github.com/rust-lang/crates.io-index)",
"phf_codegen 0.7.21 (registry+https://github.com/rust-lang/crates.io-index)",
"rand 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)",
"ref_eq 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"structopt 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
"structopt-derive 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
"try_from 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]] [[package]]
name = "aho-corasick" name = "aho-corasick"
version = "0.6.3" version = "0.6.3"
...@@ -178,6 +162,22 @@ name = "siphasher" ...@@ -178,6 +162,22 @@ name = "siphasher"
version = "0.2.2" version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "strs"
version = "0.1.0"
dependencies = [
"aterm 0.20.0 (registry+https://github.com/rust-lang/crates.io-index)",
"fnv 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
"linked-hash-map 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
"phf 0.7.21 (registry+https://github.com/rust-lang/crates.io-index)",
"phf_codegen 0.7.21 (registry+https://github.com/rust-lang/crates.io-index)",
"rand 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)",
"ref_eq 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"structopt 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
"structopt-derive 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
"try_from 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]] [[package]]
name = "strsim" name = "strsim"
version = "0.6.0" version = "0.6.0"
......
...@@ -115,10 +115,15 @@ impl<'s> Value<'s> { ...@@ -115,10 +115,15 @@ impl<'s> Value<'s> {
fn lub(&self, other: &Self) -> Self { fn lub(&self, other: &Self) -> Self {
use self::Value::*; use self::Value::*;
if self == other {
return self.clone();
}
match (self, other) { match (self, other) {
(&BoundTo(_), &Bound) => self.clone(), (&BoundTo(_), &BoundTo(_)) |
(&Bound, &BoundTo(_)) => other.clone(), (&BoundTo(_), &Bound) |
(l, r) => if l == r { l.clone() } else { MaybeBound }, (&Bound, &BoundTo(_)) => Bound,
_ => MaybeBound,
} }
} }
} }
...@@ -406,7 +411,7 @@ impl<'s> CTreeOptimize for ir_v1::Def<'s> { ...@@ -406,7 +411,7 @@ impl<'s> CTreeOptimize for ir_v1::Def<'s> {
let no_of_scopes = (c.1).0.len(); let no_of_scopes = (c.1).0.len();
// TODO: reevaluate this from_args call. // TODO: reconsider this from_args call.
// It gives an empty set of influenced variable to the sargs, which probably not correct at // It gives an empty set of influenced variable to the sargs, which probably not correct at
// this point. The closure given as sarg to this strategy could be made before this one, // this point. The closure given as sarg to this strategy could be made before this one,
// which would make it able to change variables that this Def would be able to observe. // which would make it able to change variables that this Def would be able to observe.
...@@ -447,7 +452,9 @@ where ...@@ -447,7 +452,9 @@ where
} }
} }
// =================================================================================================
// Pay attention, this is where the optimizing starts // Pay attention, this is where the optimizing starts
// =================================================================================================
impl<'s> CTreeOptimize for ir_v1::Strategy<'s> { impl<'s> CTreeOptimize for ir_v1::Strategy<'s> {
type Context = (Option<InternedString<'s>>, Scopes<'s>); type Context = (Option<InternedString<'s>>, Scopes<'s>);
...@@ -567,7 +574,7 @@ impl<'s> CTreeOptimize for ir_v1::Strategy<'s> { ...@@ -567,7 +574,7 @@ impl<'s> CTreeOptimize for ir_v1::Strategy<'s> {
return Strategy::Build(bt); return Strategy::Build(bt);
} }
// Note that we don't need to handle BoundTo because that would have // Note that we don't need to handle BoundTo because that would have
// been an alias that was replace by the optimize call // been an alias that was replaced by the optimize call on the pattern
_ => {}// eprintln!("\t...var is guaranteed to be bound");} _ => {}// eprintln!("\t...var is guaranteed to be bound");}
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment