[PATCH] D136442: [GISel] Add (fsub +-0.0, X) -> fneg combine

Matt Arsenault via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 31 19:28:46 PDT 2022


arsenm added inline comments.


================
Comment at: llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp:5201
+  const auto LHSCst = Ty.isVector()
+                          ? getFConstantSplat(LHS, MRI, /* allowUndef */ false)
+                          : getFConstantVRegValWithLookThrough(LHS, MRI);
----------------
Probably should allow undefs 


================
Comment at: llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp:5212
+  if (LHSCst->Value.isPosZero())
+    return MI.getFlags() & MachineInstr::FmNsz;
+
----------------
MI.getFlag(MachineInstr::FmNsz)


================
Comment at: llvm/test/CodeGen/AMDGPU/GlobalISel/combine-fsub-fneg.mir:367
+...
+
----------------
Test for the undef vector element case


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D136442



More information about the llvm-commits mailing list