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
09c58d75
Commit
09c58d75
authored
4 months ago
by
Aaron Councilman
Browse files
Options
Downloads
Patches
Plain Diff
Fix SROA edit issues
parent
8df0ef85
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!57
Intraprocedural SROA
Pipeline
#200286
passed
4 months ago
Stage: build
Stage: test
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
hercules_opt/src/sroa.rs
+12
-6
12 additions, 6 deletions
hercules_opt/src/sroa.rs
juno_frontend/src/lib.rs
+2
-2
2 additions, 2 deletions
juno_frontend/src/lib.rs
juno_samples/products.jn
+7
-1
7 additions, 1 deletion
juno_samples/products.jn
with
21 additions
and
9 deletions
hercules_opt/src/sroa.rs
+
12
−
6
View file @
09c58d75
...
@@ -212,6 +212,7 @@ pub fn sroa(editor: &mut FunctionEditor, reverse_postorder: &Vec<NodeID>, types:
...
@@ -212,6 +212,7 @@ pub fn sroa(editor: &mut FunctionEditor, reverse_postorder: &Vec<NodeID>, types:
// enough information to process a particular node, we add it back to the worklist
// enough information to process a particular node, we add it back to the worklist
let
mut
next_id
:
usize
=
editor
.func
()
.nodes
.len
();
let
mut
next_id
:
usize
=
editor
.func
()
.nodes
.len
();
let
mut
to_insert
=
BTreeMap
::
new
();
let
mut
to_insert
=
BTreeMap
::
new
();
let
mut
to_replace
:
Vec
<
(
NodeID
,
NodeID
)
>
=
vec!
[];
while
let
Some
(
mut
item
)
=
worklist
.pop_front
()
{
while
let
Some
(
mut
item
)
=
worklist
.pop_front
()
{
if
let
WorkItem
::
Unhandled
(
node
)
=
item
{
if
let
WorkItem
::
Unhandled
(
node
)
=
item
{
...
@@ -299,7 +300,7 @@ pub fn sroa(editor: &mut FunctionEditor, reverse_postorder: &Vec<NodeID>, types:
...
@@ -299,7 +300,7 @@ pub fn sroa(editor: &mut FunctionEditor, reverse_postorder: &Vec<NodeID>, types:
let
read_info
=
index_map
.lookup
(
indices
);
let
read_info
=
index_map
.lookup
(
indices
);
match
read_info
{
match
read_info
{
IndexTree
::
Leaf
(
field
)
=>
{
IndexTree
::
Leaf
(
field
)
=>
{
editor
.edit
(|
edit
|
edit
.replace_all_uses
(
node
,
*
field
));
to_replace
.push
(
(
node
,
*
field
));
}
}
_
=>
{}
_
=>
{}
}
}
...
@@ -426,12 +427,17 @@ pub fn sroa(editor: &mut FunctionEditor, reverse_postorder: &Vec<NodeID>, types:
...
@@ -426,12 +427,17 @@ pub fn sroa(editor: &mut FunctionEditor, reverse_postorder: &Vec<NodeID>, types:
}
}
// Create new nodes nodes
// Create new nodes nodes
for
(
node_id
,
node
)
in
to_insert
{
editor
.edit
(|
mut
edit
|
{
editor
.edit
(|
mut
edit
|
{
for
(
node_id
,
node
)
in
to_insert
{
let
id
=
edit
.add_node
(
node
);
let
id
=
edit
.add_node
(
node
);
assert!
(
node_id
==
id
.idx
());
assert_eq!
(
node_id
,
id
.idx
());
Ok
(
edit
)
}
});
Ok
(
edit
)
});
// Replace uses of old reads
for
(
old
,
new
)
in
to_replace
{
editor
.edit
(|
edit
|
edit
.replace_all_uses
(
old
,
new
));
}
}
// Remove nodes
// Remove nodes
...
...
This diff is collapsed.
Click to expand it.
juno_frontend/src/lib.rs
+
2
−
2
View file @
09c58d75
...
@@ -69,11 +69,11 @@ impl fmt::Display for ErrorMessage {
...
@@ -69,11 +69,11 @@ impl fmt::Display for ErrorMessage {
match
self
{
match
self
{
ErrorMessage
::
SemanticError
(
errs
)
=>
{
ErrorMessage
::
SemanticError
(
errs
)
=>
{
for
err
in
errs
{
for
err
in
errs
{
write!
(
f
,
"{}"
,
err
)
?
;
write!
(
f
,
"{}
\n
"
,
err
)
?
;
}
}
}
}
ErrorMessage
::
SchedulingError
(
msg
)
=>
{
ErrorMessage
::
SchedulingError
(
msg
)
=>
{
write!
(
f
,
"{}"
,
msg
)
?
;
write!
(
f
,
"{}
\n
"
,
msg
)
?
;
}
}
}
}
Ok
(())
Ok
(())
...
...
This diff is collapsed.
Click to expand it.
juno_samples/products.jn
+
7
−
1
View file @
09c58d75
fn
test_call
(
x
:
i32
,
y
:
f32
)
->
(
i32
,
f32
)
{
fn
test_call
(
x
:
i32
,
y
:
f32
)
->
(
i32
,
f32
)
{
let
res
=
(
x
,
y
);
let
res
=
(
x
,
y
);
if
x
<
13
{
res
=
(
x
+
1
,
y
);
}
for
i
=
0
to
10
{
if
i
%
2
==
0
{
res
.0
+=
1
;
}
else
{
res
.1
*=
2.0
;
}
}
return
res
;
return
res
;
}
}
...
...
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