diff --git a/llvm/lib/Target/AArch64/AArch64StackTagging.cpp b/llvm/lib/Target/AArch64/AArch64StackTagging.cpp --- a/llvm/lib/Target/AArch64/AArch64StackTagging.cpp +++ b/llvm/lib/Target/AArch64/AArch64StackTagging.cpp @@ -520,24 +520,6 @@ Info.AI = NewAI; } -// Helper function to check for post-dominance. -static bool postDominates(const PostDominatorTree *PDT, const IntrinsicInst *A, - const IntrinsicInst *B) { - const BasicBlock *ABB = A->getParent(); - const BasicBlock *BBB = B->getParent(); - - if (ABB != BBB) - return PDT->dominates(ABB, BBB); - - for (const Instruction &I : *ABB) { - if (&I == B) - return true; - if (&I == A) - return false; - } - llvm_unreachable("Corrupt instruction list"); -} - // FIXME: check for MTE extension bool AArch64StackTagging::runOnFunction(Function &Fn) { if (!Fn.hasFnAttribute(Attribute::SanitizeMemTag)) @@ -666,7 +648,7 @@ tagAlloca(AI, Start->getNextNode(), Start->getArgOperand(1), Size); // We need to ensure that if we tag some object, we certainly untag it // before the function exits. - if (PDT != nullptr && postDominates(PDT, End, Start)) { + if (PDT != nullptr && PDT->dominates(End, Start)) { untagAlloca(AI, End, Size); } else { SmallVector ReachableRetVec;