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
592f7372
Commit
592f7372
authored
Oct 30, 2018
by
Paul
Browse files
Formatting
parent
31291843
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
6 deletions
+7
-6
src/dead_code_elimination.cpp
src/dead_code_elimination.cpp
+7
-6
No files found.
src/dead_code_elimination.cpp
View file @
592f7372
...
@@ -7,23 +7,24 @@
...
@@ -7,23 +7,24 @@
namespace
migraph
{
namespace
migraph
{
template
<
class
Range
,
class
Iterator
>
template
<
class
Range
,
class
Iterator
>
std
::
ptrdiff_t
bidistance
(
const
Range
&
r
,
Iterator
start
,
Iterator
last
)
std
::
ptrdiff_t
bidistance
(
const
Range
&
r
,
Iterator
start
,
Iterator
last
)
{
{
auto
start_forward
=
start
;
auto
start_forward
=
start
;
auto
start_backwards
=
start
;
auto
start_backwards
=
start
;
std
::
size_t
n
=
0
;
std
::
size_t
n
=
0
;
while
(
start_forward
!=
last
and
start_backwards
!=
last
)
while
(
start_forward
!=
last
and
start_backwards
!=
last
)
{
{
n
++
;
n
++
;
if
(
start_forward
!=
r
.
end
())
start_forward
++
;
if
(
start_forward
!=
r
.
end
())
if
(
start_backwards
!=
r
.
begin
())
start_backwards
--
;
start_forward
++
;
if
(
start_backwards
!=
r
.
begin
())
start_backwards
--
;
}
}
if
(
start_forward
==
last
)
if
(
start_forward
==
last
)
return
n
;
return
n
;
else
else
return
-
n
;
return
-
n
;
}
}
void
dead_code_elimination
::
apply
(
program
&
p
)
const
void
dead_code_elimination
::
apply
(
program
&
p
)
const
...
...
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