[LLVMbugs] [Bug 6165] New: optimization problem with srem on negative values

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Wed Jan 27 19:32:18 PST 2010


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: unassignedbugs at nondot.org
        ReportedBy: vargaz at gmail.com
                CC: llvmbugs at cs.uiuc.edu


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.



More information about the llvm-bugs mailing list