[LLVMbugs] [Bug 2388] New: indvars makes i1 indvar, LSR doesn't fix

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Sat May 31 01:00:37 PDT 2008


           Summary: indvars makes i1 indvar, LSR doesn't fix
           Product: libraries
           Version: 1.0
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Scalar Optimizations
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: sabre at nondot.org
                CC: llvmbugs at cs.uiuc.edu

void foo(int x) {
  int i;
  _Bool b = x < 0;
  for (i = 0; i < 100000; ++i) {
    bar(i, b);

    b = !b;

This compiles into this entertaining code:

bb:             ; preds = %bb, %entry
        %i.0.reg2mem.0 = phi i32 [ 0, %entry ], [ %indvar.next, %bb ]          
; <i32> [#uses=3]
        %indvar23 = trunc i32 %i.0.reg2mem.0 to i1              ; <i1>
        %b.0.in.reg2mem.0 = add i1 %indvar23, %tmp1             ; <i1>
        %tmp34 = zext i1 %b.0.in.reg2mem.0 to i32               ; <i32>

This is really bad.

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