Currently we generate the following code leading to the post-pinvoke check for GC:
CMP32mi8 %RCX<kill>, 1, %noreg, 0, %noreg, 0, %EFLAGS<imp-def>; mem:LD4[bitcast (i64* @CaptureThreadGlobal to i32*)]
%EDX<def> = COPY %EFLAGS
MOV32mr %RBP, 1, %noreg, -92, %noreg, %EDX<kill>; mem:ST4[FixedStack12]
JE_1 <BB#8>, %EFLAGS<imp-use>
We should be able to avoid the flag spill by passing the flag value to the pause, instead of the result of the flag compare.