[PATCH] D66618: [WIP] Expose functions to determine pointer properties (Align & Deref)NOTE: This is a prototype to show an alternative to the two solutionssketched in http://lists.llvm.org/pipermail/llvm-dev/2019-August/134680.html .

Johannes Doerfert via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 22 14:07:46 PDT 2019


jdoerfert created this revision.
jdoerfert added reviewers: reames, sanjoy, hfinkel, chandlerc, efriedma, lebedev.ri, fhahn.
Herald added subscribers: bollu, hiraditya, javed.absar.
Herald added a project: LLVM.

In this patch `Value::getPointerDereferenceableBytes` and
`Value::getPointerAlignment` are extracted into more powerful versions
living alongside `isDereferenceableAndAlignedPointer` in
`Analysis/Loads.h`. The functions have also been enriched wrt. GEP
support and unified wrt. value kinds they can unpack. Thus, the only
"new" logic is concerned with GEP handling everything else is
copied/moved from other places.

NOTE: One caveat is that at least one use site (ConstantFold.cpp) does
not have access to the analysis library in which the functions now live.



NOTE: Changes to downstream code should be mechanical, I used:
      %s/\(\w\+\)->getPointerAlignment(/getPointerAlignment(\1, /



NOTE: Not all affected tests have been updated but only one to show how
the improved GEP logic affects alignment.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D66618

Files:
  llvm/include/llvm/Analysis/Loads.h
  llvm/include/llvm/IR/Value.h
  llvm/lib/Analysis/CaptureTracking.cpp
  llvm/lib/Analysis/Loads.cpp
  llvm/lib/Analysis/ValueTracking.cpp
  llvm/lib/CodeGen/CodeGenPrepare.cpp
  llvm/lib/IR/ConstantFold.cpp
  llvm/lib/IR/Value.cpp
  llvm/lib/Target/AArch64/AArch64InstrInfo.td
  llvm/lib/Transforms/IPO/Attributor.cpp
  llvm/test/Transforms/InstCombine/constant-fold-gep.ll
  llvm/unittests/IR/FunctionTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D66618.216711.patch
Type: text/x-patch
Size: 35162 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190822/b354d052/attachment.bin>


More information about the llvm-commits mailing list