[PATCH] D65150: [InstSimplify] Drop leftover "division-by-zero guard" around `@llvm.umul.with.overflow` overflow bit
Sanjay Patel via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 29 13:49:46 PDT 2019
spatel added a comment.
In D65150#1603873 <https://reviews.llvm.org/D65150#1603873>, @nikic wrote:
> In D65150#1603860 <https://reviews.llvm.org/D65150#1603860>, @nikic wrote:
>
> > I think this is something of a recurring pattern (not so much the and/or forms, but the original phi/select form), where we have `select (x != C1), y, C2`, where it turns out that `y[x = C1] == C2` and thus the whole expression reduces to `y` (same with phi's). We might want to invest in a general solution to this problem. Something along the lines of finding this kind of pattern, then checking `y` backwards for uses of `x` (to a small depth) and if we find them, replace `x` with `C1`, run InstSimplify over it and see if it reduces to `C2` in the end.
>
>
> After thinking about this a bit more, a general solution is probably fairly hard because we would need an InstSimplify mode that does not use any UB or poison-based reasoning.
Not sure if it's exactly what you're imagining, but we have an 'identity constant' fold for select with binops. See foldSelectBinOpIdentity(). Extend getBinOpIdentity() to handle intrinsics as well as standard binop opcodes?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D65150/new/
https://reviews.llvm.org/D65150
More information about the llvm-commits
mailing list