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
5a118a33
Commit
5a118a33
authored
4 months ago
by
rarbore2
Browse files
Options
Downloads
Patches
Plain Diff
Fix outlining
parent
09ad3371
No related branches found
No related tags found
1 merge request
!77
Fix outlining
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
hercules_opt/src/outline.rs
+15
-16
15 additions, 16 deletions
hercules_opt/src/outline.rs
with
15 additions
and
16 deletions
hercules_opt/src/outline.rs
+
15
−
16
View file @
5a118a33
extern
crate
bitvec
;
extern
crate
hercules_ir
;
use
std
::
collections
::{
BTreeMap
,
BTreeSet
};
use
std
::
iter
::
zip
;
use
std
::
sync
::
atomic
::{
AtomicUsize
,
Ordering
};
use
self
::
bitvec
::
prelude
::
*
;
use
self
::
hercules_ir
::
def_use
::
*
;
use
self
::
hercules_ir
::
dom
::
*
;
use
self
::
hercules_ir
::
gcm
::
*
;
...
...
@@ -88,7 +85,11 @@ pub fn outline(
// Note, this is the control ID of the exit point of the previous partition,
// not just the previous partition - partition A may have multiple exit
// points that jump to partition B.
let
callee_pred_param_idx
=
if
control_subgraph
.preds
(
top_node
)
.count
()
>
1
{
let
top_node_outside_preds
:
Box
<
[
_
]
>
=
control_subgraph
.preds
(
top_node
)
.filter
(|
pred_id
|
!
partition
.contains
(
pred_id
))
.collect
();
let
callee_pred_param_idx
=
if
top_node_outside_preds
.len
()
>
1
{
Some
(
param_idx_to_outside_id
.len
())
}
else
{
None
...
...
@@ -97,10 +98,10 @@ pub fn outline(
.iter
()
.map
(|
outside_id
|
{
let
func
=
editor
.func
();
control_subgraph
.preds
(
top_node
)
.map
(
move
|
pred_id
|
{
top_node_outside_preds
.iter
(
)
.map
(
move
|
pred_id
|
{
(
(
*
outside_id
,
pred_id
),
does_data_dom_control
(
func
,
*
outside_id
,
pred_id
,
dom
),
(
*
outside_id
,
*
pred_id
),
does_data_dom_control
(
func
,
*
outside_id
,
*
pred_id
,
dom
),
)
})
})
...
...
@@ -421,11 +422,9 @@ pub fn outline(
// - Region (single predecessor), If, Match, or Fork: the original top
// node gets replaced with a new region with a single predecessor. The
// call is generated in a straightforward manner.
let
(
new_region_id
,
call_id
)
=
if
let
Node
::
Region
{
preds
}
=
edit
.get_node
(
top_node
)
&&
preds
.len
()
>
1
{
let
(
new_region_id
,
call_id
)
=
if
top_node_outside_preds
.len
()
>
1
{
let
new_region
=
Node
::
Region
{
preds
:
preds
.clone
(),
preds
:
top_node_outside_
preds
.clone
(),
};
let
new_region_id
=
edit
.add_node
(
new_region
);
let
mut
args
=
vec!
[];
...
...
@@ -439,10 +438,10 @@ pub fn outline(
let
undef_id
=
edit
.add_node
(
undef
);
let
phi
=
Node
::
Phi
{
control
:
new_region_id
,
data
:
control_subgraph
.
preds
(
top_node
)
data
:
top_node_outside_preds
.
iter
(
)
.map
(|
pred_id
|
{
if
outside_id_and_top_pred_to_does_dom
[
&
(
*
outside_id
,
pred_id
)]
{
if
outside_id_and_top_pred_to_does_dom
[
&
(
*
outside_id
,
*
pred_id
)]
{
*
outside_id
}
else
{
undef_id
...
...
@@ -454,7 +453,7 @@ pub fn outline(
}
// Add a phi for the control predecessor indicator.
let
control_id_constants
=
control_subgraph
.preds
(
top_node
)
.map
(|
pred_id
|
{
let
control_id_constants
=
top_node_outside_preds
.iter
(
)
.map
(|
pred_id
|
{
let
id
=
edit
.add_constant
(
Constant
::
UnsignedInteger32
(
pred_id
.idx
()
as
u32
));
edit
.add_node
(
Node
::
Constant
{
id
})
});
...
...
@@ -474,7 +473,7 @@ pub fn outline(
(
new_region_id
,
call_id
)
}
else
{
let
new_region
=
Node
::
Region
{
preds
:
Box
::
new
([
control_subgraph
.preds
(
top_node
)
.next
()
.unwrap
()])
,
preds
:
top_node_outside_preds
,
};
let
new_region_id
=
edit
.add_node
(
new_region
);
let
call
=
Node
::
Call
{
...
...
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