[PATCH] D53786: [AliasSetTracker] Actually delete instructions from the AliasSetTracker.

Alina Sbirlea via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 26 21:31:43 PDT 2018


asbirlea updated this revision to Diff 171389.
asbirlea added a comment.

clang-format. Thank you!


Repository:
  rL LLVM

https://reviews.llvm.org/D53786

Files:
  include/llvm/Analysis/AliasSetTracker.h
  lib/Analysis/AliasSetTracker.cpp
  lib/Transforms/Scalar/LICM.cpp


Index: lib/Transforms/Scalar/LICM.cpp
===================================================================
--- lib/Transforms/Scalar/LICM.cpp
+++ lib/Transforms/Scalar/LICM.cpp
@@ -315,7 +315,10 @@
       bool Promoted = false;
 
       // Loop over all of the alias sets in the tracker object.
-      for (AliasSet &AS : *CurAST) {
+      for (auto ASItB = CurAST->begin(), ASItE = CurAST->end();
+           ASItB != ASItE;) {
+        auto &AS = *ASItB;
+        ++ASItB;
         // We can promote this alias set if it has a store, if it is a "Must"
         // alias set, if the pointer is loop invariant, and if we are not
         // eliminating any volatile loads or stores.
Index: lib/Analysis/AliasSetTracker.cpp
===================================================================
--- lib/Analysis/AliasSetTracker.cpp
+++ lib/Analysis/AliasSetTracker.cpp
@@ -551,6 +551,14 @@
   PointerMap.erase(I);
 }
 
+void AliasSetTracker::deleteValue(Instruction *I) {
+  auto Loc = MemoryLocation::getOrNone(I);
+  if (Loc == None)
+    deleteValue((Value *)I);
+  else
+    deleteValue(const_cast<Value *>(Loc->Ptr));
+}
+
 // copyValue - This method should be used whenever a preexisting value in the
 // program is copied or cloned, introducing a new value.  Note that it is ok for
 // clients that use this method to introduce the same value multiple times: if
Index: include/llvm/Analysis/AliasSetTracker.h
===================================================================
--- include/llvm/Analysis/AliasSetTracker.h
+++ include/llvm/Analysis/AliasSetTracker.h
@@ -401,6 +401,7 @@
   /// program to update the AST. If you don't use this, you would have dangling
   /// pointers to deleted instructions.
   void deleteValue(Value *PtrVal);
+  void deleteValue(Instruction *I);
 
   /// This method should be used whenever a preexisting value in the program is
   /// copied or cloned, introducing a new value.  Note that it is ok for clients


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D53786.171389.patch
Type: text/x-patch
Size: 1947 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181027/b317904e/attachment.bin>


More information about the llvm-commits mailing list