aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2012-10-09 23:55:19 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2012-10-09 23:55:19 +0000
commitdc47bdc43c62bf2ff01bc71c811a66cb5376d318 (patch)
treed4e24c4b4658ca3320d1922a6c9712e432eecade /lib/CodeGen
parent196f35e0bde0dc3f79fb68fda6c25250f56231e9 (diff)
-fcatch-undefined-behavior: store the type name directly at the end of a type descriptor. 5% binary size reduction due to fewer relocations.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165572 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen')
-rw-r--r--lib/CodeGen/CGExpr.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/CodeGen/CGExpr.cpp b/lib/CodeGen/CGExpr.cpp
index 3f15692e03..8b169410ce 100644
--- a/lib/CodeGen/CGExpr.cpp
+++ b/lib/CodeGen/CGExpr.cpp
@@ -1941,11 +1941,11 @@ LValue CodeGenFunction::EmitPredefinedLValue(const PredefinedExpr *E) {
/// format of a type descriptor is
///
/// \code
-/// { i8* Name, i16 TypeKind, i16 TypeInfo }
+/// { i16 TypeKind, i16 TypeInfo }
/// \endcode
///
-/// where TypeKind is 0 for an integer, 1 for a floating point value, and -1 for
-/// anything else.
+/// followed by an array of i8 containing the type name. TypeKind is 0 for an
+/// integer, 1 for a floating point value, and -1 for anything else.
llvm::Constant *CodeGenFunction::EmitCheckTypeDescriptor(QualType T) {
// FIXME: Only emit each type's descriptor once.
uint16_t TypeKind = -1;
@@ -1969,8 +1969,8 @@ llvm::Constant *CodeGenFunction::EmitCheckTypeDescriptor(QualType T) {
ArrayRef<intptr_t>());
llvm::Constant *Components[] = {
- cast<llvm::Constant>(Builder.CreateGlobalStringPtr(Buffer)),
- Builder.getInt16(TypeKind), Builder.getInt16(TypeInfo)
+ Builder.getInt16(TypeKind), Builder.getInt16(TypeInfo),
+ llvm::ConstantDataArray::getString(getLLVMContext(), Buffer)
};
llvm::Constant *Descriptor = llvm::ConstantStruct::getAnon(Components);