[ValueTracking] Allow context-sensitive nullness check for non-pointers
authorJohannes Doerfert <johannes@jdoerfert.de>
Mon, 9 Dec 2019 04:11:16 +0000 (22:11 -0600)
committerJohannes Doerfert <johannes@jdoerfert.de>
Mon, 9 Dec 2019 21:15:52 +0000 (15:15 -0600)
commita7d992c0f2d235c67f04160405c5c5606408d4b1
treef775c520cf06ab8bfb1540dcc7873c689f2cf5b1
parent1164d43855fd5b58fde221445ab0e407c0bd92ee
[ValueTracking] Allow context-sensitive nullness check for non-pointers

Summary:
Same as D60846 and D69571 but with a fix for the problem encountered
after them. Both times it was a missing context adjustment in the
handling of PHI nodes.

The reproducers created from the bugs that caused the old commits to be
reverted are included.

Reviewers: nikic, nlopes, mkazantsev, spatel, dlrobertson, uabelho, hakzsam, hans

Subscribers: hiraditya, bollu, asbirlea, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D71181
llvm/lib/Analysis/InstructionSimplify.cpp
llvm/lib/Analysis/ValueTracking.cpp
llvm/test/Transforms/Attributor/nonnull.ll
llvm/test/Transforms/InstCombine/known-non-zero.ll
llvm/test/Transforms/InstSimplify/known-non-zero.ll
llvm/test/Transforms/LICM/hoist-mustexec.ll