WinEH funclet coloring in computeLoopSafetyInfo

I’ve been looking at compilation time issues in the LICM pass, and it looks to me like colorEHFunclets() is probably being called a lot more often than it needs to be for functions that have Windows EH personality functions. For one thing, the funclet coloring is happening when computeLoopSafetyInfo() is called from LoopIdiomRecognize and LoopUnswitch but those passes don’t use the coloring information. Beyond that, it’s called for every loop within LICM even though in many case the information won’t have changed since being computed for other loops in the same function.

I was thinking about pulling the funclet coloring out of computeLoopSafetyInfo() and moving it into an analysis pass that can be used by LICM. Does this sound reasonable?

Thanks,

Andy

It looks like we only use the block colors when sinking a call out of the loop. That seems like a very uncommon scenario, so maybe we should lazily compute the block colors on demand if we discover that we want to do that transform, rather than eagerly when computing LoopSafetyInfo.

That seems reasonable. I’ll see if I can collect some information on how much time this is currently taking and how often it’s actually needed. I’ve been working with a benchmark that I think will provide a decent test case.