This is an archive of the discontinued LLVM Phabricator instance.

[IR Verifier] Do not allow bitcast of pointer to vector of pointers and vice versa.
ClosedPublic

Authored by skatkov on Aug 17 2018, 1:56 AM.

Details

Summary

LangRef for BitCast requires that
"The bit sizes of value and the destination type, ty2, must be identical".
Currently verifier allows BitCast of pointer to vector of pointers so that
the sizes are different.

This change fixes that.

Diff Detail

Repository
rL LLVM

Event Timeline

skatkov created this revision.Aug 17 2018, 1:56 AM
arsenm added inline comments.Aug 17 2018, 2:33 AM
test/Verifier/bitcast-pointer-vector-neg.ll
7 ↗(On Diff #161179)

Test names are misleading, these aren't pointers to vector

10 ↗(On Diff #161179)

Should also include tests where the pointers are in a different address space with a different size (such that the total sizes match) for good measure

skatkov added inline comments.Aug 19 2018, 8:37 PM
test/Verifier/bitcast-pointer-vector-neg.ll
7 ↗(On Diff #161179)

I'm sorry but I do not follow this comment...
The test represents bitcast of pointer to vector.
Will the name illegal_bitcast_pointer_to_vector_of_pointers fits better?

skatkov updated this revision to Diff 161416.Aug 19 2018, 10:30 PM
arsenm accepted this revision.Aug 20 2018, 7:52 AM

LGTM

This revision is now accepted and ready to land.Aug 20 2018, 7:52 AM
This revision was automatically updated to reflect the committed changes.