http://llvm.org/bugs/show_bug.cgi?id=6165

           Summary: optimization problem with srem on negative values
           Product: libraries
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Scalar Optimizations
        AssignedTo: [email protected]
        ReportedBy: [email protected]
                CC: [email protected]


To reproduce:

llvm-as bug.ll
llc bug.bc -o bug.s && gcc bug.s && ./a.out
opt -O1 bug.bc -o bug2.bc && llc bug2.bc -o bug.s && gcc bug.s && ./a.out

The first run prints '0' while the second one prints '5'.

The ll code is mostly equal to the following C code:

int foo ()
{
        int i, j;

        i = 0;
        for (j = 0; j < 29; ++j)
                i --;
        if ((i % 2) != -1)
                return 5;
        if ((i % 4) != -1)
                return 6;

        return 0;
}

void main ()
{
        printf ("%d\n", foo ());
}


-- 
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.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to