This is an archive of the discontinued LLVM Phabricator instance.

[SVE][CodeGen] Fix scalable vector issues in DAGTypeLegalizer::GenWidenVectorLoads
ClosedPublic

Authored by david-arm on Aug 13 2020, 8:20 AM.

Details

Summary

In DAGTypeLegalizer::GenWidenVectorLoads the algorithm assumes it only
ever deals with fixed width types, hence the offsets for each individual
store never take 'vscale' into account. I've changed the code in that
function to use TypeSize instead of unsigned for tracking the remaining
load amount. In addition, I've changed the load loop to use the new
IncrementPointer helper function for updating the addresses in each
iteration, since this handles scalable vector types.

Also, I've added report_fatal_errors in GenWidenVectorExtLoads,
TargetLowering::scalarizeVectorLoad and TargetLowering::scalarizeVectorStores,
since these functions currently use a sequence of element-by-element
scalar loads/stores. In a similar vein, I've also added a fatal error
report in FindMemType for the case when we decide to return the element
type for a scalable vector type.

I've added new tests in

CodeGen/AArch64/sve-split-load.ll
CodeGen/AArch64/sve-ld-addressing-mode-reg-imm.ll

for the changes in GenWidenVectorLoads.

Diff Detail

Event Timeline

david-arm created this revision.Aug 13 2020, 8:20 AM
Herald added a project: Restricted Project. · View Herald Transcript
david-arm requested review of this revision.Aug 13 2020, 8:20 AM

While you're looking at fatal errors on unimplemented codepaths, might also want to add one to TargetLowering::scalarizeVectorLoad.

llvm/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp
4909

Else-after-return.

david-arm updated this revision to Diff 285575.Aug 14 2020, 1:17 AM
david-arm edited the summary of this revision. (Show Details)
  • Removed 'else' from end of FindMemType.
  • Added fatal errors in TargetLowering::scalarizeVectorLoad and TargetLowering::scalarizeVectorStores if the type is a scalable vector.
david-arm marked an inline comment as done.Aug 17 2020, 6:25 AM
This revision is now accepted and ready to land.Aug 18 2020, 2:57 PM