[NFC][asan] Always pass Dominator Trees into forAllReachableExits
authorVitaly Buka <vitalybuka@google.com>
Fri, 23 Jul 2021 00:07:44 +0000 (17:07 -0700)
committerVitaly Buka <vitalybuka@google.com>
Fri, 23 Jul 2021 01:01:38 +0000 (18:01 -0700)
llvm/include/llvm/Transforms/Instrumentation/AddressSanitizerCommon.h
llvm/lib/Target/AArch64/AArch64StackTagging.cpp

index 56cc889..0228992 100644 (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
index 4474e60..f37fedd 100644 (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;