[PATCH] Teach SROA about addrspacecast.

Xuetian Weng xweng at google.com
Mon Jun 15 17:03:49 PDT 2015


So this is a case that we currently want to handle in nvptx, which is not covered instcombine/sroa right now.

  ; ModuleID = '<stdin>'
  target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v16:16:16-v32:32:32-v64:64:64-v128:128:128-n16:32:64"
  target triple = "nvptx64-unknown-unknown"
  
  %struct.S = type { i32, i32, i32 }
  
  ; Function Attrs: nounwind
  define void @_Z11TakesStruct1SPi(%struct.S* byval nocapture readonly %input, i32* nocapture %output) #0 {
  entry:
    %input1 = alloca %struct.S, align 8
    %0 = addrspacecast %struct.S* %input1 to %struct.S addrspace(5)*
    %input2 = addrspacecast %struct.S* %input to %struct.S addrspace(101)*
    %input3 = load %struct.S, %struct.S addrspace(101)* %input2, align 4
    store %struct.S %input3, %struct.S addrspace(5)* %0, align 8
    %1 = getelementptr inbounds %struct.S, %struct.S addrspace(5)* %0, i64 0, i32 1
    %2 = load i32, i32 addrspace(5)* %1, align 4
    store i32 %2, i32* %output, align 4
    ret void
  }


http://reviews.llvm.org/D4501

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the llvm-commits mailing list