* Partial dead code elimination
@ 2019-06-24 8:11 Gohil Dwijesh
2019-06-24 17:07 ` Jeff Law
0 siblings, 1 reply; 2+ messages in thread
From: Gohil Dwijesh @ 2019-06-24 8:11 UTC (permalink / raw)
To: gcc-help
It seems that partial dead code elimination has not been implemented by the
gcc and icc. I saw dump files dumped by the gcc using the following
command.
gcc -O3 -fdump-tree-all <file_name.c>
I can not even find a single pass for partial dead code elimination though
in the research papers(Partial Dead Code Elimination, June 1994) algorithm
is clearly mentioned. Applying partial dead code elimination, execution
time either remains the same or decreases.* I am wondering, why is it not
implemented by the recent compilers?*
example of partial dead code elimination
x = 4; y=7; y = 7;
y = 7; if(cond) then if(cond)
then
if(cond) then x = 4; x = 3;
x = 3; -------------> x = 3; ---------------> else
else else x = 4;
z = 4; x = 4; z = 4;
end if; z = 4; end if;
out(x); end if; out(x)
out(x)
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Partial dead code elimination
2019-06-24 8:11 Partial dead code elimination Gohil Dwijesh
@ 2019-06-24 17:07 ` Jeff Law
0 siblings, 0 replies; 2+ messages in thread
From: Jeff Law @ 2019-06-24 17:07 UTC (permalink / raw)
To: Gohil Dwijesh, gcc-help
On 6/24/19 2:11 AM, Gohil Dwijesh wrote:
> It seems that partial dead code elimination has not been implemented by the
> gcc and icc. I saw dump files dumped by the gcc using the following
> command.
>
> gcc -O3 -fdump-tree-all <file_name.c>
>
> I can not even find a single pass for partial dead code elimination though
> in the research papers(Partial Dead Code Elimination, June 1994) algorithm
> is clearly mentioned. Applying partial dead code elimination, execution
> time either remains the same or decreases.* I am wondering, why is it not
> implemented by the recent compilers?*
>
> example of partial dead code elimination
>
> x = 4; y=7; y = 7;
> y = 7; if(cond) then if(cond)
> then
> if(cond) then x = 4; x = 3;
> x = 3; -------------> x = 3; ---------------> else
> else else x = 4;
> z = 4; x = 4; z = 4;
> end if; z = 4; end if;
> out(x); end if; out(x)
> out(x)
>
We don't have a specific pDCE pass and I wouldn't necessarily recommend
writing one based on the '94 paper from Knoop, etc at this point. Those
comments in gcse.c are roughly 20+ years old at this point and pre-date
our move to SSA based optimizers.
A lot of what pDCE would do is handled in various parts of our
tree/gimple SSA optimizer pipeline, but not in a form that looks
anything like the Knoop paper. Implementing something based on Knoop
would likely be very expensive compile-time wise with marginal benefits.
SO what I would recommend would be a self-contained testcase for code
you care about which would benefit from pDCE. That way we can dig into
it and see what, if any, adjustments we need to make to the existing
optimizer pipeline to get good performance.
jeff
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-06-24 17:07 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-24 8:11 Partial dead code elimination Gohil Dwijesh
2019-06-24 17:07 ` Jeff Law
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).