<div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><div><div class="h5"><div><div><blockquote type="cite"><p><br>

> +    for (unsigned IO = 0, EO = Instr.getNumOperands(); IO != EO; ++IO) {<br>
> +      const MachineOperand &MO = Instr.getOperand(IO);<br>
> +      if (MO.isRegMask() && MO.clobbersPhysReg(X86::EFLAGS))<br>
> +        return false;<br>
> +      if (!MO.isReg()) continue;<br>
> +<br>
> +      // This instruction modifies or uses EFLAGS before we find a SUB.<br>
> +      // We can't do this transformation.<br>
> +      if (MO.getReg() == X86::EFLAGS)<br>
> +        return false;<br>
> +    }<br></p><p>Please hoist this loop into a helper function. Ideally on MachineInstr so others can use it. It seems generically useful.<br>  </p></blockquote></div></div></div></div></div></blockquote><div>Instead of hoisting this loop, please take a look at MI->modifiesRegister and MI->readsRegister.  I think calling both should match the functionality here.  I think MI->readsWritesVirtualRegister matches it even better, but that function specifically mentions virtual registers in its name even though from its implementation I think it would be safe here on the EFLAGS physical register.</div>
<div><br></div><div>Thanks,</div><div>Pete </div></div>