]> granicus.if.org Git - clang/commitdiff
Access ivars with inbounds GEPs, even in -fwrapv. It's unlikely that
authorJohn McCall <rjmccall@apple.com>
Fri, 4 Mar 2011 08:25:59 +0000 (08:25 +0000)
committerJohn McCall <rjmccall@apple.com>
Fri, 4 Mar 2011 08:25:59 +0000 (08:25 +0000)
this can have any optimization effect, given the opacity of objects pointers,
but you never know.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126990 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CGObjCMac.cpp

index d2af104e4836b62d6482b074cd7a55c20e656d8f..bc02ed5b436e4b8732a3b9ba14477f1a7883ab37 100644 (file)
@@ -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()) {