[PATCH] D94180: [SimplifyCFG] Optimize CFG when null is passed to a function with nonnull argument.
Johannes Doerfert via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jan 6 11:31:05 PST 2021
jdoerfert added a comment.
test missing?
================
Comment at: llvm/lib/Transforms/Utils/SimplifyCFG.cpp:6600
+ if (Arg == I &&
+ CB->paramHasAttr(CB->getArgOperandNo(&Arg), Attribute::NonNull))
+ return true;
----------------
nikic wrote:
> Two issues:
>
> 1. I believe this is subtle incorrect in conjunction with the GEP rule above. Accessing memory at `gep null, x` is always UB, but passing it to a nonnull argument isn't UB as long as x is not zero.
>
> 2. I'm not sure what the current state on this is (@aqjune), but I believe the plan is to make passing null to nonnull argument poison rather than UB. This optimization would only be valid using nonnull + noundef.
FWIW, I'm, forever, in favor of making nonnull violation poison not UB.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D94180/new/
https://reviews.llvm.org/D94180
More information about the llvm-commits
mailing list