1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-18 18:42:46 +02:00

[NFC][asan] Always pass Dominator Trees into forAllReachableExits

This commit is contained in:
Vitaly Buka 2021-07-22 17:07:44 -07:00
parent 4866aceb76
commit 381f03cdf9
2 changed files with 6 additions and 5 deletions

View File

@ -55,22 +55,22 @@ public:
// should remove End to ensure that work done at the other exits does not
// happen outside of the lifetime.
template <typename F>
bool forAllReachableExits(DominatorTree *DT, PostDominatorTree *PDT,
bool forAllReachableExits(const DominatorTree &DT, const PostDominatorTree &PDT,
const Instruction *Start, Instruction *End,
const SmallVectorImpl<Instruction *> &RetVec,
F Callback) {
// We need to ensure that if we tag some object, we certainly untag it
// before the function exits.
if (PDT != nullptr && PDT->dominates(End, Start)) {
if (PDT.dominates(End, Start)) {
Callback(End);
} else {
SmallVector<Instruction *, 8> ReachableRetVec;
unsigned NumCoveredExits = 0;
for (auto &RI : RetVec) {
if (!isPotentiallyReachable(Start, RI, nullptr, DT))
if (!isPotentiallyReachable(Start, RI, nullptr, &DT))
continue;
ReachableRetVec.push_back(RI);
if (DT != nullptr && DT->dominates(End, RI))
if (DT.dominates(End, RI))
++NumCoveredExits;
}
// If there's a mix of covered and non-covered exits, just put the untag

View File

@ -651,7 +651,8 @@ bool AArch64StackTagging::runOnFunction(Function &Fn) {
tagAlloca(AI, Start->getNextNode(), Start->getArgOperand(1), Size);
auto TagEnd = [&](Instruction *Node) { untagAlloca(AI, Node, Size); };
if (!forAllReachableExits(DT, PDT, Start, End, RetVec, TagEnd))
if (!DT || !PDT ||
!forAllReachableExits(*DT, *PDT, Start, End, RetVec, TagEnd))
End->eraseFromParent();
} else {
uint64_t Size = Info.AI->getAllocationSizeInBits(*DL).getValue() / 8;