[PATCH] D112827: [AMDGPU][GlobalISel] Fold G_FNEG above when users cannot fold mods

Mirko Brkusanin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 10 10:09:09 PST 2021


mbrkusanin added inline comments.


================
Comment at: llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp:162-170
+void CombinerHelper::replaceOpcodeWith(MachineRegisterInfo &MRI,
+                                       MachineInstr &FromMI,
+                                       unsigned ToOpcode) const {
+  Observer.changingInstr(FromMI);
+
+  FromMI.setDesc(Builder.getTII().get(ToOpcode));
+
----------------
arsenm wrote:
> I thought this already existed
There is LegalizerHelper::changeOpcode but would instantiating LegalizerHelper just for this be practical?

Observer is a protected member so it can't be used directly which is why I needed this.


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

https://reviews.llvm.org/D112827



More information about the llvm-commits mailing list