[PATCH] D28181: [MemDep] NFC walk invariant.group graph only down

Philip Reames via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 30 12:22:55 PST 2016


reames requested changes to this revision.
reames added inline comments.
This revision now requires changes to proceed.


================
Comment at: lib/Analysis/MemoryDependenceAnalysis.cpp:367
     assert(Ptr);
-    if (isa<GlobalValue>(Ptr))
-      continue;
-
-    // Value comes from bitcast: Ptr = bitcast x. Insert x.
-    if (auto *BCI = dyn_cast<BitCastInst>(Ptr))
-      TryInsertToQueue(BCI->getOperand(0));
-    // Gep with zeros is equivalent to bitcast.
-    // FIXME: we are not sure if some bitcast should be canonicalized to gep 0
-    // or gep 0 to bitcast because of SROA, so there are 2 forms. When typeless
-    // pointers will be upstream then both cases will be gone (and this BFS
-    // also won't be needed).
-    if (auto *GEP = dyn_cast<GetElementPtrInst>(Ptr))
-      if (GEP->hasAllZeroIndices())
-        TryInsertToQueue(GEP->getOperand(0));
+    assert(!isa<GlobalValue>(Ptr));
 
----------------
Don't you need to check this before the loop?  (i.e. why did this become an assert rather than a test?)


================
Comment at: lib/Analysis/MemoryDependenceAnalysis.cpp:381
+      // Gep with zeros is equivalent to bitcast.
+      // FIXME: we are not sure if some bitcast should be canonicalized to gep 0
+      // or gep 0 to bitcast because of SROA, so there are 2 forms. When typeless
----------------
Wasn't this comment in the other change you landed?


https://reviews.llvm.org/D28181





More information about the llvm-commits mailing list