Skip to content

Instantly share code, notes, and snippets.

@jmorse
Created August 28, 2020 13:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jmorse/bbab447ef6e8f9f596fbceabf188cf1e to your computer and use it in GitHub Desktop.
Save jmorse/bbab447ef6e8f9f596fbceabf188cf1e to your computer and use it in GitHub Desktop.
MIR after register coalescing
body: |
bb.0.entry:
successors: %bb.1(0x80000000)
%7:gr64 = IMPLICIT_DEF
bb.1.for.body.i.i.i.i:
successors: %bb.3(0x30000000), %bb.2(0x50000000)
%1:gr64 = MOV64rm %7, 1, $noreg, 0, $noreg :: (load 8 from %ir.__first.addr.04.i.i.i.i1)
%7:gr64 = ADD64ri8 %7, 16, implicit-def dead $eflags
CMP64rr %1, %7, implicit-def $eflags
JCC_1 %bb.3, 4, implicit killed $eflags, debug-location !3792
JMP_1 %bb.2, debug-location !3792
bb.2.if.then.i.i.i.i.i.i.i:
successors: %bb.3(0x80000000)
DBG_VALUE %7, $noreg, !3850, !DIExpression(), debug-location !3902
ADJCALLSTACKDOWN64 0, 0, 0, implicit-def dead $rsp, implicit-def dead $eflags, implicit-def dead $ssp, implicit $rsp, implicit $ssp, debug-location !3905
$rdi = COPY %1, debug-location !3905
CALL64pcrel32 @_ZdlPv, csr_64, implicit $rsp, implicit $ssp, implicit killed $rdi, implicit-def $rsp, implicit-def $ssp, debug-location !3905
ADJCALLSTACKUP64 0, 0, implicit-def dead $rsp, implicit-def dead $eflags, implicit-def dead $ssp, implicit $rsp, implicit $ssp, debug-location !3905
bb.3._ZSt8_DestroyINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEvPT_.exit.i.i.i.i:
successors: %bb.1(0x80000000)
%7:gr64 = ADD64ri8 %7, 16, implicit-def dead $eflags
JMP_1 %bb.1
@jmorse
Copy link
Author

jmorse commented Aug 28, 2020

Observe that, versus the pre-phi-elimination in [0] where the DBG_VALUE refers to a PHI, here it refers to the def from the ADD64ri8, which is incorrect.

[0] https://gist.github.com/jmorse/3d9972e91cdf94b093f14501a4d14829

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment