This is an archive of the discontinued LLVM Phabricator instance.

[SelectionDAG][RISCV][SVE] Harden fixed offset version of ComputeValueVTs against scalable offsets.
ClosedPublic

Authored by craig.topper on Aug 16 2023, 1:41 PM.

Details

Summary

Use getFixedValue instead of getKnownMinValue to convert TypeSize
to uint64_t. I believe this would have caught the bug fixed by
D157872.

To prevent false failures, I had to treat a scalable 0 as if it
is fixed value.

Diff Detail

Event Timeline

craig.topper created this revision.Aug 16 2023, 1:41 PM
Herald added a project: Restricted Project. · View Herald TranscriptAug 16 2023, 1:41 PM
craig.topper requested review of this revision.Aug 16 2023, 1:41 PM
Herald added a project: Restricted Project. · View Herald TranscriptAug 16 2023, 1:41 PM

Add the whole patch.

Matt added a subscriber: Matt.Aug 16 2023, 2:33 PM
paulwalker-arm added inline comments.Aug 17 2023, 3:02 AM
llvm/lib/CodeGen/Analysis.cpp
151

A value of zero is both fixed and scalable compatible so I think perhaps this should just always be getFixedValue() and TypeSize should be updated to allow the scalable zero case to return 0.

I also think isFixed() and isScalable() should return true for the zero case but that can be a job for later.

Sync the zero check into getFixedValue.

paulwalker-arm accepted this revision.Aug 21 2023, 5:56 AM
This revision is now accepted and ready to land.Aug 21 2023, 5:56 AM
This revision was landed with ongoing or failed builds.Aug 21 2023, 10:36 AM
This revision was automatically updated to reflect the committed changes.