[PATCH] Make the MemDepPrinter to print something
Dmitry Mikushin
dmitry at kernelgen.org
Thu Dec 5 14:02:30 PST 2013
Hi Dan,
OK, I missed that because other `-print-*` passes are just printing to stderr without `-analyze`... So is `-analyze` necessary?
Also, I have a question: why for the store from 2 loads in the IR code below I get store having only single Def dependency on one of the loads, not on both of them?
Thanks,
- D.
define void @vector_sum(i32 %length, float* nocapture readonly %in1, float* nocapture readonly %in2, float* nocapture %out) #0 {
entry:
%cmp9 = icmp sgt i32 %length, 0
br i1 %cmp9, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds float* %in1, i64 %indvars.iv
%0 = load float* %arrayidx, align 4, !tbaa !1
%arrayidx2 = getelementptr inbounds float* %in2, i64 %indvars.iv
%1 = load float* %arrayidx2, align 4, !tbaa !1
%add = fadd float %0, %1
%arrayidx4 = getelementptr inbounds float* %out, i64 %indvars.iv
store float %add, float* %arrayidx4, align 4, !tbaa !1
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%lftr.wideiv = trunc i64 %indvars.iv.next to i32
%exitcond = icmp eq i32 %lftr.wideiv, %length
br i1 %exitcond, label %for.end, label %for.body
for.end: ; preds = %for.body, %entry
ret void
}
$ clang -emit-llvm example.c -O1 -S -o - | opt -memdep -print-memdeps -o /dev/null
Function vector_sum memory dependencies:
Unknown in block %for.body
Unknown in block %entry
%0 = load float* %arrayidx, align 4, !tbaa !1
Unknown in block %for.body
Unknown in block %entry
%1 = load float* %arrayidx2, align 4, !tbaa !1
Def from: %1 = load float* %arrayidx2, align 4, !tbaa !1
store float %add, float* %arrayidx4, align 4, !tbaa !1
http://llvm-reviews.chandlerc.com/D2333
BRANCH
/llvm/trunk
ARCANIST PROJECT
llvm
More information about the llvm-commits
mailing list