1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-25 04:02:41 +01:00

[Attributor] Gracefully handle interprocedural reachability queries

This does ensure `InformationCache::getPotentiallyReachable` will not
crash/assert on instructions from different functions but simply return
that one is reachable, which is conservatively correct.
This commit is contained in:
Johannes Doerfert 2021-07-20 00:30:20 -05:00
parent d03bb7e9e6
commit 8c94163113

View File

@ -996,7 +996,9 @@ struct InformationCache {
if (Iter != PotentiallyReachableMap.end())
return Iter->second;
const Function &F = *From.getFunction();
bool Result = isPotentiallyReachable(
bool Result = true;
if (From.getFunction() == To.getFunction())
Result = isPotentiallyReachable(
&From, &To, nullptr, AG.getAnalysis<DominatorTreeAnalysis>(F),
AG.getAnalysis<LoopAnalysis>(F));
PotentiallyReachableMap.insert(std::make_pair(KeyPair, Result));