[LLVMbugs] [Bug 13958] New: LLVM doesn't optimize 64-bit inequalities best

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Sep 27 12:54:20 PDT 2012


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

             Bug #: 13958
           Summary: LLVM doesn't optimize 64-bit inequalities best
           Product: libraries
           Version: trunk
          Platform: PC
        OS/Version: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Backend: ARM
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: xocotl at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified


Hello,

I've found I can consistently save 20 bytes of code space every single time on
ARM Thumb 2 (Cortex M3) when comparing 64 bit signed integers by changing, in
Clang,

if (a < 0) { ... } else if (a > 0) { ... } else { ... }

to

if (a < 0) { ... } else if (a != 0) { ... } else { ... }

Given the first comparison, a > 0 and a != 0 become equivalent. It would be
nice if LLVM knew to optimize this -- on my embedded project I've used this to
save a good 240 bytes of code space so far. Surely the saved instructions would
improve speed as well.

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