On Thu, 2019-12-12 at 15:44 -0500, Jason Merrill wrote:
> Here are the dumps from ssa-dom-thread-7.c made to compile as C++; cx-current 
> is the dumps with current trunk; cx-old is changed to use the old goto-based 
> lowering like C.
Sorry this has taken so long to get back to.

For ssa-dom-thread-7.c it looks like the differences we're encountering start 
at the thread1 pass.

While both cc1 and cc1plus optimized 16 jump threading paths, the final targets 
differ in some cases.  I guess somewhat ironically cc1plus actually does a 
better job threading deeper through the CFG.   I suspect, but have not actually 
confirmed that by threading deeper through the CFG, there's just fewer things 
for subsequent passes to detect and optimize.

I'm pretty sure cc1 doesn't thread as deeply simply due to the ordering of the 
jump thread paths that have been recorded.  Essentially we only optimize *one* 
path starting at any given edge even though we may have multiple potential jump 
threading paths that start at that edge.   This clearly argues that we should 
sort the vector of jump threading paths so that we find the longest paths first.

While I think we've missed the boat for gcc-10, I think these patches should go 
forward in gcc-11.  I'll own getting the paths sorted so that this problem is 
avoided.

Jeff



Reply via email to