This is an archive of the discontinued LLVM Phabricator instance.

[AMDGPU] Fix for vectorizer crash with pointers of different size
ClosedPublic

Authored by rampitec on Jul 30 2019, 3:29 PM.

Details

Summary

When vectorizer strips pointers it can eventually end up with
pointers of two different sizes, then SCEV will crash.

Diff Detail

Event Timeline

rampitec created this revision.Jul 30 2019, 3:29 PM

Was this broken by r365723? Should this use stripPointerCastsSameRepresentation instead?

arsenm added inline comments.Jul 30 2019, 3:36 PM
lib/Transforms/Vectorize/LoadStoreVectorizer.cpp
348–350

Checking that PtrA and PtrB's address space are the same would be simpler

test/CodeGen/AMDGPU/vect-ptr-ptr-size-mismatch.ll
1 ↗(On Diff #212455)

Test should just run opt and go in test/Transforms/LoadStoreVectorizer

3 ↗(On Diff #212455)

Should be able to use a kernel argument instead of a global

11–14 ↗(On Diff #212455)

Control flow should be unnecessary

Was this broken by r365723? Should this use stripPointerCastsSameRepresentation instead?

I do not see a version which can accumulate constant offset.

rampitec updated this revision to Diff 212481.Jul 30 2019, 5:49 PM
rampitec marked 5 inline comments as done.
rampitec added inline comments.
lib/Transforms/Vectorize/LoadStoreVectorizer.cpp
348–350

The also need to be the same as original pointer address space before the strip.

arsenm accepted this revision.Jul 31 2019, 9:17 AM

LGTM

This revision is now accepted and ready to land.Jul 31 2019, 9:17 AM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptJul 31 2019, 9:33 AM