[LLVMdev] removal of an empty loop optimization?

edA-qa mort-ora-y
Sun, 10 Mar 2013 04:00:59 -0000

I just starting generating loops in my language and I noticed that I
would have empty loops left in the final optimized result. I'm assuming
I'm just missing an optimizer pass, can somebody tell me which one that is?

The code is below. Note that I won't ultimately be generating such a
loop, it's just a stepping stone in my code.

define void @_copy_func_array_1(i8**, i8*) {
entry:
  %2 = bitcast i8* %1 to i64*
  %3 = load i64* %2, align 8
  %4 = trunc i64 %3 to i32
  br label %loop_cond_1

loop_cond_1:                                      ; preds %loop_cond_1, %entry
  %ndx.0 = phi i32 [ 0, %entry ], [ %6, %loop_cond_1 ]
  %5 = icmp slt i32 %ndx.0, %4
  %6 = add i32 1, %ndx.0
  br i1 %5, label %loop_cond_1, label %loop_end_4

loop_end_4:                                       ; preds = %loop_cond_1
  ret void
}

--
edA-qa mort-ora-y
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Sign: Please digitally sign your emails.
Encrypt: I'm also happy to receive encrypted mail.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 261 bytes
Desc: OpenPGP digital signature
URL:
<http://lists.llvm.org/pipermail/llvm-dev/attachments/20130310/f000bfaf/attachment.sig>