[llvm-bugs] [Bug 45086] New: ExpandMemcmp fails to constant fold in the general case

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Mar 3 05:59:00 PST 2020


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

            Bug ID: 45086
           Summary: ExpandMemcmp fails to constant fold in the general
                    case
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Common Code Generator Code
          Assignee: unassignedbugs at nondot.org
          Reporter: clement.courbet at gmail.com
                CC: llvm-bugs at lists.llvm.org

define i1 @length2_gt_const(i8* %X, i8* %Y) nounwind {
; X64-LABEL: length2_gt_const:
; X64:       # %bb.0:
; X64-NEXT:    movzwl (%rdi), %eax
; X64-NEXT:    movzwl .L.str+{{.*}}(%rip), %ecx
; X64-NEXT:    rolw $8, %ax
; X64-NEXT:    rolw $8, %cx
; X64-NEXT:    movzwl %ax, %eax
; X64-NEXT:    movzwl %cx, %ecx
; X64-NEXT:    subl %ecx, %eax
; X64-NEXT:    testl %eax, %eax
; X64-NEXT:    setg %al
; X64-NEXT:    retq
  %m = tail call i32 @memcmp(i8* %X, i8* getelementptr inbounds ([513 x i8],
[513 x i8]* @.str, i32 0, i32 1), i64 2) nounwind
  %c = icmp sgt i32 %m, 0
  ret i1 %c
}

-- 
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/20200303/a445d2d1/attachment.html>


More information about the llvm-bugs mailing list