Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
gaoqiong
MIGraphX
Commits
dd576d7f
Commit
dd576d7f
authored
Apr 03, 2019
by
Paul
Browse files
Formatting
parent
58caa150
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
5 deletions
+6
-5
src/dead_code_elimination.cpp
src/dead_code_elimination.cpp
+2
-1
test/dead_code_elimination_test.cpp
test/dead_code_elimination_test.cpp
+4
-4
No files found.
src/dead_code_elimination.cpp
View file @
dd576d7f
...
@@ -51,7 +51,8 @@ void dead_code_elimination::apply(program& p) const
...
@@ -51,7 +51,8 @@ void dead_code_elimination::apply(program& p) const
assert
(
p
.
has_instruction
(
leaf
));
assert
(
p
.
has_instruction
(
leaf
));
if
(
leaf
->
outputs
().
empty
())
if
(
leaf
->
outputs
().
empty
())
{
{
std
::
unordered_set
<
instruction_ref
>
args
(
leaf
->
inputs
().
begin
(),
leaf
->
inputs
().
end
());
std
::
unordered_set
<
instruction_ref
>
args
(
leaf
->
inputs
().
begin
(),
leaf
->
inputs
().
end
());
leaf
->
clear_arguments
();
leaf
->
clear_arguments
();
assert
(
bidistance
(
p
,
last
,
leaf
)
<
0
);
assert
(
bidistance
(
p
,
last
,
leaf
)
<
0
);
assert
(
leaf
!=
ins
);
assert
(
leaf
!=
ins
);
...
...
test/dead_code_elimination_test.cpp
View file @
dd576d7f
...
@@ -149,8 +149,8 @@ TEST_CASE(duplicate_args2)
...
@@ -149,8 +149,8 @@ TEST_CASE(duplicate_args2)
{
{
migraphx
::
program
p
;
migraphx
::
program
p
;
auto
l0
=
p
.
add_literal
(
0
);
auto
l0
=
p
.
add_literal
(
0
);
auto
l3
=
p
.
add_literal
(
3
);
auto
l3
=
p
.
add_literal
(
3
);
auto
sum1
=
p
.
add_instruction
(
migraphx
::
op
::
add
{},
l0
,
l3
);
auto
sum1
=
p
.
add_instruction
(
migraphx
::
op
::
add
{},
l0
,
l3
);
p
.
add_instruction
(
migraphx
::
op
::
add
{},
sum1
,
l3
);
p
.
add_instruction
(
migraphx
::
op
::
add
{},
sum1
,
l3
);
p
.
add_instruction
(
migraphx
::
op
::
identity
{},
l0
);
p
.
add_instruction
(
migraphx
::
op
::
identity
{},
l0
);
...
@@ -166,8 +166,8 @@ TEST_CASE(duplicate_args3)
...
@@ -166,8 +166,8 @@ TEST_CASE(duplicate_args3)
{
{
migraphx
::
program
p
;
migraphx
::
program
p
;
auto
l0
=
p
.
add_literal
(
0
);
auto
l0
=
p
.
add_literal
(
0
);
auto
l3
=
p
.
add_literal
(
3
);
auto
l3
=
p
.
add_literal
(
3
);
auto
sum1
=
p
.
add_instruction
(
migraphx
::
op
::
add
{},
l0
,
l3
);
auto
sum1
=
p
.
add_instruction
(
migraphx
::
op
::
add
{},
l0
,
l3
);
auto
sum2
=
p
.
add_instruction
(
migraphx
::
op
::
add
{},
l0
,
sum1
);
auto
sum2
=
p
.
add_instruction
(
migraphx
::
op
::
add
{},
l0
,
sum1
);
p
.
add_instruction
(
migraphx
::
op
::
add
{},
sum2
,
l3
);
p
.
add_instruction
(
migraphx
::
op
::
add
{},
sum2
,
l3
);
...
...
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