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

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 4 09:16:20 PST 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");
----------------
arsenm wrote:

Yes, this should be cleaned up at some point 

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


More information about the llvm-commits mailing list