I have been exploring def-use for alloca values.
I have the following piece of IR code -
continuation: ; No predecessors!
%iftmp = phi i32 [ 8, %then ], [ 20, %else ]
store i32 %iftmp, i32* %datasize
%res = alloca i8
store i8 -113, i8* %res
store i8 -127, i8* %res
%res3 = load i8, i8* %res
ret i8 %res3
On running the def-use chain for "%res" , and printing the instruction that is using "%res" . Following was the output -
for val=
%res = alloca i8
instruction with usage=
%res3 = load i8, i8* %res
instruction with usage=
store i8 -127, i8* %res
instruction with usage=
store i8 -113, i8* %res
I find that the loads are seen before store. Is there any way to get the "use"s of the alloca value in exactly the same order of instructions as they appear in the IR ?