-; RUN: llc -O2 -o - %s | FileCheck %s
-target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
-target triple = "x86_64-unknown-linux-gnu"
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
+; RUN: llc < %s -mtriple=x86_64-unknown-linux-gnu | FileCheck %s
; Function Attrs: nounwind uwtable
-; CHECK-LABEL: tail_dup_merge_loops
-; CHECK: # %entry
-; CHECK-NOT: # %{{[a-zA-Z_]+}}
-; CHECK: # %inner_loop_exit
-; CHECK-NOT: # %{{[a-zA-Z_]+}}
-; CHECK: # %inner_loop_latch
-; CHECK-NOT: # %{{[a-zA-Z_]+}}
-; CHECK: # %inner_loop_top
-; CHECK-NOT: # %{{[a-zA-Z_]+}}
-; CHECK: # %exit
define void @tail_dup_merge_loops(i32 %a, i8* %b, i8* %c) local_unnamed_addr #0 {
+; CHECK-LABEL: tail_dup_merge_loops:
+; CHECK: # %bb.0: # %entry
+; CHECK-NEXT: testl %edi, %edi
+; CHECK-NEXT: jne .LBB0_2
+; CHECK-NEXT: jmp .LBB0_5
+; CHECK-NEXT: .LBB0_3: # %inner_loop_exit
+; CHECK-NEXT: # in Loop: Header=BB0_2 Depth=1
+; CHECK-NEXT: incq %rsi
+; CHECK-NEXT: testl %edi, %edi
+; CHECK-NEXT: jne .LBB0_2
+; CHECK-NEXT: jmp .LBB0_5
+; CHECK-NEXT: .p2align 4, 0x90
+; CHECK-NEXT: .LBB0_4: # %inner_loop_latch
+; CHECK-NEXT: # in Loop: Header=BB0_2 Depth=1
+; CHECK-NEXT: addq $2, %rsi
+; CHECK-NEXT: .LBB0_2: # %inner_loop_top
+; CHECK-NEXT: # =>This Inner Loop Header: Depth=1
+; CHECK-NEXT: cmpb $0, (%rsi)
+; CHECK-NEXT: jns .LBB0_4
+; CHECK-NEXT: jmp .LBB0_3
+; CHECK-NEXT: .LBB0_5: # %exit
+; CHECK-NEXT: retq
entry:
%notlhs674.i = icmp eq i32 %a, 0
br label %outer_loop_top
; The rest of the blocks in the function are noise unfortunately. Bugpoint
; couldn't shrink the test any further.
-; CHECK-LABEL: loop_shared_header
-; CHECK: # %entry
-; CHECK: # %shared_preheader
-; CHECK: # %shared_loop_header
-; CHECK: # %inner_loop_body
-; CHECK: # %outer_loop_latch
-; CHECK: # %merge_predecessor_split
-; CHECK: # %outer_loop_latch
-; CHECK: # %cleanup
define i32 @loop_shared_header(i8* %exe, i32 %exesz, i32 %headsize, i32 %min, i32 %wwprva, i32 %e_lfanew, i8* readonly %wwp, i32 %wwpsz, i16 zeroext %sects) local_unnamed_addr #0 {
+; CHECK-LABEL: loop_shared_header:
+; CHECK: # %bb.0: # %entry
+; CHECK-NEXT: pushq %rbp
+; CHECK-NEXT: pushq %r15
+; CHECK-NEXT: pushq %r14
+; CHECK-NEXT: pushq %r13
+; CHECK-NEXT: pushq %r12
+; CHECK-NEXT: pushq %rbx
+; CHECK-NEXT: pushq %rax
+; CHECK-NEXT: movl $1, %ebx
+; CHECK-NEXT: xorl %eax, %eax
+; CHECK-NEXT: testb %al, %al
+; CHECK-NEXT: jne .LBB1_26
+; CHECK-NEXT: # %bb.1: # %if.end19
+; CHECK-NEXT: movl %esi, %ebp
+; CHECK-NEXT: movq %rdi, %r12
+; CHECK-NEXT: movl (%rax), %r14d
+; CHECK-NEXT: leal (,%r14,4), %r13d
+; CHECK-NEXT: movl %r13d, %r15d
+; CHECK-NEXT: movl $1, %esi
+; CHECK-NEXT: movq %r15, %rdi
+; CHECK-NEXT: callq cli_calloc
+; CHECK-NEXT: testl %ebp, %ebp
+; CHECK-NEXT: je .LBB1_25
+; CHECK-NEXT: # %bb.2: # %if.end19
+; CHECK-NEXT: testl %r14d, %r14d
+; CHECK-NEXT: je .LBB1_25
+; CHECK-NEXT: # %bb.3: # %if.end19
+; CHECK-NEXT: movq %rax, %rbx
+; CHECK-NEXT: xorl %eax, %eax
+; CHECK-NEXT: testb %al, %al
+; CHECK-NEXT: jne .LBB1_25
+; CHECK-NEXT: # %bb.4: # %if.end19
+; CHECK-NEXT: cmpq %r12, %rax
+; CHECK-NEXT: jb .LBB1_25
+; CHECK-NEXT: # %bb.5: # %if.end50
+; CHECK-NEXT: movq %rbx, %rdi
+; CHECK-NEXT: movq %r15, %rdx
+; CHECK-NEXT: callq memcpy
+; CHECK-NEXT: cmpl $4, %r13d
+; CHECK-NEXT: jb .LBB1_28
+; CHECK-NEXT: # %bb.6: # %shared_preheader
+; CHECK-NEXT: movb $32, %dl
+; CHECK-NEXT: xorl %eax, %eax
+; CHECK-NEXT: # implicit-def: $rcx
+; CHECK-NEXT: testl %eax, %eax
+; CHECK-NEXT: je .LBB1_18
+; CHECK-NEXT: .p2align 4, 0x90
+; CHECK-NEXT: .LBB1_8: # %shared_loop_header
+; CHECK-NEXT: # =>This Inner Loop Header: Depth=1
+; CHECK-NEXT: cmpq %rbx, %rax
+; CHECK-NEXT: jb .LBB1_27
+; CHECK-NEXT: # %bb.9: # %inner_loop_body
+; CHECK-NEXT: # in Loop: Header=BB1_8 Depth=1
+; CHECK-NEXT: testl %eax, %eax
+; CHECK-NEXT: jns .LBB1_8
+; CHECK-NEXT: # %bb.10: # %if.end96.i
+; CHECK-NEXT: # in Loop: Header=BB1_8 Depth=1
+; CHECK-NEXT: cmpl $3, %eax
+; CHECK-NEXT: jae .LBB1_22
+; CHECK-NEXT: # %bb.11: # %if.end287.i
+; CHECK-NEXT: # in Loop: Header=BB1_8 Depth=1
+; CHECK-NEXT: xorl %esi, %esi
+; CHECK-NEXT: cmpl $1, %eax
+; CHECK-NEXT: setne %dl
+; CHECK-NEXT: testb %al, %al
+; CHECK-NEXT: jne .LBB1_15
+; CHECK-NEXT: # %bb.12: # %if.end308.i
+; CHECK-NEXT: # in Loop: Header=BB1_8 Depth=1
+; CHECK-NEXT: testb %al, %al
+; CHECK-NEXT: je .LBB1_17
+; CHECK-NEXT: # %bb.13: # %if.end335.i
+; CHECK-NEXT: # in Loop: Header=BB1_8 Depth=1
+; CHECK-NEXT: xorl %edx, %edx
+; CHECK-NEXT: testb %dl, %dl
+; CHECK-NEXT: movl $0, %esi
+; CHECK-NEXT: jne .LBB1_7
+; CHECK-NEXT: # %bb.14: # %merge_other
+; CHECK-NEXT: # in Loop: Header=BB1_8 Depth=1
+; CHECK-NEXT: xorl %esi, %esi
+; CHECK-NEXT: jmp .LBB1_16
+; CHECK-NEXT: .LBB1_15: # in Loop: Header=BB1_8 Depth=1
+; CHECK-NEXT: movb %dl, %sil
+; CHECK-NEXT: addl $3, %esi
+; CHECK-NEXT: .LBB1_16: # %outer_loop_latch
+; CHECK-NEXT: # in Loop: Header=BB1_8 Depth=1
+; CHECK-NEXT: # implicit-def: $dl
+; CHECK-NEXT: jmp .LBB1_7
+; CHECK-NEXT: .LBB1_17: # %merge_predecessor_split
+; CHECK-NEXT: # in Loop: Header=BB1_8 Depth=1
+; CHECK-NEXT: movb $32, %dl
+; CHECK-NEXT: xorl %esi, %esi
+; CHECK-NEXT: .LBB1_7: # %outer_loop_latch
+; CHECK-NEXT: # in Loop: Header=BB1_8 Depth=1
+; CHECK-NEXT: movzwl %si, %esi
+; CHECK-NEXT: decl %esi
+; CHECK-NEXT: movzwl %si, %esi
+; CHECK-NEXT: leaq 1(%rcx,%rsi), %rcx
+; CHECK-NEXT: testl %eax, %eax
+; CHECK-NEXT: jne .LBB1_8
+; CHECK-NEXT: .LBB1_18: # %while.cond.us1412.i
+; CHECK-NEXT: xorl %eax, %eax
+; CHECK-NEXT: testb %al, %al
+; CHECK-NEXT: movl $1, %ebx
+; CHECK-NEXT: jne .LBB1_20
+; CHECK-NEXT: # %bb.19: # %while.cond.us1412.i
+; CHECK-NEXT: decb %dl
+; CHECK-NEXT: jne .LBB1_26
+; CHECK-NEXT: .LBB1_20: # %if.end41.us1436.i
+; CHECK-NEXT: .LBB1_25:
+; CHECK-NEXT: movl $1, %ebx
+; CHECK-NEXT: jmp .LBB1_26
+; CHECK-NEXT: .LBB1_22: # %if.then99.i
+; CHECK-NEXT: xorl %ebx, %ebx
+; CHECK-NEXT: movl $.str.6, %edi
+; CHECK-NEXT: xorl %eax, %eax
+; CHECK-NEXT: callq cli_dbgmsg
+; CHECK-NEXT: .LBB1_26: # %cleanup
+; CHECK-NEXT: movl %ebx, %eax
+; CHECK-NEXT: addq $8, %rsp
+; CHECK-NEXT: popq %rbx
+; CHECK-NEXT: popq %r12
+; CHECK-NEXT: popq %r13
+; CHECK-NEXT: popq %r14
+; CHECK-NEXT: popq %r15
+; CHECK-NEXT: popq %rbp
+; CHECK-NEXT: retq
+; CHECK-NEXT: .LBB1_27: # %wunpsect.exit.thread.loopexit389
+; CHECK-NEXT: .LBB1_28: # %wunpsect.exit.thread.loopexit391
entry:
%0 = load i32, i32* undef, align 4
%mul = shl nsw i32 %0, 2
-; RUN: llc -O3 -o - %s | FileCheck %s
-target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
-target triple = "x86_64-unknown-linux-gnu"
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
+; RUN: llc < %s -mtriple=x86_64-unknown-linux-gnu | FileCheck %s
; Function Attrs: uwtable
; When tail-duplicating during placement, we work backward from blocks with
; multiple successors. In this case, the block dup1 gets duplicated into dup2
; and if.then64, and then the block dup2 gets duplicated into land.lhs.true
; and if.end70
-; CHECK-LABEL: repeated_tail_dup:
+
define void @repeated_tail_dup(i1 %a1, i1 %a2, i32* %a4, i32* %a5, i8* %a6) #0 align 2 {
+; CHECK-LABEL: repeated_tail_dup:
+; CHECK: # %bb.0: # %entry
+; CHECK-NEXT: .p2align 4, 0x90
+; CHECK-NEXT: .LBB0_1: # %for.cond
+; CHECK-NEXT: # =>This Inner Loop Header: Depth=1
+; CHECK-NEXT: testb $1, %dil
+; CHECK-NEXT: je .LBB0_3
+; CHECK-NEXT: # %bb.2: # %land.lhs.true
+; CHECK-NEXT: # in Loop: Header=BB0_1 Depth=1
+; CHECK-NEXT: movl $10, (%rdx)
+; CHECK-NEXT: jmp .LBB0_6
+; CHECK-NEXT: .p2align 4, 0x90
+; CHECK-NEXT: .LBB0_3: # %if.end56
+; CHECK-NEXT: # in Loop: Header=BB0_1 Depth=1
+; CHECK-NEXT: testb $1, %sil
+; CHECK-NEXT: je .LBB0_5
+; CHECK-NEXT: # %bb.4: # %if.then64
+; CHECK-NEXT: # in Loop: Header=BB0_1 Depth=1
+; CHECK-NEXT: movb $1, (%r8)
+; CHECK-NEXT: testl %eax, %eax
+; CHECK-NEXT: je .LBB0_1
+; CHECK-NEXT: jmp .LBB0_8
+; CHECK-NEXT: .p2align 4, 0x90
+; CHECK-NEXT: .LBB0_5: # %if.end70
+; CHECK-NEXT: # in Loop: Header=BB0_1 Depth=1
+; CHECK-NEXT: movl $12, (%rdx)
+; CHECK-NEXT: .LBB0_6: # %dup2
+; CHECK-NEXT: # in Loop: Header=BB0_1 Depth=1
+; CHECK-NEXT: movl $2, (%rcx)
+; CHECK-NEXT: testl %eax, %eax
+; CHECK-NEXT: je .LBB0_1
+; CHECK-NEXT: .LBB0_8: # %for.end
+; CHECK-NEXT: retq
entry:
br label %for.cond
-; CHECK: {{^}}.[[HEADER:LBB0_[1-9]]]: # %for.cond
for.cond: ; preds = %dup1, %entry
br i1 %a1, label %land.lhs.true, label %if.end56
store i8 1, i8* %a6, align 1
br label %dup1
-; CHECK: # %if.end70
-; CHECK-NEXT: # in Loop:
-; CHECK-NEXT: movl $12, (%rdx)
-; CHECK-NEXT: movl $2, (%rcx)
-; CHECK-NEXT: testl %eax, %eax
-; CHECK-NEXT: je .[[HEADER]]
if.end70: ; preds = %if.end56
store i32 12, i32* %a4, align 8
br label %dup2