This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Unnecessary code changing by compiler

Initial source code:

if( send_u >= 0){
    SEND(send_u + 6)
    send_u = -1;
}//if


generates following object code:

00C11A9E D7000000  EXTS     #0x0000,#1
00C11AA2 F2F418FD  MOV      R4,DPP3:0x3D18
00C11AA6 6D13      JMPR     CC_N,0xC11ACE
    46:         SEND(send_u + 6)
00C11AA8 F054      MOV      R5,R4
00C11AAA 5C24      SHL      R4,#0x02
00C11AAC 2045      SUB      R4,R5
00C11AAE 5C24      SHL      R4,#0x02
00C11AB0 2045      SUB      R4,R5
00C11AB2 5C14      SHL      R4,#0x01
00C11AB4 E6F88440  MOV      R8,#0x4084
00C11AB8 0084      ADD      R8,R4
00C11ABA E6F40002  MOV      R4,#0x0200
00C11ABE E6F5C000  MOV      R5,#0x00C0
00C11AC2 DAC14417  CALLS    ?C_SCALLI(0xC11744)


When I add to the initial source code label:

if( send_u >= 0){
some_label_:
    SEND(send_u + 6)
    send_u = -1;
}//if


compiler generates another object code:

00C11A9E D7000000  EXTS     #0x0000,#1
00C11AA2 F2F418FD  MOV      R4,DPP3:0x3D18
00C11AA6 6D17      JMPR     CC_N,0xC11AD6
    45: fpp_cycle_3_2:;
    46:         SEND(send_u + 6)
00C11AA8 D7000000  EXTS     #0x0000,#1
00C11AAC F2F418FD  MOV      R4,DPP3:0x3D18
00C11AB0 F054      MOV      R5,R4
00C11AB2 5C24      SHL      R4,#0x02
00C11AB4 2045      SUB      R4,R5
00C11AB6 5C24      SHL      R4,#0x02
00C11AB8 2045      SUB      R4,R5
00C11ABA 5C14      SHL      R4,#0x01
00C11ABC E6F88440  MOV      R8,#0x4084
00C11AC0 0084      ADD      R8,R4
00C11AC2 E6F40002  MOV      R4,#0x0200
00C11AC6 E6F5C000  MOV      R5,#0x00C0
00C11ACA DAC14417  CALLS    ?C_SCALLI(0xC11744)


Why does compiler do this?