[RS4GC] Add an assert which fails if there is a (yet unsupported) addrspacecast.
authorManuel Jacob <me@manueljacob.de>
Mon, 21 Dec 2015 01:26:46 +0000 (01:26 +0000)
committerManuel Jacob <me@manueljacob.de>
Mon, 21 Dec 2015 01:26:46 +0000 (01:26 +0000)
The slightly strange indentation comes from clang-format.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@256132 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/Scalar/RewriteStatepointsForGC.cpp

index 16ee5bbaecbc67f484afc21abc5570a6c5d9784b..049a7fc54597321ab0f593a2f32981c3fa3e0f22 100644 (file)
@@ -454,6 +454,11 @@ static BaseDefiningValueResult findBaseDefiningValue(Value *I) {
 
   if (CastInst *CI = dyn_cast<CastInst>(I)) {
     Value *Def = CI->stripPointerCasts();
 
   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.
     // 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.