[llvm] [LoopFusion] Fix crash "SCEVAddRecExpr operand is not available at loop entry (PR #176378)

Ehsan Amiri via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 4 07:00:58 PST 2026


amehsan wrote:

> @asb Can we get this change in?

Last week I ran an experiment using a number of SPEC benchmarks. I counted the total number of fused loops in two cases:

1- loop-fusion-dependence-analysis = FUSION_DEPENDENCE_ANALYSIS_ALL
2- loop-fusion-dependence-analysis = FUSION_DEPENDENCE_ANALYSIS_DA

In case 1 we have 35 loops fused, In case 2 we have 34 loops fused. There are several questions that we can ask for further investigation. (e.g. how many more we will lose when DA bugs are fixed?). I also haven't measured whether any of these fusions have any performance impact or not.

I can do a measurement to see whether the lost opportunity has any impact or not (most likely not, but still). Apart from that, I believe it is fine to switch the default and that will help us to fix this bug. (and later on we can remove the disabled code). 

On our side we have some cases that eventually I want to make sure fusion works for them properly. But I prefer to just make sure the DA path is good enough to catch them rather than maintaining another dep analysis internal to fusion.

Obviously I have no objections to merging this patch either. But I believe we need to switch the  default too. Please let me know your thoughts.

https://github.com/llvm/llvm-project/pull/176378


More information about the llvm-commits mailing list