From 74186ab391c8e82b58efd015ae7fd91c322355ed Mon Sep 17 00:00:00 2001 From: John McCall Date: Fri, 4 Mar 2011 08:25:59 +0000 Subject: [PATCH] Access ivars with inbounds GEPs, even in -fwrapv. It's unlikely that this can have any optimization effect, given the opacity of objects pointers, but you never know. llvm-svn: 126990 --- clang/lib/CodeGen/CGObjCMac.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/clang/lib/CodeGen/CGObjCMac.cpp b/clang/lib/CodeGen/CGObjCMac.cpp index d2af104e4836..bc02ed5b436e 100644 --- a/clang/lib/CodeGen/CGObjCMac.cpp +++ b/clang/lib/CodeGen/CGObjCMac.cpp @@ -115,7 +115,7 @@ LValue CGObjCRuntime::EmitValueForIvarAtOffset(CodeGen::CodeGenFunction &CGF, QualType IvarTy = Ivar->getType(); const llvm::Type *LTy = CGF.CGM.getTypes().ConvertTypeForMem(IvarTy); llvm::Value *V = CGF.Builder.CreateBitCast(BaseValue, I8Ptr); - V = CGF.Builder.CreateGEP(V, Offset, "add.ptr"); + V = CGF.Builder.CreateInBoundsGEP(V, Offset, "add.ptr"); V = CGF.Builder.CreateBitCast(V, llvm::PointerType::getUnqual(LTy)); if (!Ivar->isBitField()) {