[Attributor][NFC] Avoid dependences on known information

This commit is contained in:
Johannes Doerfert 2020-05-05 11:18:03 -05:00
parent 0fac1c1912
commit 094137a6c6
2 changed files with 14 additions and 9 deletions

View File

@ -2598,12 +2598,15 @@ struct AAIsDeadValueImpl : public AAIsDead {
if (!NoUnwindAA.isAssumedNoUnwind()) if (!NoUnwindAA.isAssumedNoUnwind())
return false; return false;
const auto &MemBehaviorAA = A.getAAFor<AAMemoryBehavior>(*this, CallIRP); const auto &MemBehaviorAA = A.getAAFor<AAMemoryBehavior>(
if (!MemBehaviorAA.isAssumedReadOnly()) *this, CallIRP, /* TrackDependence */ false);
return false; if (MemBehaviorAA.isAssumedReadOnly()) {
if (!MemBehaviorAA.isKnownReadOnly())
A.recordDependence(MemBehaviorAA, *this, DepClassTy::OPTIONAL);
return true; return true;
} }
return false;
}
}; };
struct AAIsDeadFloating : public AAIsDeadValueImpl { struct AAIsDeadFloating : public AAIsDeadValueImpl {
@ -4061,12 +4064,14 @@ ChangeStatus AANoCaptureImpl::updateImpl(Attributor &A) {
AANoCapture::StateType T; AANoCapture::StateType T;
// Readonly means we cannot capture through memory. // Readonly means we cannot capture through memory.
const auto &FnMemAA = A.getAAFor<AAMemoryBehavior>( const auto &FnMemAA =
*this, FnPos, /* TrackDependence */ true, DepClassTy::OPTIONAL); A.getAAFor<AAMemoryBehavior>(*this, FnPos, /* TrackDependence */ false);
if (FnMemAA.isAssumedReadOnly()) { if (FnMemAA.isAssumedReadOnly()) {
T.addKnownBits(NOT_CAPTURED_IN_MEM); T.addKnownBits(NOT_CAPTURED_IN_MEM);
if (FnMemAA.isKnownReadOnly()) if (FnMemAA.isKnownReadOnly())
addKnownBits(NOT_CAPTURED_IN_MEM); addKnownBits(NOT_CAPTURED_IN_MEM);
else
A.recordDependence(FnMemAA, *this, DepClassTy::OPTIONAL);
} }
// Make sure all returned values are different than the underlying value. // Make sure all returned values are different than the underlying value.

View File

@ -1,6 +1,6 @@
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature --scrub-attributes ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature --scrub-attributes
; RUN: opt -attributor -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=7 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_NPM,NOT_CGSCC_OPM,NOT_TUNIT_NPM,IS__TUNIT____,IS________OPM,IS__TUNIT_OPM ; RUN: opt -attributor -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=6 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_NPM,NOT_CGSCC_OPM,NOT_TUNIT_NPM,IS__TUNIT____,IS________OPM,IS__TUNIT_OPM
; RUN: opt -aa-pipeline=basic-aa -passes=attributor -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=7 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_OPM,NOT_CGSCC_NPM,NOT_TUNIT_OPM,IS__TUNIT____,IS________NPM,IS__TUNIT_NPM ; RUN: opt -aa-pipeline=basic-aa -passes=attributor -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=6 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_OPM,NOT_CGSCC_NPM,NOT_TUNIT_OPM,IS__TUNIT____,IS________NPM,IS__TUNIT_NPM
; RUN: opt -attributor-cgscc -attributor-manifest-internal -attributor-annotate-decl-cs -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_TUNIT_NPM,NOT_TUNIT_OPM,NOT_CGSCC_NPM,IS__CGSCC____,IS________OPM,IS__CGSCC_OPM ; RUN: opt -attributor-cgscc -attributor-manifest-internal -attributor-annotate-decl-cs -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_TUNIT_NPM,NOT_TUNIT_OPM,NOT_CGSCC_NPM,IS__CGSCC____,IS________OPM,IS__CGSCC_OPM
; RUN: opt -aa-pipeline=basic-aa -passes=attributor-cgscc -attributor-manifest-internal -attributor-annotate-decl-cs -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_TUNIT_NPM,NOT_TUNIT_OPM,NOT_CGSCC_OPM,IS__CGSCC____,IS________NPM,IS__CGSCC_NPM ; RUN: opt -aa-pipeline=basic-aa -passes=attributor-cgscc -attributor-manifest-internal -attributor-annotate-decl-cs -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_TUNIT_NPM,NOT_TUNIT_OPM,NOT_CGSCC_OPM,IS__CGSCC____,IS________NPM,IS__CGSCC_NPM