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

Manuel Jacob via llvm-commits llvm-commits at lists.llvm.org
Sun Dec 20 17:26:46 PST 2015


Author: mjacob
Date: Sun Dec 20 19:26:46 2015
New Revision: 256132

URL: http://llvm.org/viewvc/llvm-project?rev=256132&view=rev
Log:
[RS4GC] Add an assert which fails if there is a (yet unsupported) addrspacecast.

The slightly strange indentation comes from clang-format.

Modified:
    llvm/trunk/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp

Modified: llvm/trunk/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp?rev=256132&r1=256131&r2=256132&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp Sun Dec 20 19:26:46 2015
@@ -454,6 +454,11 @@ static BaseDefiningValueResult findBaseD
 
   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.




More information about the llvm-commits mailing list