summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorJohannes Doerfert <jdoerfert@anl.gov>2019-10-13 21:25:53 +0000
committerJohannes Doerfert <jdoerfert@anl.gov>2019-10-13 21:25:53 +0000
commit0cc2b61943ab3e4e91e831c6fe6061882f81ec09 (patch)
tree7d1004ef52f0860757f44c201321308c36c72c06 /llvm/lib
parentd82385b0491385a01f5bc2216f8fc72a6521746e (diff)
downloadbcm5719-llvm-0cc2b61943ab3e4e91e831c6fe6061882f81ec09.tar.gz
bcm5719-llvm-0cc2b61943ab3e4e91e831c6fe6061882f81ec09.zip
[Attributor] Shortcut no-return through will-return
No-return and will-return are exclusive, assuming the latter is more prominent we can avoid updates of the former unless will-return is not known for sure. llvm-svn: 374739
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Transforms/IPO/Attributor.cpp19
1 files changed, 11 insertions, 8 deletions
diff --git a/llvm/lib/Transforms/IPO/Attributor.cpp b/llvm/lib/Transforms/IPO/Attributor.cpp
index 7dfc802179c..ce720e4aff7 100644
--- a/llvm/lib/Transforms/IPO/Attributor.cpp
+++ b/llvm/lib/Transforms/IPO/Attributor.cpp
@@ -2859,6 +2859,14 @@ struct AAAlignCallSiteReturned final : AAAlignImpl {
struct AANoReturnImpl : public AANoReturn {
AANoReturnImpl(const IRPosition &IRP) : AANoReturn(IRP) {}
+ /// See AbstractAttribute::initialize(...).
+ void initialize(Attributor &A) override {
+ AANoReturn::initialize(A);
+ Function *F = getAssociatedFunction();
+ if (!F || F->hasFnAttribute(Attribute::WillReturn))
+ indicatePessimisticFixpoint();
+ }
+
/// See AbstractAttribute::getAsStr().
const std::string getAsStr() const override {
return getAssumed() ? "noreturn" : "may-return";
@@ -2866,6 +2874,9 @@ 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}))
@@ -2885,14 +2896,6 @@ struct AANoReturnFunction final : AANoReturnImpl {
struct AANoReturnCallSite final : AANoReturnImpl {
AANoReturnCallSite(const IRPosition &IRP) : AANoReturnImpl(IRP) {}
- /// See AbstractAttribute::initialize(...).
- void initialize(Attributor &A) override {
- AANoReturnImpl::initialize(A);
- Function *F = getAssociatedFunction();
- if (!F)
- indicatePessimisticFixpoint();
- }
-
/// See AbstractAttribute::updateImpl(...).
ChangeStatus updateImpl(Attributor &A) override {
// TODO: Once we have call site specific value information we can provide
OpenPOWER on IntegriCloud