diff options
| author | Johannes Doerfert <johannes@jdoerfert.de> | 2019-11-01 20:17:48 -0500 |
|---|---|---|
| committer | Johannes Doerfert <johannes@jdoerfert.de> | 2019-11-02 00:35:22 -0500 |
| commit | 1b6041a9e8c537894dfda998fdd3d284b1111bd2 (patch) | |
| tree | 7ee6d5b951b826686a06c4cc62f81c1faf4195be /llvm/lib/Transforms/IPO | |
| parent | e360ee62650609112b08e4ab2249e1e5a8c9e0d0 (diff) | |
| download | bcm5719-llvm-1b6041a9e8c537894dfda998fdd3d284b1111bd2.tar.gz bcm5719-llvm-1b6041a9e8c537894dfda998fdd3d284b1111bd2.zip | |
[Attributor] `willreturn` + `noreturn` = UB
We gave up on `noreturn` if `willreturn` was known for a while but we
now again try to always derive `noreturn`. This is useful because a
function that is `noreturn` + `willreturn` is basically dead as
executing it would lead to undefined behavior (UB).
This came up in the IPConstantProp cases where a function only contained
a unreachable but was not marked `noreturn` which caused missed
opportunities down the line.
Diffstat (limited to 'llvm/lib/Transforms/IPO')
| -rw-r--r-- | llvm/lib/Transforms/IPO/Attributor.cpp | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/llvm/lib/Transforms/IPO/Attributor.cpp b/llvm/lib/Transforms/IPO/Attributor.cpp index 4c8bb0f51e9..ee7166e381a 100644 --- a/llvm/lib/Transforms/IPO/Attributor.cpp +++ b/llvm/lib/Transforms/IPO/Attributor.cpp @@ -3076,7 +3076,7 @@ struct AANoReturnImpl : public AANoReturn { void initialize(Attributor &A) override { AANoReturn::initialize(A); Function *F = getAssociatedFunction(); - if (!F || F->hasFnAttribute(Attribute::WillReturn)) + if (!F) indicatePessimisticFixpoint(); } @@ -3087,9 +3087,6 @@ struct AANoReturnImpl : public AANoReturn { /// See AbstractAttribute::updateImpl(Attributor &A). virtual ChangeStatus updateImpl(Attributor &A) override { - const auto &WillReturnAA = A.getAAFor<AAWillReturn>(*this, getIRPosition()); - if (WillReturnAA.isKnownWillReturn()) - return indicatePessimisticFixpoint(); auto CheckForNoReturn = [](Instruction &) { return false; }; if (!A.checkForAllInstructions(CheckForNoReturn, *this, {(unsigned)Instruction::Ret})) |

