This is an archive of the discontinued LLVM Phabricator instance.

GlobalISel: Handle more cases for widenScalar for G_STORE
ClosedPublic

Authored by arsenm on Jan 22 2019, 4:18 PM.

Diff Detail

Event Timeline

arsenm created this revision.Jan 22 2019, 4:18 PM
aemerson added inline comments.Jan 28 2019, 10:44 AM
lib/CodeGen/GlobalISel/LegalizerHelper.cpp
934

Why is this being changed?

946

SelectionDAG does zext for the same IR for all types, so I think we should be consistent there.

arsenm marked 2 inline comments as done.Jan 28 2019, 10:56 AM
arsenm added inline comments.
lib/CodeGen/GlobalISel/LegalizerHelper.cpp
934

This is the entire problem. This was only handling the 1-to-8 bit case. All the AMDGPU 8 or 16-bit stores use 32-bit source registers

946

I don't think that's true?

In this test case for example, in PromoteIntOp_STORE/PromoteIntRes_LOAD it decided to use the morally equivalent ISD::EXTLOAD extload type.

define void @foo(i8 addrspace(1)* %in, i8 addrspace(1)* %out) {

%val = load i8, i8 addrspace(1)* %in
store i8 %val, i8 addrspace(1)* %out
ret void

}

The high bits also won't matter for a truncating store

aemerson added inline comments.Jan 28 2019, 11:30 AM
lib/CodeGen/GlobalISel/LegalizerHelper.cpp
934

Oh sorry, for some reason I thought this hunk was the before-diff not the *after*.

946

So I was using a test case like this to check:

define void @test(i12 %v, i12 *%ptr) {
  store i12 %v, i12* %ptr
  ret void
}

I get your point that in theory it should be semantically correct to do anyext. However I'd rather not we change the way i1s are handled.

arsenm marked an inline comment as done.Jan 28 2019, 11:46 AM
arsenm added inline comments.
lib/CodeGen/GlobalISel/LegalizerHelper.cpp
946

This is preserving how i1 is handled. It's using zext for i1, and anyext for anything else. I don't think any other non-byte sizes are special cased though

aemerson accepted this revision.Jan 28 2019, 11:52 AM
aemerson added inline comments.
lib/CodeGen/GlobalISel/LegalizerHelper.cpp
946

Yes, can you remove the comment about i1s before the code then.

This revision is now accepted and ready to land.Jan 28 2019, 11:52 AM
arsenm closed this revision.Jan 29 2019, 6:04 PM
arsenm marked an inline comment as done.

r352585