Target specific type modifications

Is there a way to modify the LLVM-IR type of a pointer, cascading the change to all uses, without causing code duplication?

For example,

define void @test (i32 addrspace(1)* nocapture %a, i32 addrspace(1)* nocapture %b) nounwind {

entry:

%0 = tail call <4 x i32> @__amdil_id_int() nounwind ; <<4 x i32>> [#uses=1]

%1 = extractelement <4 x i32> %0, i32 0 ; [#uses=2]

%arrayidx = getelementptr i32 addrspace(1)* %a, i32 %1 ; <i32 addrspace(1)*> [#uses=1]

%arrayidx4 = getelementptr i32 addrspace(1)* %b, i32 %1 ; <i32 addrspace(1)*> [#uses=1]

%tmp5 = load i32 addrspace(1)* %arrayidx4 ; [#uses=1]

store i32 %tmp5, i32 addrspace(1)* %arrayidx

ret void

}

I want to change the address space on %a from 1 to N, where N is not 1.

This is for device specific optimizations where a and b are non-aliased and can go to different hardware memory.

The only way I know how to do this currently would be to duplicate the test function with a new type for A.

Any idea’s or feedback?

Thanks,

Micah

Is there a way to modify the LLVM-IR type of a pointer, cascading the change to
all uses, without causing code duplication?

I don't think so.

Ciao,

Duncan.