56 changes: 24 additions & 32 deletions llvm/test/CodeGen/X86/bt.ll
Original file line number Diff line number Diff line change
Expand Up @@ -611,23 +611,21 @@ define void @query3(i32 %x, i32 %n) nounwind {
; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
; X86-NEXT: btl %ecx, %eax
; X86-NEXT: jb .LBB16_1
; X86-NEXT: # %bb.2: # %UnifiedReturnBlock
; X86-NEXT: retl
; X86-NEXT: .LBB16_1: # %bb
; X86-NEXT: jae .LBB16_2
; X86-NEXT: # %bb.1: # %bb
; X86-NEXT: calll foo
; X86-NEXT: .LBB16_2: # %UnifiedReturnBlock
; X86-NEXT: retl
;
; X64-LABEL: query3:
; X64: # %bb.0: # %entry
; X64-NEXT: btl %esi, %edi
; X64-NEXT: jb .LBB16_1
; X64-NEXT: # %bb.2: # %UnifiedReturnBlock
; X64-NEXT: retq
; X64-NEXT: .LBB16_1: # %bb
; X64-NEXT: jae .LBB16_2
; X64-NEXT: # %bb.1: # %bb
; X64-NEXT: pushq %rax
; X64-NEXT: callq foo
; X64-NEXT: popq %rax
; X64-NEXT: .LBB16_2: # %UnifiedReturnBlock
; X64-NEXT: retq
entry:
%tmp29 = shl i32 1, %n
Expand All @@ -649,23 +647,21 @@ define void @query3b(i32 %x, i32 %n) nounwind {
; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
; X86-NEXT: btl %ecx, %eax
; X86-NEXT: jb .LBB17_1
; X86-NEXT: # %bb.2: # %UnifiedReturnBlock
; X86-NEXT: retl
; X86-NEXT: .LBB17_1: # %bb
; X86-NEXT: jae .LBB17_2
; X86-NEXT: # %bb.1: # %bb
; X86-NEXT: calll foo
; X86-NEXT: .LBB17_2: # %UnifiedReturnBlock
; X86-NEXT: retl
;
; X64-LABEL: query3b:
; X64: # %bb.0: # %entry
; X64-NEXT: btl %esi, %edi
; X64-NEXT: jb .LBB17_1
; X64-NEXT: # %bb.2: # %UnifiedReturnBlock
; X64-NEXT: retq
; X64-NEXT: .LBB17_1: # %bb
; X64-NEXT: jae .LBB17_2
; X64-NEXT: # %bb.1: # %bb
; X64-NEXT: pushq %rax
; X64-NEXT: callq foo
; X64-NEXT: popq %rax
; X64-NEXT: .LBB17_2: # %UnifiedReturnBlock
; X64-NEXT: retq
entry:
%tmp29 = shl i32 1, %n
Expand All @@ -687,23 +683,21 @@ define void @query3x(i32 %x, i32 %n) nounwind {
; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
; X86-NEXT: btl %ecx, %eax
; X86-NEXT: jb .LBB18_1
; X86-NEXT: # %bb.2: # %UnifiedReturnBlock
; X86-NEXT: retl
; X86-NEXT: .LBB18_1: # %bb
; X86-NEXT: jae .LBB18_2
; X86-NEXT: # %bb.1: # %bb
; X86-NEXT: calll foo
; X86-NEXT: .LBB18_2: # %UnifiedReturnBlock
; X86-NEXT: retl
;
; X64-LABEL: query3x:
; X64: # %bb.0: # %entry
; X64-NEXT: btl %esi, %edi
; X64-NEXT: jb .LBB18_1
; X64-NEXT: # %bb.2: # %UnifiedReturnBlock
; X64-NEXT: retq
; X64-NEXT: .LBB18_1: # %bb
; X64-NEXT: jae .LBB18_2
; X64-NEXT: # %bb.1: # %bb
; X64-NEXT: pushq %rax
; X64-NEXT: callq foo
; X64-NEXT: popq %rax
; X64-NEXT: .LBB18_2: # %UnifiedReturnBlock
; X64-NEXT: retq
entry:
%tmp29 = shl i32 1, %n
Expand All @@ -725,23 +719,21 @@ define void @query3bx(i32 %x, i32 %n) nounwind {
; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
; X86-NEXT: btl %ecx, %eax
; X86-NEXT: jb .LBB19_1
; X86-NEXT: # %bb.2: # %UnifiedReturnBlock
; X86-NEXT: retl
; X86-NEXT: .LBB19_1: # %bb
; X86-NEXT: jae .LBB19_2
; X86-NEXT: # %bb.1: # %bb
; X86-NEXT: calll foo
; X86-NEXT: .LBB19_2: # %UnifiedReturnBlock
; X86-NEXT: retl
;
; X64-LABEL: query3bx:
; X64: # %bb.0: # %entry
; X64-NEXT: btl %esi, %edi
; X64-NEXT: jb .LBB19_1
; X64-NEXT: # %bb.2: # %UnifiedReturnBlock
; X64-NEXT: retq
; X64-NEXT: .LBB19_1: # %bb
; X64-NEXT: jae .LBB19_2
; X64-NEXT: # %bb.1: # %bb
; X64-NEXT: pushq %rax
; X64-NEXT: callq foo
; X64-NEXT: popq %rax
; X64-NEXT: .LBB19_2: # %UnifiedReturnBlock
; X64-NEXT: retq
entry:
%tmp29 = shl i32 1, %n
Expand Down
48 changes: 24 additions & 24 deletions llvm/test/CodeGen/X86/conditional-tailcall-pgso.ll
Original file line number Diff line number Diff line change
Expand Up @@ -63,21 +63,21 @@ define void @f_non_leaf(i32 %x, i32 %y) !prof !14 {
; CHECK32-NEXT: #APP
; CHECK32-NEXT: #NO_APP
; CHECK32-NEXT: cmpl {{[0-9]+}}(%esp), %eax # encoding: [0x3b,0x44,0x24,0x0c]
; CHECK32-NEXT: je .LBB1_1 # encoding: [0x74,A]
; CHECK32-NEXT: # fixup A - offset: 1, value: .LBB1_1-1, kind: FK_PCRel_1
; CHECK32-NEXT: # %bb.2: # %bb2
; CHECK32-NEXT: jne .LBB1_2 # encoding: [0x75,A]
; CHECK32-NEXT: # fixup A - offset: 1, value: .LBB1_2-1, kind: FK_PCRel_1
; CHECK32-NEXT: # %bb.1: # %bb1
; CHECK32-NEXT: popl %ebx # encoding: [0x5b]
; CHECK32-NEXT: .cfi_def_cfa_offset 4
; CHECK32-NEXT: jmp bar # TAILCALL
; CHECK32-NEXT: jmp foo # TAILCALL
; CHECK32-NEXT: # encoding: [0xeb,A]
; CHECK32-NEXT: # fixup A - offset: 1, value: bar-1, kind: FK_PCRel_1
; CHECK32-NEXT: .LBB1_1: # %bb1
; CHECK32-NEXT: # fixup A - offset: 1, value: foo-1, kind: FK_PCRel_1
; CHECK32-NEXT: .LBB1_2: # %bb2
; CHECK32-NEXT: .cfi_def_cfa_offset 8
; CHECK32-NEXT: popl %ebx # encoding: [0x5b]
; CHECK32-NEXT: .cfi_def_cfa_offset 4
; CHECK32-NEXT: jmp foo # TAILCALL
; CHECK32-NEXT: jmp bar # TAILCALL
; CHECK32-NEXT: # encoding: [0xeb,A]
; CHECK32-NEXT: # fixup A - offset: 1, value: foo-1, kind: FK_PCRel_1
; CHECK32-NEXT: # fixup A - offset: 1, value: bar-1, kind: FK_PCRel_1
;
; CHECK64-LABEL: f_non_leaf:
; CHECK64: # %bb.0: # %entry
Expand All @@ -87,21 +87,21 @@ define void @f_non_leaf(i32 %x, i32 %y) !prof !14 {
; CHECK64-NEXT: #APP
; CHECK64-NEXT: #NO_APP
; CHECK64-NEXT: cmpl %esi, %edi # encoding: [0x39,0xf7]
; CHECK64-NEXT: je .LBB1_1 # encoding: [0x74,A]
; CHECK64-NEXT: # fixup A - offset: 1, value: .LBB1_1-1, kind: FK_PCRel_1
; CHECK64-NEXT: # %bb.2: # %bb2
; CHECK64-NEXT: jne .LBB1_2 # encoding: [0x75,A]
; CHECK64-NEXT: # fixup A - offset: 1, value: .LBB1_2-1, kind: FK_PCRel_1
; CHECK64-NEXT: # %bb.1: # %bb1
; CHECK64-NEXT: popq %rbx # encoding: [0x5b]
; CHECK64-NEXT: .cfi_def_cfa_offset 8
; CHECK64-NEXT: jmp bar # TAILCALL
; CHECK64-NEXT: jmp foo # TAILCALL
; CHECK64-NEXT: # encoding: [0xeb,A]
; CHECK64-NEXT: # fixup A - offset: 1, value: bar-1, kind: FK_PCRel_1
; CHECK64-NEXT: .LBB1_1: # %bb1
; CHECK64-NEXT: # fixup A - offset: 1, value: foo-1, kind: FK_PCRel_1
; CHECK64-NEXT: .LBB1_2: # %bb2
; CHECK64-NEXT: .cfi_def_cfa_offset 16
; CHECK64-NEXT: popq %rbx # encoding: [0x5b]
; CHECK64-NEXT: .cfi_def_cfa_offset 8
; CHECK64-NEXT: jmp foo # TAILCALL
; CHECK64-NEXT: jmp bar # TAILCALL
; CHECK64-NEXT: # encoding: [0xeb,A]
; CHECK64-NEXT: # fixup A - offset: 1, value: foo-1, kind: FK_PCRel_1
; CHECK64-NEXT: # fixup A - offset: 1, value: bar-1, kind: FK_PCRel_1
;
; WIN64-LABEL: f_non_leaf:
; WIN64: # %bb.0: # %entry
Expand All @@ -111,19 +111,19 @@ define void @f_non_leaf(i32 %x, i32 %y) !prof !14 {
; WIN64-NEXT: #APP
; WIN64-NEXT: #NO_APP
; WIN64-NEXT: cmpl %edx, %ecx # encoding: [0x39,0xd1]
; WIN64-NEXT: je .LBB1_1 # encoding: [0x74,A]
; WIN64-NEXT: # fixup A - offset: 1, value: .LBB1_1-1, kind: FK_PCRel_1
; WIN64-NEXT: # %bb.2: # %bb2
; WIN64-NEXT: jne .LBB1_2 # encoding: [0x75,A]
; WIN64-NEXT: # fixup A - offset: 1, value: .LBB1_2-1, kind: FK_PCRel_1
; WIN64-NEXT: # %bb.1: # %bb1
; WIN64-NEXT: popq %rbx # encoding: [0x5b]
; WIN64-NEXT: jmp bar # TAILCALL
; WIN64-NEXT: jmp foo # TAILCALL
; WIN64-NEXT: # encoding: [0xeb,A]
; WIN64-NEXT: # fixup A - offset: 1, value: bar-1, kind: FK_PCRel_1
; WIN64-NEXT: .LBB1_1: # %bb1
; WIN64-NEXT: # fixup A - offset: 1, value: foo-1, kind: FK_PCRel_1
; WIN64-NEXT: .LBB1_2: # %bb2
; WIN64-NEXT: nop # encoding: [0x90]
; WIN64-NEXT: popq %rbx # encoding: [0x5b]
; WIN64-NEXT: jmp foo # TAILCALL
; WIN64-NEXT: jmp bar # TAILCALL
; WIN64-NEXT: # encoding: [0xeb,A]
; WIN64-NEXT: # fixup A - offset: 1, value: foo-1, kind: FK_PCRel_1
; WIN64-NEXT: # fixup A - offset: 1, value: bar-1, kind: FK_PCRel_1
; WIN64-NEXT: .seh_handlerdata
; WIN64-NEXT: .text
; WIN64-NEXT: .seh_endproc
Expand Down
48 changes: 24 additions & 24 deletions llvm/test/CodeGen/X86/conditional-tailcall.ll
Original file line number Diff line number Diff line change
Expand Up @@ -63,21 +63,21 @@ define void @f_non_leaf(i32 %x, i32 %y) optsize {
; CHECK32-NEXT: #APP
; CHECK32-NEXT: #NO_APP
; CHECK32-NEXT: cmpl {{[0-9]+}}(%esp), %eax # encoding: [0x3b,0x44,0x24,0x0c]
; CHECK32-NEXT: je .LBB1_1 # encoding: [0x74,A]
; CHECK32-NEXT: # fixup A - offset: 1, value: .LBB1_1-1, kind: FK_PCRel_1
; CHECK32-NEXT: # %bb.2: # %bb2
; CHECK32-NEXT: jne .LBB1_2 # encoding: [0x75,A]
; CHECK32-NEXT: # fixup A - offset: 1, value: .LBB1_2-1, kind: FK_PCRel_1
; CHECK32-NEXT: # %bb.1: # %bb1
; CHECK32-NEXT: popl %ebx # encoding: [0x5b]
; CHECK32-NEXT: .cfi_def_cfa_offset 4
; CHECK32-NEXT: jmp bar # TAILCALL
; CHECK32-NEXT: jmp foo # TAILCALL
; CHECK32-NEXT: # encoding: [0xeb,A]
; CHECK32-NEXT: # fixup A - offset: 1, value: bar-1, kind: FK_PCRel_1
; CHECK32-NEXT: .LBB1_1: # %bb1
; CHECK32-NEXT: # fixup A - offset: 1, value: foo-1, kind: FK_PCRel_1
; CHECK32-NEXT: .LBB1_2: # %bb2
; CHECK32-NEXT: .cfi_def_cfa_offset 8
; CHECK32-NEXT: popl %ebx # encoding: [0x5b]
; CHECK32-NEXT: .cfi_def_cfa_offset 4
; CHECK32-NEXT: jmp foo # TAILCALL
; CHECK32-NEXT: jmp bar # TAILCALL
; CHECK32-NEXT: # encoding: [0xeb,A]
; CHECK32-NEXT: # fixup A - offset: 1, value: foo-1, kind: FK_PCRel_1
; CHECK32-NEXT: # fixup A - offset: 1, value: bar-1, kind: FK_PCRel_1
;
; CHECK64-LABEL: f_non_leaf:
; CHECK64: # %bb.0: # %entry
Expand All @@ -87,21 +87,21 @@ define void @f_non_leaf(i32 %x, i32 %y) optsize {
; CHECK64-NEXT: #APP
; CHECK64-NEXT: #NO_APP
; CHECK64-NEXT: cmpl %esi, %edi # encoding: [0x39,0xf7]
; CHECK64-NEXT: je .LBB1_1 # encoding: [0x74,A]
; CHECK64-NEXT: # fixup A - offset: 1, value: .LBB1_1-1, kind: FK_PCRel_1
; CHECK64-NEXT: # %bb.2: # %bb2
; CHECK64-NEXT: jne .LBB1_2 # encoding: [0x75,A]
; CHECK64-NEXT: # fixup A - offset: 1, value: .LBB1_2-1, kind: FK_PCRel_1
; CHECK64-NEXT: # %bb.1: # %bb1
; CHECK64-NEXT: popq %rbx # encoding: [0x5b]
; CHECK64-NEXT: .cfi_def_cfa_offset 8
; CHECK64-NEXT: jmp bar # TAILCALL
; CHECK64-NEXT: jmp foo # TAILCALL
; CHECK64-NEXT: # encoding: [0xeb,A]
; CHECK64-NEXT: # fixup A - offset: 1, value: bar-1, kind: FK_PCRel_1
; CHECK64-NEXT: .LBB1_1: # %bb1
; CHECK64-NEXT: # fixup A - offset: 1, value: foo-1, kind: FK_PCRel_1
; CHECK64-NEXT: .LBB1_2: # %bb2
; CHECK64-NEXT: .cfi_def_cfa_offset 16
; CHECK64-NEXT: popq %rbx # encoding: [0x5b]
; CHECK64-NEXT: .cfi_def_cfa_offset 8
; CHECK64-NEXT: jmp foo # TAILCALL
; CHECK64-NEXT: jmp bar # TAILCALL
; CHECK64-NEXT: # encoding: [0xeb,A]
; CHECK64-NEXT: # fixup A - offset: 1, value: foo-1, kind: FK_PCRel_1
; CHECK64-NEXT: # fixup A - offset: 1, value: bar-1, kind: FK_PCRel_1
;
; WIN64-LABEL: f_non_leaf:
; WIN64: # %bb.0: # %entry
Expand All @@ -111,19 +111,19 @@ define void @f_non_leaf(i32 %x, i32 %y) optsize {
; WIN64-NEXT: #APP
; WIN64-NEXT: #NO_APP
; WIN64-NEXT: cmpl %edx, %ecx # encoding: [0x39,0xd1]
; WIN64-NEXT: je .LBB1_1 # encoding: [0x74,A]
; WIN64-NEXT: # fixup A - offset: 1, value: .LBB1_1-1, kind: FK_PCRel_1
; WIN64-NEXT: # %bb.2: # %bb2
; WIN64-NEXT: jne .LBB1_2 # encoding: [0x75,A]
; WIN64-NEXT: # fixup A - offset: 1, value: .LBB1_2-1, kind: FK_PCRel_1
; WIN64-NEXT: # %bb.1: # %bb1
; WIN64-NEXT: popq %rbx # encoding: [0x5b]
; WIN64-NEXT: jmp bar # TAILCALL
; WIN64-NEXT: jmp foo # TAILCALL
; WIN64-NEXT: # encoding: [0xeb,A]
; WIN64-NEXT: # fixup A - offset: 1, value: bar-1, kind: FK_PCRel_1
; WIN64-NEXT: .LBB1_1: # %bb1
; WIN64-NEXT: # fixup A - offset: 1, value: foo-1, kind: FK_PCRel_1
; WIN64-NEXT: .LBB1_2: # %bb2
; WIN64-NEXT: nop # encoding: [0x90]
; WIN64-NEXT: popq %rbx # encoding: [0x5b]
; WIN64-NEXT: jmp foo # TAILCALL
; WIN64-NEXT: jmp bar # TAILCALL
; WIN64-NEXT: # encoding: [0xeb,A]
; WIN64-NEXT: # fixup A - offset: 1, value: foo-1, kind: FK_PCRel_1
; WIN64-NEXT: # fixup A - offset: 1, value: bar-1, kind: FK_PCRel_1
; WIN64-NEXT: .seh_handlerdata
; WIN64-NEXT: .text
; WIN64-NEXT: .seh_endproc
Expand Down
317 changes: 74 additions & 243 deletions llvm/test/CodeGen/X86/fast-isel-cmp-branch2.ll

Large diffs are not rendered by default.

18 changes: 9 additions & 9 deletions llvm/test/CodeGen/X86/funnel-shift.ll
Original file line number Diff line number Diff line change
Expand Up @@ -941,17 +941,17 @@ define void @PR45265(i32 %0, %struct.S* nocapture readonly %1) nounwind {
; X32-SSE2-NEXT: shldl $24, %ebx, %edi
; X32-SSE2-NEXT: xorl %eax, %edi
; X32-SSE2-NEXT: orl %edi, %ecx
; X32-SSE2-NEXT: je .LBB44_2
; X32-SSE2-NEXT: # %bb.1:
; X32-SSE2-NEXT: jne .LBB44_1
; X32-SSE2-NEXT: # %bb.2:
; X32-SSE2-NEXT: popl %esi
; X32-SSE2-NEXT: popl %edi
; X32-SSE2-NEXT: popl %ebx
; X32-SSE2-NEXT: retl
; X32-SSE2-NEXT: .LBB44_2:
; X32-SSE2-NEXT: jmp _Z3foov # TAILCALL
; X32-SSE2-NEXT: .LBB44_1:
; X32-SSE2-NEXT: popl %esi
; X32-SSE2-NEXT: popl %edi
; X32-SSE2-NEXT: popl %ebx
; X32-SSE2-NEXT: jmp _Z3foov # TAILCALL
; X32-SSE2-NEXT: retl
;
; X64-AVX2-LABEL: PR45265:
; X64-AVX2: # %bb.0:
Expand All @@ -964,11 +964,11 @@ define void @PR45265(i32 %0, %struct.S* nocapture readonly %1) nounwind {
; X64-AVX2-NEXT: movq (%rsi,%rcx,4), %rcx
; X64-AVX2-NEXT: shrdq $40, %rdi, %rcx
; X64-AVX2-NEXT: cmpq %rax, %rcx
; X64-AVX2-NEXT: je .LBB44_2
; X64-AVX2-NEXT: # %bb.1:
; X64-AVX2-NEXT: retq
; X64-AVX2-NEXT: .LBB44_2:
; X64-AVX2-NEXT: jne .LBB44_1
; X64-AVX2-NEXT: # %bb.2:
; X64-AVX2-NEXT: jmp _Z3foov # TAILCALL
; X64-AVX2-NEXT: .LBB44_1:
; X64-AVX2-NEXT: retq
%3 = sext i32 %0 to i64
%4 = getelementptr inbounds %struct.S, %struct.S* %1, i64 %3
%5 = bitcast %struct.S* %4 to i88*
Expand Down
220 changes: 48 additions & 172 deletions llvm/test/CodeGen/X86/indirect-branch-tracking-eh2.ll
Original file line number Diff line number Diff line change
@@ -1,183 +1,59 @@
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
; RUN: llc -mtriple x86_64-unknown-unknown -exception-model sjlj -verify-machineinstrs=0 < %s | FileCheck %s --check-prefix=NUM
; RUN: llc -mtriple x86_64-unknown-unknown -exception-model sjlj -verify-machineinstrs=0 < %s | FileCheck %s --check-prefix=SJLJ

; NUM-COUNT-3: endbr64

;SJLJ: main: # @main
;SJLJ-NEXT: .Lfunc_begin0:
;SJLJ-NEXT: # %bb.0: # %entry
;SJLJ-NEXT: endbr64
;SJLJ-NEXT: pushq %rbp
;SJLJ: callq _Unwind_SjLj_Register
;SJLJ-NEXT: .Ltmp0:
;SJLJ-NEXT: callq _Z3foov
;SJLJ-NEXT: .Ltmp1:
;SJLJ-NEXT: # %bb.1: # %invoke.cont
;SJLJ-NEXT: movl
;SJLJ-NEXT: .LBB0_7: # %return
;SJLJ: callq _Unwind_SjLj_Unregister
;SJLJ: retq
;SJLJ-NEXT: .LBB0_9:
;SJLJ-NEXT: endbr64
;SJLJ-NEXT: movl
;SJLJ-NEXT: cmpl
;SJLJ-NEXT: jb .LBB0_10
;SJLJ-NEXT: # %bb.11:
;SJLJ-NEXT: ud2
;SJLJ-NEXT: .LBB0_10:
;SJLJ-NEXT: leaq .LJTI0_0(%rip), %rcx
;SJLJ-NEXT: jmpq *(%rcx,%rax,8)
;SJLJ-NEXT: .LBB0_2: # %lpad
;SJLJ-NEXT: .Ltmp2:
;SJLJ-NEXT: endbr64
;SJLJ: jne .LBB0_4
;SJLJ-NEXT: # %bb.3: # %catch3
;SJLJ: callq __cxa_begin_catch
;SJLJ: jmp .LBB0_6
;SJLJ-NEXT: .LBB0_4: # %catch.fallthrough
;SJLJ-NEXT: cmpl
;SJLJ-NEXT: jne .LBB0_8
;SJLJ-NEXT: # %bb.5: # %catch
;SJLJ: callq __cxa_begin_catch
;SJLJ: cmpb
;SJLJ-NEXT: .LBB0_6: # %return
;SJLJ: callq __cxa_end_catch
;SJLJ-NEXT: jmp .LBB0_7
;SJLJ-NEXT: .LBB0_8: # %eh.resume
;SJLJ-NEXT: movl
;SJLJ-NEXT: .Lfunc_end0:
;SJLJ: .LJTI0_0:
;SJLJ-NEXT: .quad .LBB0_2

@_ZTIi = external dso_local constant i8*
@_ZTIc = external dso_local constant i8*

; Function Attrs: noinline norecurse optnone uwtable
define dso_local i32 @main() #0 personality i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*) {
; NUM-LABEL: main:
; NUM: # %bb.0: # %entry
; NUM-NEXT: endbr64
; NUM-NEXT: pushq %rbp
; NUM-NEXT: movq %rsp, %rbp
; NUM-NEXT: pushq %r15
; NUM-NEXT: pushq %r14
; NUM-NEXT: pushq %r13
; NUM-NEXT: pushq %r12
; NUM-NEXT: pushq %rbx
; NUM-NEXT: subq $120, %rsp
; NUM-NEXT: movl $0, -44(%rbp)
; NUM-NEXT: movq $__gxx_personality_sj0, -120(%rbp)
; NUM-NEXT: movq $GCC_except_table0, -112(%rbp)
; NUM-NEXT: movq %rbp, -104(%rbp)
; NUM-NEXT: movq %rsp, -88(%rbp)
; NUM-NEXT: movq $.LBB0_9, -96(%rbp)
; NUM-NEXT: movl $1, -144(%rbp)
; NUM-NEXT: leaq -152(%rbp), %rdi
; NUM-NEXT: callq _Unwind_SjLj_Register
; NUM-NEXT: .Ltmp0:
; NUM-NEXT: callq _Z3foov
; NUM-NEXT: .Ltmp1:
; NUM-NEXT: # %bb.1: # %invoke.cont
; NUM-NEXT: movl $1, -44(%rbp)
; NUM-NEXT: .LBB0_7: # %return
; NUM-NEXT: movl -44(%rbp), %ebx
; NUM-NEXT: leaq -152(%rbp), %rdi
; NUM-NEXT: callq _Unwind_SjLj_Unregister
; NUM-NEXT: movl %ebx, %eax
; NUM-NEXT: addq $120, %rsp
; NUM-NEXT: popq %rbx
; NUM-NEXT: popq %r12
; NUM-NEXT: popq %r13
; NUM-NEXT: popq %r14
; NUM-NEXT: popq %r15
; NUM-NEXT: popq %rbp
; NUM-NEXT: retq
; NUM-NEXT: .LBB0_9:
; NUM-NEXT: endbr64
; NUM-NEXT: movl -144(%rbp), %eax
; NUM-NEXT: cmpl $1, %eax
; NUM-NEXT: jb .LBB0_10
; NUM-NEXT: # %bb.11:
; NUM-NEXT: ud2
; NUM-NEXT: .LBB0_10:
; NUM-NEXT: leaq {{.*}}(%rip), %rcx
; NUM-NEXT: jmpq *(%rcx,%rax,8)
; NUM-NEXT: .LBB0_2: # %lpad
; NUM-NEXT: .Ltmp2:
; NUM-NEXT: endbr64
; NUM-NEXT: movl -140(%rbp), %ecx
; NUM-NEXT: movl -136(%rbp), %eax
; NUM-NEXT: movq %rcx, -56(%rbp)
; NUM-NEXT: movl %eax, -64(%rbp)
; NUM-NEXT: cmpl $2, %eax
; NUM-NEXT: je .LBB0_3
; NUM-NEXT: # %bb.4: # %catch.fallthrough
; NUM-NEXT: cmpl $1, %eax
; NUM-NEXT: jne .LBB0_8
; NUM-NEXT: # %bb.5: # %catch
; NUM-NEXT: movq -56(%rbp), %rdi
; NUM-NEXT: movl $-1, -144(%rbp)
; NUM-NEXT: callq __cxa_begin_catch
; NUM-NEXT: movb (%rax), %al
; NUM-NEXT: movb %al, -45(%rbp)
; NUM-NEXT: xorl %ecx, %ecx
; NUM-NEXT: cmpb $3, %al
; NUM-NEXT: jmp .LBB0_6
; NUM-NEXT: .LBB0_3: # %catch3
; NUM-NEXT: movq -56(%rbp), %rdi
; NUM-NEXT: movl $-1, -144(%rbp)
; NUM-NEXT: callq __cxa_begin_catch
; NUM-NEXT: movl (%rax), %eax
; NUM-NEXT: movl %eax, -60(%rbp)
; NUM-NEXT: xorl %ecx, %ecx
; NUM-NEXT: cmpl $5, %eax
; NUM-NEXT: .LBB0_6: # %return
; NUM-NEXT: setne %cl
; NUM-NEXT: movl %ecx, -44(%rbp)
; NUM-NEXT: movl $-1, -144(%rbp)
; NUM-NEXT: callq __cxa_end_catch
; NUM-NEXT: jmp .LBB0_7
; NUM-NEXT: .LBB0_8: # %eh.resume
; NUM-NEXT: movl $-1, -144(%rbp)
;
; SJLJ-LABEL: main:
; SJLJ: # %bb.0: # %entry
; SJLJ-NEXT: endbr64
; SJLJ-NEXT: pushq %rbp
; SJLJ-NEXT: movq %rsp, %rbp
; SJLJ-NEXT: pushq %r15
; SJLJ-NEXT: pushq %r14
; SJLJ-NEXT: pushq %r13
; SJLJ-NEXT: pushq %r12
; SJLJ-NEXT: pushq %rbx
; SJLJ-NEXT: subq $120, %rsp
; SJLJ-NEXT: movl $0, -44(%rbp)
; SJLJ-NEXT: movq $__gxx_personality_sj0, -120(%rbp)
; SJLJ-NEXT: movq $GCC_except_table0, -112(%rbp)
; SJLJ-NEXT: movq %rbp, -104(%rbp)
; SJLJ-NEXT: movq %rsp, -88(%rbp)
; SJLJ-NEXT: movq $.LBB0_9, -96(%rbp)
; SJLJ-NEXT: movl $1, -144(%rbp)
; SJLJ-NEXT: leaq -152(%rbp), %rdi
; SJLJ-NEXT: callq _Unwind_SjLj_Register
; SJLJ-NEXT: .Ltmp0:
; SJLJ-NEXT: callq _Z3foov
; SJLJ-NEXT: .Ltmp1:
; SJLJ-NEXT: # %bb.1: # %invoke.cont
; SJLJ-NEXT: movl $1, -44(%rbp)
; SJLJ-NEXT: .LBB0_7: # %return
; SJLJ-NEXT: movl -44(%rbp), %ebx
; SJLJ-NEXT: leaq -152(%rbp), %rdi
; SJLJ-NEXT: callq _Unwind_SjLj_Unregister
; SJLJ-NEXT: movl %ebx, %eax
; SJLJ-NEXT: addq $120, %rsp
; SJLJ-NEXT: popq %rbx
; SJLJ-NEXT: popq %r12
; SJLJ-NEXT: popq %r13
; SJLJ-NEXT: popq %r14
; SJLJ-NEXT: popq %r15
; SJLJ-NEXT: popq %rbp
; SJLJ-NEXT: retq
; SJLJ-NEXT: .LBB0_9:
; SJLJ-NEXT: endbr64
; SJLJ-NEXT: movl -144(%rbp), %eax
; SJLJ-NEXT: cmpl $1, %eax
; SJLJ-NEXT: jb .LBB0_10
; SJLJ-NEXT: # %bb.11:
; SJLJ-NEXT: ud2
; SJLJ-NEXT: .LBB0_10:
; SJLJ-NEXT: leaq {{.*}}(%rip), %rcx
; SJLJ-NEXT: jmpq *(%rcx,%rax,8)
; SJLJ-NEXT: .LBB0_2: # %lpad
; SJLJ-NEXT: .Ltmp2:
; SJLJ-NEXT: endbr64
; SJLJ-NEXT: movl -140(%rbp), %ecx
; SJLJ-NEXT: movl -136(%rbp), %eax
; SJLJ-NEXT: movq %rcx, -56(%rbp)
; SJLJ-NEXT: movl %eax, -64(%rbp)
; SJLJ-NEXT: cmpl $2, %eax
; SJLJ-NEXT: je .LBB0_3
; SJLJ-NEXT: # %bb.4: # %catch.fallthrough
; SJLJ-NEXT: cmpl $1, %eax
; SJLJ-NEXT: jne .LBB0_8
; SJLJ-NEXT: # %bb.5: # %catch
; SJLJ-NEXT: movq -56(%rbp), %rdi
; SJLJ-NEXT: movl $-1, -144(%rbp)
; SJLJ-NEXT: callq __cxa_begin_catch
; SJLJ-NEXT: movb (%rax), %al
; SJLJ-NEXT: movb %al, -45(%rbp)
; SJLJ-NEXT: xorl %ecx, %ecx
; SJLJ-NEXT: cmpb $3, %al
; SJLJ-NEXT: jmp .LBB0_6
; SJLJ-NEXT: .LBB0_3: # %catch3
; SJLJ-NEXT: movq -56(%rbp), %rdi
; SJLJ-NEXT: movl $-1, -144(%rbp)
; SJLJ-NEXT: callq __cxa_begin_catch
; SJLJ-NEXT: movl (%rax), %eax
; SJLJ-NEXT: movl %eax, -60(%rbp)
; SJLJ-NEXT: xorl %ecx, %ecx
; SJLJ-NEXT: cmpl $5, %eax
; SJLJ-NEXT: .LBB0_6: # %return
; SJLJ-NEXT: setne %cl
; SJLJ-NEXT: movl %ecx, -44(%rbp)
; SJLJ-NEXT: movl $-1, -144(%rbp)
; SJLJ-NEXT: callq __cxa_end_catch
; SJLJ-NEXT: jmp .LBB0_7
; SJLJ-NEXT: .LBB0_8: # %eh.resume
; SJLJ-NEXT: movl $-1, -144(%rbp)
entry:
%retval = alloca i32, align 4
%exn.slot = alloca i8*
Expand Down
14 changes: 6 additions & 8 deletions llvm/test/CodeGen/X86/jump_sign.ll
Original file line number Diff line number Diff line change
Expand Up @@ -139,12 +139,11 @@ define i32 @func_l2(i32 %a, i32 %b) nounwind {
; CHECK-NEXT: movl {{[0-9]+}}(%esp), %ecx
; CHECK-NEXT: movl %ecx, %eax
; CHECK-NEXT: subl %edx, %eax
; CHECK-NEXT: je .LBB8_1
; CHECK-NEXT: # %bb.2: # %if.else
; CHECK-NEXT: retl
; CHECK-NEXT: .LBB8_1: # %if.then
; CHECK-NEXT: jne .LBB8_2
; CHECK-NEXT: # %bb.1: # %if.then
; CHECK-NEXT: cmpl %ecx, %edx
; CHECK-NEXT: cmovlel %ecx, %eax
; CHECK-NEXT: .LBB8_2: # %if.else
; CHECK-NEXT: retl
%cmp = icmp eq i32 %b, %a
%sub = sub nsw i32 %a, %b
Expand Down Expand Up @@ -330,13 +329,12 @@ define i8* @func_r(i8* %base, i32* nocapture %offset, i32 %size) nounwind {
; CHECK-NEXT: movl (%edx), %ecx
; CHECK-NEXT: xorl %eax, %eax
; CHECK-NEXT: subl {{[0-9]+}}(%esp), %ecx
; CHECK-NEXT: jge .LBB15_1
; CHECK-NEXT: # %bb.2: # %return
; CHECK-NEXT: retl
; CHECK-NEXT: .LBB15_1: # %if.end
; CHECK-NEXT: jl .LBB15_2
; CHECK-NEXT: # %bb.1: # %if.end
; CHECK-NEXT: movl {{[0-9]+}}(%esp), %eax
; CHECK-NEXT: movl %ecx, (%edx)
; CHECK-NEXT: addl %ecx, %eax
; CHECK-NEXT: .LBB15_2: # %return
; CHECK-NEXT: retl
entry:
%0 = load i32, i32* %offset, align 8
Expand Down
9 changes: 5 additions & 4 deletions llvm/test/CodeGen/X86/lsr-negative-stride.ll
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,11 @@ define i32 @t(i32 %a, i32 %b) nounwind {
; CHECK-NEXT: movl {{[0-9]+}}(%esp), %ecx
; CHECK-NEXT: movl {{[0-9]+}}(%esp), %edx
; CHECK-NEXT: cmpl %ecx, %edx
; CHECK-NEXT: je .LBB0_1
; CHECK-NEXT: jne .LBB0_2
; CHECK-NEXT: # %bb.1:
; CHECK-NEXT: movl %edx, %eax
; CHECK-NEXT: retl
; CHECK-NEXT: .p2align 4, 0x90
; CHECK-NEXT: .LBB0_2: # %bb.outer
; CHECK-NEXT: # =>This Loop Header: Depth=1
; CHECK-NEXT: # Child Loop BB0_3 Depth 2
Expand All @@ -45,9 +49,6 @@ define i32 @t(i32 %a, i32 %b) nounwind {
; CHECK-NEXT: jne .LBB0_2
; CHECK-NEXT: .LBB0_6: # %bb17
; CHECK-NEXT: retl
; CHECK-NEXT: .LBB0_1:
; CHECK-NEXT: movl %edx, %eax
; CHECK-NEXT: retl
entry:
%tmp1434 = icmp eq i32 %a, %b ; <i1> [#uses=1]
br i1 %tmp1434, label %bb17, label %bb.outer
Expand Down
7 changes: 3 additions & 4 deletions llvm/test/CodeGen/X86/machine-cse.ll
Original file line number Diff line number Diff line change
Expand Up @@ -110,11 +110,10 @@ define i32 @cross_mbb_phys_cse(i32 %a, i32 %b) nounwind ssp {
; CHECK: # %bb.0: # %entry
; CHECK-NEXT: movl $1, %eax
; CHECK-NEXT: cmpl %esi, %edi
; CHECK-NEXT: jbe .LBB2_1
; CHECK-NEXT: # %bb.2: # %return
; CHECK-NEXT: retq
; CHECK-NEXT: .LBB2_1: # %if.end
; CHECK-NEXT: ja .LBB2_2
; CHECK-NEXT: # %bb.1: # %if.end
; CHECK-NEXT: sbbl %eax, %eax
; CHECK-NEXT: .LBB2_2: # %return
; CHECK-NEXT: retq
entry:
%cmp = icmp ugt i32 %a, %b
Expand Down
877 changes: 417 additions & 460 deletions llvm/test/CodeGen/X86/memcmp-more-load-pairs.ll

Large diffs are not rendered by default.

158 changes: 77 additions & 81 deletions llvm/test/CodeGen/X86/memcmp-optsize.ll
Original file line number Diff line number Diff line change
Expand Up @@ -120,16 +120,16 @@ define i32 @length3(i8* %X, i8* %Y) nounwind optsize {
; X86-NEXT: rolw $8, %dx
; X86-NEXT: rolw $8, %si
; X86-NEXT: cmpw %si, %dx
; X86-NEXT: je .LBB4_1
; X86-NEXT: # %bb.3: # %res_block
; X86-NEXT: setae %al
; X86-NEXT: movzbl %al, %eax
; X86-NEXT: leal -1(%eax,%eax), %eax
; X86-NEXT: jmp .LBB4_2
; X86-NEXT: .LBB4_1: # %loadbb1
; X86-NEXT: jne .LBB4_3
; X86-NEXT: # %bb.1: # %loadbb1
; X86-NEXT: movzbl 2(%eax), %eax
; X86-NEXT: movzbl 2(%ecx), %ecx
; X86-NEXT: subl %ecx, %eax
; X86-NEXT: jmp .LBB4_2
; X86-NEXT: .LBB4_3: # %res_block
; X86-NEXT: setae %al
; X86-NEXT: movzbl %al, %eax
; X86-NEXT: leal -1(%eax,%eax), %eax
; X86-NEXT: .LBB4_2: # %endblock
; X86-NEXT: popl %esi
; X86-NEXT: retl
Expand All @@ -141,16 +141,16 @@ define i32 @length3(i8* %X, i8* %Y) nounwind optsize {
; X64-NEXT: rolw $8, %ax
; X64-NEXT: rolw $8, %cx
; X64-NEXT: cmpw %cx, %ax
; X64-NEXT: je .LBB4_1
; X64-NEXT: # %bb.3: # %res_block
; X64-NEXT: setae %al
; X64-NEXT: movzbl %al, %eax
; X64-NEXT: leal -1(%rax,%rax), %eax
; X64-NEXT: retq
; X64-NEXT: .LBB4_1: # %loadbb1
; X64-NEXT: jne .LBB4_3
; X64-NEXT: # %bb.1: # %loadbb1
; X64-NEXT: movzbl 2(%rdi), %eax
; X64-NEXT: movzbl 2(%rsi), %ecx
; X64-NEXT: subl %ecx, %eax
; X64-NEXT: retq
; X64-NEXT: .LBB4_3: # %res_block
; X64-NEXT: setae %al
; X64-NEXT: movzbl %al, %eax
; X64-NEXT: leal -1(%rax,%rax), %eax
; X64-NEXT: retq
%m = tail call i32 @memcmp(i8* %X, i8* %Y, i64 3) nounwind
ret i32 %m
Expand Down Expand Up @@ -265,16 +265,16 @@ define i32 @length5(i8* %X, i8* %Y) nounwind optsize {
; X86-NEXT: bswapl %edx
; X86-NEXT: bswapl %esi
; X86-NEXT: cmpl %esi, %edx
; X86-NEXT: je .LBB9_1
; X86-NEXT: # %bb.3: # %res_block
; X86-NEXT: setae %al
; X86-NEXT: movzbl %al, %eax
; X86-NEXT: leal -1(%eax,%eax), %eax
; X86-NEXT: jmp .LBB9_2
; X86-NEXT: .LBB9_1: # %loadbb1
; X86-NEXT: jne .LBB9_3
; X86-NEXT: # %bb.1: # %loadbb1
; X86-NEXT: movzbl 4(%eax), %eax
; X86-NEXT: movzbl 4(%ecx), %ecx
; X86-NEXT: subl %ecx, %eax
; X86-NEXT: jmp .LBB9_2
; X86-NEXT: .LBB9_3: # %res_block
; X86-NEXT: setae %al
; X86-NEXT: movzbl %al, %eax
; X86-NEXT: leal -1(%eax,%eax), %eax
; X86-NEXT: .LBB9_2: # %endblock
; X86-NEXT: popl %esi
; X86-NEXT: retl
Expand All @@ -286,16 +286,16 @@ define i32 @length5(i8* %X, i8* %Y) nounwind optsize {
; X64-NEXT: bswapl %eax
; X64-NEXT: bswapl %ecx
; X64-NEXT: cmpl %ecx, %eax
; X64-NEXT: je .LBB9_1
; X64-NEXT: # %bb.3: # %res_block
; X64-NEXT: setae %al
; X64-NEXT: movzbl %al, %eax
; X64-NEXT: leal -1(%rax,%rax), %eax
; X64-NEXT: retq
; X64-NEXT: .LBB9_1: # %loadbb1
; X64-NEXT: jne .LBB9_3
; X64-NEXT: # %bb.1: # %loadbb1
; X64-NEXT: movzbl 4(%rdi), %eax
; X64-NEXT: movzbl 4(%rsi), %ecx
; X64-NEXT: subl %ecx, %eax
; X64-NEXT: retq
; X64-NEXT: .LBB9_3: # %res_block
; X64-NEXT: setae %al
; X64-NEXT: movzbl %al, %eax
; X64-NEXT: leal -1(%rax,%rax), %eax
; X64-NEXT: retq
%m = tail call i32 @memcmp(i8* %X, i8* %Y, i64 5) nounwind
ret i32 %m
Expand Down Expand Up @@ -334,32 +334,30 @@ define i32 @length8(i8* %X, i8* %Y) nounwind optsize {
; X86-LABEL: length8:
; X86: # %bb.0:
; X86-NEXT: pushl %esi
; X86-NEXT: movl {{[0-9]+}}(%esp), %edx
; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
; X86-NEXT: movl {{[0-9]+}}(%esp), %esi
; X86-NEXT: movl (%esi), %eax
; X86-NEXT: movl (%edx), %ecx
; X86-NEXT: bswapl %eax
; X86-NEXT: movl (%esi), %ecx
; X86-NEXT: movl (%eax), %edx
; X86-NEXT: bswapl %ecx
; X86-NEXT: cmpl %ecx, %eax
; X86-NEXT: jne .LBB11_4
; X86-NEXT: bswapl %edx
; X86-NEXT: cmpl %edx, %ecx
; X86-NEXT: jne .LBB11_2
; X86-NEXT: # %bb.1: # %loadbb1
; X86-NEXT: movl 4(%esi), %eax
; X86-NEXT: movl 4(%edx), %ecx
; X86-NEXT: bswapl %eax
; X86-NEXT: movl 4(%esi), %ecx
; X86-NEXT: movl 4(%eax), %edx
; X86-NEXT: bswapl %ecx
; X86-NEXT: cmpl %ecx, %eax
; X86-NEXT: je .LBB11_2
; X86-NEXT: .LBB11_4: # %res_block
; X86-NEXT: xorl %edx, %edx
; X86-NEXT: cmpl %ecx, %eax
; X86-NEXT: setae %dl
; X86-NEXT: leal -1(%edx,%edx), %eax
; X86-NEXT: bswapl %edx
; X86-NEXT: xorl %eax, %eax
; X86-NEXT: cmpl %edx, %ecx
; X86-NEXT: je .LBB11_3
; X86-NEXT: .LBB11_2: # %res_block
; X86-NEXT: xorl %eax, %eax
; X86-NEXT: cmpl %edx, %ecx
; X86-NEXT: setae %al
; X86-NEXT: leal -1(%eax,%eax), %eax
; X86-NEXT: .LBB11_3: # %endblock
; X86-NEXT: popl %esi
; X86-NEXT: retl
; X86-NEXT: .LBB11_2:
; X86-NEXT: xorl %eax, %eax
; X86-NEXT: jmp .LBB11_3
;
; X64-LABEL: length8:
; X64: # %bb.0:
Expand Down Expand Up @@ -463,27 +461,26 @@ define i32 @length12(i8* %X, i8* %Y) nounwind optsize {
;
; X64-LABEL: length12:
; X64: # %bb.0:
; X64-NEXT: movq (%rdi), %rax
; X64-NEXT: movq (%rsi), %rcx
; X64-NEXT: bswapq %rax
; X64-NEXT: movq (%rdi), %rcx
; X64-NEXT: movq (%rsi), %rdx
; X64-NEXT: bswapq %rcx
; X64-NEXT: cmpq %rcx, %rax
; X64-NEXT: jne .LBB15_4
; X64-NEXT: bswapq %rdx
; X64-NEXT: cmpq %rdx, %rcx
; X64-NEXT: jne .LBB15_2
; X64-NEXT: # %bb.1: # %loadbb1
; X64-NEXT: movl 8(%rdi), %eax
; X64-NEXT: movl 8(%rsi), %ecx
; X64-NEXT: bswapl %eax
; X64-NEXT: movl 8(%rdi), %ecx
; X64-NEXT: movl 8(%rsi), %edx
; X64-NEXT: bswapl %ecx
; X64-NEXT: cmpq %rcx, %rax
; X64-NEXT: je .LBB15_2
; X64-NEXT: .LBB15_4: # %res_block
; X64-NEXT: xorl %edx, %edx
; X64-NEXT: cmpq %rcx, %rax
; X64-NEXT: setae %dl
; X64-NEXT: leal -1(%rdx,%rdx), %eax
; X64-NEXT: retq
; X64-NEXT: .LBB15_2:
; X64-NEXT: bswapl %edx
; X64-NEXT: xorl %eax, %eax
; X64-NEXT: cmpq %rdx, %rcx
; X64-NEXT: je .LBB15_3
; X64-NEXT: .LBB15_2: # %res_block
; X64-NEXT: xorl %eax, %eax
; X64-NEXT: cmpq %rdx, %rcx
; X64-NEXT: setae %al
; X64-NEXT: leal -1(%rax,%rax), %eax
; X64-NEXT: .LBB15_3: # %endblock
; X64-NEXT: retq
%m = tail call i32 @memcmp(i8* %X, i8* %Y, i64 12) nounwind
ret i32 %m
Expand All @@ -504,27 +501,26 @@ define i32 @length16(i8* %X, i8* %Y) nounwind optsize {
;
; X64-LABEL: length16:
; X64: # %bb.0:
; X64-NEXT: movq (%rdi), %rax
; X64-NEXT: movq (%rsi), %rcx
; X64-NEXT: bswapq %rax
; X64-NEXT: movq (%rdi), %rcx
; X64-NEXT: movq (%rsi), %rdx
; X64-NEXT: bswapq %rcx
; X64-NEXT: cmpq %rcx, %rax
; X64-NEXT: jne .LBB16_4
; X64-NEXT: bswapq %rdx
; X64-NEXT: cmpq %rdx, %rcx
; X64-NEXT: jne .LBB16_2
; X64-NEXT: # %bb.1: # %loadbb1
; X64-NEXT: movq 8(%rdi), %rax
; X64-NEXT: movq 8(%rsi), %rcx
; X64-NEXT: bswapq %rax
; X64-NEXT: movq 8(%rdi), %rcx
; X64-NEXT: movq 8(%rsi), %rdx
; X64-NEXT: bswapq %rcx
; X64-NEXT: cmpq %rcx, %rax
; X64-NEXT: je .LBB16_2
; X64-NEXT: .LBB16_4: # %res_block
; X64-NEXT: xorl %edx, %edx
; X64-NEXT: cmpq %rcx, %rax
; X64-NEXT: setae %dl
; X64-NEXT: leal -1(%rdx,%rdx), %eax
; X64-NEXT: retq
; X64-NEXT: .LBB16_2:
; X64-NEXT: bswapq %rdx
; X64-NEXT: xorl %eax, %eax
; X64-NEXT: cmpq %rdx, %rcx
; X64-NEXT: je .LBB16_3
; X64-NEXT: .LBB16_2: # %res_block
; X64-NEXT: xorl %eax, %eax
; X64-NEXT: cmpq %rdx, %rcx
; X64-NEXT: setae %al
; X64-NEXT: leal -1(%rax,%rax), %eax
; X64-NEXT: .LBB16_3: # %endblock
; X64-NEXT: retq
%m = tail call i32 @memcmp(i8* %X, i8* %Y, i64 16) nounwind
ret i32 %m
Expand Down
166 changes: 81 additions & 85 deletions llvm/test/CodeGen/X86/memcmp-pgso.ll
Original file line number Diff line number Diff line change
Expand Up @@ -120,19 +120,19 @@ define i32 @length3(i8* %X, i8* %Y) nounwind !prof !14 {
; X86-NEXT: rolw $8, %dx
; X86-NEXT: rolw $8, %si
; X86-NEXT: cmpw %si, %dx
; X86-NEXT: je .LBB4_1
; X86-NEXT: # %bb.3: # %res_block
; X86-NEXT: jne .LBB4_3
; X86-NEXT: # %bb.1: # %loadbb1
; X86-NEXT: movzbl 2(%eax), %eax
; X86-NEXT: movzbl 2(%ecx), %ecx
; X86-NEXT: subl %ecx, %eax
; X86-NEXT: jmp .LBB4_2
; X86-NEXT: .LBB4_3: # %res_block
; X86-NEXT: setae %al
; X86-NEXT: movzbl %al, %eax
; X86-NEXT: leal -1(%eax,%eax), %eax
; X86-NEXT: .LBB4_2: # %endblock
; X86-NEXT: popl %esi
; X86-NEXT: retl
; X86-NEXT: .LBB4_1: # %loadbb1
; X86-NEXT: movzbl 2(%eax), %eax
; X86-NEXT: movzbl 2(%ecx), %ecx
; X86-NEXT: subl %ecx, %eax
; X86-NEXT: jmp .LBB4_2
;
; X64-LABEL: length3:
; X64: # %bb.0:
Expand All @@ -141,16 +141,16 @@ define i32 @length3(i8* %X, i8* %Y) nounwind !prof !14 {
; X64-NEXT: rolw $8, %ax
; X64-NEXT: rolw $8, %cx
; X64-NEXT: cmpw %cx, %ax
; X64-NEXT: je .LBB4_1
; X64-NEXT: # %bb.3: # %res_block
; X64-NEXT: setae %al
; X64-NEXT: movzbl %al, %eax
; X64-NEXT: leal -1(%rax,%rax), %eax
; X64-NEXT: retq
; X64-NEXT: .LBB4_1: # %loadbb1
; X64-NEXT: jne .LBB4_3
; X64-NEXT: # %bb.1: # %loadbb1
; X64-NEXT: movzbl 2(%rdi), %eax
; X64-NEXT: movzbl 2(%rsi), %ecx
; X64-NEXT: subl %ecx, %eax
; X64-NEXT: retq
; X64-NEXT: .LBB4_3: # %res_block
; X64-NEXT: setae %al
; X64-NEXT: movzbl %al, %eax
; X64-NEXT: leal -1(%rax,%rax), %eax
; X64-NEXT: retq
%m = tail call i32 @memcmp(i8* %X, i8* %Y, i64 3) nounwind
ret i32 %m
Expand Down Expand Up @@ -265,19 +265,19 @@ define i32 @length5(i8* %X, i8* %Y) nounwind !prof !14 {
; X86-NEXT: bswapl %edx
; X86-NEXT: bswapl %esi
; X86-NEXT: cmpl %esi, %edx
; X86-NEXT: je .LBB9_1
; X86-NEXT: # %bb.3: # %res_block
; X86-NEXT: jne .LBB9_3
; X86-NEXT: # %bb.1: # %loadbb1
; X86-NEXT: movzbl 4(%eax), %eax
; X86-NEXT: movzbl 4(%ecx), %ecx
; X86-NEXT: subl %ecx, %eax
; X86-NEXT: jmp .LBB9_2
; X86-NEXT: .LBB9_3: # %res_block
; X86-NEXT: setae %al
; X86-NEXT: movzbl %al, %eax
; X86-NEXT: leal -1(%eax,%eax), %eax
; X86-NEXT: .LBB9_2: # %endblock
; X86-NEXT: popl %esi
; X86-NEXT: retl
; X86-NEXT: .LBB9_1: # %loadbb1
; X86-NEXT: movzbl 4(%eax), %eax
; X86-NEXT: movzbl 4(%ecx), %ecx
; X86-NEXT: subl %ecx, %eax
; X86-NEXT: jmp .LBB9_2
;
; X64-LABEL: length5:
; X64: # %bb.0:
Expand All @@ -286,16 +286,16 @@ define i32 @length5(i8* %X, i8* %Y) nounwind !prof !14 {
; X64-NEXT: bswapl %eax
; X64-NEXT: bswapl %ecx
; X64-NEXT: cmpl %ecx, %eax
; X64-NEXT: je .LBB9_1
; X64-NEXT: # %bb.3: # %res_block
; X64-NEXT: setae %al
; X64-NEXT: movzbl %al, %eax
; X64-NEXT: leal -1(%rax,%rax), %eax
; X64-NEXT: retq
; X64-NEXT: .LBB9_1: # %loadbb1
; X64-NEXT: jne .LBB9_3
; X64-NEXT: # %bb.1: # %loadbb1
; X64-NEXT: movzbl 4(%rdi), %eax
; X64-NEXT: movzbl 4(%rsi), %ecx
; X64-NEXT: subl %ecx, %eax
; X64-NEXT: retq
; X64-NEXT: .LBB9_3: # %res_block
; X64-NEXT: setae %al
; X64-NEXT: movzbl %al, %eax
; X64-NEXT: leal -1(%rax,%rax), %eax
; X64-NEXT: retq
%m = tail call i32 @memcmp(i8* %X, i8* %Y, i64 5) nounwind
ret i32 %m
Expand Down Expand Up @@ -334,32 +334,30 @@ define i32 @length8(i8* %X, i8* %Y) nounwind !prof !14 {
; X86-LABEL: length8:
; X86: # %bb.0:
; X86-NEXT: pushl %esi
; X86-NEXT: movl {{[0-9]+}}(%esp), %edx
; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
; X86-NEXT: movl {{[0-9]+}}(%esp), %esi
; X86-NEXT: movl (%esi), %eax
; X86-NEXT: movl (%edx), %ecx
; X86-NEXT: bswapl %eax
; X86-NEXT: movl (%esi), %ecx
; X86-NEXT: movl (%eax), %edx
; X86-NEXT: bswapl %ecx
; X86-NEXT: bswapl %edx
; X86-NEXT: cmpl %edx, %ecx
; X86-NEXT: jne .LBB11_2
; X86-NEXT: # %bb.1: # %loadbb1
; X86-NEXT: movl 4(%esi), %ecx
; X86-NEXT: movl 4(%eax), %edx
; X86-NEXT: bswapl %ecx
; X86-NEXT: cmpl %ecx, %eax
; X86-NEXT: je .LBB11_1
; X86-NEXT: .LBB11_4: # %res_block
; X86-NEXT: xorl %edx, %edx
; X86-NEXT: cmpl %ecx, %eax
; X86-NEXT: setae %dl
; X86-NEXT: leal -1(%edx,%edx), %eax
; X86-NEXT: bswapl %edx
; X86-NEXT: xorl %eax, %eax
; X86-NEXT: cmpl %edx, %ecx
; X86-NEXT: je .LBB11_3
; X86-NEXT: .LBB11_2: # %res_block
; X86-NEXT: xorl %eax, %eax
; X86-NEXT: cmpl %edx, %ecx
; X86-NEXT: setae %al
; X86-NEXT: leal -1(%eax,%eax), %eax
; X86-NEXT: .LBB11_3: # %endblock
; X86-NEXT: popl %esi
; X86-NEXT: retl
; X86-NEXT: .LBB11_1: # %loadbb1
; X86-NEXT: movl 4(%esi), %eax
; X86-NEXT: movl 4(%edx), %ecx
; X86-NEXT: bswapl %eax
; X86-NEXT: bswapl %ecx
; X86-NEXT: cmpl %ecx, %eax
; X86-NEXT: jne .LBB11_4
; X86-NEXT: # %bb.2:
; X86-NEXT: xorl %eax, %eax
; X86-NEXT: jmp .LBB11_3
;
; X64-LABEL: length8:
; X64: # %bb.0:
Expand Down Expand Up @@ -463,27 +461,26 @@ define i32 @length12(i8* %X, i8* %Y) nounwind !prof !14 {
;
; X64-LABEL: length12:
; X64: # %bb.0:
; X64-NEXT: movq (%rdi), %rax
; X64-NEXT: movq (%rsi), %rcx
; X64-NEXT: bswapq %rax
; X64-NEXT: movq (%rdi), %rcx
; X64-NEXT: movq (%rsi), %rdx
; X64-NEXT: bswapq %rcx
; X64-NEXT: cmpq %rcx, %rax
; X64-NEXT: je .LBB15_1
; X64-NEXT: .LBB15_4: # %res_block
; X64-NEXT: xorl %edx, %edx
; X64-NEXT: cmpq %rcx, %rax
; X64-NEXT: setae %dl
; X64-NEXT: leal -1(%rdx,%rdx), %eax
; X64-NEXT: retq
; X64-NEXT: .LBB15_1: # %loadbb1
; X64-NEXT: movl 8(%rdi), %eax
; X64-NEXT: movl 8(%rsi), %ecx
; X64-NEXT: bswapl %eax
; X64-NEXT: bswapq %rdx
; X64-NEXT: cmpq %rdx, %rcx
; X64-NEXT: jne .LBB15_2
; X64-NEXT: # %bb.1: # %loadbb1
; X64-NEXT: movl 8(%rdi), %ecx
; X64-NEXT: movl 8(%rsi), %edx
; X64-NEXT: bswapl %ecx
; X64-NEXT: cmpq %rcx, %rax
; X64-NEXT: jne .LBB15_4
; X64-NEXT: # %bb.2:
; X64-NEXT: bswapl %edx
; X64-NEXT: xorl %eax, %eax
; X64-NEXT: cmpq %rdx, %rcx
; X64-NEXT: je .LBB15_3
; X64-NEXT: .LBB15_2: # %res_block
; X64-NEXT: xorl %eax, %eax
; X64-NEXT: cmpq %rdx, %rcx
; X64-NEXT: setae %al
; X64-NEXT: leal -1(%rax,%rax), %eax
; X64-NEXT: .LBB15_3: # %endblock
; X64-NEXT: retq
%m = tail call i32 @memcmp(i8* %X, i8* %Y, i64 12) nounwind
ret i32 %m
Expand All @@ -504,27 +501,26 @@ define i32 @length16(i8* %X, i8* %Y) nounwind !prof !14 {
;
; X64-LABEL: length16:
; X64: # %bb.0:
; X64-NEXT: movq (%rdi), %rax
; X64-NEXT: movq (%rsi), %rcx
; X64-NEXT: bswapq %rax
; X64-NEXT: movq (%rdi), %rcx
; X64-NEXT: movq (%rsi), %rdx
; X64-NEXT: bswapq %rcx
; X64-NEXT: cmpq %rcx, %rax
; X64-NEXT: je .LBB16_1
; X64-NEXT: .LBB16_4: # %res_block
; X64-NEXT: xorl %edx, %edx
; X64-NEXT: cmpq %rcx, %rax
; X64-NEXT: setae %dl
; X64-NEXT: leal -1(%rdx,%rdx), %eax
; X64-NEXT: retq
; X64-NEXT: .LBB16_1: # %loadbb1
; X64-NEXT: movq 8(%rdi), %rax
; X64-NEXT: movq 8(%rsi), %rcx
; X64-NEXT: bswapq %rax
; X64-NEXT: bswapq %rdx
; X64-NEXT: cmpq %rdx, %rcx
; X64-NEXT: jne .LBB16_2
; X64-NEXT: # %bb.1: # %loadbb1
; X64-NEXT: movq 8(%rdi), %rcx
; X64-NEXT: movq 8(%rsi), %rdx
; X64-NEXT: bswapq %rcx
; X64-NEXT: cmpq %rcx, %rax
; X64-NEXT: jne .LBB16_4
; X64-NEXT: # %bb.2:
; X64-NEXT: bswapq %rdx
; X64-NEXT: xorl %eax, %eax
; X64-NEXT: cmpq %rdx, %rcx
; X64-NEXT: je .LBB16_3
; X64-NEXT: .LBB16_2: # %res_block
; X64-NEXT: xorl %eax, %eax
; X64-NEXT: cmpq %rdx, %rcx
; X64-NEXT: setae %al
; X64-NEXT: leal -1(%rax,%rax), %eax
; X64-NEXT: .LBB16_3: # %endblock
; X64-NEXT: retq
%m = tail call i32 @memcmp(i8* %X, i8* %Y, i64 16) nounwind
ret i32 %m
Expand Down
433 changes: 206 additions & 227 deletions llvm/test/CodeGen/X86/memcmp.ll

Large diffs are not rendered by default.

16 changes: 8 additions & 8 deletions llvm/test/CodeGen/X86/neg_cmp.ll
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ define void @neg_cmp(i32 %x, i32 %y) nounwind {
; CHECK-LABEL: neg_cmp:
; CHECK: # %bb.0:
; CHECK-NEXT: addl %esi, %edi
; CHECK-NEXT: je .LBB0_2
; CHECK-NEXT: # %bb.1: # %if.end
; CHECK-NEXT: retq
; CHECK-NEXT: .LBB0_2: # %if.then
; CHECK-NEXT: jne .LBB0_1
; CHECK-NEXT: # %bb.2: # %if.then
; CHECK-NEXT: jmp g # TAILCALL
; CHECK-NEXT: .LBB0_1: # %if.end
; CHECK-NEXT: retq
%sub = sub i32 0, %y
%cmp = icmp eq i32 %x, %sub
br i1 %cmp, label %if.then, label %if.end
Expand All @@ -31,11 +31,11 @@ define void @neg_cmp_commuted(i32 %x, i32 %y) nounwind {
; CHECK-LABEL: neg_cmp_commuted:
; CHECK: # %bb.0:
; CHECK-NEXT: addl %esi, %edi
; CHECK-NEXT: je .LBB1_2
; CHECK-NEXT: # %bb.1: # %if.end
; CHECK-NEXT: retq
; CHECK-NEXT: .LBB1_2: # %if.then
; CHECK-NEXT: jne .LBB1_1
; CHECK-NEXT: # %bb.2: # %if.then
; CHECK-NEXT: jmp g # TAILCALL
; CHECK-NEXT: .LBB1_1: # %if.end
; CHECK-NEXT: retq
%sub = sub i32 0, %y
%cmp = icmp eq i32 %sub, %x
br i1 %cmp, label %if.then, label %if.end
Expand Down
14 changes: 6 additions & 8 deletions llvm/test/CodeGen/X86/nobt.ll
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,10 @@ define void @test2(i32 %x, i32 %n) nounwind {
; CHECK: # %bb.0: # %entry
; CHECK-NEXT: xorl %eax, %eax
; CHECK-NEXT: testb %al, %al
; CHECK-NEXT: je .LBB0_1
; CHECK-NEXT: # %bb.2: # %UnifiedReturnBlock
; CHECK-NEXT: retl
; CHECK-NEXT: .LBB0_1: # %bb
; CHECK-NEXT: jne .LBB0_2
; CHECK-NEXT: # %bb.1: # %bb
; CHECK-NEXT: calll foo
; CHECK-NEXT: .LBB0_2: # %UnifiedReturnBlock
; CHECK-NEXT: retl
entry:
%tmp1 = and i32 %x, 1
Expand All @@ -35,11 +34,10 @@ define void @test3(i32 %x, i32 %n) nounwind {
; CHECK: # %bb.0: # %entry
; CHECK-NEXT: xorl %eax, %eax
; CHECK-NEXT: testb %al, %al
; CHECK-NEXT: je .LBB1_1
; CHECK-NEXT: # %bb.2: # %UnifiedReturnBlock
; CHECK-NEXT: retl
; CHECK-NEXT: .LBB1_1: # %bb
; CHECK-NEXT: jne .LBB1_2
; CHECK-NEXT: # %bb.1: # %bb
; CHECK-NEXT: calll foo
; CHECK-NEXT: .LBB1_2: # %UnifiedReturnBlock
; CHECK-NEXT: retl
entry:
%tmp1 = and i32 %x, 1
Expand Down
10 changes: 5 additions & 5 deletions llvm/test/CodeGen/X86/pr29170.ll
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,8 @@ define i32 @main() {
; CHECK: # %bb.0: # %entry
; CHECK-NEXT: xorl %eax, %eax
; CHECK-NEXT: testb %al, %al
; CHECK-NEXT: je .LBB0_1
; CHECK-NEXT: .LBB0_3: # %if.else
; CHECK-NEXT: xorl %eax, %eax
; CHECK-NEXT: retl
; CHECK-NEXT: .LBB0_1: # %go
; CHECK-NEXT: jne .LBB0_3
; CHECK-NEXT: # %bb.1: # %go
; CHECK-NEXT: movl $-1, %ecx
; CHECK-NEXT: movsbl b, %edx
; CHECK-NEXT: notl %ecx
Expand All @@ -26,6 +23,9 @@ define i32 @main() {
; CHECK-NEXT: # %bb.2: # %if.then
; CHECK-NEXT: movl $42, %eax
; CHECK-NEXT: retl
; CHECK-NEXT: .LBB0_3: # %if.else
; CHECK-NEXT: xorl %eax, %eax
; CHECK-NEXT: retl
entry:
%true = icmp eq i32 0, 0
%const = bitcast i64 -4294967296 to i64
Expand Down
20 changes: 10 additions & 10 deletions llvm/test/CodeGen/X86/wide-integer-cmp.ll
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ define i32 @branch_eq(i64 %a, i64 %b) {
; CHECK-NEXT: xorl {{[0-9]+}}(%esp), %ecx
; CHECK-NEXT: xorl {{[0-9]+}}(%esp), %eax
; CHECK-NEXT: orl %ecx, %eax
; CHECK-NEXT: je .LBB0_1
; CHECK-NEXT: # %bb.2: # %bb2
; CHECK-NEXT: movl $2, %eax
; CHECK-NEXT: retl
; CHECK-NEXT: .LBB0_1: # %bb1
; CHECK-NEXT: jne .LBB0_2
; CHECK-NEXT: # %bb.1: # %bb1
; CHECK-NEXT: movl $1, %eax
; CHECK-NEXT: retl
; CHECK-NEXT: .LBB0_2: # %bb2
; CHECK-NEXT: movl $2, %eax
; CHECK-NEXT: retl
entry:
%cmp = icmp eq i64 %a, %b
br i1 %cmp, label %bb1, label %bb2
Expand Down Expand Up @@ -55,13 +55,13 @@ define i32 @branch_ule(i64 %a, i64 %b) {
; CHECK-NEXT: movl {{[0-9]+}}(%esp), %ecx
; CHECK-NEXT: cmpl {{[0-9]+}}(%esp), %eax
; CHECK-NEXT: sbbl {{[0-9]+}}(%esp), %ecx
; CHECK-NEXT: jae .LBB2_1
; CHECK-NEXT: # %bb.2: # %bb2
; CHECK-NEXT: movl $2, %eax
; CHECK-NEXT: retl
; CHECK-NEXT: .LBB2_1: # %bb1
; CHECK-NEXT: jb .LBB2_2
; CHECK-NEXT: # %bb.1: # %bb1
; CHECK-NEXT: movl $1, %eax
; CHECK-NEXT: retl
; CHECK-NEXT: .LBB2_2: # %bb2
; CHECK-NEXT: movl $2, %eax
; CHECK-NEXT: retl
entry:
%cmp = icmp ule i64 %a, %b
br i1 %cmp, label %bb1, label %bb2
Expand Down
23 changes: 11 additions & 12 deletions llvm/test/DebugInfo/COFF/fpo-shrink-wrap.ll
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,8 @@
; ASM: .cv_loc 0 1 3 9 # t.c:3:9
; ASM: movl %ecx, %eax
; ASM: cmpl %edx, %ecx
; ASM: jge LBB0_1
; ASM: jl [[EPILOGUE:LBB0_[0-9]+]]

; ASM: retl $8

; ASM: LBB0_1:
; ASM: pushl %ebx
; ASM: .cv_fpo_pushreg %ebx
; ASM: pushl %edi
Expand All @@ -34,24 +31,26 @@
; ASM: popl %esi
; ASM: popl %edi
; ASM: popl %ebx
; ASM: Ltmp11:
; ASM: [[EPILOGUE]]: # %return
; ASM: retl $8
; ASM: Ltmp10:
; ASM: .cv_fpo_endproc

; Note how RvaStart advances 7 bytes to skip the shrink-wrapped portion.
; OBJ: SubSectionType: FrameData (0xF5)
; OBJ: FrameData {
; OBJ: RvaStart: 0x0
; OBJ: CodeSize: 0x36
; OBJ: PrologSize: 0xC
; OBJ: PrologSize: 0x9
; OBJ: FrameFunc [
; OBJ-NEXT: $T0 .raSearch =
; OBJ-NEXT: $eip $T0 ^ =
; OBJ-NEXT: $esp $T0 4 + =
; OBJ-NEXT: ]
; OBJ: }
; OBJ: FrameData {
; OBJ: RvaStart: 0xA
; OBJ: CodeSize: 0x2C
; OBJ: RvaStart: 0x7
; OBJ: CodeSize: 0x2F
; OBJ: PrologSize: 0x2
; OBJ: FrameFunc [
; OBJ-NEXT: $T0 .raSearch =
Expand All @@ -61,8 +60,8 @@
; OBJ-NEXT: ]
; OBJ: }
; OBJ: FrameData {
; OBJ: RvaStart: 0xB
; OBJ: CodeSize: 0x2B
; OBJ: RvaStart: 0x8
; OBJ: CodeSize: 0x2E
; OBJ: PrologSize: 0x1
; OBJ: FrameFunc [
; OBJ-NEXT: $T0 .raSearch =
Expand All @@ -73,8 +72,8 @@
; OBJ-NEXT: ]
; OBJ: }
; OBJ: FrameData {
; OBJ: RvaStart: 0xC
; OBJ: CodeSize: 0x2A
; OBJ: RvaStart: 0x9
; OBJ: CodeSize: 0x2D
; OBJ: PrologSize: 0x0
; OBJ: FrameFunc [
; OBJ-NEXT: $T0 .raSearch =
Expand Down
127 changes: 43 additions & 84 deletions llvm/test/Transforms/PGOProfile/counter_promo_mexits.ll
Original file line number Diff line number Diff line change
@@ -1,95 +1,27 @@
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt < %s -pgo-instr-gen -instrprof -do-counter-promotion=true -speculative-counter-promotion-max-exiting=3 -S | FileCheck %s --check-prefix=PROMO
; RUN: opt < %s --passes=pgo-instr-gen,instrprof -do-counter-promotion=true -speculative-counter-promotion-max-exiting=3 -S | FileCheck %s --check-prefix=PROMO
; RUN: opt < %s -pgo-instr-gen -instrprof -do-counter-promotion=true -speculative-counter-promotion-max-exiting=3 -S | FileCheck --check-prefix=PROMO %s
; RUN: opt < %s --passes=pgo-instr-gen,instrprof -do-counter-promotion=true -speculative-counter-promotion-max-exiting=3 -S | FileCheck --check-prefix=PROMO %s

@g = common local_unnamed_addr global i32 0, align 4

define void @foo(i32 %arg) local_unnamed_addr {
; PROMO-LABEL: @foo(
; PROMO-NEXT: bb:
; PROMO-NEXT: [[T:%.*]] = add nsw i32 [[ARG:%.*]], -1
; PROMO-NEXT: br label [[BB1:%.*]]
; PROMO: bb1:
; PROMO-NEXT: [[PGOCOUNT213:%.*]] = phi i64 [ 0, [[BB:%.*]] ], [ [[PGOCOUNT212:%.*]], [[BB11:%.*]] ]
; PROMO-NEXT: [[PGOCOUNT19:%.*]] = phi i64 [ 0, [[BB]] ], [ [[PGOCOUNT18:%.*]], [[BB11]] ]
; PROMO-NEXT: [[PGOCOUNT6:%.*]] = phi i64 [ 0, [[BB]] ], [ [[PGOCOUNT5:%.*]], [[BB11]] ]
; PROMO-NEXT: [[T2:%.*]] = phi i32 [ 0, [[BB]] ], [ [[T12:%.*]], [[BB11]] ]
; PROMO-NEXT: [[T3:%.*]] = icmp sgt i32 [[T2]], [[ARG]]
; PROMO-NEXT: br i1 [[T3]], label [[BB7:%.*]], label [[BB4:%.*]]
; PROMO: bb4:
; PROMO-NEXT: [[TMP0:%.*]] = add i64 [[PGOCOUNT6]], 1
; PROMO-NEXT: tail call void @bar(i32 1)
; PROMO-NEXT: [[T5:%.*]] = load i32, i32* @g, align 4
; PROMO-NEXT: [[T6:%.*]] = icmp sgt i32 [[T5]], 100
; PROMO-NEXT: br i1 [[T6]], label [[BB15_0:%.*]], label [[BB11]]
; PROMO: bb7:
; PROMO-NEXT: [[T8:%.*]] = icmp slt i32 [[T2]], [[T]]
; PROMO-NEXT: br i1 [[T8]], label [[BB9:%.*]], label [[BB10:%.*]]
; PROMO: bb9:
; PROMO-NEXT: [[TMP1:%.*]] = add i64 [[PGOCOUNT19]], 1
; PROMO-NEXT: tail call void @bar(i32 2)
; PROMO-NEXT: br label [[BB11]]
; PROMO: bb10:
; PROMO-NEXT: [[TMP2:%.*]] = add i64 [[PGOCOUNT213]], 1
; PROMO-NEXT: tail call void @bar(i32 3)
; PROMO-NEXT: br label [[BB11]]
; PROMO: bb11:
; PROMO-NEXT: [[PGOCOUNT212]] = phi i64 [ [[TMP2]], [[BB10]] ], [ [[PGOCOUNT213]], [[BB9]] ], [ [[PGOCOUNT213]], [[BB4]] ]
; PROMO-NEXT: [[PGOCOUNT18]] = phi i64 [ [[PGOCOUNT19]], [[BB10]] ], [ [[TMP1]], [[BB9]] ], [ [[PGOCOUNT19]], [[BB4]] ]
; PROMO-NEXT: [[PGOCOUNT5]] = phi i64 [ [[PGOCOUNT6]], [[BB10]] ], [ [[PGOCOUNT6]], [[BB9]] ], [ [[TMP0]], [[BB4]] ]
; PROMO-NEXT: [[T12]] = add nuw nsw i32 [[T2]], 1
; PROMO-NEXT: [[T13:%.*]] = icmp slt i32 [[T2]], 99
; PROMO-NEXT: br i1 [[T13]], label [[BB1]], label [[BB14:%.*]]
; PROMO: bb14:
; PROMO-NEXT: [[PGOCOUNT_PROMOTED7:%.*]] = load i64, i64* getelementptr inbounds ([5 x i64], [5 x i64]* @__profc_foo, i64 0, i64 1), align 4
; PROMO-NEXT: [[TMP3:%.*]] = add i64 [[PGOCOUNT_PROMOTED7]], [[PGOCOUNT5]]
; PROMO-NEXT: store i64 [[TMP3]], i64* getelementptr inbounds ([5 x i64], [5 x i64]* @__profc_foo, i64 0, i64 1), align 4
; PROMO-NEXT: [[PGOCOUNT_PROMOTED11:%.*]] = load i64, i64* getelementptr inbounds ([5 x i64], [5 x i64]* @__profc_foo, i64 0, i64 0), align 4
; PROMO-NEXT: [[TMP4:%.*]] = add i64 [[PGOCOUNT_PROMOTED11]], [[PGOCOUNT18]]
; PROMO-NEXT: store i64 [[TMP4]], i64* getelementptr inbounds ([5 x i64], [5 x i64]* @__profc_foo, i64 0, i64 0), align 4
; PROMO-NEXT: [[PGOCOUNT_PROMOTED15:%.*]] = load i64, i64* getelementptr inbounds ([5 x i64], [5 x i64]* @__profc_foo, i64 0, i64 2), align 4
; PROMO-NEXT: [[TMP5:%.*]] = add i64 [[PGOCOUNT_PROMOTED15]], [[PGOCOUNT212]]
; PROMO-NEXT: store i64 [[TMP5]], i64* getelementptr inbounds ([5 x i64], [5 x i64]* @__profc_foo, i64 0, i64 2), align 4
; PROMO-NEXT: [[PGOCOUNT3:%.*]] = load i64, i64* getelementptr inbounds ([5 x i64], [5 x i64]* @__profc_foo, i64 0, i64 3), align 4
; PROMO-NEXT: [[TMP6:%.*]] = add i64 [[PGOCOUNT3]], 1
; PROMO-NEXT: store i64 [[TMP6]], i64* getelementptr inbounds ([5 x i64], [5 x i64]* @__profc_foo, i64 0, i64 3), align 4
; PROMO-NEXT: tail call void @bar(i32 0)
; PROMO-NEXT: br label [[BB15:%.*]]
; PROMO: bb15_0:
; PROMO-NEXT: [[PGOCOUNT_PROMOTED:%.*]] = load i64, i64* getelementptr inbounds ([5 x i64], [5 x i64]* @__profc_foo, i64 0, i64 1), align 4
; PROMO-NEXT: [[TMP7:%.*]] = add i64 [[PGOCOUNT_PROMOTED]], [[TMP0]]
; PROMO-NEXT: store i64 [[TMP7]], i64* getelementptr inbounds ([5 x i64], [5 x i64]* @__profc_foo, i64 0, i64 1), align 4
; PROMO-NEXT: [[PGOCOUNT_PROMOTED10:%.*]] = load i64, i64* getelementptr inbounds ([5 x i64], [5 x i64]* @__profc_foo, i64 0, i64 0), align 4
; PROMO-NEXT: [[TMP8:%.*]] = add i64 [[PGOCOUNT_PROMOTED10]], [[PGOCOUNT19]]
; PROMO-NEXT: store i64 [[TMP8]], i64* getelementptr inbounds ([5 x i64], [5 x i64]* @__profc_foo, i64 0, i64 0), align 4
; PROMO-NEXT: [[PGOCOUNT_PROMOTED14:%.*]] = load i64, i64* getelementptr inbounds ([5 x i64], [5 x i64]* @__profc_foo, i64 0, i64 2), align 4
; PROMO-NEXT: [[TMP9:%.*]] = add i64 [[PGOCOUNT_PROMOTED14]], [[PGOCOUNT213]]
; PROMO-NEXT: store i64 [[TMP9]], i64* getelementptr inbounds ([5 x i64], [5 x i64]* @__profc_foo, i64 0, i64 2), align 4
; PROMO-NEXT: [[PGOCOUNT4:%.*]] = load i64, i64* getelementptr inbounds ([5 x i64], [5 x i64]* @__profc_foo, i64 0, i64 4), align 4
; PROMO-NEXT: [[TMP10:%.*]] = add i64 [[PGOCOUNT4]], 1
; PROMO-NEXT: store i64 [[TMP10]], i64* getelementptr inbounds ([5 x i64], [5 x i64]* @__profc_foo, i64 0, i64 4), align 4
; PROMO-NEXT: br label [[BB15]]
; PROMO: bb15:
; PROMO-NEXT: tail call void @bar(i32 1)
; PROMO-NEXT: ret void
;
; PROMO-LABEL: @foo
bb:
%t = add nsw i32 %arg, -1
%tmp = add nsw i32 %arg, -1
br label %bb1
bb1: ; preds = %bb11, %bb
%t2 = phi i32 [ 0, %bb ], [ %t12, %bb11 ]
%t3 = icmp sgt i32 %t2, %arg
br i1 %t3, label %bb7, label %bb4
%tmp2 = phi i32 [ 0, %bb ], [ %tmp12, %bb11 ]
%tmp3 = icmp sgt i32 %tmp2, %arg
br i1 %tmp3, label %bb7, label %bb4

bb4: ; preds = %bb1
tail call void @bar(i32 1)
%t5 = load i32, i32* @g, align 4
%t6 = icmp sgt i32 %t5, 100
br i1 %t6, label %bb15_0, label %bb11
%tmp5 = load i32, i32* @g, align 4
%tmp6 = icmp sgt i32 %tmp5, 100
br i1 %tmp6, label %bb15_0, label %bb11

bb7: ; preds = %bb1
%t8 = icmp slt i32 %t2, %t
br i1 %t8, label %bb9, label %bb10
%tmp8 = icmp slt i32 %tmp2, %tmp
br i1 %tmp8, label %bb9, label %bb10

bb9: ; preds = %bb7
tail call void @bar(i32 2)
Expand All @@ -100,18 +32,45 @@ bb10: ; preds = %bb7
br label %bb11

bb11: ; preds = %bb10, %bb9, %bb4
%t12 = add nuw nsw i32 %t2, 1
%t13 = icmp slt i32 %t2, 99
br i1 %t13, label %bb1, label %bb14
%tmp12 = add nuw nsw i32 %tmp2, 1
%tmp13 = icmp slt i32 %tmp2, 99
br i1 %tmp13, label %bb1, label %bb14

bb14: ; preds = %bb11
; PROMO-LABEL: bb14:
tail call void @bar(i32 0)
br label %bb15

; PROMO: %pgocount.promoted{{.*}} = load {{.*}} @__profc_foo{{.*}} 0)
; PROMO-NEXT: add
; PROMO-NEXT: store {{.*}}@__profc_foo{{.*}}0)
; PROMO-NEXT: %pgocount.promoted{{.*}} = load {{.*}} @__profc_foo{{.*}} 1)
; PROMO-NEXT: add
; PROMO-NEXT: store {{.*}}@__profc_foo{{.*}}1)
; PROMO-NEXT: %pgocount.promoted{{.*}} = load {{.*}} @__profc_foo{{.*}} 2)
; PROMO-NEXT: add
; PROMO-NEXT: store {{.*}}@__profc_foo{{.*}}2)
; PROMO-NEXT: %pgocount{{.*}} = load {{.*}} @__profc_foo{{.*}} 3)
; PROMO-NEXT: add
; PROMO-NEXT: store {{.*}}@__profc_foo{{.*}}3)


bb15_0: ; preds = %bb11
; PROMO-LABEL: bb15_0:
br label %bb15
; PROMO: %pgocount.promoted{{.*}} = load {{.*}} @__profc_foo{{.*}} 0)
; PROMO-NEXT: add
; PROMO-NEXT: store {{.*}}@__profc_foo{{.*}}0)
; PROMO-NEXT: %pgocount.promoted{{.*}} = load {{.*}} @__profc_foo{{.*}} 1)
; PROMO-NEXT: add
; PROMO-NEXT: store {{.*}}@__profc_foo{{.*}}1)
; PROMO-NEXT: %pgocount.promoted{{.*}} = load {{.*}} @__profc_foo{{.*}} 2)
; PROMO-NEXT: add
; PROMO-NEXT: store {{.*}}@__profc_foo{{.*}}2)
; PROMO-NEXT: %pgocount{{.*}} = load {{.*}} @__profc_foo{{.*}} 4)
; PROMO-NEXT: add
; PROMO-NEXT: store {{.*}}@__profc_foo{{.*}}4)
; PROMO-NOT: @__profc_foo


bb15: ; preds = %bb14, %bb4
tail call void @bar(i32 1)
Expand Down
3 changes: 1 addition & 2 deletions llvm/test/Transforms/PGOProfile/landingpad.ll
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,7 @@ catch.dispatch:
; GEN: catch.dispatch:
; GEN-NOT: call void @llvm.instrprof.increment
%tmp3 = call i32 @llvm.eh.typeid.for(i8* bitcast (i8** @_ZTIi to i8*))
%c = icmp ne i32 %tmp2, %tmp3
%matches = xor i1 %c, -1
%matches = icmp eq i32 %tmp2, %tmp3
br i1 %matches, label %catch, label %eh.resume
; USE: br i1 %matches, label %catch, label %eh.resume
; USE-SAME: !prof ![[BW_CATCH_DISPATCH:[0-9]+]]
Expand Down