Ask questionscmd/compile: create cheapdeadcode
There are a number of places in the SSA pipeline where it would produce better code if we could run deadcode. However, deadcode is expensive.
I suspect we could create a cheaper, only slightly less effective version of deadcode:
One complication is line number handling, which currently depends on an ordering map which is created while building the full value liveness graph. I am not sure how best to address this; I find the existing code confusing. Perhaps @dr2chase has ideas.
We could use it in more places; we could probably also replace many uses of the full deadcode pass with it. I suspect this would end up improving both compiled code quality and compiler performance.
This is a reminder issue to investigate this. It's probably not a good introduction to the compiler, but help is definitely welcome!
Answer questions erifan
I suspect this would end up improving both compiled code quality and compiler performance.
It is definitely true. If there is a cheaper DCE, then we can call it in more places where it is needed and more optimization opportunities will appear. For example, the fuse pass, if we can clean up dead blocks in time, we can handle more situations.