]> granicus.if.org Git - llvm/commitdiff
[X86] Use VR512_0_15RegClass intead of VR512RegClass in X86VZeroUpper.
authorCraig Topper <craig.topper@intel.com>
Wed, 25 Sep 2019 23:25:15 +0000 (23:25 +0000)
committerCraig Topper <craig.topper@intel.com>
Wed, 25 Sep 2019 23:25:15 +0000 (23:25 +0000)
This pass is only concerned with ZMM0-15 and YMM0-15. For YMM
we use VR256 which only contains YMM0-15, but for ZMM we were
using VR512 which contains ZMM0-31. Using VR512_0_15 is more
correct.

Given that the ABI and register allocator will use registers in
order, its unlikely that register from 16-31 would be used
without also using 0-15. So this probably doesn't functionally
matter.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@372933 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/X86/X86VZeroUpper.cpp

index a07d2f20acab817816187deb2af9f185a3d7fb90..9280d030b5d5f400e02b87b33893b10fe6a61e2b 100644 (file)
@@ -292,8 +292,7 @@ bool VZeroUpperInserter::runOnMachineFunction(MachineFunction &MF) {
   // need to insert any VZEROUPPER instructions.  This is constant-time, so it
   // is cheap in the common case of no ymm/zmm use.
   bool YmmOrZmmUsed = FnHasLiveInYmmOrZmm;
-  const TargetRegisterClass *RCs[2] = {&X86::VR256RegClass, &X86::VR512RegClass};
-  for (auto *RC : RCs) {
+  for (auto *RC : {&X86::VR256RegClass, &X86::VR512_0_15RegClass}) {
     if (!YmmOrZmmUsed) {
       for (TargetRegisterClass::iterator i = RC->begin(), e = RC->end(); i != e;
            i++) {
@@ -304,9 +303,8 @@ bool VZeroUpperInserter::runOnMachineFunction(MachineFunction &MF) {
       }
     }
   }
-  if (!YmmOrZmmUsed) {
+  if (!YmmOrZmmUsed)
     return false;
-  }
 
   assert(BlockStates.empty() && DirtySuccessors.empty() &&
          "X86VZeroUpper state should be clear");