[llvm] [GISel][AArch64][AMDGPU][RISCV] Canonicalize (sub X, C) -> (add X, -C) (PR #114309)

Thorsten Schütt via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 30 15:06:39 PDT 2024


================
@@ -2041,6 +2041,28 @@ void CombinerHelper::applyCombineMulToShl(MachineInstr &MI,
   Observer.changedInstr(MI);
 }
 
+bool CombinerHelper::matchCombineSubToAdd(MachineInstr &MI,
+                                          BuildFnTy &MatchInfo) {
+  assert(MI.getOpcode() == TargetOpcode::G_SUB && "Expected a G_SUB");
----------------
tschuett wrote:

```
GSub *Sub = cast<GSub>(&MI);
```

https://github.com/llvm/llvm-project/pull/114309


More information about the llvm-commits mailing list