[PATCH] D76947: [SelectionDAGBuilder][CGP][X86] Move some of SDB's gather/scatter uniform base handling to CGP.

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 8 05:55:36 PDT 2020


spatel added inline comments.


================
Comment at: llvm/lib/CodeGen/CodeGenPrepare.cpp:5185-5186
 
+bool CodeGenPrepare::optimizeGatherScatterInst(Instruction *MemoryInst,
+                                               Value *Ptr) {
+  const GetElementPtrInst *GEP = dyn_cast<GetElementPtrInst>(Ptr);
----------------
I haven't looked at this before, so I'm not the best reviewer...
But it would be helpful to any first-time reader if this function had a documentation comment to describe the transform. An IR example in the comment and IR regression tests would also be educational.


================
Comment at: llvm/lib/CodeGen/CodeGenPrepare.cpp:5281-5298
+  // If we have no uses, recursively delete the value and all dead instructions
+  // using it.
+  if (Ptr->use_empty()) {
+    // This can cause recursive deletion, which can invalidate our iterator.
+    // Use a WeakTrackingVH to hold onto it in case this happens.
+    Value *CurValue = &*CurInstIterator;
+    WeakTrackingVH IterHandle(CurValue);
----------------
Can this copied chunk be lifted to a helper function as a preliminary commit?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D76947/new/

https://reviews.llvm.org/D76947





More information about the llvm-commits mailing list