[PATCH] D153838: [MCP] Optimize copies from undef

Pierre van Houtryve via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 27 22:55:40 PDT 2023


Pierre-vh marked 2 inline comments as done.
Pierre-vh added inline comments.


================
Comment at: llvm/lib/CodeGen/MachineCopyPropagation.cpp:486-487
+  if (!CopyOperands->Source->isUndef()) {
+    PrevCopy->getOperand(PrevCopyOperands->Source->getOperandNo())
+        .setIsUndef(false);
+  }
----------------
arsenm wrote:
> Pierre-vh wrote:
> > foad wrote:
> > > Doesn't `PrevCopyOperands->Source->setIsUndef(false)` work?
> > The reference to the MachineOperand is const, unfortunately
> You can change that?
It's `struct DestSourcePair`, it's sometimes initialized from `const MachineInstr` so I can't just remove the const qualifier there.

An alternative may be to create a copy of that struct and name it `MutableDestSourcePair`, and use it where relevant. 


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D153838



More information about the llvm-commits mailing list