[llvm] a24f104 - [MTE] Remove redundant helper function.
Florian Mayer via llvm-commits
llvm-commits at lists.llvm.org
Wed Jun 30 03:11:38 PDT 2021
Author: Florian Mayer
Date: 2021-06-30T11:11:26+01:00
New Revision: a24f104645f3faf4d0e4ea6047f933caddb85de5
URL: https://github.com/llvm/llvm-project/commit/a24f104645f3faf4d0e4ea6047f933caddb85de5
DIFF: https://github.com/llvm/llvm-project/commit/a24f104645f3faf4d0e4ea6047f933caddb85de5.diff
LOG: [MTE] Remove redundant helper function.
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.
Reviewed By: eugenis
Differential Revision: https://reviews.llvm.org/D105141
Added:
Modified:
llvm/lib/Target/AArch64/AArch64StackTagging.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Target/AArch64/AArch64StackTagging.cpp b/llvm/lib/Target/AArch64/AArch64StackTagging.cpp
index 33224c658c80..7008b188e1f1 100644
--- a/llvm/lib/Target/AArch64/AArch64StackTagging.cpp
+++ b/llvm/lib/Target/AArch64/AArch64StackTagging.cpp
@@ -520,24 +520,6 @@ void AArch64StackTagging::alignAndPadAlloca(AllocaInfo &Info) {
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 @@ bool AArch64StackTagging::runOnFunction(Function &Fn) {
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;
More information about the llvm-commits
mailing list