[PATCH] D51431: [WIP][IPSCCP] Add lattice value for != constant and propagate nonnull.

Florian Hahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 29 08:40:35 PDT 2018


fhahn created this revision.
fhahn added reviewers: efriedma, davide.

This is a proof-of-concept patch extending IPSCCP's lattice to represent
val != Constant which is used to propagate facts for the 'false' BB
following an X == Const condition.

Initially, this allows us to propagate nonnull to some pointer
arguments. Currently, we add nonnull to pointer arguments in
instcombine, which does not seem like the ideal place, as it has nothing
to do with combining instructions and uses isKnownNonZero which tries to
prove non-null by walking backwards from the arguments, which
potentially is more expensive and I think we can also be more precise in
SCCP.

This needs more work (and will be even better with integer ranges), but
I thought I share it and would appreciate any thoughts.

Not sure if it would be worthwhile trying to get rid of the nonnull
propagation in instcombine. One issue is that instcombine runs more
often than SCCP.


https://reviews.llvm.org/D51431

Files:
  lib/Transforms/Scalar/SCCP.cpp
  test/Transforms/SCCP/ipsccp-nonnull.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D51431.163100.patch
Type: text/x-patch
Size: 10395 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180829/ba2c0656/attachment.bin>


More information about the llvm-commits mailing list