This is an archive of the discontinued LLVM Phabricator instance.

[SelectionDAG] Fix incorrect offset when expanding CONCAT_VECTORS.
ClosedPublic

Authored by paulwalker-arm on Jul 7 2020, 6:53 AM.

Details

Summary

ExpandVectorBuildThroughStack is also used for CONCAT_VECTORS.
However, when calculating the offsets for each of the operands we
incorrectly use the element size rather than actual size and thus
the stores overlap.

Diff Detail

Event Timeline

paulwalker-arm created this revision.Jul 7 2020, 6:53 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 7 2020, 6:53 AM
paulwalker-arm marked an inline comment as done.Jul 7 2020, 7:01 AM
paulwalker-arm added inline comments.
llvm/test/CodeGen/AArch64/sve-fixed-length-shuffles.ll
14

The tests are a little looser than I'd like but this mov prevents me from using CHECK-DAG because there's a similar unrelated mov that's part of the function prolog.

cameron.mcinally accepted this revision.Jul 7 2020, 7:57 AM

LGTM

llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
1429

Nit: Not specific to this patch, but I think we can hoist Node->getOperand(i).getValueType() out of the loop. All the BUILD_VECTOR/CONCAT_VECTOR operand types should be the same.

Looking deeper, the BUILD_VECTOR description is a little vague though:

/// The types of the operands must all be
/// the same and must match the vector element type, except that integer types
/// are allowed to be larger than the element type, in which case the operands
/// are implicitly truncated.

I assume the larger integer operand types must all be the same type. Maybe I'm misinterpreting this though.

Just queried llvm-dev about BUILD_VECTOR and will report back...

This revision is now accepted and ready to land.Jul 7 2020, 7:57 AM
cameron.mcinally marked an inline comment as done.Jul 7 2020, 12:03 PM
cameron.mcinally added inline comments.
llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
1429

It seems that the operands must always have the same type, but there's a modicum of disagreement (uncertainty?) there. No reason to hold up this patch though.

RKSimon added a subscriber: RKSimon.Jul 7 2020, 2:29 PM

@paulwalker-arm Does this finally fix PR12772?

@paulwalker-arm Does this finally fix PR12772?

@RKSimon: I believe so. I'll update the ticket once I've pushed this change.

This revision was automatically updated to reflect the committed changes.

Nice, thank you. @davidb this probably means you can drop the TargetConcatVectors ISD node from your llc.