Tue, Oct 8
Sun, Sep 29
Thu, Sep 26
Hi @jgorbe , indeed we still get some enhance opportunity for this patch, such as considering register pressure. I'm wondering if the regression was caused by spilling.
Tue, Sep 24
Sun, Sep 22
I think the test can be simplified more, kinda like
# RUN: llc -O3 -mtriple=powerpc64le-unknown-linux-gnu -stop-after=ppc-pre-emit-peephole -verify-machineinstrs %s -o - | FileCheck %s --- name: foo alignment: 4 tracksRegLiveness: true body: | bb.0.entry: liveins: $r3 renamable $r4 = LI 0 renamable $r5 = SRW renamable $r3, renamable killed $r4 $r3 = COPY renamable killed $r5 BLR implicit $lr, implicit $rm, implicit $r3 ...
And a NFC patch to pre-commit the test would also be preferable.
Thu, Sep 19
Sep 18 2019
Seems we don't need the terminal BB constraint. I'll prepare another patch to address this issue.
Sep 16 2019
Added test case that copy has side effect.
Updated the patch. Currently we don't handle non-trivial copy which has more than 2 operands(Cuz I notice current copy forward propagation algorithm considers copy's implicit operands).
Sep 15 2019
Sep 12 2019
Pre-committed machine-backward-cp.mir, including edge cases as far as I can imagine. Some test cases remain unchanged, reviewers might have to read whole diff of machine-backward-cp.mir to see unchanged cases.
Sep 10 2019
Sep 9 2019
@gribozavr Please let me know if the latest patch resolves the issue.
When replacing copy's src with copy's def, I missed a point that copy's def is clobbered by selected SrcMI and Tracker should be informed.
Hi @gribozavr , thanks for the affirmative action. Could you provide me your command to generate the executable and the target platform you compile to?
Sep 8 2019
Check if SrcOp is tied or an implicit-def.
Sep 7 2019
Sep 6 2019
Added reserved register check on SrcOp.getReg().
Hi @craig.topper , would you mind having a look at changes of X86 test cases?
Sep 4 2019
Sep 3 2019
Added comment for bool MachineCopyPropagation::eraseIfRedundant(MachineInstr &Copy).
Rebased and updated tests.
Sep 2 2019
Aug 29 2019
Aug 22 2019
Aug 19 2019
Since this patch has long been not updated, I'll close it and plan another patch that also works for PowerPC.
Hi @RKSimon , currently I'm not working on it. I should have abandoned this patch. I might have another patch which also works for PowerPC.
Aug 18 2019
Updated the patch and summary.
Aug 14 2019
Updated patch to remove redundant copies by implementing backward copy propagation in machine-cp.
Aug 13 2019
// $reg0 = OP .... // ... // $reg1 = COPY $reg0
If we can be sure that $reg0 is renamable, and no use of $reg0 or $reg1 in between (and of course there might be other restrictions, like ReservedReg etc),
we should be able to remove the COPY here.// `$reg1` = OP .. // ...
One concern here, there might be uses of $reg0 in succ BBs. To overcome it, we might constraint this opt in terminal BBs considering current machine-cp working on single BB. To summarize, without complex uses and defs(thus we don't need to do complex replace-uses-with after RA), in a terminal BB we should have
$reg0 = OP ... ... <<< No uses of $reg0 and $reg1 $reg1 = COPY $reg0 <<< $reg0 is killed ... <RET>
Aug 12 2019
Have you considered extend MachineCopyPropagation to cover this? Looks like to me that this is a 'backward' COPY propagation.
Aug 8 2019
Aug 6 2019
Aug 1 2019
Updated patch to use llvm::Register::isVirtualRegister.
Jul 31 2019
Jul 25 2019
FYI, I should have make getDefMIPostRA public. So I committed another NFC patch to make getDefMIPostRA public. https://reviews.llvm.org/rG985e52a4c1c6
Jul 22 2019
Jul 21 2019
Jul 20 2019
Jul 19 2019
Jul 18 2019
Use hasMinSize to check if optimized for size.
Btw, this change breaks multiple (more than two) hoisting to common dominator. I've tested this patch for the original test case taken from here: https://bugs.llvm.org/show_bug.cgi?id=38917. There are several comparisons giving 96 > 40 + 10, 96 > 29 + 10, 96 > 18 + 10 (so no hoisting at all), meanwhile 96 < 97 = 40 + 29 + 18 + 10.
However I do not see easy solution for this issue.
Jul 17 2019
Updated patch following @dmgreen 's suggestion.