This is an archive of the discontinued LLVM Phabricator instance.

[CodeGen] Fix warnings in DAGCombiner::visitSCALAR_TO_VECTOR
ClosedPublic

Authored by david-arm on Jun 30 2020, 6:25 AM.

Details

Summary

In visitSCALAR_TO_VECTOR we try to optimise cases such as:

scalar_to_vector (extract_vector_elt %x)

into vector shuffles of %x. However, it led to numerous warnings
when %x is a scalable vector type, so for now I've changed the
code to only perform the combination on fixed length vectors.
Although we probably could change the code to work with scalable
vectors in certain cases, without a proper profit analysis it
doesn't seem worth it at the moment.

This change fixes up one of the warnings in:

llvm/test/CodeGen/AArch64/sve-merging-stores.ll

I've also added a simplified version of the same test to:

llvm/test/CodeGen/AArch64/sve-fp.ll

which already has checks for no warnings.

Diff Detail

Event Timeline

david-arm created this revision.Jun 30 2020, 6:25 AM
efriedma added inline comments.Jun 30 2020, 12:40 PM
llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
20278

Do we not need to check the result type of the SCALAR_TO_VECTOR node itself?

efriedma added inline comments.Jun 30 2020, 12:41 PM
llvm/test/CodeGen/AArch64/sve-fp.ll
145

Please just generate the checks in this test with update_llc_test_checks.py.

david-arm updated this revision to Diff 274691.Jul 1 2020, 12:19 AM
david-arm marked 2 inline comments as done.Jul 1 2020, 12:21 AM
  • Added extra check that SCALAR_TO_VECTOR result type is also a fixed length vector.
  • Actually added proper CHECK lines to my new test. Sorry about that @efriedma - that was a silly mistake.
sdesmalen accepted this revision.Jul 1 2020, 9:36 AM

LGTM with nit addressed.

llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
20271

nit: This comment does the opposite of clarifying things for me. Maybe better to just remove it, as the suggestion is quite speculative anyway.

This revision is now accepted and ready to land.Jul 1 2020, 9:36 AM
This revision was automatically updated to reflect the committed changes.