[llvm] [SimplifyCFG] Switch to use `paramHasNonNullAttr` (PR #125383)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Sun Feb 2 00:44:44 PST 2025
================
@@ -8276,15 +8276,17 @@ static bool passingValueIsAlwaysUndefined(Value *V, Instruction *I, bool PtrValu
return true;
if (C->isNullValue()) {
- for (const llvm::Use &Arg : CB->args())
- if (Arg == I) {
- unsigned ArgIdx = CB->getArgOperandNo(&Arg);
- if (CB->isPassingUndefUB(ArgIdx) &&
- CB->paramHasAttr(ArgIdx, Attribute::NonNull)) {
- // Passing null to a nonnnull+noundef argument is undefined.
- return !PtrValueMayBeModified;
+ if (C->getType()->isPointerTy()) {
+ for (const llvm::Use &Arg : CB->args())
----------------
nikic wrote:
We should switch this code to work on `Use` instead of `User` so we can directly get the right argument...
https://github.com/llvm/llvm-project/pull/125383
More information about the llvm-commits
mailing list