[LLVMbugs] [Bug 4548] New: missed optimization: zext 8/16->32+udiv 32+trunc 32->8/16 - > udiv 8/16

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Mon Jul 13 09:05:36 PDT 2009


           Summary: missed optimization: zext 8/16->32+udiv 32+trunc 32-
                    >8/16 -> udiv 8/16
           Product: new-bugs
           Version: unspecified
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: new bugs
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: edwintorok at gmail.com
                CC: llvmbugs at cs.uiuc.edu

For the C code below:

uint8_t udiv_i8(uint8_t a, uint8_t b)
  return a / b;

Clang generates this IR (at -O1/O2):

        %conv = zext i8 %a to i32       
        %conv2 = zext i8 %b to i32      
        %div = udiv i32 %conv, %conv2   
        %conv3 = trunc i32 %div to i8   
        ret i8 %conv3

This should be optimized to this IR, since that  is what the original C code

%div = udiv i8 %a, %b
ret i8 %div

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