This reverts commit 6c062b7641623b1cfd2f359edb3118a4810c965e.
The testcase was invalid and failed the verifier after LiveIntervals
construction. I am unable to see the original error when I correct the
value numbering.
Differential D158324
Revert "[RegisterCoalescing] Don't move COPY if it would interfere with another value" arsenm on Aug 18 2023, 4:10 PM. Authored by
Details
Diff Detail Event Timeline
Comment Actions One thing I don't fully understand is that the description says that the test case was wrong and did not pass verification. But you've also reverted the code and not only changed the test case. But I figure the modified test case would pass both with and without the code changes. So do you want to revert the code changes as well since there is no motivating test case? If so it would be nice to say something in the commit message about that (that the code is reverted even if there is no proof that it was incorrect?). Btw. I'll try to dig a bit to see if I can track this patch back to some other test case (I suspect that uabelho has used mips64 just to find an upstream target showing the original bug). Comment Actions It does
That is what this does
Not sure what you mean, if you add -verify-coalescing to the test it fails.
Comment Actions The test case failed verification even before (or without) running the register-coalescer. So as the commit message says, the test case seems broken. But I thought it was a bit unclear in the commit message that it also removes a defensive check in removePartialRedundancy. I doubt that we will trigger the optimization in more cases (and if it does, then that would be faulty). So something saying that we no longer think that the problematic situation can occur for valid input. And if that assumption is wrong, then we hopefully will catch it in regression tests with verifiers activates since the defensive check in removePartialRedundancy is removed. I've however found our downstream test case now. And that one is not failing verification on the input. I came up with these adjustments, that without the patch by uabelho would end up with "Assertion `SlotIndex::isEarlierInstr(Def, S->start) && "Already live at def"' failed.": # RUN: llc -march=mips64 -o - %s -run-pass=register-coalescer -verify-coalescing | FileCheck %s --- name: f tracksRegLiveness: true body: | bb.0: %0:gpr32 = ADDiu $zero, 0 %1:gpr32 = COPY %0 %1:gpr32 = ADDiu %1, 1 BEQ %0, $zero, %bb.3, implicit-def $at J %bb.1, implicit-def dead $at bb.1: J %bb.2, implicit %1, implicit-def dead $at bb.2: %1:gpr32 = COPY %0 %0:gpr32 = COPY %1 BEQ %0:gpr32, $zero, %bb.2, implicit-def $at bb.3: %4:gpr32 = ADDiu %1, 1 ... Afaict that test case passes verification on the test input. Comment Actions I put up a patch to fix the testcase rather than reverting the whole patch (which I think is still needed): Thanks @arsenm for pointing the problem out and @bjope for the testcase update suggestion. |
Something weird here. But since it talks about hoisting I figure this used to refer to the COPY in bb.2. So then it should be %3 instead of %1.
But then the "%3 is used in the BEQ" becomes weird. But now when it says %1 it is weird as well, because I don't see that %1 is used in any BEQ.