[PATCH] D79996: Reorder Type fields to make various isa< > check more concise
serge via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri May 15 05:13:24 PDT 2020
serge-sans-paille created this revision.
serge-sans-paille added a reviewer: nikic.
Herald added a reviewer: ctetreau.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
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.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D79996
Files:
llvm/include/llvm/IR/Type.h
Index: llvm/include/llvm/IR/Type.h
===================================================================
--- llvm/include/llvm/IR/Type.h
+++ llvm/include/llvm/IR/Type.h
@@ -53,26 +53,25 @@
/// 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
- FloatTyID, ///< 2: 32-bit floating point type
- DoubleTyID, ///< 3: 64-bit floating point type
- X86_FP80TyID, ///< 4: 80-bit floating point type (X87)
- FP128TyID, ///< 5: 128-bit floating point type (112-bit mantissa)
- PPC_FP128TyID, ///< 6: 128-bit floating point type (two 64-bits, PowerPC)
+ // PrimitiveTypes
+ HalfTyID = 0, ///< 0: 16-bit floating point type
+ FloatTyID, ///< 1: 32-bit floating point type
+ DoubleTyID, ///< 2: 64-bit floating point type
+ X86_FP80TyID, ///< 3: 80-bit floating point type (X87)
+ FP128TyID, ///< 4: 128-bit floating point type (112-bit mantissa)
+ PPC_FP128TyID, ///< 5: 128-bit floating point type (two 64-bits, PowerPC)
+ VoidTyID, ///< 6: type with no size
LabelTyID, ///< 7: Labels
MetadataTyID, ///< 8: Metadata
X86_MMXTyID, ///< 9: MMX vectors (64 bits, X86 specific)
TokenTyID, ///< 10: Tokens
// Derived types... see DerivedTypes.h file.
- // Make sure FirstDerivedTyID stays up to date!
IntegerTyID, ///< 11: Arbitrary bit width integers
FunctionTyID, ///< 12: Functions
+ PointerTyID, ///< 14: Pointers
StructTyID, ///< 13: Structures
- ArrayTyID, ///< 14: Arrays
- PointerTyID, ///< 15: Pointers
+ ArrayTyID, ///< 15: Arrays
FixedVectorTyID, ///< 16: Fixed width SIMD vector type
ScalableVectorTyID ///< 17: Scalable SIMD vector type
};
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D79996.264206.patch
Type: text/x-patch
Size: 1964 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200515/27ee6abb/attachment.bin>
More information about the llvm-commits
mailing list