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
8aabec77
Commit
8aabec77
authored
2 months ago
by
Xavier Routh
Browse files
Options
Downloads
Patches
Plain Diff
better phi reduce condition
parent
b2d0899d
No related branches found
No related tags found
1 merge request
!103
Forkify + Loop Canonicalization + Initial Fork Fission
Pipeline
#201246
passed
2 months ago
Stage: test
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
hercules_opt/src/forkify.rs
+14
-9
14 additions, 9 deletions
hercules_opt/src/forkify.rs
with
14 additions
and
9 deletions
hercules_opt/src/forkify.rs
+
14
−
9
View file @
8aabec77
...
@@ -477,10 +477,17 @@ pub fn analyze_phis<'a>(
...
@@ -477,10 +477,17 @@ pub fn analyze_phis<'a>(
return
false
;
return
false
;
})
})
.collect
();
.collect
();
let
continue_idx
=
editor
.get_uses
(
natural_loop
.header
)
.position
(|
node
|
natural_loop
.control
[
node
.idx
()])
.unwrap
();
let
loop_continue_latch
=
editor
.node
(
phi
)
.try_phi
()
.unwrap
()
.1
[
continue_idx
];
// TODO: We may need to stop on exiting the loop for looking for data cycles.
// TODO: We may need to stop on exiting the loop for looking for data cycles.
let
uses
=
walk_all_uses_stop_on
(
*
phi
,
editor
,
stop_on
.clone
());
let
uses
=
walk_all_uses_stop_on
(
loop_continue_latch
,
editor
,
stop_on
.clone
());
let
users
=
walk_all_users_stop_on
(
*
phi
,
editor
,
stop_on
.clone
());
let
users
=
walk_all_users_stop_on
(
loop_continue_latch
,
editor
,
stop_on
.clone
());
let
other_stop_on
:
HashSet
<
NodeID
>
=
editor
let
other_stop_on
:
HashSet
<
NodeID
>
=
editor
.node_ids
()
.node_ids
()
...
@@ -509,8 +516,10 @@ pub fn analyze_phis<'a>(
...
@@ -509,8 +516,10 @@ pub fn analyze_phis<'a>(
return
false
;
return
false
;
})
})
.collect
();
.collect
();
let
mut
uses_for_dependance
=
walk_all_users_stop_on
(
*
phi
,
editor
,
other_stop_on
);
let
mut
uses_for_dependance
=
walk_all_users_stop_on
(
loop_continue_latch
,
editor
,
other_stop_on
);
let
set1
:
HashSet
<
_
>
=
HashSet
::
from_iter
(
uses
);
let
set1
:
HashSet
<
_
>
=
HashSet
::
from_iter
(
uses
);
let
set2
:
HashSet
<
_
>
=
HashSet
::
from_iter
(
users
);
let
set2
:
HashSet
<
_
>
=
HashSet
::
from_iter
(
users
);
...
@@ -523,12 +532,7 @@ pub fn analyze_phis<'a>(
...
@@ -523,12 +532,7 @@ pub fn analyze_phis<'a>(
LoopPHI
::
LoopDependant
(
*
phi
)
LoopPHI
::
LoopDependant
(
*
phi
)
}
}
else
if
intersection
.clone
()
.iter
()
.any
(|
node
|
true
)
{
else
if
intersection
.clone
()
.iter
()
.any
(|
node
|
true
)
{
let
continue_idx
=
editor
.get_uses
(
natural_loop
.header
)
.position
(|
node
|
natural_loop
.control
[
node
.idx
()])
.unwrap
();
let
loop_continue_latch
=
editor
.node
(
phi
)
.try_phi
()
.unwrap
()
.1
[
continue_idx
];
// PHIs on the frontier of the uses by the candidate phi, i.e in uses_for_dependance need
// PHIs on the frontier of the uses by the candidate phi, i.e in uses_for_dependance need
// to have headers that postdominate the loop continue latch. The value of the PHI used needs to be defined
// to have headers that postdominate the loop continue latch. The value of the PHI used needs to be defined
...
@@ -538,7 +542,8 @@ pub fn analyze_phis<'a>(
...
@@ -538,7 +542,8 @@ pub fn analyze_phis<'a>(
// If some other node in the cycle is used, there is not a valid node to assign it after making the cycle a reduce.
// If some other node in the cycle is used, there is not a valid node to assign it after making the cycle a reduce.
if
intersection
if
intersection
.iter
()
.iter
()
.filter
(|
node
|
**
node
!=
loop_continue_latch
)
.filter
(|
node
|
**
node
!=
loop_continue_latch
)
.filter
(|
node
|
!
(
editor
.node
(
*
node
)
.is_reduce
()
||
editor
.node
(
*
node
)
.is_phi
()))
.any
(|
data_node
|
{
.any
(|
data_node
|
{
editor
editor
.get_users
(
*
data_node
)
.get_users
(
*
data_node
)
...
...
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