This is an archive of the discontinued LLVM Phabricator instance.

[ARM] Fix infinite loop when lowering STRICT_FP_EXTEND
ClosedPublic

Authored by john.brawn on Feb 13 2020, 7:08 AM.

Details

Summary

If the target has FP64 but not FP16 then we have custom lowering for FP_EXTEND and STRICT_FP_EXTEND with type f64. However if the extend is from f32 to f64 the current implementation will cause in infinite loop for STRICT_FP_EXTEND due to emitting a merge_values of the original node which after replacement becomes a merge_values of itself.

Fix this by not doing anything for f32 to f64 extend when we have FP64, though for STRICT_FP_EXTEND we have to do the strict-to-nonstrict mutation as that doesn't happen automatically for opcodes with custom lowering.

Diff Detail

Event Timeline

john.brawn created this revision.Feb 13 2020, 7:08 AM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 13 2020, 7:08 AM

Perhaps I have missed it, but are the test that have been changed here actually doing any 32 -> 64 converts?

Perhaps I have missed it, but are the test that have been changed here actually doing any 32 -> 64 converts?

The test fpext_f32 tests 32 -> 64 converts. The test changes here are because we're now running the tests with ARMv7 (because ARMv7 by default doesn't have FP16 support), which doesn't have some instruction that we have in ARMv8.

SjoerdMeijer accepted this revision.Feb 13 2020, 8:01 AM

Ah, thanks for clarifying. In that case, this looks like a straightforward fix to me: LGTM.

This revision is now accepted and ready to land.Feb 13 2020, 8:01 AM
This revision was automatically updated to reflect the committed changes.