This is an archive of the discontinued LLVM Phabricator instance.

Clean up usages of asserting vector getters in Type
ClosedPublic

Authored by ctetreau on Apr 1 2020, 4:31 PM.

Details

Summary

Remove usages of asserting vector getters in Type in preparation for the
VectorType refactor. The existence of these functions complicates the
refactor while adding little value.

Diff Detail

Event Timeline

ctetreau created this revision.Apr 1 2020, 4:31 PM
Herald added a project: Restricted Project. · View Herald TranscriptApr 1 2020, 4:31 PM
ctetreau updated this revision to Diff 254574.Apr 2 2020, 11:29 AM

Mention that this is NFC

sdesmalen added inline comments.Apr 6 2020, 8:45 AM
mlir/lib/Conversion/StandardToLLVM/StandardToLLVM.cpp
1618–1621

is the cast to unsigned needed?

ctetreau marked an inline comment as done.Apr 6 2020, 10:09 AM
ctetreau added inline comments.
mlir/lib/Conversion/StandardToLLVM/StandardToLLVM.cpp
1618–1621

VectorType::getNumElements() returns uint64_t, where Type::getVectorNumElements() returned unsigned. At least in visual studio, this results in an error due to a narrowing conversion.

I have no idea why this is, I can't imagine that we'd need 64 bits to express the number of vector lanes.

ctetreau updated this revision to Diff 255392.Apr 6 2020, 10:16 AM

Update commit message to mention MLIR

efriedma added inline comments.Apr 6 2020, 11:27 AM
mlir/lib/Conversion/StandardToLLVM/StandardToLLVM.cpp
1618–1621

Actually, I'm pretty sure it's actually "SequentalType::getNumElements()" returns a uint64_t.

We could consider changing that once I land the patch to kill SequentialType.

ctetreau marked an inline comment as done.Apr 8 2020, 4:43 PM
ctetreau added inline comments.
mlir/lib/Conversion/StandardToLLVM/StandardToLLVM.cpp
1618–1621

I added D77763 to change it. Most of the calls to this were through getVectorNumElements() anyways, which did the cast.

sdesmalen accepted this revision.Apr 10 2020, 7:17 AM

LGTM!

mlir/lib/Conversion/StandardToLLVM/StandardToLLVM.cpp
1618–1621

Thanks for that!

This revision is now accepted and ready to land.Apr 10 2020, 7:17 AM
ctetreau updated this revision to Diff 256636.Apr 10 2020, 12:54 PM

rebase, catch straggler

This revision was automatically updated to reflect the committed changes.