[PATCH] D20477: [x86, AVX] don't add a vzeroupper if that's what the code is already doing (PR27823)

Sanjay Patel via llvm-commits llvm-commits at lists.llvm.org
Sun May 22 13:29:12 PDT 2016


This revision was automatically updated to reflect the committed changes.
Closed by commit rL270378: [x86, AVX] don't add a vzeroupper if that's what the code is already doing… (authored by spatel).

Changed prior to commit:
  http://reviews.llvm.org/D20477?vs=57953&id=58065#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D20477

Files:
  llvm/trunk/lib/Target/X86/X86VZeroUpper.cpp
  llvm/trunk/test/CodeGen/X86/avx-intrinsics-fast-isel.ll
  llvm/trunk/test/CodeGen/X86/avx-intrinsics-x86.ll

Index: llvm/trunk/test/CodeGen/X86/avx-intrinsics-fast-isel.ll
===================================================================
--- llvm/trunk/test/CodeGen/X86/avx-intrinsics-fast-isel.ll
+++ llvm/trunk/test/CodeGen/X86/avx-intrinsics-fast-isel.ll
@@ -3736,13 +3736,11 @@
 ; 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 @@
 ; 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
Index: llvm/trunk/test/CodeGen/X86/avx-intrinsics-x86.ll
===================================================================
--- llvm/trunk/test/CodeGen/X86/avx-intrinsics-x86.ll
+++ llvm/trunk/test/CodeGen/X86/avx-intrinsics-x86.ll
@@ -4755,7 +4755,6 @@
 ; 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 @@
 ; AVX-LABEL: test_x86_avx_vzeroupper:
 ; AVX:       ## BB#0:
 ; AVX-NEXT:    vzeroupper
-; AVX-NEXT:    vzeroupper
 ; AVX-NEXT:    retl
 ;
 ; AVX512VL-LABEL: test_x86_avx_vzeroupper:
Index: llvm/trunk/lib/Target/X86/X86VZeroUpper.cpp
===================================================================
--- llvm/trunk/lib/Target/X86/X86VZeroUpper.cpp
+++ llvm/trunk/lib/Target/X86/X86VZeroUpper.cpp
@@ -192,6 +192,12 @@
     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.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D20477.58065.patch
Type: text/x-patch
Size: 2351 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160522/3d6ffa2e/attachment.bin>


More information about the llvm-commits mailing list