[LLVMbugs] [Bug 11196] New: suboptimal code generation in loop unrolling

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Oct 20 12:01:42 PDT 2011


           Summary: suboptimal code generation in loop unrolling
           Product: new-bugs
           Version: trunk
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: new bugs
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: s3734770 at mail.zih.tu-dresden.de
                CC: llvmbugs at cs.uiuc.edu

Created an attachment (id=7495)
 --> (http://llvm.org/bugs/attachment.cgi?id=7495)
test case

I attached a llvm-ir translation of the following program:
static init
  if(copy('hello', 1, 2) == 'el') {

This program should be completely constant folded, but the optimization stucks
at a loop:
the loop begins at line 51 and compares two strings of the same size.
As you see in line 61+63 and 62+64, the characters of the strings at this
specific position are loaded and this exactly is the problem.

It is about the same issue like http://llvm.org/bugs/show_bug.cgi?id=11142
but this time, it's a bit more complex: the memory is not directly copied, but
it's received by a getelementptr+load from the malloced memory.
The challenge is to proof that the loop will stay exactly in the copied range
of [3 x i8]* @label416 so that the getelementptr call can fetched from
@label416 instead of %result.i.i10

An other question is why the loop that only consists of two iterations is not
constant folded.
The loop has the following structure:

 br label %test
 %loopvar = phi i32 [%loopvar2, %body], [0, %start]
 %finished = icmp sgt i32 %loopvar, 2 ; or any other constant or non-constant
 br i1 %finished, label %continue, label %body
 ; sth fancy
 %otherbreak = icmp .....
 br i1 %otherbreak, label %exception, label %test

This report is maybe two bugs but when you fix one of the two issues, the test
case will become unusable to test the other issue because of constant folding.

Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

More information about the llvm-bugs mailing list