[Attributor][FIX] Dead return values are not `noundef`
authorJohannes Doerfert <johannes@jdoerfert.de>
Wed, 9 Sep 2020 01:18:54 +0000 (20:18 -0500)
committerJohannes Doerfert <johannes@jdoerfert.de>
Tue, 6 Oct 2020 14:32:18 +0000 (09:32 -0500)
commit04f6951397cfbb892b99027bd3c0e4e0382f5458
treec685470795dd8a816fbb074ab1ed396bbce26305
parent957094e31b058f1b0a4bd3c76912f7d8b5b294b7
[Attributor][FIX] Dead return values are not `noundef`

When we assume a return value is dead we might still visit return
instructions via `Attributor::checkForAllReturnedValuesAndReturnInsts(..)`.
When we do so the "returned value" is potentially simplified to `undef`
as it is the assumed "returned value". This is a problem if there was a
preexisting `noundef` attribute that will only be removed as we manifest
the `undef` return value. We should not use this combination to derive
`unreachable` though. Two test cases fixed.
llvm/lib/Transforms/IPO/AttributorAttributes.cpp
llvm/test/Transforms/Attributor/ArgumentPromotion/2008-02-01-ReturnAttrs.ll
llvm/test/Transforms/Attributor/ArgumentPromotion/byval.ll
llvm/test/Transforms/Attributor/ArgumentPromotion/inalloca.ll
llvm/test/Transforms/Attributor/ArgumentPromotion/live_called_from_dead.ll
llvm/test/Transforms/Attributor/ArgumentPromotion/live_called_from_dead_2.ll
llvm/test/Transforms/Attributor/align.ll
llvm/test/Transforms/Attributor/depgraph.ll
llvm/test/Transforms/Attributor/noalias.ll
llvm/test/Transforms/Attributor/readattrs.ll