[PATCH] D51431: [WIP][IPSCCP] Add lattice value for != constant and propagate nonnull.
Florian Hahn via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 29 09:34:31 PDT 2018
fhahn added a comment.
In https://reviews.llvm.org/D51431#1217705, @xbolva00 wrote:
> Does this patch + https://reviews.llvm.org/D50039 optimizes following code?
>
> int l = strlen(s);
> if (!s) <-- remove this condition
>
> return -1;
>
> return len;
Nope, this patch would add nonnull to the argument in this case
if (!s) {
return -1:
} else {
return strlen(s)
}
Once we have a notconst lattice value, we could however eliminate the condition in with some more work:
1. for call sites with nonnull arguments, we could create a ssa copy of the argument and mark it as `not null`. (The copy ensures we only use the fact in places dominated by the call site. Not sure if inserting copies for that will have an impact on the runtime, so it might not work overall)
2. deduce false for "x == null" with x `not null`
https://reviews.llvm.org/D51431
More information about the llvm-commits
mailing list