diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2021-04-19 19:18:04 +0000 |
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2021-04-19 19:18:04 +0000 |
| commit | b4125f7d51da2bb55d3b850dba9a69c201c3422c (patch) | |
| tree | 256fd6bf19d3fdd6b175d7b60ef759ef2365e14a /llvm/lib/Transforms/InstCombine/InstCombinePHI.cpp | |
| parent | 9f93bc8bfd2690abd12a830e42a1c26038173ae5 (diff) | |
Diffstat (limited to 'llvm/lib/Transforms/InstCombine/InstCombinePHI.cpp')
| -rw-r--r-- | llvm/lib/Transforms/InstCombine/InstCombinePHI.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstCombinePHI.cpp b/llvm/lib/Transforms/InstCombine/InstCombinePHI.cpp index d687ec654438..b211b0813611 100644 --- a/llvm/lib/Transforms/InstCombine/InstCombinePHI.cpp +++ b/llvm/lib/Transforms/InstCombine/InstCombinePHI.cpp @@ -592,8 +592,14 @@ static bool isSafeAndProfitableToSinkLoad(LoadInst *L) { BasicBlock::iterator BBI = L->getIterator(), E = L->getParent()->end(); for (++BBI; BBI != E; ++BBI) - if (BBI->mayWriteToMemory()) + if (BBI->mayWriteToMemory()) { + // Calls that only access inaccessible memory do not block sinking the + // load. + if (auto *CB = dyn_cast<CallBase>(BBI)) + if (CB->onlyAccessesInaccessibleMemory()) + continue; return false; + } // Check for non-address taken alloca. If not address-taken already, it isn't // profitable to do this xform. |
