[PATCH] D114716: [DAGCombiner] When combining REM ensure optimized div nodes are unique

Bradley Smith via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 29 09:21:10 PST 2021


bsmith added inline comments.


================
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.
----------------
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.


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