How to create PHI node in LLVM , make use of the PHINode class and
StoreInst class
Original LLVM IR code
if.then: ; preds = %entry
....
%sub = fsub float %tmp11, %tmp14
store float %sub, float addrspace(1)* %arrayidx4, align 4
br label %if.end
if.else: ; preds = %entry
....
%sub7 = fsub float %tmp19, %tmp22
store float %sub7, float addrspace(1)* %arrayidx4, align 4
br label %if.end
if.end: ; preds = %if.else,
%if.then
ret void
I have stuck here for a long time , i don't know how to make use of the
PHINode class and StoreInst class. I have trace the llvm source code but
still don't know how to do..
Now i want to merge this two store instruction.
Like this ...
if.then: ; preds = %entry
....
%sub = fsub float %tmp11, %tmp14
br label %if.end
if.else: ; preds = %entry
....
%sub7 = fsub float %tmp19, %tmp22
br label %if.end
if.end: ; preds = %if.else,
%if.then
%storemerge = phi float [ %sub, %if.then ], [ %sub7, %if.else ]
store float %storemerge, float addrspace(1)* %arrayidx4, align 4
ret void
Can anyone teach me how to do it ?? Thanks in advance ...
No comments:
Post a Comment