[llvm-bugs] [Bug 24441] New: missing cse for smin/smax

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Aug 12 14:21:46 PDT 2015


https://llvm.org/bugs/show_bug.cgi?id=24441

            Bug ID: 24441
           Summary: missing cse for smin/smax
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Scalar Optimizations
          Assignee: unassignedbugs at nondot.org
          Reporter: wmi at google.com
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

For testcase 1.c:

int m, n;
void foo(int x, int y) {
  m = (x < y) ? x : y;
  n = (y < x) ? y : x;
}

~/workarea/llvm-r243652/build/bin/clang -O2 -S 1.c

foo:                                    # @foo
        .cfi_startproc
# BB#0:                                 # %entry
        cmpl    %esi, %edi
        movl    %esi, %eax
        cmovlel %edi, %eax
        movl    %eax, m(%rip)
        cmpl    %edi, %esi
        cmovlel %esi, %edi
        movl    %edi, n(%rip)
        retq
.Lfunc_end0:
        .size   foo, .Lfunc_end0-foo
        .cfi_endproc

llvm failed to find out both of the exprs to compute m and n were smin(x, y).

Fixing this is important to cleanup redundency introduced by expansion of SCEV
because building and then expanding SCEV often transformed one form of
smin/smax to another.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20150812/8ff6bf91/attachment.html>


More information about the llvm-bugs mailing list