[llvm] [GISel][AArch64][AMDGPU][RISCV] Canonicalize (sub X, C) -> (add X, -C) (PR #114309)
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Thu Oct 31 10:33:34 PDT 2024
================
@@ -2041,6 +2041,28 @@ void CombinerHelper::applyCombineMulToShl(MachineInstr &MI,
Observer.changedInstr(MI);
}
+bool CombinerHelper::matchCombineSubToAdd(MachineInstr &MI,
+ BuildFnTy &MatchInfo) {
+ GSub &Sub = cast<GSub>(MI);
+
+ LLT Ty = MRI.getType(Sub.getReg(0));
+
+ if (!isLegalOrBeforeLegalizer({TargetOpcode::G_ADD, {Ty}}))
+ return false;
----------------
topperc wrote:
Done
https://github.com/llvm/llvm-project/pull/114309
More information about the llvm-commits
mailing list