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)
commit66c6de61eea9d88061648fe505f420b7cb958df5
tree773b61817fa443a659a8dcbb6cccc24800e302f1
parent2e764b83aad54c5e557a64a9507f35cad90edead
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

llvm-svn: 221737
llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
llvm/test/Transforms/InstCombine/assume.ll