[LLVMdev] Which transform passes to apply?

Josh Klontz josh.klontz at gmail.com
Sun Dec 2 17:58:51 PST 2012


Hello, I'm a new LLVM user working on a C++ EDSL for image processing. I have
a function, which after applying createInstructionCombiningPass() and
createDeadCodeEliminationPass() looks like:

define void @jitcv_sum_64sf1001(%Matrix* %src, %Matrix* %dst, i32 %len) {
entry:
  br label %loop_i

loop_i:                                           ; preds = %loop_i_end,
%entry
  %i = phi i32 [ 0, %entry ], [ %increment_i, %loop_i_end ]
  %0 = getelementptr inbounds %Matrix* %dst, i32 0, i32 2
  %dst_columns = load i32* %0
  *%dst_yRem = urem i32 %i, %dst_columns
  %dst_y = urem i32 %i, %dst_columns
  %1 = sub i32 %i, %dst_y
  %2 = add i32 %1, %dst_yRem*
  %3 = getelementptr inbounds %Matrix* %src, i32 0, i32 0
  %4 = load i8** %3
  %src_data = bitcast i8* %4 to double*
  %5 = getelementptr double* %src_data, i32 %2
  %6 = load double* %5
  *%accumulate = fadd double %6, 0.000000e+00*
  %7 = getelementptr inbounds %Matrix* %dst, i32 0, i32 0
  %8 = load i8** %7
  %dst_data = bitcast i8* %8 to double*
  %9 = getelementptr double* %dst_data, i32 %i
  store double %accumulate, double* %9
  br label %loop_i_end

loop_i_end:                                       ; preds = %loop_i
  %increment_i = add i32 %i, 1
  %loop_i_test = icmp eq i32 %increment_i, %len
  br i1 %loop_i_test, label %loop_i_exit, label %loop_i

loop_i_exit:                                      ; preds = %loop_i_end
  ret void
}

My question is which optimization pass(es) are needed to simplify the
instructions in bold. I've tried running the same passes again and also
tried createInstructionSimplifierPass() with no luck.

Many Thanks,

Josh



--
View this message in context: http://llvm.1065342.n5.nabble.com/Which-transform-passes-to-apply-tp52111.html
Sent from the LLVM - Dev mailing list archive at Nabble.com.



More information about the llvm-dev mailing list