[llvm-commits] [llvm] r139765 - in /llvm/trunk: include/llvm/CodeGen/LiveInterval.h lib/CodeGen/RegisterCoalescer.cpp test/CodeGen/X86/2011-09-14-valcoalesce.ll
Andrew Trick
atrick at apple.com
Thu Sep 15 09:19:36 PDT 2011
On Sep 14, 2011, at 7:46 PM, Jakob Stoklund Olesen wrote:
>
> On Sep 14, 2011, at 6:09 PM, Andrew Trick wrote:
>
>> Author: atrick
>> Date: Wed Sep 14 20:09:33 2011
>> New Revision: 139765
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=139765&view=rev
>> Log:
>> [regcoalescing] bug fix for RegistersDefinedFromSameValue.
>>
>> + /// getVNInfoBefore - Return the VNInfo that is live up to but not
>> + /// necessarilly including Idx, or NULL. Use this to find the reaching def
>> + /// used by an instruction at this SlotIndex position.
>> + VNInfo *getVNInfoBefore(SlotIndex Idx) const {
>> + const_iterator I = FindLiveRangeContaining(Idx.getPrevIndex());
>> + return I == end() ? 0 : I->valno;
>> + }
>
> Nice!
>
>> --- llvm/trunk/test/CodeGen/X86/2011-09-14-valcoalesce.ll (added)
>> +++ llvm/trunk/test/CodeGen/X86/2011-09-14-valcoalesce.ll Wed Sep 14 20:09:33 2011
>> @@ -0,0 +1,115 @@
>> +; RUN: llc < %s -march=x86
>> +;
>> +; Test RegistersDefinedFromSameValue. We have multiple copies of the same vreg:
>> +; while.body85.i:
>> +; vreg1 = copy vreg2
>> +; vreg2 = add
>> +; critical edge from land.lhs.true.i -> if.end117.i:
>> +; vreg27 = vreg2
>> +; critical edge from land.lhs.true103.i -> if.end117.i:
>> +; vreg27 = vreg2
>> +; if.then108.i:
>> +; vreg27 = vreg1
>> +;
>> +; Prior to fixing PR10920 401.bzip miscompile, the coalescer would
>> +; consider vreg1 and vreg27 to be copies of the same value. It would
>> +; then remove one of the critical edge copes, which cannot safely be removed.
>> +
>
> How would this test actually fail? The miscompilation didn't cause llc to crash, right?
>
> /jakob
>
Nope. And verification does catch it. We really need post-coalescing interference verification based on SSA values.
I struggled with how to add CHECK lines that weren't ridiculously fragile. Block's are "randomly" shuffled, copies "randomly" coalesced on different paths, and registers "randomly" renamed. I can try to add some though if you think it's worthwhile.
I figured at least the test provides an example of an interesting case to go along with the PR.
-Andy
More information about the llvm-commits
mailing list