Skip to content
Snippets Groups Projects
Commit 7baa7040 authored by rarbore2's avatar rarbore2
Browse files

Merge branch 'clone_detection7' into 'main'

Handle loop vs. simple induced clones better

See merge request !97
parents 157e4645 9e5b344f
No related branches found
No related tags found
1 merge request!97Handle loop vs. simple induced clones better
Pipeline #200909 passed
...@@ -23,6 +23,7 @@ pub struct Subgraph { ...@@ -23,6 +23,7 @@ pub struct Subgraph {
original_num_nodes: u32, original_num_nodes: u32,
} }
#[derive(Debug, Clone)]
pub struct SubgraphIterator<'a> { pub struct SubgraphIterator<'a> {
nodes: &'a Vec<NodeID>, nodes: &'a Vec<NodeID>,
edges: &'a [u32], edges: &'a [u32],
......
This diff is collapsed.
...@@ -64,16 +64,32 @@ fn tricky_loop_implicit_clone(a : usize, b : usize) -> i32 { ...@@ -64,16 +64,32 @@ fn tricky_loop_implicit_clone(a : usize, b : usize) -> i32 {
fn tricky2_loop_implicit_clone(a : usize, b : usize) -> i32 { fn tricky2_loop_implicit_clone(a : usize, b : usize) -> i32 {
let x = 0; let x = 0;
for i = 0 to 3 { for i = 0 to 3 {
let arr : i32[1]; let arr1 : i32[1];
let arr2 : i32[1];
if a == b { if a == b {
arr[0] = 6; arr1[0] = 6;
} else { } else {
arr[0] = 9; arr2[0] = 9;
} }
arr1[0] = 2;
for j = 0 to 4 { for j = 0 to 4 {
arr[0] += 1; arr2[0] += 1;
}
x += arr2[0];
}
return x;
}
#[entry]
fn tricky3_loop_implicit_clone(a : usize, b : usize) -> usize {
let x = 0;
for i = 0 to b {
let arr1 : usize[10];
let arr2 : usize[10];
arr1[1] = 1;
for kk = 0 to 10 {
arr2[kk] += arr1[kk];
} }
x += arr[0];
} }
return x; return x;
} }
......
...@@ -27,6 +27,10 @@ fn main() { ...@@ -27,6 +27,10 @@ fn main() {
println!("{}", output); println!("{}", output);
assert_eq!(output, 39); assert_eq!(output, 39);
let output = tricky3_loop_implicit_clone(5, 7).await;
println!("{}", output);
assert_eq!(output, 0);
let output = no_implicit_clone(4).await; let output = no_implicit_clone(4).await;
println!("{}", output); println!("{}", output);
assert_eq!(output, 13); assert_eq!(output, 13);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment