This is an archive of the discontinued LLVM Phabricator instance.

[WebAssembly] Disable SimplifyDemandedVectorElts after legalization
ClosedPublic

Authored by aheejin on Mar 16 2022, 4:23 PM.

Details

Summary

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.

Diff Detail

Event Timeline

aheejin created this revision.Mar 16 2022, 4:23 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 16 2022, 4:23 PM
aheejin requested review of this revision.Mar 16 2022, 4:23 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 16 2022, 4:23 PM
tlively accepted this revision.Mar 16 2022, 6:39 PM

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.

This revision is now accepted and ready to land.Mar 16 2022, 6:39 PM

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.

This revision was landed with ongoing or failed builds.Mar 16 2022, 8:52 PM
This revision was automatically updated to reflect the committed changes.