[PATCH] D12351: Changing @llvm.objectsize(i8*, i1) to @llvm.objectsize(i8*, i8)

George Burgess IV via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 25 19:35:30 PDT 2015


george.burgess.iv created this revision.
george.burgess.iv added a subscriber: llvm-commits.

I'm not sure who to tag for review due to the breadth of this change, so I'm seeing if there are any kind souls out there. :)

In order to make `__builtin_object_size` do a better job, we need to enable `@llvm.objectsize` to give more accurate answers. Currently, `@llvm.objectsize` takes an `i1 Min` argument instead of a Type, so whether or not we want information about a subobject is lost. Currently, this preference is mostly[1] useless to LLVM, because we can't rely on LLVM's type information to determine the size of a subobject. However, as is alluded to in the diff, the current plan is to use metadata in order to pass this information along so LLVM can be more accurate.

Full proposal for the metadata is here: https://docs.google.com/document/d/1D5GibUI2RCCfa3g1zb5-3a7-l7nY1-tm3jrYciLP8dI/edit?usp=sharing

Accompanying patch for clang will be posted soon.

[1] - If Type = 3, this information is highly relevant, because LLVM can only return 0 in this case. Currently, Clang handles this for LLVM by substituting 0 where it would normally emit `@llvm.objectsize(%ptr, 3)`. 

http://reviews.llvm.org/D12351

Files:
  docs/LangRef.rst
  include/llvm/IR/Intrinsics.td
  lib/CodeGen/CodeGenPrepare.cpp
  lib/CodeGen/SelectionDAG/FastISel.cpp
  lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
  lib/Transforms/InstCombine/InstCombineCalls.cpp
  lib/Transforms/InstCombine/InstructionCombining.cpp
  test/Assembler/auto_upgrade_intrinsics.ll
  test/CodeGen/AArch64/arm64-2012-07-11-InstrEmitterBug.ll
  test/CodeGen/AArch64/arm64-indexed-vector-ldst-2.ll
  test/CodeGen/AArch64/arm64-memset-to-bzero.ll
  test/CodeGen/ARM/divmod.ll
  test/CodeGen/Generic/crash.ll
  test/CodeGen/Generic/object-size-type.ll
  test/CodeGen/X86/2011-05-26-UnreachableBlockElim.ll
  test/CodeGen/X86/crash.ll
  test/CodeGen/X86/object-size.ll
  test/Transforms/CodeGenPrepare/basic.ll
  test/Transforms/InstCombine/debuginfo.ll
  test/Transforms/InstCombine/invoke.ll
  test/Transforms/InstCombine/malloc-free-delete.ll
  test/Transforms/InstCombine/objsize-64.ll
  test/Transforms/InstCombine/objsize-address-space.ll
  test/Transforms/InstCombine/objsize-noverify.ll
  test/Transforms/InstCombine/objsize.ll
  test/Transforms/InstCombine/stpcpy_chk-1.ll
  test/Transforms/InstCombine/strcpy_chk-1.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D12351.33166.patch
Type: text/x-patch
Size: 40618 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150826/31b53df8/attachment.bin>


More information about the llvm-commits mailing list