[PATCH] D82299: Add a pass to eliminate nullchecks after objects have been dereferenced (WIP)

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 22 13:59:44 PDT 2020


nikic added a comment.

> It is probably possible to improve that if we would directly traverse the dominator tree.

Yes, I think that would make more sense. Another possibility would be to traverse in RPO and intersect nonnull objects from visited predecessors (I think that's legal, because these must be nonnull on backedges as well). That would come at the cost of set intersections though.



================
Comment at: llvm/lib/Transforms/Scalar/DereferenceNullCheckElimination.cpp:170
+        DFSInStack.emplace_back(CB.NumIn, CB.NumOut, UODest);
+      }
+    } else {
----------------
For memory intrinsics, it's also necessary to check that the length is non-zero. Per LangRef:

> If “len” is 0, the pointers may be NULL or dangling. However, they must still be appropriately aligned.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D82299





More information about the llvm-commits mailing list