[InstCombine] erase instructions leading up to unreachable
authorSanjay Patel <spatel@rotateright.com>
Mon, 7 Sep 2020 14:26:42 +0000 (10:26 -0400)
committerSanjay Patel <spatel@rotateright.com>
Mon, 7 Sep 2020 14:44:08 +0000 (10:44 -0400)
commitb22910daab95be1ebc6ab8a74190e38130b0e6ef
treee7990e20f70064f1b194daa5efb6801744f8d911
parenta70f2eb3e39a42a71ba077247f9deafbdf1e8092
[InstCombine] erase instructions leading up to unreachable

Normal dead code elimination ignores assume intrinsics, so we fail to
delete assumes that are not meaningful (and potentially worse if they
cause conflicts with other assumptions).

The motivating example in https://llvm.org/PR47416 suggests that we
might have problems upstream from here (difference between C and C++),
but this should be a cheap way to make sure we remove more dead code.

Differential Revision: https://reviews.llvm.org/D87149
llvm/lib/Transforms/InstCombine/InstCombineInternal.h
llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
llvm/test/Transforms/InstCombine/assume.ll
llvm/test/Transforms/InstCombine/pr33689_same_bitwidth.ll