I think I'm getting a bit closer to the problem. I've found that the call to InlineSpiller::foldMemoryOperand() inside InlineSpiller::spillAroundUses() is causing the problems. <br>As a test, I removed that call and with your yesterday's patch I'm not getting any errors at all, the code generated is the same one as with the call. This is happening when InlineSpiller::foldMemoryOperand() returns true, so a very wild guess is that maybe when calling LIS.ReplaceMachineInstrInMaps() the new SlotIndex created is not of type Slot_EarlyClobber since the MI being replaced is a COPY with no EC ops.<br>
<br>I've also found a way for you to reproduce this error in a simple way with the ARM backend with -march=thumb:<br>Just add "Constraints = "@earlyclobber $Rt" in" to the tLDRspi instruction in ARMInstrThumb.td (around line 620) and compile the following code with llc at -O3:<br>
<br>target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:32:64-v128:32:128-a0:0:32-n32-S32"<br>target triple = "armv4t-generic-generic"<br>define float @f3(float %days) nounwind readnone {<br>
entry:<br>  %mul = fmul float %days, 0x3FEF8A6C60000000<br>  %add = fadd float %mul, 0x40718776A0000000<br>  %mul1 = fmul float %days, 0x3FEF8A09A0000000<br>  %add2 = fadd float %mul1, 0x4076587740000000<br>  %mul3 = fmul float %days, 0x3E81B35CC0000000<br>
  %sub = fsub float 0x3FFEA235C0000000, %mul3<br>  %call = tail call float @dsin(float %add2) nounwind readnone<br>  %mul4 = fmul float %sub, %call<br>  %mul5 = fmul float %days, 0x3E27C04CA0000000<br>  %sub6 = fsub float 0x3F94790B80000000, %mul5<br>
  %mul7 = fmul float %add2, 2.000000e+00<br>  %call8 = tail call float @dsin(float %mul7) nounwind readnone<br>  %mul9 = fmul float %sub6, %call8<br>  %add10 = fadd float %mul4, %mul9<br>  %add11 = fadd float %add, %add10<br>
  %mul12 = fmul float %days, 0x3E13C5B640000000<br>  %sub13 = fsub float 0x3F911C1180000000, %mul12<br>  %mul14 = fmul float %add, 2.000000e+00<br>  %call15 = tail call float @dsin(float %mul14) nounwind readnone<br>  %mul16 = fmul float %call15, 0x3FF1F736C0000000<br>
  %mul17 = fmul float %sub13, 2.000000e+00<br>  %mul19 = fmul float %mul17, %call<br>  %sub20 = fsub float %mul16, %mul19<br>  %mul21 = fmul float %sub13, 4.000000e+00<br>  %mul22 = fmul float %mul21, 0x3FF1F736C0000000<br>
  %mul24 = fmul float %mul22, %call<br>  %call26 = tail call float @dcos(float %mul14) nounwind readnone<br>  %mul27 = fmul float %mul24, %call26<br>  %add28 = fadd float %sub20, %mul27<br>  %call29 = tail call float @dsin(float %add11) nounwind readnone<br>
  %mul30 = fmul float %call29, 0x3FF0AB6960000000<br>  %call31 = tail call float @dasin(float %mul30) nounwind readnone<br>  %add32 = fadd float %call31, %add28<br>  ret float %add32<br>}<br><br>declare float @dsin(float) nounwind readnone<br>
declare float @dcos(float) nounwind readnone<br>declare float @dasin(float) nounwind readnone<br><br>You will get the following error:<br><br>*** Bad machine code: No live range at def ***<br>- function:    f3<br>- basic block: entry 0x9e5d2bc (BB#0) [0B;3360B)<br>
- instruction: 2440e    %vreg51<earlyclobber,def> = tLDRspi <fi#0>, 0, pred:14, pred:%noreg; mem:LD4[FixedStack0] tGPR:%vreg51<br>- operand 0:   %vreg51<earlyclobber,def><br>2440e is not live in [2440r,2976r:0)  0@2440r<br>
<br>*** Bad machine code: Early clobber def must be at an early-clobber slot ***<br>- function:    f3<br>Valno #0 is defined at 2440r in [2440r,2976r:0)  0@2440r2440r<br>LLVM ERROR: Found 2 machine code errors.<br><br>Hope this helps a bit.<br>
<br>Thanks!<br>