GEP and BitCast instructions may produce a pointer of vectors from
underlying object. So it is valid for GetUnderlyingObject utility to
accept vector of pointers and detect underlying object which might be
instruction of vector or non-vector type.
Details
Diff Detail
Event Timeline
Thank you for your comment. Unfortunately till now I failed to create a test showing the benefit from this change in a pass (I tried). I can make one more try.
The problem I'm trying to solve is the following: in downstream pass I have a BitCast instruction which is actually originated from allocation but has a vector type gotten using gep + bitcast from allocation.
I'd like to know the fact that it is an underlying allocation but now utility function just ignore instructions with vector of pointers.
There are ValueTracking unittests already you could fall back on putting a test there, but I think a pass using this would be better
unittests/Analysis/ValueTrackingTest.cpp | ||
---|---|---|
318–322 | It looks like a bug this IR is accepted by the verifier at all. This is a bitcast between different sized objects |
unittests/Analysis/ValueTrackingTest.cpp | ||
---|---|---|
318–322 | I think fixing this is a prerequisite for making any changes like this to avoid issues |
unittests/Analysis/ValueTrackingTest.cpp | ||
---|---|---|
318–322 | what if the size of the pointer is 32 bit? |
unittests/Analysis/ValueTrackingTest.cpp | ||
---|---|---|
318–322 | It seems I'm not right here... |
unittests/Analysis/ValueTrackingTest.cpp | ||
---|---|---|
318–322 | This is a cast between a 64-bit pointer and 2 64-bit pointers |
unittests/Analysis/ValueTrackingTest.cpp | ||
---|---|---|
318–322 | This still looks invalid to me. We don't allow bitcast between pointers and FP types for example. |
What is supposed to happen if the elements in the pointer vector have different underlying objects?
We need to document that in the comment and test it.
unittests/Analysis/ValueTrackingTest.cpp | ||
---|---|---|
344 | Isn't this index out-of-bounds. If so, that is a problem. |
Sorry guys, I'm not working on this at the moment. I can abandon this review for a while if it mislead anyone.
It looks like a bug this IR is accepted by the verifier at all. This is a bitcast between different sized objects