[PATCH] D144535: [RISCV] Enable machine copy propagation for copy-like instructions
Wang Pengcheng via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Feb 22 22:27:30 PST 2023
pcwang-thead marked 2 inline comments as done.
pcwang-thead added inline comments.
================
Comment at: llvm/lib/Target/RISCV/RISCVTargetMachine.cpp:344
+
+ if (TM->getOptLevel() >= CodeGenOpt::Default && EnableRISCVCopyPropagation)
+ addPass(createMachineCopyPropagationPass(true));
----------------
craig.topper wrote:
> pcwang-thead wrote:
> > craig.topper wrote:
> > > Can this be before the two Expand passes? Especially the one that says "last possible moment"?
> > How about between the two Expand passes? we may produce MVs when expanding `PseudoCCMOVGPR`.
> Would optimizing them break the macrofusion that `PseudoCCMOVGPR` represents?
After thinking, I think MVs produced by `PseudoCCMOVGPR` won't be eliminatable.
```
dst = falsev
branch
| \
| TrueBB:
| dst = truev
| /
MergeBB:
usage of dst
```
For these kinds of CFGs, `truev` could be propagated only if we do tail duplication and CFG becomes like below, but we won't run tail duplication again after expanding.
```
dst = falsev
branch
| \
MergeBB TrueBB:
| dst = truev
| duplicated MergeBB
| /
Successor of MergeBB
```
So I think it has no impact on the macrofusion.
----
Another reason why we inserted it after expanding pseudos is because some internal pseudos in our downstream will produce MVs.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D144535/new/
https://reviews.llvm.org/D144535
More information about the llvm-commits
mailing list