This is an archive of the discontinued LLVM Phabricator instance.

Fix array sizes where address space is not yet known
ClosedPublic

Authored by kzhuravl on Mar 10 2017, 1:51 PM.

Details

Summary

For variables in generic address spaces, for example:

unsigned char V[6442450944];
...

the address space is not yet known when we get into *getConstantArrayType*, it is 0. AMDGCN target's address space 0 has 32 bits pointers, so when we call *getPointerWidth* with 0, the array size is trimmed to 32 bits, which is not right.

Diff Detail

Repository
rL LLVM

Event Timeline

kzhuravl created this revision.Mar 10 2017, 1:51 PM

I am not sure if this is the right way to fix it.

yaxunl accepted this revision.Mar 21 2017, 8:38 AM
lib/AST/ASTContext.cpp
2696 ↗(On Diff #91404)

Can we just use getMaxPointerWidth instead? If we cannot determine the pointer size, using max pointer size makes sense. Also can you add a ToDo comment about this. Ideally we could get a better fix later.

This revision is now accepted and ready to land.Mar 21 2017, 8:38 AM
This revision was automatically updated to reflect the committed changes.
kzhuravl marked an inline comment as done.