Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
R
riscv-gcc-1
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
riscv-gcc-1
Commits
7195b414
Commit
7195b414
authored
Apr 20, 2005
by
Kazu Hirata
Committed by
Kazu Hirata
Apr 20, 2005
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
* tree-ssa-phiopt.c: Update a comment about the pass.
From-SVN: r98428
parent
acf55c29
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
52 additions
and
37 deletions
+52
-37
gcc/ChangeLog
+4
-0
gcc/tree-ssa-phiopt.c
+48
-37
No files found.
gcc/ChangeLog
View file @
7195b414
2005-04-20 Kazu Hirata <kazu@cs.umass.edu>
* tree-ssa-phiopt.c: Update a comment about the pass.
2005-04-19 Kazu Hirata <kazu@cs.umass.edu>
2005-04-19 Kazu Hirata <kazu@cs.umass.edu>
* tree-ssa-phiopt.c, config/arm/arm.c, config/fr30/fr30.md,
* tree-ssa-phiopt.c, config/arm/arm.c, config/fr30/fr30.md,
...
...
gcc/tree-ssa-phiopt.c
View file @
7195b414
...
@@ -49,80 +49,91 @@ static void replace_phi_edge_with_variable (basic_block, basic_block, edge,
...
@@ -49,80 +49,91 @@ static void replace_phi_edge_with_variable (basic_block, basic_block, edge,
tree
,
tree
);
tree
,
tree
);
static
basic_block
*
blocks_in_phiopt_order
(
void
);
static
basic_block
*
blocks_in_phiopt_order
(
void
);
/* This pass eliminates PHI nodes which can be trivially implemented as
/* This pass tries to replaces an if-then-else block with an
an assignment from a conditional expression. i.e. if we have something
assignment. We have four kinds of transformations. Some of these
like:
transformations are also performed by the ifcvt RTL optimizer.
Conditional Replacement
-----------------------
This transformation, implmented in conditional_replacement,
replaces
bb0:
bb0:
if (cond) goto bb2; else goto bb1;
if (cond) goto bb2; else goto bb1;
bb1:
bb1:
bb2:
bb2:
x = PHI
(0 (bb1), 1 (bb0)
x = PHI
<0 (bb1), 1 (bb0), ...>;
We can rewrite that as:
with
bb0:
bb0:
bb1:
x' = cond;
goto bb2;
bb2:
bb2:
x =
cond
;
x =
PHI <x' (bb0), ...>
;
bb1 will become unreachable and bb0 and bb2 will almost always
We remove bb1 as it becomes unreachable. This occurs often due to
be merged into a single block. This occurs often due to gimplification
gimplification of conditionals.
of conditionals.
Also done is the following optimization:
Value Replacement
-----------------
This transformation, implemented in value_replacement, replaces
bb0:
bb0:
if (a != b) goto bb2; else goto bb1;
if (a != b) goto bb2; else goto bb1;
bb1:
bb1:
bb2:
bb2:
x = PHI (a (bb1), b (bb0))
x = PHI <a (bb1), b (bb0), ...>;
We can rewrite that as:
with
bb0:
bb0:
bb1:
bb2:
bb2:
x = b;
x = PHI <b (bb0), ...>;
This opportunity can sometimes occur as a result of other
optimizations.
This can sometimes occur as a result of other optimizations. A
ABS Replacement
similar transformation is done by the ifcvt RTL optimizer.
---------------
This pass also eliminates PHI nodes which are really absolute
This transformation, implemented in abs_replacement, replaces
values. i.e. if we have something like:
bb0:
bb0:
if (a >= 0) goto bb2; else goto bb1;
if (a >= 0) goto bb2; else goto bb1;
bb1:
bb1:
x = -a;
x = -a;
bb2:
bb2:
x = PHI (x (bb1), a (bb0))
;
x = PHI <x (bb1), a (bb0), ...>
;
We can rewrite that as:
with
bb0:
bb0:
bb1:
x' = ABS_EXPR< a >;
bb2:
bb2:
x = ABS_EXPR< a >;
x = PHI <x' (bb0), ...>;
MIN/MAX Replacement
-------------------
Similarly,
This transformation, minmax_replacement replaces
bb0:
bb0:
if (a <= b) goto bb2; else goto bb1;
if (a <= b) goto bb2; else goto bb1;
bb1:
bb1:
goto bb2;
bb2:
bb2:
x = PHI (b (bb1), a (bb0))
;
x = PHI <b (bb1), a (bb0), ...>
;
Becomes
with
x = MIN_EXPR (a, b)
bb0:
x' = MIN_EXPR (a, b)
And the same transformation for MAX_EXPR.
bb2:
x = PHI <x' (bb0), ...>;
bb1 will become unreachable and bb0 and bb2 will almost always be merged
A similar transformtion is done for MAX_EXPR. */
into a single block. Similar transformations are done by the ifcvt
RTL optimizer. */
static
void
static
void
tree_ssa_phiopt
(
void
)
tree_ssa_phiopt
(
void
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment