[Attributor][FIX] Handle droppable uses when replacing values
authorJohannes Doerfert <johannes@jdoerfert.de>
Sat, 11 Apr 2020 04:41:59 +0000 (23:41 -0500)
committerJohannes Doerfert <johannes@jdoerfert.de>
Thu, 16 Apr 2020 05:56:08 +0000 (00:56 -0500)
commit0741dec27b049111094aec22f547651bb42a27ce
treea6bdf50c61ecf919bf39b172c711ae5b4c13f91d
parentea7f17ee387062fcb74af2ba27c426a68c6bc8ad
[Attributor][FIX] Handle droppable uses when replacing values

Since we use the fact that some uses are droppable in the Attributor we
need to handle them explicitly when we replace uses. As an example, an
assumed dead value can have live droppable users. In those we cannot
replace the value simply by an undef. Instead, we either drop the uses
(via `dropDroppableUses`) or keep them as they are. In this patch we do
both, depending on the situation. For values that are dead but not
necessarily removed we keep droppable uses around because they contain
information we might be able to use later. For values that are removed
we drop droppable uses explicitly to avoid replacement with undef.
llvm/include/llvm/Transforms/IPO/Attributor.h
llvm/lib/Transforms/IPO/Attributor.cpp
llvm/lib/Transforms/IPO/AttributorAttributes.cpp
llvm/test/Transforms/Attributor/dereferenceable-1.ll
llvm/test/Transforms/Attributor/nonnull.ll