[PATCH] D87936: [GISel] Add new combines for G_ADD

Jessica Paquette via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 6 09:25:11 PDT 2022


paquette accepted this revision.
paquette added a comment.
This revision is now accepted and ready to land.

I think this looks reasonable now? I basically only have one nit.



================
Comment at: llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp:5644
+  // (B - A) + A -> B
+  auto CheckFold = [&](Register &MaybeSub, Register &MaybeSameReg) {
+    Register Reg;
----------------
FYI, in Register.h:

```
/// Wrapper class representing virtual and physical registers. Should be passed
/// by value.
class Register {
  unsigned Reg;
```

Since neither `MaybeSub` nor `MaybeSameReg` is being mutated, they might as well be passed by value.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D87936



More information about the llvm-commits mailing list