]> granicus.if.org Git - clang/commit
[CodeGenObjC] Use a constant value for non-fragile ivar offsets when possible
authorErik Pilkington <erik.pilkington@gmail.com>
Thu, 17 Jan 2019 18:18:53 +0000 (18:18 +0000)
committerErik Pilkington <erik.pilkington@gmail.com>
Thu, 17 Jan 2019 18:18:53 +0000 (18:18 +0000)
commit4ee4a0f3317d452831081ffb66298ae936ba43ab
tree3636a7f33ef2425c49625a6c715b4310ef261ad9
parentf812df94335cccf585168fcda36d6b683b625640
[CodeGenObjC] Use a constant value for non-fragile ivar offsets when possible

If a class inherits from NSObject and has an implementation, then we
can assume that ivar offsets won't need to be updated by the runtime.
This allows us to index into the object using a constant value and
avoid loading from the ivar offset variable.

This patch was adapted from one written by Pete Cooper.

rdar://problem/10132568

Differential revision: https://reviews.llvm.org/D56802

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@351461 91177308-0d34-0410-b5e6-96231b3b80d8
lib/CodeGen/CGObjCMac.cpp
test/CodeGenObjC/constant-non-fragile-ivar-offset.m [new file with mode: 0644]
test/CodeGenObjC/optimize-ivar-offset-load.m
test/CodeGenObjC/reorder-synthesized-ivars.m