Ver 3.0 Beta - Over optimisation of registers

Beta Testing discussion on mikroBasic PRO for dsPIC30/33 and PIC24.
Post Reply
Author
Message
Skyline
Posts: 267
Joined: 10 Jan 2006 09:35

Ver 3.0 Beta - Over optimisation of registers

#1 Post by Skyline » 15 Apr 2010 03:07

Hi,

1. Have a very long program compiled for 6014A with plenty of matrices and matrix assignments/manipulations.

Code: Select all

program assignments

const I9 as float[9] = (1.0,0.0,0.0, 0.0,1.0,0.0, 0.0,0.0,1.0)
dim matA,matB as float[9]

main:
  matA = I9
  matB = I9
  goto main
end.
2. Code generated wrongly with opt level 4 SSA.

Code: Select all

;assignments.mbas,6 :: 		main:
;assignments.mbas,7 :: 		matA = I9
0x010E	0x208001  	MOV	#lo_addr(_matA), W1
0x0110	0x280000  	MOV	#lo_addr(_I9), W0
0x0112	0x090011  	REPEAT	#17
0x0114	0x7818B0  	MOV	[W0++], [W1++]
;assignments.mbas,8 :: 		matB = I9
0x0116	0x208241  	MOV	#lo_addr(_matB), W1
0x0118	0x090011  	REPEAT	#17
0x011A	0x7818B0  	MOV	[W0++], [W1++]            <<< W0 should be pointing to @I9 but is now pointing @I9+#18 >>>
3. Code is ok under opt level zero:

Code: Select all

;assignments.mbas,6 :: 		main:
;assignments.mbas,7 :: 		matA = I9
0x010E	0x208001  	MOV	#lo_addr(_matA), W1
0x0110	0x280000  	MOV	#lo_addr(_I9), W0
0x0112	0x090011  	REPEAT	#17
0x0114	0x7818B0  	MOV	[W0++], [W1++]
;assignments.mbas,8 :: 		matB = I9
0x0116	0x208241  	MOV	#lo_addr(_matB), W1
0x0118	0x280000  	MOV	#lo_addr(_I9), W0         <<< this statement was wrongly optimised out with opt 4 SSA >>>
0x011A	0x090011  	REPEAT	#17
0x011C	0x7818B0  	MOV	[W0++], [W1++]
4. The 0x0114 statement [W0++] should end the propagation of W0 optimisation.

5. The problem is independent of I9 being a constant or variable.

User avatar
tihomir.losic
mikroElektronika team
Posts: 2138
Joined: 02 Dec 2009 14:16
Location: Serbia
Contact:

Re: Ver 3.0 Beta - Over optimisation of registers

#2 Post by tihomir.losic » 16 Apr 2010 08:40

Hello,

We have successfully recreated the error you have reported.
I have filed a BUG report to our developers, and I will provide
you with a workaround as soon as I have their response.
Thank you for pointing this.

Sorry for the inconvenience.

Best regards,

Losic Tihomir
mikroElektronika [Support team]

Post Reply

Return to “mikroBasic PRO for dsPIC30/33 and PIC24 Beta Testing”