summaryrefslogtreecommitdiffstats
path: root/llvm/lib/VMCore/LLVMContext.cpp
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2009-07-27 21:59:50 +0000
committerDan Gohman <gohman@apple.com>2009-07-27 21:59:50 +0000
commit75b7f678a3a055cef372daeb928eb466ca350f1e (patch)
treeffde2b342ec6dea02e4f9cfc3e2b37cdec4b45f7 /llvm/lib/VMCore/LLVMContext.cpp
parent0ad4247da3b93b0a472df9a3bfda4b9cd365d9dc (diff)
downloadbcm5719-llvm-75b7f678a3a055cef372daeb928eb466ca350f1e.tar.gz
bcm5719-llvm-75b7f678a3a055cef372daeb928eb466ca350f1e.zip
Add a comment about the "getelementptr null" trick.
llvm-svn: 77262
Diffstat (limited to 'llvm/lib/VMCore/LLVMContext.cpp')
-rw-r--r--llvm/lib/VMCore/LLVMContext.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/llvm/lib/VMCore/LLVMContext.cpp b/llvm/lib/VMCore/LLVMContext.cpp
index d7f4594e3ab..722e29ee5dc 100644
--- a/llvm/lib/VMCore/LLVMContext.cpp
+++ b/llvm/lib/VMCore/LLVMContext.cpp
@@ -419,6 +419,7 @@ Constant* LLVMContext::getConstantExprInsertValue(Constant* Agg, Constant* Val,
Constant* LLVMContext::getConstantExprSizeOf(const Type* Ty) {
// sizeof is implemented as: (i64) gep (Ty*)null, 1
+ // Note that a non-inbounds gep is used, as null isn't within any object.
Constant *GEPIdx = ConstantInt::get(Type::Int32Ty, 1);
Constant *GEP = getConstantExprGetElementPtr(
getNullValue(getPointerTypeUnqual(Ty)), &GEPIdx, 1);
OpenPOWER on IntegriCloud