[asan] make sure asan erases old unused allocas after it created a new one. This...
[oota-llvm.git] / lib / Transforms / Instrumentation / AddressSanitizer.cpp
index 75f42f30fab1036bf7f6232859e506f1c7f6bc75..d99bb87fd4c7800749915749334713392cfef1ab 100644 (file)
@@ -1148,6 +1148,10 @@ bool AddressSanitizer::poisonStackInFunction(Function &F) {
     }
   }
 
+  // We are done. Remove the old unused alloca instructions.
+  for (size_t i = 0, n = AllocaVec.size(); i < n; i++)
+    AllocaVec[i]->eraseFromParent();
+
   if (ClDebugStack) {
     DEBUG(dbgs() << F);
   }