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
d47fdea4
Commit
d47fdea4
authored
Mar 14, 2019
by
Khalique
Browse files
change logic to handle multiple identity inputs to ins
parent
0ba33502
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
11 deletions
+8
-11
src/eliminate_identity.cpp
src/eliminate_identity.cpp
+8
-11
No files found.
src/eliminate_identity.cpp
View file @
d47fdea4
...
@@ -14,20 +14,17 @@ void eliminate_identity::apply(program& p) const
...
@@ -14,20 +14,17 @@ void eliminate_identity::apply(program& p) const
{
{
for
(
auto
ins
:
iterator_for
(
p
))
for
(
auto
ins
:
iterator_for
(
p
))
{
{
if
(
ins
->
get_operator
().
name
()
==
"identity"
)
std
::
vector
<
instruction_ref
>
new_ins_inputs
=
ins
->
inputs
();
// check each input arg for identity ops,
// replace with the input of the respective identity
for
(
instruction_ref
&
input
:
new_ins_inputs
)
{
{
if
(
ins
!=
p
.
end
())
if
(
input
->
name
()
==
"identity"
){
{
input
=
input
->
inputs
().
at
(
0
);
instruction_ref
identity_input
{
ins
->
inputs
().
at
(
0
)};
auto
next_ins
=
std
::
next
(
ins
);
std
::
vector
<
instruction_ref
>
next_ins_inputs
{
next_ins
->
inputs
()};
std
::
replace_if
(
next_ins_inputs
.
begin
(),
next_ins_inputs
.
end
(),
[
&
](
instruction_ref
&
input
)
{
return
input
==
ins
;
},
identity_input
);
p
.
replace_instruction
(
next_ins
,
next_ins
->
get_operator
(),
next_ins_inputs
);
}
}
}
}
if
(
new_ins_inputs
!=
ins
->
inputs
())
p
.
replace_instruction
(
ins
,
ins
->
get_operator
(),
new_ins_inputs
);
}
}
}
}
...
...
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