[llvm-bugs] [Bug 41182] New: TargetLowering.SimplifySetCC - missing icmp eq knownbits combine

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Mar 21 08:39:16 PDT 2019


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

            Bug ID: 41182
           Summary: TargetLowering.SimplifySetCC - missing icmp eq
                    knownbits combine
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Common Code Generator Code
          Assignee: unassignedbugs at nondot.org
          Reporter: llvm-dev at redking.me.uk
                CC: lebedev.ri at gmail.com, llvm-bugs at lists.llvm.org,
                    spatel+llvm at rotateright.com

https://gcc.godbolt.org/z/JahwVe

define i32 @square(i32 %a0)  {
    %1 = and i32 %a0, 127
    %2 = icmp eq i32 %1, -2
    %3 = select i1 %2, i32 42, i32 -17
    ret i32 %3
}

square: # @square
  andl $127, %edi
  cmpl $-2, %edi
  movl $42, %ecx
  movl $-17, %eax
  cmovel %ecx, %eax
  retq


We should be able to constant fold this completely as we know that some of the
known bits will never match:

square: # @square
  movl $-17, %eax
  retq

-- 
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/20190321/80bf86bd/attachment.html>


More information about the llvm-bugs mailing list