[PATCH] D133036: [InstCombine] Treat passing undef to noundef params as UB

Arthur Eubanks via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 1 09:16:54 PDT 2022


aeubanks added inline comments.


================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp:2905
+  for (unsigned I = 0; I < Call.arg_size(); ++I) {
+    if (Call.paramHasAttr(I, Attribute::NoUndef) &&
+        isa<UndefValue>(Call.getArgOperand(I))) {
----------------
nikic wrote:
> Call.isPassingUndefUB(I). You probably want to flip the checks, because the UndefValue check is cheaper. Also add tests with dereferenceable instead of noundef.
`isa<UndefValue>` seems much less likely to be true though. anyway, flipped

added dereferenceable tests on top of noundef since ints can't be dereferenceable


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D133036



More information about the llvm-commits mailing list