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