Changeset View
Changeset View
Standalone View
Standalone View
llvm/lib/Transforms/Scalar/NewGVN.cpp
Show First 20 Lines • Show All 1,601 Lines • ▼ Show 20 Lines | if (auto *II = dyn_cast<IntrinsicInst>(I)) { | ||||
// Intrinsics with the returned attribute are copies of arguments. | // Intrinsics with the returned attribute are copies of arguments. | ||||
if (auto *ReturnedValue = II->getReturnedArgOperand()) { | if (auto *ReturnedValue = II->getReturnedArgOperand()) { | ||||
if (II->getIntrinsicID() == Intrinsic::ssa_copy) | if (II->getIntrinsicID() == Intrinsic::ssa_copy) | ||||
if (auto Res = performSymbolicPredicateInfoEvaluation(II)) | if (auto Res = performSymbolicPredicateInfoEvaluation(II)) | ||||
return Res; | return Res; | ||||
return ExprResult::some(createVariableOrConstant(ReturnedValue)); | return ExprResult::some(createVariableOrConstant(ReturnedValue)); | ||||
} | } | ||||
} | } | ||||
// FIXME: Currently the calls which may access the thread id may | |||||
// be considered as not accessing the memory. But this is | |||||
// problematic for coroutines, since coroutines may resume in a | |||||
// different thread. So we disable the optimization here for the | |||||
// correctness. However, it may block many other correct | |||||
// optimizations. Revert this one when we detect the memory | |||||
// accessing kind more precisely. | |||||
if (CI->getFunction()->isPresplitCoroutine()) | |||||
return ExprResult::none(); | |||||
if (AA->doesNotAccessMemory(CI)) { | if (AA->doesNotAccessMemory(CI)) { | ||||
return ExprResult::some( | return ExprResult::some( | ||||
createCallExpression(CI, TOPClass->getMemoryLeader())); | createCallExpression(CI, TOPClass->getMemoryLeader())); | ||||
} else if (AA->onlyReadsMemory(CI)) { | } else if (AA->onlyReadsMemory(CI)) { | ||||
if (auto *MA = MSSA->getMemoryAccess(CI)) { | if (auto *MA = MSSA->getMemoryAccess(CI)) { | ||||
auto *DefiningAccess = MSSAWalker->getClobberingMemoryAccess(MA); | auto *DefiningAccess = MSSAWalker->getClobberingMemoryAccess(MA); | ||||
return ExprResult::some(createCallExpression(CI, DefiningAccess)); | return ExprResult::some(createCallExpression(CI, DefiningAccess)); | ||||
} else // MSSA determined that CI does not access memory. | } else // MSSA determined that CI does not access memory. | ||||
▲ Show 20 Lines • Show All 2,656 Lines • Show Last 20 Lines |