[RS4GC] Add an assert which fails if there is a (yet unsupported) addrspacecast.

The slightly strange indentation comes from clang-format.

llvm-svn: 256132
This commit is contained in:
Manuel Jacob 2015-12-21 01:26:46 +00:00
parent eafbd57ebc
commit 8050a49737
1 changed files with 5 additions and 0 deletions

View File

@ -454,6 +454,11 @@ static BaseDefiningValueResult findBaseDefiningValue(Value *I) {
if (CastInst *CI = dyn_cast<CastInst>(I)) {
Value *Def = CI->stripPointerCasts();
// If stripping pointer casts changes the address space there is an
// addrspacecast in between.
assert(cast<PointerType>(Def->getType())->getAddressSpace() ==
cast<PointerType>(CI->getType())->getAddressSpace() &&
"unsupported addrspacecast");
// If we find a cast instruction here, it means we've found a cast which is
// not simply a pointer cast (i.e. an inttoptr). We don't know how to
// handle int->ptr conversion.