This fixes a reported bug that caused an infinite loop during the
SelectionDAG optimization phase in ISel, by creating an overridable hook
in TargetLowering that allows us to bail out from running
SimplifyDemandedVectorElts.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
LGTM! This seems fairly reasonable as a solution, all things considered. Have you been able to check whether this has any broad impacts on the quality of our codegen? My guess is that it doesn't since it seems that any code that would have had the vector elements simplified previously would have ended up in that infinite loop, but we went a long time without ever seeing that bug in the wild.
I wasn't able to check performances for real-world programs myself, but there's no changes in our existing tests. I don't think it will have a huge impact because I made the condition fairly specific: we bail out only when it is a build_vector and the DAG is already type-legalized and legalized, meaning it does so only in the very last stage before instruction selection. Also I'm not sure if there's any other way around this at this point.