zext ivar offsets if required (GNU runtimes).

llvm-svn: 154175
This commit is contained in:
David Chisnall 2012-04-06 15:39:12 +00:00
parent d12b18f820
commit a79b469d73
1 changed files with 4 additions and 1 deletions

View File

@ -2654,7 +2654,10 @@ llvm::Value *CGObjCGNU::EmitIvarOffset(CodeGenFunction &CGF,
Offset = new llvm::GlobalVariable(TheModule, IntTy,
false, llvm::GlobalValue::LinkOnceAnyLinkage,
llvm::Constant::getNullValue(IntTy), name);
return CGF.Builder.CreateLoad(Offset);
Offset = CGF.Builder.CreateLoad(Offset);
if (Offset->getType() != PtrDiffTy)
Offset = CGF.Builder.CreateZExtOrBitCast(Offset, PtrDiffTy);
return Offset;
}
uint64_t Offset = ComputeIvarBaseOffset(CGF.CGM, Interface, Ivar);
return llvm::ConstantInt::get(PtrDiffTy, Offset, /*isSigned*/true);