[PATCH] D20764: Reduce dependence on pointee types when deducing dereferenceability

Sanjoy Das via llvm-commits llvm-commits at lists.llvm.org
Fri May 27 18:50:28 PDT 2016


sanjoy created this revision.
sanjoy added reviewers: apilipenko, dblaikie, hfinkel, reames.
sanjoy added a subscriber: llvm-commits.
Herald added a subscriber: mcrosier.

Change some of the internal interfaces in Loads.cpp to keep track of the
number of bytes we're trying to prove dereferenceable using an explicit
`Size` parameter.

Before this, the `Size` parameter was implicitly inferred from the
pointee type of the pointer whose dereferenceability we were trying to
prove, causing us to be conservative around bitcasts. This was
unfortunate since bitcast instructions are no-ops and should never
break optimizations.  With an explicit `Size` parameter, we're more
precise (as shown in the test cases), and the code is simpler.

We should eventually move towards a `DerefQuery` struct that groups
together a base pointer, an offset, a size and an alignment; but this
patch is a first step.

http://reviews.llvm.org/D20764

Files:
  lib/Analysis/Loads.cpp
  test/Analysis/ValueTracking/deref-bitcast-of-gep.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D20764.58875.patch
Type: text/x-patch
Size: 10309 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160528/b7ee526c/attachment.bin>


More information about the llvm-commits mailing list