[llvm] afd8957 - [AMDGPU] Use isMetaInstruction for instruction size

Sebastian Neubauer via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 15 03:30:56 PDT 2021


Author: Sebastian Neubauer
Date: 2021-07-15T12:23:11+02:00
New Revision: afd895709db96f86fe80c4c0980e449f67bdbe9e

URL: https://github.com/llvm/llvm-project/commit/afd895709db96f86fe80c4c0980e449f67bdbe9e
DIFF: https://github.com/llvm/llvm-project/commit/afd895709db96f86fe80c4c0980e449f67bdbe9e.diff

LOG: [AMDGPU] Use isMetaInstruction for instruction size

Meta instructions have a size of 0. Use isMetaInstruction instead of
listing them explicitly.

Differential Revision: https://reviews.llvm.org/D106043

Added: 
    

Modified: 
    llvm/lib/Target/AMDGPU/SIInstrInfo.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/AMDGPU/SIInstrInfo.cpp b/llvm/lib/Target/AMDGPU/SIInstrInfo.cpp
index af276c606dcb..d24b6d84023d 100644
--- a/llvm/lib/Target/AMDGPU/SIInstrInfo.cpp
+++ b/llvm/lib/Target/AMDGPU/SIInstrInfo.cpp
@@ -7196,11 +7196,6 @@ unsigned SIInstrInfo::getInstSizeInBytes(const MachineInstr &MI) const {
   }
 
   switch (Opc) {
-  case TargetOpcode::IMPLICIT_DEF:
-  case TargetOpcode::KILL:
-  case TargetOpcode::DBG_VALUE:
-  case TargetOpcode::EH_LABEL:
-    return 0;
   case TargetOpcode::BUNDLE:
     return getInstBundleSize(MI);
   case TargetOpcode::INLINEASM:
@@ -7210,6 +7205,8 @@ unsigned SIInstrInfo::getInstSizeInBytes(const MachineInstr &MI) const {
     return getInlineAsmLength(AsmStr, *MF->getTarget().getMCAsmInfo(), &ST);
   }
   default:
+    if (MI.isMetaInstruction())
+      return 0;
     return DescSize;
   }
 }


        


More information about the llvm-commits mailing list