[llvm-commits] [llvm] r101930 - /llvm/trunk/lib/CodeGen/MachineLICM.cpp
Jakob Stoklund Olesen
stoklund at 2pi.dk
Tue Apr 20 12:45:29 PDT 2010
On Apr 20, 2010, at 12:22 PM, Evan Cheng wrote:
>
> On Apr 20, 2010, at 11:45 AM, Jakob Stoklund Olesen wrote:
>
>> Author: stoklund
>> Date: Tue Apr 20 13:45:47 2010
>> New Revision: 101930
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=101930&view=rev
>> Log:
>> When MachineLICM is hoisting a physical register after regalloc, make sure the
>> register is not killed in the loop.
>>
>> This fixes 188.ammp on ARM where the post-ra scheduler would grab a register
>> that looked available but wasn't.
>>
>> A testcase would be huge and fragile, sorry.
>> + for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) {
>> + MachineOperand &MO = MI->getOperand(i);
>> + if (!MO.isReg() || !MO.getReg() || MO.isDef()) continue;
>> + if (MO.getReg() == Reg || TRI->isSuperRegister(Reg, MO.getReg()))
>
> Shouldn't this checks for alias rather than super register? It's bad if any part of the loop invariant is modified.
I am pretty sure the above is safe since nobody would steal a register with a live super-register (Right?!). There is not going to be any sub-reg redefines, or we wouldn't do the hoist in the first place, so it doesn't really make a difference as far as I can tell.
TRI->regsOverlap(Reg, MO.getReg()) works too, feel free to change it.
/jakob
More information about the llvm-commits
mailing list