[PATCH] D82566: [CodeMoverUtils] Make specific analysis dependent checks optional

Whitney Tsang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 25 09:40:42 PDT 2020


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


================
Comment at: llvm/lib/Transforms/Scalar/LoopFuse.cpp:513
   LoopInfo &LI;
-  DominatorTree &DT;
-  DependenceInfo &DI;
+  DominatorTree *DT;
+  DependenceInfo *DI;
----------------
where is no need to change LoopFuse, just pass the address when calling the APIs. 


================
Comment at: llvm/lib/Transforms/Utils/CodeMoverUtils.cpp:100
+    const PostDominatorTree *PDT, unsigned MaxLookup) {
+  assert(DT->dominates(&Dominator, &BB) &&
+         "Expecting Dominator to dominate BB");
----------------
you can a segfault here when DT is nullptr, making analyses optional means you have to add handle when they are nullptr, and add alternative ways to do what the function is intended to do.


================
Comment at: llvm/lib/Transforms/Utils/CodeMoverUtils.cpp:320
+  if (!DT)
+    return true;
 
----------------
so as long as DT is nullptr, instruction is safe to move before InsertPoint? can return false here instead of true.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D82566





More information about the llvm-commits mailing list