[LLVMdev] Query Regarding instruction ordering of passive nodes

KARTHIKVENKATESH BHAT kv.bhat at samsung.com
Mon Dec 17 04:38:09 PST 2012

Hi All,
I'm trying to compile the attached code(gdb11531.c) with latest clang with -O0 on ARM. 
Clang seems to be reordering the instructions in case of constant nodes(for ARM) even when O0 is specified resulting in few wrong information when debugging through GDB. 
I had few queries,would be great if someone could clarify the same -

In the given assembly code, the instructions where constant data is copied into registers are marked with wrong location information.


mov       r0, #5
mov       r1, #56
are marked with line number 34 where as in source assembly, myrec.z = 56; is at line number 36.

mov       r0, #78
is marked at line number 36 where as in source assembly, myrec.x = 78; is at line number 37.

It is observed that such nodes are not updated with correction debug location info, hence they are generally placed at the top of the finally generated assembly code. Is this by design intentionally? 
If so, why ? 

Tried updating the debugloc info for constant sdnodes as per http://llvm.org/bugs/show_bug.cgi?id=13269 by just modifying for getConstant APIs
It results in duplicate debug location info for same line numbers as attached in gdb11531_getConstant_modified.s

In addition, passive nodes are omitted from scheduled during instruction scheduling such that they are free to be placed anywhere while generating the instruction sequence. Is this related with above problem of debug location ?

The list of passive nodes are :-



-------------- next part --------------
A non-text attachment was scrubbed...
Name: gdb11531.s
Type: application/octet-stream
Size: 10377 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20121217/5b876d39/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: gdb11531_getConstant_modified.s
Type: application/octet-stream
Size: 10499 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20121217/5b876d39/attachment-0001.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: gdb11531.c
Type: application/octet-stream
Size: 1046 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20121217/5b876d39/attachment-0002.obj>

More information about the llvm-dev mailing list