[PATCH] D87939: [PeepholeOptimizer] Enhance the redundant COPY elimination.

Quentin Colombet via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 21 10:58:14 PDT 2020


qcolombet requested changes to this revision.
qcolombet added a comment.
This revision now requires changes to proceed.

Hi @hliao,

I must be missing something, but it feels to me that this patch is actually making the situation worse.

Could you look at my example inlined below and explain how it would still work with this patch?

Cheers,
-Quentin



================
Comment at: llvm/lib/CodeGen/PeepholeOptimizer.cpp:1409
+
+  if (CopyMIs.insert(std::make_pair(SrcPair, &MI)).second) {
     // First copy of this reg seen.
----------------
I am not convinced this patch is an improvement at removing redundant copy instructions.

It seems to me we would only consider redundant copies for matching sub register whereas previously we would have propagated whole copies.
E.g., previously for
```
%1 = COPY %0
%2 = COPY %0:sub1
```
We would have replaced `%2` with `%1:sub1`, but unless I miss something, with this new patch, we won't see `%2` as a redundant copy anymore.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D87939



More information about the llvm-commits mailing list