[PATCH] D144319: [SimplifyCFG] Check if the return instruction causes undefined behavior
Nikita Popov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Feb 20 08:04:36 PST 2023
nikic added inline comments.
================
Comment at: llvm/lib/Transforms/Utils/SimplifyCFG.cpp:7138
+ if (C->isNullValue() && HasNoUndefAttr &&
+ Ret->getFunction()->hasRetAttribute(Attribute::NonNull)) {
+ return true;
----------------
DianQK wrote:
> nikic wrote:
> > Not sure whether that's the cause of the sanitizer failures, but I just realized that we're missing a check for `!PtrValueMayBeModified` here -- this is not a provenance based fold, so it must be exactly the null pointer.
> I found the `DeadArgumentElimination` pass will change `define internal noundef zeroext i1 @...SelectionFinder12TraverseStmt...` to `define fastcc void @...SelectionFinder12TraverseStmt...`. Then the `if (isa<UndefValue>(C) && HasNoUndefAttr) return true;` statement is no longer a sound decision.
Not sure I understand. Once the return type is changed to void there is no longer a noundef attribute (or return instruction operand, for that matter).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D144319/new/
https://reviews.llvm.org/D144319
More information about the llvm-commits
mailing list