This is an archive of the discontinued LLVM Phabricator instance.

[SVE][LoopVectorize] Fix crash in InnerLoopVectorizer::widenPHIInstruction
ClosedPublic

Authored by david-arm on Mar 24 2021, 4:25 AM.

Details

Summary

There were a few places in widenPHIInstruction where calculations of
offsets were failing to take the runtime calculation of VF into
account for scalable vectors. I've fixed those cases in this patch
as well as adding an assert that we should not be scalarising for
scalable vectors.

Tests are added here:

Transforms/LoopVectorize/AArch64/sve-widen-phi.ll

Diff Detail

Event Timeline

david-arm created this revision.Mar 24 2021, 4:25 AM
david-arm requested review of this revision.Mar 24 2021, 4:25 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 24 2021, 4:25 AM
david-arm updated this revision to Diff 335798.Apr 7 2021, 6:35 AM
david-arm edited the summary of this revision. (Show Details)
  • I realised that there was still a broken case where the PHIs are treated as uniform, which leads us to fall into the path where the PHI is scalar after vectorisation. We can support the uniform case for scalable vectors. I've fixed the code to work for scalable vectors and added a test.
kmclaughlin accepted this revision.Apr 14 2021, 11:19 AM
kmclaughlin added inline comments.
llvm/test/Transforms/LoopVectorize/AArch64/sve-widen-phi.ll
84

nit: can you check for [[VSCALE1]] here instead of %5?

88

Is it also worth adding some similar checks for SGEP2 here?

This revision is now accepted and ready to land.Apr 14 2021, 11:19 AM
This revision was landed with ongoing or failed builds.Apr 15 2021, 2:52 AM
This revision was automatically updated to reflect the committed changes.