Canonicalize an assume(load != null) into !nonnull metadata
authorPhilip Reames <listmail@philipreames.com>
Tue, 11 Nov 2014 23:33:19 +0000 (23:33 +0000)
committerPhilip Reames <listmail@philipreames.com>
Tue, 11 Nov 2014 23:33:19 +0000 (23:33 +0000)
commita03cda02ab4023d47d6f3a1636e11bdb9c9fd4f4
treec878a42af02dee8b03bc86236c7100d93efe384f
parent4f897091e40c5cf6fe9ff0d9bf5dc0d28945b389
Canonicalize an assume(load != null) into !nonnull metadata

We currently have two ways of informing the optimizer that the result of a load is never null: metadata and assume. This change converts the second in to the former. This avoids a need to implement optimizations using both forms.

We should probably extend this basic idea to metadata of other forms; in particular, range metadata. We view is that assumes should be considered a "last resort" for when there isn't a more canonical way to represent something.

Reviewed by: Hal
Differential Revision: http://reviews.llvm.org/D5951

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@221737 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/InstCombine/InstCombineCalls.cpp
test/Transforms/InstCombine/assume.ll