[PATCH] D114716: [DAGCombiner] When combining REM ensure optimized div nodes are unique
Paul Walker via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Nov 29 09:30:40 PST 2021
paulwalker-arm accepted this revision.
paulwalker-arm added inline comments.
This revision is now accepted and ready to land.
================
Comment at: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:4439
isSigned ? visitSDIVLike(N0, N1, N) : visitUDIVLike(N0, N1, N);
- if (OptimizedDiv.getNode()) {
+ if (OptimizedDiv.getNode() && OptimizedDiv.getNode() != N) {
// If the equivalent Div node also exists, update its users.
----------------
bsmith wrote:
> paulwalker-arm wrote:
> > Can you just use `if (OptimizedDiv.getNode() != N)` here?
> Presumably not? If `OptimizedDiv` is `SDValue()`, then `getNode()` will return `nullptr` which is `!= N`, hence this check would pass, whereas currently it would fail.
Are yes, I see what you mean. I guess this hasn't been hit before because the code is protected by `TLI.isIntDivCheap` which is the only other time `N` is returned untouched.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D114716/new/
https://reviews.llvm.org/D114716
More information about the llvm-commits
mailing list