[PATCH] D122539: [SelectionDAG][DAGCombiner] Reuse exist node by reassociate

Simon Pilgrim via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 14 00:32:01 PDT 2022


RKSimon added a comment.

A few style comments



================
Comment at: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1022
   const APInt &C2APIntVal = C2->getAPIntValue();
-  if (C1APIntVal.getBitWidth() > 64 || C2APIntVal.getBitWidth() > 64)
-    return false;
+  if (C1) {
+    if (N0.hasOneUse())
----------------
```
if (auto *C1 = dyn_cast<ConstantSDNode>(N0.getOperand(1))) {
```


================
Comment at: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1057
+  } else {
+    if (GlobalAddressSDNode *GA =
+            dyn_cast<GlobalAddressSDNode>(N0.getOperand(1)))
----------------
```
if (auto *GA = dyn_cast<GlobalAddressSDNode>(N0.getOperand(1)))
```


================
Comment at: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1064
+      auto LoadStore = dyn_cast<MemSDNode>(Node);
+      if (LoadStore) {
+        // Is x[offset2] a legal addressing mode? If so then
----------------
(style) Early-out:
```
auto *LoadStore = dyn_cast<MemSDNode>(Node);
if (!LoadStore)
  return false;
```


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D122539/new/

https://reviews.llvm.org/D122539



More information about the llvm-commits mailing list