[Local] Treat calls that may not return as being alive.
authorFlorian Hahn <flo@fhahn.com>
Sat, 23 Jan 2021 12:42:46 +0000 (12:42 +0000)
committerFlorian Hahn <flo@fhahn.com>
Sat, 23 Jan 2021 16:05:14 +0000 (16:05 +0000)
commit292077072ec1279d89d21873fe900061e55ef936
tree110099a94bc7a1057888131789f699cace5cb48c
parent25531a1d9657897e648d93f776a3abb70e9816ef
[Local] Treat calls that may not return as being alive.

With the addition of the `willreturn` attribute, functions that may
not return (e.g. due to an infinite loop) are well defined, if they are
not marked as `willreturn`.

This patch updates `wouldInstructionBeTriviallyDead` to not consider
calls that may not return as dead.

This patch still provides an escape hatch for intrinsics, which are
still assumed as willreturn unconditionally. It will be removed once
all intrinsics definitions have been reviewed and updated.

Reviewed By: jdoerfert

Differential Revision: https://reviews.llvm.org/D94106
29 files changed:
llvm/include/llvm/IR/InstrTypes.h
llvm/lib/Transforms/Utils/Local.cpp
llvm/test/Feature/OperandBundles/early-cse.ll
llvm/test/Transforms/Attributor/ArgumentPromotion/fp80.ll
llvm/test/Transforms/Attributor/align.ll
llvm/test/Transforms/Attributor/nocapture-1.ll
llvm/test/Transforms/Attributor/nocapture-2.ll
llvm/test/Transforms/Attributor/nonnull.ll
llvm/test/Transforms/Attributor/norecurse.ll
llvm/test/Transforms/Attributor/range.ll
llvm/test/Transforms/Attributor/readattrs.ll
llvm/test/Transforms/BDCE/basic.ll
llvm/test/Transforms/CodeGenPrepare/X86/delete-assume-dead-code.ll
llvm/test/Transforms/Coroutines/coro-split-00.ll
llvm/test/Transforms/Coroutines/coro-split-hidden.ll
llvm/test/Transforms/Coroutines/no-suspend.ll
llvm/test/Transforms/DeadStoreElimination/MSSA/simple.ll
llvm/test/Transforms/DeadStoreElimination/MemDepAnalysis/DeleteThrowableInst.ll
llvm/test/Transforms/DeadStoreElimination/MemDepAnalysis/simple.ll
llvm/test/Transforms/Inline/dead-calls-willreturn.ll
llvm/test/Transforms/InstCombine/constant-fold-libfunc.ll
llvm/test/Transforms/InstCombine/nothrow.ll
llvm/test/Transforms/InstSimplify/ConstProp/rint.ll
llvm/test/Transforms/InstSimplify/remove-dead-call.ll
llvm/test/Transforms/InstSimplify/returned.ll
llvm/test/Transforms/MemCpyOpt/memcpy.ll
llvm/test/Transforms/NewGVN/eliminate-callsite-inline.ll
llvm/test/Transforms/OpenMP/parallel_deletion.ll
llvm/test/Transforms/Reassociate/erase_inst_made_change.ll