forked from OSchip/llvm-project
[Attributor] Add checks needed as we strengthen value simplify
This commit is contained in:
parent
393be12b74
commit
0ece283f03
llvm/lib/Transforms/IPO
|
@ -2002,8 +2002,12 @@ ChangeStatus Attributor::cleanupIR() {
|
|||
for (auto &U : OldV->uses())
|
||||
if (Entry.second || !U.getUser()->isDroppable())
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
for (auto &V : InvokeWithDeadSuccessor)
|
||||
|
|
|
@ -4895,8 +4895,13 @@ struct AAInstanceInfoImpl : public AAInstanceInfo {
|
|||
const auto &ArgInstanceInfoAA = A.getAAFor<AAInstanceInfo>(
|
||||
*this, IRPosition::callsite_argument(*CB, CB->getArgOperandNo(&U)),
|
||||
DepClassTy::OPTIONAL);
|
||||
if (ArgInstanceInfoAA.isAssumedUniqueForAnalysis())
|
||||
return true;
|
||||
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 false;
|
||||
};
|
||||
|
@ -5201,6 +5206,8 @@ ChangeStatus AANoCaptureImpl::updateImpl(Attributor &A) {
|
|||
// AAReturnedValues, e.g., track all values that escape through returns
|
||||
// directly somehow.
|
||||
auto CheckReturnedArgs = [&](const AAReturnedValues &RVAA) {
|
||||
if (!RVAA.getState().isValidState())
|
||||
return false;
|
||||
bool SeenConstant = false;
|
||||
for (auto &It : RVAA.returned_values()) {
|
||||
if (isa<Constant>(It.first)) {
|
||||
|
@ -6433,6 +6440,8 @@ ChangeStatus AAHeapToStackFunction::updateImpl(Attributor &A) {
|
|||
dbgs() << "[H2S] unique free call might free unknown allocations\n");
|
||||
return false;
|
||||
}
|
||||
if (DI->PotentialAllocationCalls.empty())
|
||||
return true;
|
||||
if (DI->PotentialAllocationCalls.size() > 1) {
|
||||
LLVM_DEBUG(dbgs() << "[H2S] unique free call might free "
|
||||
<< DI->PotentialAllocationCalls.size()
|
||||
|
|
Loading…
Reference in New Issue