Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
H
Hercules
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
llvm
Hercules
Commits
13718590
Commit
13718590
authored
3 months ago
by
Xavier Routh
Browse files
Options
Downloads
Patches
Plain Diff
add back implicit clone
parent
20fd62e5
No related branches found
No related tags found
1 merge request
!103
Forkify + Loop Canonicalization + Initial Fork Fission
Pipeline
#201235
canceled
3 months ago
Stage: test
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
juno_samples/implicit_clone/src/implicit_clone.jn
+135
-0
135 additions, 0 deletions
juno_samples/implicit_clone/src/implicit_clone.jn
with
135 additions
and
0 deletions
juno_samples/implicit_clone/src/implicit_clone.jn
+
135
−
0
View file @
13718590
#[entry]
fn
simple_implicit_clone
(
input
:
i32
)
->
i32
{
let
arr
:
i32
[
3
];
arr
[
0
]
=
2
;
let
arr2
=
arr
;
arr2
[
1
]
=
input
;
arr
[
2
]
=
4
;
return
arr
[
0
]
+
arr2
[
0
]
+
arr
[
1
]
+
arr2
[
1
]
+
arr
[
2
]
+
arr2
[
2
];
}
#[entry]
fn
loop_implicit_clone
(
input
:
i32
)
->
i32
{
let
arr
:
i32
[
3
];
let
r
:
i32
=
5
;
while
input
>
0
{
r
=
arr
[
0
];
let
arr2
=
arr
;
let
x
=
arr2
[
input
as
usize
-
input
as
usize
];
arr2
[
input
as
usize
-
input
as
usize
]
=
9
;
if
x
==
0
{
input
-=
arr2
[
0
];
}
else
{
r
=
99
;
break
;
}
}
return
r
+
7
;
}
#[entry]
fn
double_loop_implicit_clone
(
a
:
usize
)
->
usize
{
for
i
=
0
to
a
{
let
arr
:
i32
[
1
];
for
j
=
0
to
a
{
arr
[
0
]
=
1
;
}
}
return
42
;
}
#[entry]
fn
tricky_loop_implicit_clone
(
a
:
usize
,
b
:
usize
)
->
i32
{
let
x
=
0
;
...
...
@@ -19,3 +59,98 @@ fn tricky_loop_implicit_clone(a : usize, b : usize) -> i32 {
}
return
x
;
}
#[entry]
fn
tricky2_loop_implicit_clone
(
a
:
usize
,
b
:
usize
)
->
i32
{
let
x
=
0
;
for
i
=
0
to
3
{
let
arr1
:
i32
[
1
];
let
arr2
:
i32
[
1
];
if
a
==
b
{
arr1
[
0
]
=
6
;
}
else
{
arr2
[
0
]
=
9
;
}
arr1
[
0
]
=
2
;
for
j
=
0
to
4
{
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
+=
arr2
[
1
];
}
return
x
;
}
#[entry]
fn
no_implicit_clone
(
input
:
i32
)
->
i32
{
let
arr
:
i32
[
2
];
arr
[
0
]
=
input
;
while
input
>
0
{
arr
[
0
]
+=
1
;
input
-=
1
;
}
let
arr2
:
i32
[
1
];
if
input
==
0
{
arr2
[
0
]
=
5
;
}
else
{
arr2
[
0
]
=
3
;
}
return
arr
[
0
]
+
arr2
[
0
];
}
#[entry]
fn
mirage_implicit_clone
(
input
:
i32
)
->
i32
{
let
arr1
:
i32
[
2
];
let
arr2
:
i32
[
2
];
let
arr3
:
i32
[
2
];
let
arr4
:
i32
[
2
];
arr1
[
0
]
=
7
;
arr1
[
1
]
=
3
;
arr2
[
0
]
=
input
;
arr2
[
1
]
=
45
;
arr3
[
0
]
=
-
14
;
arr3
[
1
]
=
-
5
;
arr4
[
0
]
=
-
1
;
arr4
[
1
]
=
0
;
arr2
=
arr4
;
arr3
=
arr2
;
arr2
=
arr1
;
let
p1
=
arr1
[
0
]
+
arr1
[
1
]
+
arr2
[
0
]
+
arr2
[
1
]
+
arr3
[
0
]
+
arr3
[
1
]
+
arr4
[
0
]
+
arr4
[
1
];
// 18
arr4
=
arr2
;
let
p2
=
arr1
[
0
]
+
arr1
[
1
]
+
arr2
[
0
]
+
arr2
[
1
]
+
arr3
[
0
]
+
arr3
[
1
]
+
arr4
[
0
]
+
arr4
[
1
];
// 29
if
input
>
0
{
while
input
>
10
{
arr1
[
0
]
=
arr1
[
1
]
+
input
;
arr1
[
1
]
=
arr1
[
0
]
+
input
;
input
-=
10
;
}
}
let
p3
=
arr1
[
0
];
// 592
let
x
:
i32
=
0
;
while
input
<
20
{
let
arr5
:
i32
[
2
];
arr5
[
0
]
=
7
;
let
y
=
arr5
[
0
]
+
arr5
[
1
];
arr5
=
arr4
;
arr5
[
1
]
+=
2
;
y
+=
arr5
[
1
];
x
+=
12
;
input
+=
1
;
}
let
p4
=
x
;
// 204
return
p1
+
p2
+
p3
+
p4
;
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment