Open kavon opened 7 years ago
Actually, the problem only crops up if the SP_ARGNUM
argument is undef, because we get the following code:
%vreg3<def> = IMPLICIT_DEF; GR64:%vreg3
%RBP<def> = COPY %vreg3; GR64:%vreg3
%vreg6<def> = LEA64r %RIP, 1, %noreg, <MCSym=LCAFE0>, %noreg; GR64:%vreg6
MOV64mr %RBP, 1, %noreg, 17, %noreg, %vreg6<kill>; GR64:%vreg6
which turns into
%vreg6<def> = LEA64r %RIP, 1, %noreg, <MCSym=LCAFE0>, %noreg; GR64:%vreg6
MOV64mr %RBP<undef>, 1, %noreg, 17, %noreg, %vreg6; GR64:%vreg6
which makes no sense as RBP was not defined. I think this might make sense if we had started with the following instead:
%vreg3<def> = IMPLICIT_DEF; GR64:%vreg3
%RBP<def> = COPY %vreg3; GR64:%vreg3
%vreg6<def> = LEA64r %RIP, 1, %noreg, <MCSym=LCAFE0>, %noreg; GR64:%vreg6
MOV64mr %vreg3, 1, %noreg, 17, %noreg, %vreg6<kill>; GR64:%vreg6
All of the above instructions would probably be deleted safely then.
Overall, I'm not concerned with this bug right now. If there's a way to check that the value is not undef/posion
during verification (see #7 ) that'd be nice.
As you can see below, if one of the arguments to the CPSCALL is an
undef
, or in MBB speakIMPLICIT_DEF
value, we're free to eliminate that binding, which leaves theTCRETURN
referencing an unbound register.I think the solution to this is to use the call-sequence start/end instructions to protect the physical register bindings. I have a feeling that's part of what their purpose is.