[DSE,MemorySSA] Skip defs without analyzable write locations.
authorFlorian Hahn <flo@fhahn.com>
Sun, 30 Aug 2020 20:53:31 +0000 (21:53 +0100)
committerFlorian Hahn <flo@fhahn.com>
Sun, 30 Aug 2020 20:56:25 +0000 (21:56 +0100)
Similar to other checks above, if there is no write location for a def,
it cannot be considered for elimination and can be skipped.

llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp

index b261369..7e4ef1e 100644 (file)
@@ -1896,9 +1896,13 @@ struct DSEState {
         continue;
       }
 
+      // If Current does not have an analyzable write location, skip it
       auto CurrentLoc = getLocForWriteEx(CurrentI);
-      if (!CurrentLoc)
-        break;
+      if (!CurrentLoc) {
+        StepAgain = true;
+        Current = CurrentDef->getDefiningAccess();
+        continue;
+      }
 
       if (IsMemTerm) {
         // If the killing def is a memory terminator (e.g. lifetime.end), check