forked from OSchip/llvm-project
[Attributor] Add checks needed as we strengthen value simplify
This commit is contained in:
parent
393be12b74
commit
0ece283f03
|
@ -2002,9 +2002,13 @@ ChangeStatus Attributor::cleanupIR() {
|
||||||
for (auto &U : OldV->uses())
|
for (auto &U : OldV->uses())
|
||||||
if (Entry.second || !U.getUser()->isDroppable())
|
if (Entry.second || !U.getUser()->isDroppable())
|
||||||
Uses.push_back(&U);
|
Uses.push_back(&U);
|
||||||
for (Use *U : Uses)
|
for (Use *U : Uses) {
|
||||||
|
if (auto *I = dyn_cast<Instruction>(U->getUser()))
|
||||||
|
if (!isRunOn(*I->getFunction()))
|
||||||
|
continue;
|
||||||
ReplaceUse(U, NewV);
|
ReplaceUse(U, NewV);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for (auto &V : InvokeWithDeadSuccessor)
|
for (auto &V : InvokeWithDeadSuccessor)
|
||||||
if (InvokeInst *II = dyn_cast_or_null<InvokeInst>(V)) {
|
if (InvokeInst *II = dyn_cast_or_null<InvokeInst>(V)) {
|
||||||
|
|
|
@ -4895,7 +4895,12 @@ struct AAInstanceInfoImpl : public AAInstanceInfo {
|
||||||
const auto &ArgInstanceInfoAA = A.getAAFor<AAInstanceInfo>(
|
const auto &ArgInstanceInfoAA = A.getAAFor<AAInstanceInfo>(
|
||||||
*this, IRPosition::callsite_argument(*CB, CB->getArgOperandNo(&U)),
|
*this, IRPosition::callsite_argument(*CB, CB->getArgOperandNo(&U)),
|
||||||
DepClassTy::OPTIONAL);
|
DepClassTy::OPTIONAL);
|
||||||
if (ArgInstanceInfoAA.isAssumedUniqueForAnalysis())
|
if (!ArgInstanceInfoAA.isAssumedUniqueForAnalysis())
|
||||||
|
return false;
|
||||||
|
// If this call base might reach the scope again we might forward the
|
||||||
|
// argument back here. This is very conservative.
|
||||||
|
if (AA::isPotentiallyReachable(A, *CB, *Scope, *this, nullptr))
|
||||||
|
return false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@ -5201,6 +5206,8 @@ ChangeStatus AANoCaptureImpl::updateImpl(Attributor &A) {
|
||||||
// AAReturnedValues, e.g., track all values that escape through returns
|
// AAReturnedValues, e.g., track all values that escape through returns
|
||||||
// directly somehow.
|
// directly somehow.
|
||||||
auto CheckReturnedArgs = [&](const AAReturnedValues &RVAA) {
|
auto CheckReturnedArgs = [&](const AAReturnedValues &RVAA) {
|
||||||
|
if (!RVAA.getState().isValidState())
|
||||||
|
return false;
|
||||||
bool SeenConstant = false;
|
bool SeenConstant = false;
|
||||||
for (auto &It : RVAA.returned_values()) {
|
for (auto &It : RVAA.returned_values()) {
|
||||||
if (isa<Constant>(It.first)) {
|
if (isa<Constant>(It.first)) {
|
||||||
|
@ -6433,6 +6440,8 @@ ChangeStatus AAHeapToStackFunction::updateImpl(Attributor &A) {
|
||||||
dbgs() << "[H2S] unique free call might free unknown allocations\n");
|
dbgs() << "[H2S] unique free call might free unknown allocations\n");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
if (DI->PotentialAllocationCalls.empty())
|
||||||
|
return true;
|
||||||
if (DI->PotentialAllocationCalls.size() > 1) {
|
if (DI->PotentialAllocationCalls.size() > 1) {
|
||||||
LLVM_DEBUG(dbgs() << "[H2S] unique free call might free "
|
LLVM_DEBUG(dbgs() << "[H2S] unique free call might free "
|
||||||
<< DI->PotentialAllocationCalls.size()
|
<< DI->PotentialAllocationCalls.size()
|
||||||
|
|
Loading…
Reference in New Issue