[PATCH] D96614: [AMDGPU][GlobalISel] Transform (fsub (fmul x, y), z) -> (fma x, y, -z)

Jay Foad via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri May 28 07:51:58 PDT 2021


foad added a comment.

Does this assume that all targets can do the fneg for free? Or can a target choose to fold only `(fadd (fmul x, y), z)`, not `(fsub (fmul x, y), z)` ?



================
Comment at: llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp:4438
+
+  // This reffers to instruction MI1 having more uses than instruction MI2,
+  // 1 if that's the case, 0 if they're equal, else it's -1.
----------------
Typo "refers", and they're called MI0 and MI1.


================
Comment at: llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp:4443
+      isContractableFMul(*MI1, AllowFusionGlobally)) {
+    if (std::distance(MRI.use_instr_nodbg_begin(MI0->getOperand(0).getReg()),
+                      MRI.use_instr_nodbg_end()) >
----------------
Use hasMoreUses() from the previous patch.


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

https://reviews.llvm.org/D96614



More information about the llvm-commits mailing list