[PATCH] Reject bitcasts between address spaces with different sizes

Matt Arsenault Matthew.Arsenault at amd.com
Mon Jul 22 14:55:35 PDT 2013


  Check for illegal bitcasts where the original source pointer is an inttoptr from a constant integer. This is a pain because these can be almost anywhere, so this searches global initializers and ConstantExpr pointer operands of instructions.

  Add helper functions to reduce duplication in all the places bitcasts need to be checked.

  Remove autoupgrade parts since it isn't necessary when bitcasts between address spaces of the same size are going to be allowed, removing the compatibility problem.

  Allow bitcasts without a datalayout. The approach in other places without DataLayout seems to be that all pointers are the maximum pointer size of 64-bits, so I think it makes sense to assume that without DataLayout, all pointers are the same size.

  Make verifier tests use llvm-as instead of opt -verify which aborts.

Hi eli.friedman,

http://llvm-reviews.chandlerc.com/D1083

CHANGE SINCE LAST DIFF
  http://llvm-reviews.chandlerc.com/D1083?vs=2703&id=2952#toc

Files:
  docs/LangRef.rst
  lib/AsmParser/LLParser.cpp
  lib/IR/Verifier.cpp
  test/Transforms/InstCombine/memset2.ll
  test/Verifier/bitcast-address-space-nested-global-cycle.ll
  test/Verifier/bitcast-address-space-nested-global.ll
  test/Verifier/bitcast-address-space-through-constant-inttoptr-inside-gep-instruction.ll
  test/Verifier/bitcast-address-space-through-constant-inttoptr.ll
  test/Verifier/bitcast-address-space-through-gep-2.ll
  test/Verifier/bitcast-address-space-through-gep.ll
  test/Verifier/bitcast-address-space-through-inttoptr.ll
  test/Verifier/bitcast-address-spaces.ll
  test/Verifier/bitcast-vector-pointer-as.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D1083.8.patch
Type: text/x-patch
Size: 19324 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130722/605953e8/attachment.bin>


More information about the llvm-commits mailing list