[PATCH] D105141: [MTE] Remove redundant helper function.
Florian Mayer via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 29 12:18:51 PDT 2021
fmayer created this revision.
Herald added a subscriber: hiraditya.
fmayer edited the summary of this revision.
fmayer published this revision for review.
fmayer added a reviewer: eugenis.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
Looking at PostDominatorTree::dominates, we can see that has the same
logic (with the addition of handling Phi nodes - which are not used as inputs in
this pass) as the helper function.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D105141
Files:
llvm/lib/Target/AArch64/AArch64StackTagging.cpp
Index: llvm/lib/Target/AArch64/AArch64StackTagging.cpp
===================================================================
--- llvm/lib/Target/AArch64/AArch64StackTagging.cpp
+++ 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<Instruction *, 8> ReachableRetVec;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D105141.355328.patch
Type: text/x-patch
Size: 1365 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210629/95df4a72/attachment.bin>
More information about the llvm-commits
mailing list