[PATCH] D25096: [RS4GC] New pass to remove gc.relocates added by RS4GC

Anna Thomas via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 30 08:30:24 PDT 2016


anna added inline comments.


> RemoveGCRelocates.cpp:77-78
> +    // the correct type of the original pointer (if they are not the same).
> +    // TODO: Handle gc.relocates that are of different type from original
> +    // pointer, but all uses are the gc.relocate of i8 addrspace(1)* type.
> +    if (GCRel->getType() != OrigPtr->getType()) {

These are cases where lets say original pointer is i32*, while the gc.relocate are of type  i8*.

All uses of the gc.relocates are `phi` or other non-store operations, which use the i8* relocated pointer. In such a case, there is no bitcast from i8* to i32* (since there are no uses of the i32* version of relocated pointer). I think this can be transformed to:

  original_ptr.casted = bitcast i32* original_ptr to i8*
  replace all uses of relocated pointer with original_ptr.casted

https://reviews.llvm.org/D25096





More information about the llvm-commits mailing list