[llvm] ab1fb38 - Reorder Type fields to make various isa< > check more concise
via llvm-commits
llvm-commits at lists.llvm.org
Mon May 18 05:24:10 PDT 2020
Author: serge-sans-paille
Date: 2020-05-18T14:23:52+02:00
New Revision: ab1fb38d8fe8055ddfb2e5a7ae1b1824b3f3cab7
URL: https://github.com/llvm/llvm-project/commit/ab1fb38d8fe8055ddfb2e5a7ae1b1824b3f3cab7
DIFF: https://github.com/llvm/llvm-project/commit/ab1fb38d8fe8055ddfb2e5a7ae1b1824b3f3cab7.diff
LOG: Reorder Type fields to make various isa< > check more concise
Depending on the order of fields, some isa < > checks can be faster because of
tests that check a range of type, leading to assembly simplification.
To find a relevant ordering, I... brute-forced the permutation among the derived
types and pick the combination that resulted in the smallest libLLVM-11.so.
On my laptop (x86_64), this reduces the size of libLLVM-11.so from 127344064 bytes to 127335336,
that's 8728 bytes shaved without much effort.
Also removed obsolete comments in the process.
Differential Revision: https://reviews.llvm.org/D79996
Added:
Modified:
llvm/include/llvm/IR/Type.h
Removed:
################################################################################
diff --git a/llvm/include/llvm/IR/Type.h b/llvm/include/llvm/IR/Type.h
index 5d6c0c676f5e..7043775f2439 100644
--- a/llvm/include/llvm/IR/Type.h
+++ b/llvm/include/llvm/IR/Type.h
@@ -53,29 +53,28 @@ class Type {
/// Also update LLVMTypeKind and LLVMGetTypeKind () in the C binding.
///
enum TypeID {
- // PrimitiveTypes - make sure LastPrimitiveTyID stays up to date.
- VoidTyID = 0, ///< 0: type with no size
- HalfTyID, ///< 1: 16-bit floating point type
- BFloatTyID, ///< 2: 16-bit floating point type (7-bit significand)
- FloatTyID, ///< 3: 32-bit floating point type
- DoubleTyID, ///< 4: 64-bit floating point type
- X86_FP80TyID, ///< 5: 80-bit floating point type (X87)
- FP128TyID, ///< 6: 128-bit floating point type (112-bit significand)
- PPC_FP128TyID, ///< 7: 128-bit floating point type (two 64-bits, PowerPC)
- LabelTyID, ///< 8: Labels
- MetadataTyID, ///< 9: Metadata
- X86_MMXTyID, ///< 10: MMX vectors (64 bits, X86 specific)
- TokenTyID, ///< 11: Tokens
+ // PrimitiveTypes
+ HalfTyID = 0, ///< 16-bit floating point type
+ BFloatTyID, ///< 16-bit floating point type (7-bit significand)
+ FloatTyID, ///< 32-bit floating point type
+ DoubleTyID, ///< 64-bit floating point type
+ X86_FP80TyID, ///< 80-bit floating point type (X87)
+ FP128TyID, ///< 128-bit floating point type (112-bit significand)
+ PPC_FP128TyID, ///< 128-bit floating point type (two 64-bits, PowerPC)
+ VoidTyID, ///< type with no size
+ LabelTyID, ///< Labels
+ MetadataTyID, ///< Metadata
+ X86_MMXTyID, ///< MMX vectors (64 bits, X86 specific)
+ TokenTyID, ///< Tokens
// Derived types... see DerivedTypes.h file.
- // Make sure FirstDerivedTyID stays up to date!
- IntegerTyID, ///< 12: Arbitrary bit width integers
- FunctionTyID, ///< 13: Functions
- StructTyID, ///< 14: Structures
- ArrayTyID, ///< 15: Arrays
- PointerTyID, ///< 16: Pointers
- FixedVectorTyID, ///< 17: Fixed width SIMD vector type
- ScalableVectorTyID ///< 18: Scalable SIMD vector type
+ IntegerTyID, ///< Arbitrary bit width integers
+ FunctionTyID, ///< Functions
+ PointerTyID, ///< Pointers
+ StructTyID, ///< Structures
+ ArrayTyID, ///< Arrays
+ FixedVectorTyID, ///< Fixed width SIMD vector type
+ ScalableVectorTyID ///< Scalable SIMD vector type
};
private:
More information about the llvm-commits
mailing list