[PATCH] D97244: [SimplifyCFG] Update passingValueIsAlwaysUndefined to check more attributes
Guozhi Wei via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Mar 16 18:04:56 PDT 2021
Carrot added inline comments.
================
Comment at: llvm/include/llvm/IR/InstrTypes.h:1663
+ paramHasAttr(ArgNo, Attribute::Dereferenceable) ||
+ // dereferenceable implies noundef, and null is a well-defined value.
+ paramHasAttr(ArgNo, Attribute::DereferenceableOrNull);
----------------
aqjune wrote:
> Carrot wrote:
> > It is not true for "this" parameter. It always has dereferenceable and nonnull attribute, if "this" is not used in the function, passing in undef is no problem.
> >
> > It causes wrong code generated for our application.
> > passing in undef is no problem
>
> This property holds for `nonnull` and `align`, but not for the three attributes listed here. Passing undef to these is UB because LangRef says violation of these is UB. `dereferenceable` paragraph says:
>
> ```
> The pointer should be well defined, otherwise it is undefined behavior
> ```
>
> Is your program being transformed from passing valid `this` to passing `undef` by some pass? Then, the pass is the buggy one.
Since "this" is not used in the function, DeadArgumentElimination pass changes all callers' valid "this" to undef.
@spatel, what's your opinion on where to fix it?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D97244/new/
https://reviews.llvm.org/D97244
More information about the llvm-commits
mailing list