This is an archive of the discontinued LLVM Phabricator instance.

[MachineVerifier][GlobalISel] Verifying generic extends and truncates
ClosedPublic

Authored by rtereshin on May 4 2018, 10:37 PM.

Details

Summary

Making sure we don't truncate / extend pointers, don't try to change
vector topology or bitcast vectors to scalars or back, and most
importantly, don't extend to a smaller type or truncate to a large
one.

While crafting a test for this change with a more or less decent code coverage I noticed that our MIR Parser is not able to parse vector pointer LLTs. We do quite explicitly support their representation in LLT class, and there is a direct counterpart in LLVM IR. Also it's easy to imagine a target actually sporting them (with some sort of vector scatter / gather stores / loads. So the test ended up depending on a fix for MIR Parser planned as a separate commit:

[MIRParser][GlobalISel] Parsing vector pointer types (<M x pA>)

MIParser wasn't able to parse LLTs like `<4 x p0>`, fixing that.

This diff includes both commits together.

Diff Detail

Repository
rL LLVM

Event Timeline

rtereshin created this revision.May 4 2018, 10:37 PM
nhaehnle removed a subscriber: nhaehnle.May 7 2018, 12:34 AM
qcolombet accepted this revision.May 7 2018, 12:59 PM
qcolombet added inline comments.
test/CodeGen/AMDGPU/GlobalISel/regbankselect-trunc.mir
15

Haha, this is already paying back :)

This revision is now accepted and ready to land.May 7 2018, 12:59 PM

Thank you, @qcolombet!

The parser part of this got a conflict with recently pushed https://reviews.llvm.org/D45948 (which got bug-fixed a bit in https://reviews.llvm.org/D46491), I'm going to resolve the conflict a tad later. I hope I can assume the revision is still accepted afterwards.

Best,
Roman

test/CodeGen/AMDGPU/GlobalISel/regbankselect-trunc.mir
15

;-)

rtereshin updated this revision to Diff 145614.May 7 2018, 6:48 PM

I have updated the MIParser::parseLowLevelType part of the patch (as before, within a separate commit) resolving conflicts with Allow register class names in the form of integer/scalar and Improve error checking for typed immediate operands

This revision was automatically updated to reflect the committed changes.