This is an archive of the discontinued LLVM Phabricator instance.

[mlir] fix LLVM IR translation of vector<... x index>
ClosedPublic

Authored by ftynse on Feb 14 2023, 2:08 AM.

Details

Summary

When the translation was written, vector<... x index> was not allowed
at all. After it was added later, the translation was never adapted. It
kept working in the most common case of index-typed attributes using
64-bit storage and being converted to 64-bit integers in LLVM IR, but
not in the other cases that require truncation or extension, producing
wrong results when using the raw data storage of the dense attrbute to
construct the LLVM IR constant. When the storage size doesn't match,
fall back to the per-element constant construction, which is slower but
handles bitwidth differences correctly.

Fixes #60614.

Diff Detail

Event Timeline

ftynse created this revision.Feb 14 2023, 2:08 AM
ftynse requested review of this revision.Feb 14 2023, 2:08 AM
gysit accepted this revision.Feb 14 2023, 2:14 AM

LGTM!

This revision is now accepted and ready to land.Feb 14 2023, 2:14 AM
This revision was automatically updated to reflect the committed changes.

Awesome! I didn't know there was a fallback mechanism!