[llvm] 44ba8c6 - [NFC][asan] Always pass Dominator Trees into forAllReachableExits

Vitaly Buka via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 22 18:01:46 PDT 2021


Author: Vitaly Buka
Date: 2021-07-22T18:01:38-07:00
New Revision: 44ba8c691cb8f88ba2023843f8d48876102dff36

URL: https://github.com/llvm/llvm-project/commit/44ba8c691cb8f88ba2023843f8d48876102dff36
DIFF: https://github.com/llvm/llvm-project/commit/44ba8c691cb8f88ba2023843f8d48876102dff36.diff

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

Added: 
    

Modified: 
    llvm/include/llvm/Transforms/Instrumentation/AddressSanitizerCommon.h
    llvm/lib/Target/AArch64/AArch64StackTagging.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/Transforms/Instrumentation/AddressSanitizerCommon.h b/llvm/include/llvm/Transforms/Instrumentation/AddressSanitizerCommon.h
index 56cc889221036..0228992af8743 100644
--- a/llvm/include/llvm/Transforms/Instrumentation/AddressSanitizerCommon.h
+++ b/llvm/include/llvm/Transforms/Instrumentation/AddressSanitizerCommon.h
@@ -55,22 +55,22 @@ class InterestingMemoryOperand {
 // 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

diff  --git a/llvm/lib/Target/AArch64/AArch64StackTagging.cpp b/llvm/lib/Target/AArch64/AArch64StackTagging.cpp
index 4474e60ed9410..f37fedd50378d 100644
--- a/llvm/lib/Target/AArch64/AArch64StackTagging.cpp
+++ b/llvm/lib/Target/AArch64/AArch64StackTagging.cpp
@@ -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;


        


More information about the llvm-commits mailing list