[llvm-commits] [llvm] r146604 - in /llvm/trunk: lib/CodeGen/MachineSink.cpp test/CodeGen/ARM/2011-12-14-machine-sink.ll

Akira Hatanaka ahatanak at gmail.com
Fri Dec 23 10:43:41 PST 2011


The problem seems to be that InstructionStoresToFI iterates over
MachineMemOperands to see if the instruction is a store to a
particular frame object. It doesn't return true if there are no
MachineMemOperands.

static bool InstructionStoresToFI(const MachineInstr *MI, int FI)
{
   for (MachineInstr::mmo_iterator o = MI->memoperands_begin(),
          oe = MI->memoperands_end(); o != oe; ++o) {
     if (!(*o)->isStore() || !(*o)->getValue())
       continue;
...
}

It looks like the FI could be retrieved and checked by calling
TII->isStoreToStackSlot(MI, FI) regardless of whether there are
MachineMemOperands attached, but there might be a reason I don't see
for examining the MachineMemOperands instead.

On Thu, Dec 22, 2011 at 5:16 PM, Jakob Stoklund Olesen <stoklund at 2pi.dk> wrote:
>
> On Dec 22, 2011, at 10:10 AM, Akira Hatanaka wrote:
>
>> It turns out that the failure was caused by a bug in
>> MipsInstrInfo::storeRegToStackSlot and loadRegFromStackSlot. A
>> MachineMemOperand was not being added to the generated instruction,
>> which was causing MachineLICM to incorrectly determine it is safe to
>> move a load out of a loop. So this wasn't a mis-compilation caused by
>> a bug in Machine Sink or the register allocator.
>
> Nice!
>
> It does sound like an LICM bug, though. A load or store without any memory operands should be treated as volatile, aliases-everything.
>
> /jakob
>



More information about the llvm-commits mailing list