[PATCH] D28204: [ValueTracking] use nonnull argument attribute to eliminate null checks

Philip Reames via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 3 21:26:15 PST 2017


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


================
Comment at: lib/Analysis/ValueTracking.cpp:3385
+    // attributes may provide an answer about null-ness.
+    if (auto *Call = dyn_cast<CallInst>(U))
+      if (auto *CalledFunc = Call->getCalledFunction())
----------------
Please handle invokes as well.  Use CallSite to abstract over both.


================
Comment at: lib/Analysis/ValueTracking.cpp:3409
       } else if (Pred == ICmpInst::ICMP_NE &&
                  match(CmpU, m_Intrinsic<Intrinsic::experimental_guard>()) &&
                  DT->dominates(cast<Instruction>(CmpU), CtxI)) {
----------------
Huh, this should really be handling assumes as well.  Can you file a separate bug for that?


https://reviews.llvm.org/D28204





More information about the llvm-commits mailing list