[LLVMdev] Any Optimization Suggestion to Get Rid of AddrSpaceCast around PHI

Changpeng Fang cfang.llvm at gmail.com
Thu Aug 21 15:11:31 PDT 2014


In the following example, for some reasons, the input pointer entering the
loop was casted to generic pointer. How can the backend get rid of the
addrspacecast and use local store in the loop?


for.body.lr.ph: ; preds = %entry

%0 = addrspacecast i32 addrspace(3)* %in to i32 addrspace(4)*

br label %for.body

for.body: ; preds = %for.body, %for.body.lr.ph

%i.03 = phi i32 [ 0, %for.body.lr.ph ], [ %inc, %for.body ]

%ptr.02 = phi i32 addrspace(4)* [ %0, %for.body.lr.ph ], [ %add.ptr,
%for.body ]

store i32 %i.03, i32 addrspace(4)* %ptr.02, align 4

%add.ptr = getelementptr inbounds i32 addrspace(4)* %ptr.02, i64 4

%inc = add i32 %i.03, 1

%exitcond = icmp eq i32 %inc, %numElems

br i1 %exitcond, label %for.end, label %for.body

for.end: ; preds = %


Thanks;

Changpeng
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20140821/a0d9e48b/attachment.html>


More information about the llvm-dev mailing list