[PATCH] D94180: [SimplifyCFG] Optimize CFG when null is passed to a function with nonnull argument

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 15 12:14:59 PST 2021


lebedev.ri added inline comments.


================
Comment at: llvm/lib/Transforms/Utils/SimplifyCFG.cpp:6591-6592
+    if (auto *CB = dyn_cast<CallBase>(Use)) {
+      if (NullPointerIsDefined(CB->getFunction()))
+        return false;
+      // A call to null is undefined.
----------------
jdoerfert wrote:
> xbolva00 wrote:
> > lebedev.ri wrote:
> > > And what if `C` is actually `undef`?
> > So in this case, we require noundef attribute only (?) @aqjune
> > 
> > I will add a testcase.
> `noundef undef` -> instant UB
Yep, and will we watch it if the `null` ptr is defined?


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

https://reviews.llvm.org/D94180



More information about the llvm-commits mailing list