diff options
| author | Guozhi Wei <carrot@google.com> | 2019-12-04 16:01:20 -0800 |
|---|---|---|
| committer | Guozhi Wei <carrot@google.com> | 2019-12-06 09:53:53 -0800 |
| commit | 72942459d070cbfe6f3524e89c3ac37440be7890 (patch) | |
| tree | 6a45cb456c8fff75ba7c89eb4156254ef6d485d8 /llvm/test/CodeGen/X86/speculative-load-hardening.ll | |
| parent | 164e0fc5c7f782b174db5c87b37725ea0e174853 (diff) | |
| download | bcm5719-llvm-72942459d070cbfe6f3524e89c3ac37440be7890.tar.gz bcm5719-llvm-72942459d070cbfe6f3524e89c3ac37440be7890.zip | |
[MBP] Avoid tail duplication if it can't bring benefit
Current tail duplication integrated in bb layout is designed to increase the fallthrough from a BB's predecessor to its successor, but we have observed cases that duplication doesn't increase fallthrough, or it brings too much size overhead.
To overcome these two issues in function canTailDuplicateUnplacedPreds I add two checks:
make sure there is at least one duplication in current work set.
the number of duplication should not exceed the number of successors.
The modification in hasBetterLayoutPredecessor fixes a bug that potential predecessor must be at the bottom of a chain.
Differential Revision: https://reviews.llvm.org/D64376
Diffstat (limited to 'llvm/test/CodeGen/X86/speculative-load-hardening.ll')
| -rw-r--r-- | llvm/test/CodeGen/X86/speculative-load-hardening.ll | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/llvm/test/CodeGen/X86/speculative-load-hardening.ll b/llvm/test/CodeGen/X86/speculative-load-hardening.ll index 934581e137f..c20964fcdac 100644 --- a/llvm/test/CodeGen/X86/speculative-load-hardening.ll +++ b/llvm/test/CodeGen/X86/speculative-load-hardening.ll @@ -411,8 +411,18 @@ define void @test_basic_nested_loop(i32 %a, i32 %b, i32 %c, i32* %ptr1, i32* %pt ; X64-LFENCE-NEXT: pushq %rbx ; X64-LFENCE-NEXT: pushq %rax ; X64-LFENCE-NEXT: testl %edi, %edi -; X64-LFENCE-NEXT: jne .LBB3_6 -; X64-LFENCE-NEXT: # %bb.1: # %l1.header.preheader +; X64-LFENCE-NEXT: je .LBB3_1 +; X64-LFENCE-NEXT: .LBB3_6: # %exit +; X64-LFENCE-NEXT: lfence +; X64-LFENCE-NEXT: addq $8, %rsp +; X64-LFENCE-NEXT: popq %rbx +; X64-LFENCE-NEXT: popq %r12 +; X64-LFENCE-NEXT: popq %r13 +; X64-LFENCE-NEXT: popq %r14 +; X64-LFENCE-NEXT: popq %r15 +; X64-LFENCE-NEXT: popq %rbp +; X64-LFENCE-NEXT: retq +; X64-LFENCE-NEXT: .LBB3_1: # %l1.header.preheader ; X64-LFENCE-NEXT: movq %r8, %r14 ; X64-LFENCE-NEXT: movq %rcx, %rbx ; X64-LFENCE-NEXT: movl %edx, %r13d @@ -452,16 +462,6 @@ define void @test_basic_nested_loop(i32 %a, i32 %b, i32 %c, i32* %ptr1, i32* %pt ; X64-LFENCE-NEXT: cmpl %r13d, %ebp ; X64-LFENCE-NEXT: jl .LBB3_4 ; X64-LFENCE-NEXT: jmp .LBB3_5 -; X64-LFENCE-NEXT: .LBB3_6: # %exit -; X64-LFENCE-NEXT: lfence -; X64-LFENCE-NEXT: addq $8, %rsp -; X64-LFENCE-NEXT: popq %rbx -; X64-LFENCE-NEXT: popq %r12 -; X64-LFENCE-NEXT: popq %r13 -; X64-LFENCE-NEXT: popq %r14 -; X64-LFENCE-NEXT: popq %r15 -; X64-LFENCE-NEXT: popq %rbp -; X64-LFENCE-NEXT: retq entry: %a.cmp = icmp eq i32 %a, 0 br i1 %a.cmp, label %l1.header, label %exit |

