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

Philip Reames via llvm-commits llvm-commits at lists.llvm.org
Sun Dec 20 17:48:38 PST 2015


It's really not clear to me that stripPointerCasts should be stripping 
addrspacecast at all.  I could see arguments either way, but my bias 
would be that it shouldn't unless there's a good reason.  Too many 
things are likely to rely on the stripped value having the same bit 
width (for instance).

Philip

On 12/20/2015 05:26 PM, Manuel Jacob via llvm-commits wrote:
> 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.
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits



More information about the llvm-commits mailing list