[PATCH] D22793: IR: Introduce inbounds attribute on getelementptr indices.

Peter Collingbourne via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 25 17:41:16 PDT 2016


pcc created this revision.
pcc added reviewers: eli.friedman, majnemer, grosser, hfinkel, eugenis.
pcc added a subscriber: llvm-commits.

If the inbounds keyword is present before any index, loading from or
storing to any pointer derived from the getelementptr has undefined
behavior if the load or store would access memory outside of the bounds of
the element selected by the index marked as inbounds.

This can be used, e.g. for alias analysis or to split globals at element
boundaries where beneficial.

As previously proposed on llvm-dev:
http://lists.llvm.org/pipermail/llvm-dev/2016-July/102472.html

https://reviews.llvm.org/D22793

Files:
  docs/LangRef.rst
  include/llvm/Bitcode/LLVMBitCodes.h
  include/llvm/IR/Constants.h
  include/llvm/IR/Operator.h
  lib/Analysis/ConstantFolding.cpp
  lib/AsmParser/LLParser.cpp
  lib/AsmParser/LLParser.h
  lib/Bitcode/Reader/BitcodeReader.cpp
  lib/Bitcode/Writer/BitcodeWriter.cpp
  lib/IR/AsmWriter.cpp
  lib/IR/ConstantFold.cpp
  lib/IR/ConstantFold.h
  lib/IR/Constants.cpp
  test/Analysis/ConstantFolding/gep.ll
  test/Assembler/getelementptr.ll
  test/Bitcode/compatibility.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D22793.65454.patch
Type: text/x-patch
Size: 30146 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160726/a723d2da/attachment.bin>


More information about the llvm-commits mailing list