[LLVMbugs] [Bug 10769] New: code with shl and bitwise or instructions optimizes wrong

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Aug 26 00:06:51 PDT 2011


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

           Summary: code with shl and bitwise or instructions optimizes
                    wrong
           Product: libraries
           Version: trunk
          Platform: Other
        OS/Version: FreeBSD
            Status: NEW
          Severity: release blocker
          Priority: P
         Component: Scalar Optimizations
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: yuri at tsoft.com
                CC: llvmbugs at cs.uiuc.edu


Created an attachment (id=7149)
 --> (http://llvm.org/bugs/attachment.cgi?id=7149)
llvm code illustrating the problem

Please compile the attached file mm.ll into executable with and without
optimization and observe different results:

--with optimization--
llvm-as mm.ll
opt -O3 mm.bc > mm-o.bc ; mv mm-o.bc mm.bc
llc mm.bc
as mm.s -o mm.o
gcc -o mm mm.o
./mm
==> Prints: 255 (wrong value)

--without optimization--
llvm-as mm.ll
llc mm.bc
as mm.s -o mm.o
gcc -o mm mm.o
./mm
==> Prints: 1 (correct value)

When I optimized the function 'func' from mm.ll, it optimizes into the wrong
precomputed value 255 which is returned.

Optimization should never change the numeric result produced by any code.

rev.134967

-- 
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