[PATCH] D130248: [LoongArch] Offset folding for frameindex

Sergei Barannikov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Jul 23 14:43:32 PDT 2022


barannikov88 added inline comments.


================
Comment at: llvm/lib/Target/LoongArch/LoongArchInstrInfo.td:591
+/// Predicates
+def IsOrAdd: PatFrag<(ops node:$A, node:$B), (or node:$A, node:$B), [{
+    return isOrEquivalentToAdd(N);
----------------
You can check for both ADD and OR in one PatFrags, e.g.:
```
def add_like : PatFrags<(ops node:$lhs, node:$rhs),
                        [(add $lhs, $rhs), (or $lhs, $rhs)], [{
  return N->getOpcode() == ISD::ADD || isOrEquivalentToAdd(N);
}]>;
```
This will halve the number of patterns. Up to you, of course.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D130248



More information about the llvm-commits mailing list