mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-02-09 05:47:13 +00:00
[x86, AVX] don't add a vzeroupper if that's what the code is already doing (PR27823)
This isn't the complete fix, but it handles the trivial examples of duplicate vzero* ops in PR27823: https://llvm.org/bugs/show_bug.cgi?id=27823 ...and amusingly, the bogus cases already exist as regression tests, so let's take this baby step. We'll need to do more in the general case where there's legitimate AVX usage in the function + there's already a vzero in the code. Differential Revision: http://reviews.llvm.org/D20477 llvm-svn: 270378
This commit is contained in:
parent
e49c68f164
commit
b2763427c2
@ -192,6 +192,12 @@ void VZeroUpperInserter::processBasicBlock(MachineBasicBlock &MBB) {
|
||||
if ((!IsControlFlow || IsReturnFromX86INTR) && CurState == EXITS_DIRTY)
|
||||
continue;
|
||||
|
||||
// Ignore existing VZERO* instructions.
|
||||
// FIXME: The existence of these instructions should be used to modify the
|
||||
// current state and/or used when deciding whether we need to create a VZU.
|
||||
if (MI->getOpcode() == X86::VZEROALL || MI->getOpcode() == X86::VZEROUPPER)
|
||||
continue;
|
||||
|
||||
if (hasYmmReg(MI)) {
|
||||
// We found a ymm-using instruction; this could be an AVX instruction,
|
||||
// or it could be control flow.
|
||||
|
@ -3736,13 +3736,11 @@ define void @test_mm256_zeroall() nounwind {
|
||||
; X32-LABEL: test_mm256_zeroall:
|
||||
; X32: # BB#0:
|
||||
; X32-NEXT: vzeroall
|
||||
; X32-NEXT: vzeroupper
|
||||
; X32-NEXT: retl
|
||||
;
|
||||
; X64-LABEL: test_mm256_zeroall:
|
||||
; X64: # BB#0:
|
||||
; X64-NEXT: vzeroall
|
||||
; X64-NEXT: vzeroupper
|
||||
; X64-NEXT: retq
|
||||
call void @llvm.x86.avx.vzeroall()
|
||||
ret void
|
||||
@ -3753,13 +3751,11 @@ define void @test_mm256_zeroupper() nounwind {
|
||||
; X32-LABEL: test_mm256_zeroupper:
|
||||
; X32: # BB#0:
|
||||
; X32-NEXT: vzeroupper
|
||||
; X32-NEXT: vzeroupper
|
||||
; X32-NEXT: retl
|
||||
;
|
||||
; X64-LABEL: test_mm256_zeroupper:
|
||||
; X64: # BB#0:
|
||||
; X64-NEXT: vzeroupper
|
||||
; X64-NEXT: vzeroupper
|
||||
; X64-NEXT: retq
|
||||
call void @llvm.x86.avx.vzeroupper()
|
||||
ret void
|
||||
|
@ -4755,7 +4755,6 @@ define void @test_x86_avx_vzeroall() {
|
||||
; AVX-LABEL: test_x86_avx_vzeroall:
|
||||
; AVX: ## BB#0:
|
||||
; AVX-NEXT: vzeroall
|
||||
; AVX-NEXT: vzeroupper
|
||||
; AVX-NEXT: retl
|
||||
;
|
||||
; AVX512VL-LABEL: test_x86_avx_vzeroall:
|
||||
@ -4772,7 +4771,6 @@ define void @test_x86_avx_vzeroupper() {
|
||||
; AVX-LABEL: test_x86_avx_vzeroupper:
|
||||
; AVX: ## BB#0:
|
||||
; AVX-NEXT: vzeroupper
|
||||
; AVX-NEXT: vzeroupper
|
||||
; AVX-NEXT: retl
|
||||
;
|
||||
; AVX512VL-LABEL: test_x86_avx_vzeroupper:
|
||||
|
Loading…
x
Reference in New Issue
Block a user