diff --git a/llvm/test/CodeGen/X86/lsr-interesting-step.ll b/llvm/test/CodeGen/X86/lsr-interesting-step.ll index c9096156de015..66afd387c6a30 100644 --- a/llvm/test/CodeGen/X86/lsr-interesting-step.ll +++ b/llvm/test/CodeGen/X86/lsr-interesting-step.ll @@ -1,17 +1,35 @@ -; RUN: llc < %s -relocation-model=static -mtriple=x86_64-unknown-linux-gnu -asm-verbose=0 | FileCheck %s +; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py +; RUN: llc < %s -relocation-model=static -mtriple=x86_64-unknown-linux-gnu | FileCheck %s ; The inner loop should require only one add (and no leas either). ; rdar://8100380 -; CHECK: BB0_2: -; CHECK-NEXT: movb $0, flags(%rcx) -; CHECK-NEXT: addq %rax, %rcx -; CHECK-NEXT: cmpq $8192, %rcx -; CHECK-NEXT: jl - @flags = external dso_local global [8192 x i8], align 16 ; <[8192 x i8]*> [#uses=1] define void @foo() nounwind { +; CHECK-LABEL: foo: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: movl $2, %eax +; CHECK-NEXT: .p2align 4, 0x90 +; CHECK-NEXT: .LBB0_1: # %bb7 +; CHECK-NEXT: # =>This Loop Header: Depth=1 +; CHECK-NEXT: # Child Loop BB0_2 Depth 2 +; CHECK-NEXT: movl $2, %ecx +; CHECK-NEXT: .p2align 4, 0x90 +; CHECK-NEXT: .LBB0_2: # %bb11 +; CHECK-NEXT: # Parent Loop BB0_1 Depth=1 +; CHECK-NEXT: # => This Inner Loop Header: Depth=2 +; CHECK-NEXT: movb $0, flags(%rcx) +; CHECK-NEXT: addq %rax, %rcx +; CHECK-NEXT: cmpq $8192, %rcx # imm = 0x2000 +; CHECK-NEXT: jl .LBB0_2 +; CHECK-NEXT: # %bb.3: # %bb16 +; CHECK-NEXT: # in Loop: Header=BB0_1 Depth=1 +; CHECK-NEXT: incq %rax +; CHECK-NEXT: cmpq $8192, %rax # imm = 0x2000 +; CHECK-NEXT: jl .LBB0_1 +; CHECK-NEXT: # %bb.4: # %bb20 +; CHECK-NEXT: retq entry: br label %bb diff --git a/llvm/test/CodeGen/X86/sink-out-of-loop.ll b/llvm/test/CodeGen/X86/sink-out-of-loop.ll index e7b721d36a0d9..e3443b9339e27 100644 --- a/llvm/test/CodeGen/X86/sink-out-of-loop.ll +++ b/llvm/test/CodeGen/X86/sink-out-of-loop.ll @@ -1,3 +1,4 @@ +; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py ; RUN: llc -mtriple=x86_64-apple-darwin < %s | FileCheck %s ; A MOV32ri is inside a loop, it has two successors, one successor is inside the @@ -5,15 +6,48 @@ ; MOV32ri outside the loop. ; rdar://11980766 define i32 @sink_succ(i32 %argc, i8** nocapture %argv) nounwind uwtable ssp { -; CHECK-LABEL: sink_succ -; CHECK: [[OUTER_LN1:LBB0_[0-9]+]]: ## %preheader -; CHECK: %exit -; CHECK-NOT: movl -; CHECK: jne [[OUTER_LN1]] -; CHECK: movl -; CHECK: [[LN2:LBB0_[0-9]+]]: ## %for.body2 -; CHECK: jne [[LN2]] -; CHECK: ret +; CHECK-LABEL: sink_succ: +; CHECK: ## %bb.0: ## %entry +; CHECK-NEXT: xorl %eax, %eax +; CHECK-NEXT: .p2align 4, 0x90 +; CHECK-NEXT: LBB0_1: ## %preheader +; CHECK-NEXT: ## =>This Loop Header: Depth=1 +; CHECK-NEXT: ## Child Loop BB0_2 Depth 2 +; CHECK-NEXT: ## Child Loop BB0_3 Depth 3 +; CHECK-NEXT: movl $1, %ecx +; CHECK-NEXT: .p2align 4, 0x90 +; CHECK-NEXT: LBB0_2: ## %for.body1.lr +; CHECK-NEXT: ## Parent Loop BB0_1 Depth=1 +; CHECK-NEXT: ## => This Loop Header: Depth=2 +; CHECK-NEXT: ## Child Loop BB0_3 Depth 3 +; CHECK-NEXT: movl %ecx, %edx +; CHECK-NEXT: .p2align 4, 0x90 +; CHECK-NEXT: LBB0_3: ## %for.body1 +; CHECK-NEXT: ## Parent Loop BB0_1 Depth=1 +; CHECK-NEXT: ## Parent Loop BB0_2 Depth=2 +; CHECK-NEXT: ## => This Inner Loop Header: Depth=3 +; CHECK-NEXT: decl %edx +; CHECK-NEXT: jne LBB0_3 +; CHECK-NEXT: ## %bb.4: ## %for.inc40.i +; CHECK-NEXT: ## in Loop: Header=BB0_2 Depth=2 +; CHECK-NEXT: incl %ecx +; CHECK-NEXT: cmpl $32, %ecx +; CHECK-NEXT: jne LBB0_2 +; CHECK-NEXT: ## %bb.5: ## %exit +; CHECK-NEXT: ## in Loop: Header=BB0_1 Depth=1 +; CHECK-NEXT: incl %eax +; CHECK-NEXT: cmpl $10, %eax +; CHECK-NEXT: jne LBB0_1 +; CHECK-NEXT: ## %bb.6: ## %for.body2.preheader +; CHECK-NEXT: movl $2048, %eax ## imm = 0x800 +; CHECK-NEXT: .p2align 4, 0x90 +; CHECK-NEXT: LBB0_7: ## %for.body2 +; CHECK-NEXT: ## =>This Inner Loop Header: Depth=1 +; CHECK-NEXT: decl %eax +; CHECK-NEXT: jne LBB0_7 +; CHECK-NEXT: ## %bb.8: ## %for.end20 +; CHECK-NEXT: xorl %eax, %eax +; CHECK-NEXT: retq entry: br label %preheader @@ -55,6 +89,19 @@ for.end20: define i32 @sink_out_of_loop(i32 %n, i32* %output) { ; CHECK-LABEL: sink_out_of_loop: +; CHECK: ## %bb.0: ## %entry +; CHECK-NEXT: xorl %ecx, %ecx +; CHECK-NEXT: .p2align 4, 0x90 +; CHECK-NEXT: LBB1_1: ## %loop +; CHECK-NEXT: ## =>This Inner Loop Header: Depth=1 +; CHECK-NEXT: movl %ecx, %eax +; CHECK-NEXT: movl %ecx, (%rsi,%rcx,4) +; CHECK-NEXT: incq %rcx +; CHECK-NEXT: cmpl %edi, %ecx +; CHECK-NEXT: jl LBB1_1 +; CHECK-NEXT: ## %bb.2: ## %exit +; CHECK-NEXT: imull %eax, %eax +; CHECK-NEXT: retq entry: br label %loop @@ -68,8 +115,5 @@ loop: br i1 %exit_cond, label %exit, label %loop exit: -; CHECK: %bb.2 -; CHECK: imull %eax, %eax -; CHECK: retq ret i32 %j } diff --git a/llvm/test/Transforms/LoopStrengthReduce/X86/2012-01-13-phielim.ll b/llvm/test/Transforms/LoopStrengthReduce/X86/2012-01-13-phielim.ll index 44da8b7f72cf8..b08c1eb862b6c 100644 --- a/llvm/test/Transforms/LoopStrengthReduce/X86/2012-01-13-phielim.ll +++ b/llvm/test/Transforms/LoopStrengthReduce/X86/2012-01-13-phielim.ll @@ -1,15 +1,61 @@ +; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py ; RUN: llc < %s -O3 -mtriple=x86_64-- -mcpu=core2 | FileCheck %s declare i1 @check() nounwind declare i1 @foo(i8*, i8*, i8*) nounwind ; Check that redundant phi elimination ran -; CHECK: @test -; CHECK: %while.body.i -; CHECK: movs -; CHECK-NOT: movs -; CHECK: %for.end.i define i32 @test(i8* %base) nounwind uwtable ssp { +; CHECK-LABEL: test: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: pushq %r15 +; CHECK-NEXT: .cfi_def_cfa_offset 16 +; CHECK-NEXT: pushq %r14 +; CHECK-NEXT: .cfi_def_cfa_offset 24 +; CHECK-NEXT: pushq %r13 +; CHECK-NEXT: .cfi_def_cfa_offset 32 +; CHECK-NEXT: pushq %r12 +; CHECK-NEXT: .cfi_def_cfa_offset 40 +; CHECK-NEXT: pushq %rbx +; CHECK-NEXT: .cfi_def_cfa_offset 48 +; CHECK-NEXT: .cfi_offset %rbx, -48 +; CHECK-NEXT: .cfi_offset %r12, -40 +; CHECK-NEXT: .cfi_offset %r13, -32 +; CHECK-NEXT: .cfi_offset %r14, -24 +; CHECK-NEXT: .cfi_offset %r15, -16 +; CHECK-NEXT: movq %rdi, %r14 +; CHECK-NEXT: leaq 16(%rdi), %r15 +; CHECK-NEXT: movl $16, %eax +; CHECK-NEXT: xorl %r12d, %r12d +; CHECK-NEXT: .p2align 4, 0x90 +; CHECK-NEXT: .LBB0_1: # %while.body.i +; CHECK-NEXT: # =>This Loop Header: Depth=1 +; CHECK-NEXT: # Child Loop BB0_2 Depth 2 +; CHECK-NEXT: movslq %r12d, %r13 +; CHECK-NEXT: movq %rax, %r12 +; CHECK-NEXT: leaq (%r15,%r13), %rbx +; CHECK-NEXT: addq $16, %r13 +; CHECK-NEXT: .p2align 4, 0x90 +; CHECK-NEXT: .LBB0_2: # %for.body.i +; CHECK-NEXT: # Parent Loop BB0_1 Depth=1 +; CHECK-NEXT: # => This Inner Loop Header: Depth=2 +; CHECK-NEXT: callq check@PLT +; CHECK-NEXT: incq %rbx +; CHECK-NEXT: testb $1, %al +; CHECK-NEXT: je .LBB0_2 +; CHECK-NEXT: # %bb.3: # %for.end.i +; CHECK-NEXT: # in Loop: Header=BB0_1 Depth=1 +; CHECK-NEXT: addq %r14, %r13 +; CHECK-NEXT: movq %r13, %rdi +; CHECK-NEXT: movq %r13, %rsi +; CHECK-NEXT: callq foo@PLT +; CHECK-NEXT: testb $1, %al +; CHECK-NEXT: je .LBB0_5 +; CHECK-NEXT: # %bb.4: # %cond.true29.i +; CHECK-NEXT: # in Loop: Header=BB0_1 Depth=1 +; CHECK-NEXT: leaq 16(%r12), %rax +; CHECK-NEXT: jmp .LBB0_1 +; CHECK-NEXT: .LBB0_5: # %cond.false35.i entry: br label %while.body.lr.ph.i @@ -58,11 +104,20 @@ exit: ; preds = %cond.true29.i, %cond.true.i ; Test phi reuse after LSR that requires SCEVExpander to hoist an ; interesting GEP. ; -; CHECK: @test2 -; CHECK: %entry -; CHECK-NOT: mov -; CHECK: je define void @test2(i32 %n) nounwind uwtable { +; CHECK-LABEL: test2: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: xorl %eax, %eax +; CHECK-NEXT: testb %al, %al +; CHECK-NEXT: je .LBB1_1 +; CHECK-NEXT: # %bb.3: # %while.end +; CHECK-NEXT: retq +; CHECK-NEXT: .LBB1_1: # %for.cond468.preheader +; CHECK-NEXT: cmpl $2, %edi +; CHECK-NEXT: .p2align 4, 0x90 +; CHECK-NEXT: .LBB1_2: # %for.inc498 +; CHECK-NEXT: # =>This Inner Loop Header: Depth=1 +; CHECK-NEXT: jmp .LBB1_2 entry: br i1 undef, label %while.end, label %for.cond468 @@ -95,16 +150,36 @@ while.end: ; preds = %entry ; Test redundant phi elimination when the deleted phi's increment is ; itself a phi. ; -; CHECK: @test3 -; CHECK: %meshBB1 -; CHECK: %meshBB -; CHECK-NEXT: Parent Loop -; CHECK-NEXT: Inner Loop -; CHECK-NEXT: incq -; CHECK: testb -; CHECK: je -; CHECK: jmp define fastcc void @test3(double* nocapture %u) nounwind uwtable ssp { +; CHECK-LABEL: test3: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: xorl %eax, %eax +; CHECK-NEXT: testb %al, %al +; CHECK-NEXT: jne .LBB2_6 +; CHECK-NEXT: # %bb.1: +; CHECK-NEXT: xorl %eax, %eax +; CHECK-NEXT: .p2align 4, 0x90 +; CHECK-NEXT: .LBB2_2: # %meshBB1 +; CHECK-NEXT: # =>This Loop Header: Depth=1 +; CHECK-NEXT: # Child Loop BB2_4 Depth 2 +; CHECK-NEXT: # implicit-def: $rcx +; CHECK-NEXT: testb %al, %al +; CHECK-NEXT: jne .LBB2_2 +; CHECK-NEXT: .p2align 4, 0x90 +; CHECK-NEXT: .LBB2_4: # %meshBB +; CHECK-NEXT: # Parent Loop BB2_2 Depth=1 +; CHECK-NEXT: # => This Inner Loop Header: Depth=2 +; CHECK-NEXT: incq %rcx +; CHECK-NEXT: testb %al, %al +; CHECK-NEXT: je .LBB2_4 +; CHECK-NEXT: jmp .LBB2_2 +; CHECK-NEXT: .LBB2_6: # %meshBB5 +; CHECK-NEXT: xorl %eax, %eax +; CHECK-NEXT: testb %al, %al +; CHECK-NEXT: je .LBB2_5 +; CHECK-NEXT: # %bb.7: # %eval_At_times_u.exit +; CHECK-NEXT: retq +; CHECK-NEXT: .LBB2_5: # %for.inc8.us.i2 entry: br i1 undef, label %meshBB1, label %meshBB5