[PATCH] D73131: [IR] Value::getPointerAlignment(): handle pointer constants

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 21 12:33:01 PST 2020


lebedev.ri created this revision.
lebedev.ri added reviewers: jdoerfert, gchatelet, courbet.
lebedev.ri added a project: LLVM.
Herald added subscribers: jfb, arphaman, hiraditya.
Herald added a reviewer: sstefan1.

New `@test13` in `Attributor/align.ll` is the main motivation - `null` pointer
really does not limit our alignment knowledge, in fact it is fully aligned
since it has no bits set.

Here we don't special-case `null` pointer because it is somewhat controversial
to add one more place where we enforce that `null` pointer is zero,
but instead we do the more general thing of trying to perform constant-fold
of pointer constant to an integer, and perform alignment inferrment on that.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D73131

Files:
  llvm/lib/IR/Value.cpp
  llvm/test/Transforms/Attributor/ArgumentPromotion/2008-07-02-array-indexing.ll
  llvm/test/Transforms/Attributor/IPConstantProp/pthreads.ll
  llvm/test/Transforms/Attributor/align.ll
  llvm/test/Transforms/Attributor/callbacks.ll
  llvm/test/Transforms/Attributor/nocapture-1.ll
  llvm/test/Transforms/Attributor/nonnull.ll
  llvm/test/Transforms/Attributor/value-simplify.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D73131.239403.patch
Type: text/x-patch
Size: 14407 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200121/435cc775/attachment.bin>


More information about the llvm-commits mailing list