This is an archive of the discontinued LLVM Phabricator instance.

[SelectionDAG] Don't pass a scalable vector to MachinePointerInfo::getWithOffset in a unit test.
ClosedPublic

Authored by craig.topper on Mar 16 2021, 12:21 PM.

Details

Summary

Suppresses an implicit TypeSize to uint64_t conversion warning.

We might be able to just not offset it since we're writing to a
Fixed stack object, but I wasn't sure so I just did what
DAGTypeLegalizer::IncrementPointer does.

Diff Detail

Event Timeline

craig.topper created this revision.Mar 16 2021, 12:21 PM
craig.topper requested review of this revision.Mar 16 2021, 12:21 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 16 2021, 12:21 PM
sdesmalen added inline comments.Mar 18 2021, 5:14 AM
llvm/include/llvm/Support/TypeSize.h
451 ↗(On Diff #331065)

I don't think we're at a point yet where we can always safely remove the warning in favour of the assert (from getFixedValue).

While it may not break any of the tests (other than the one you fixed in this patch), users of Clang that use the SVE intrinsics, or that try out some of the experimental vectorization work, don't want their compiler to actually break when LLVM goes down a code-path that hasn't been migrated yet to work for scalable vectors. Note that the code may still be doing the right thing, but just using the wrong interfaces.

Having the warning instead of an error has helped us bring up scalable-vector support incrementally. I agree that we need to work to remove this in the near future, and hopefully the work on fixed-width vectorization (mapping to scalable vectors at SelectionDAG), and the work on scalable-auto-vec will increase our test-coverage so that we'll soon have enough confidence to remove this code altogether.

I've created a patch D98856 that puts the behaviour to demote the error to a warning message under an option, which is enabled by default. This means all tests fail if the wrong interface is used, but it allows tools (like Clang) to suppress the error for now.

craig.topper added inline comments.Mar 18 2021, 8:03 AM
llvm/include/llvm/Support/TypeSize.h
451 ↗(On Diff #331065)

So sorry that was not supposed to be in here. That was just how I caught the issue. I must have accidentally committed it

If you remove the change to operator ScalarTy(), I'd be happy to accept this patch and rebase D98856.
I did something similar in D98856 for this test, but wasn't sure if the first MachineMemOperand should just be PtrInfo directly, since the added offset is 0.
(It probably doesn't matter that much, because the information isn't really used by computeAliasing if I'm understanding the code correctly)

llvm/include/llvm/Support/TypeSize.h
451 ↗(On Diff #331065)

No worries, thanks for the clarification!

Remove extra change. Keep PtrInfo for the first store.

Change the right function

craig.topper added inline comments.Mar 18 2021, 9:00 AM
llvm/unittests/CodeGen/SelectionDAGAddressAnalysisTest.cpp
171

Should we get rid of Index0 too?

sdesmalen added inline comments.Mar 18 2021, 9:02 AM
llvm/unittests/CodeGen/SelectionDAGAddressAnalysisTest.cpp
171

Yes, I think that makes sense, it makes the test a bit simpler to understand.

Harbormaster completed remote builds in B94475: Diff 331579.

Remove Index0

sdesmalen accepted this revision.Mar 18 2021, 9:59 AM

Thanks, LGTM!

This revision is now accepted and ready to land.Mar 18 2021, 9:59 AM