[llvm-commits] Handling of DebugLocs during CSE of SelectionDAG nodes.

Kyriakos Georgiou kyriakos at xmos.com
Thu Dec 15 03:20:58 PST 2011


Hi,

I realised that in my previous solution there was a bug as I was dropping the DebugLoc for OptLeveles greater than -O0 and that was  the opposite from my intention. This was running fine for me because in our Xcore Target the optimization level was not passed to "XCoreDAGToDAGISel" making the related passes to run always with the llvm default level of optimization. So I was not able to spot the bug by just running the tests. I fixed that and also I rename the utility function that drops the DebugLoc from the merged SDNodes in order to match its functionality. 

Now I run again all the regression tests and our in house debugger tests and they are all running ok and improving the debugger 
functionality on -O0.

Kyriakos Georgiou | XMOS
www.xmos.com
________________________________________
From: Kyriakos Georgiou
Sent: 11 November 2011 11:24
To: Devang Patel
Subject: RE: [llvm-commits] Handling of DebugLocs during CSE of SelectionDAG    nodes.

Hi Devang,

I am sorry for my late reply but I had so many things to deal with. I moved the functionality out to a function.
Now about testing, I was getting an incorrect behaviour for many of ours debugging tests. I tried to create the smallest
piece of code reflecting those cases and giving me that incorrect behaviour and I end up with this code:

1. int main()
2. {
3.    char     uch;
4.    long     long_ref;
5.     int k=1;
6.     long_ref = 0;
7.     uch      = 3;
8.     k = k+3;
9. }

In this example is merging the two load 0 to r0 the one on long_ref = 0; and the one from uch = 3; Then is
choosing to attach to the merged code the line number 7 of uch=3; which causes the incorrect behaviour of the debugger.

After applying my changes of dropping the debugLoc of that node the debugger was behaving ok. This also applies to the rest
of our tests that have similar cases of merging nodes. I have this change for more than 1 month and it did not cause any failings
in our regressions tests.

kind Regards,
Kyriakos Georgiou | XMOS
www.xmos.com
________________________________________
From: Devang Patel [dpatel at apple.com]
Sent: 01 November 2011 18:18
To: Kyriakos Georgiou
Cc: llvm-commits at cs.uiuc.edu
Subject: Re: [llvm-commits] Handling of DebugLocs during CSE of SelectionDAG    nodes.

On Oct 31, 2011, at 10:30 AM, Kyriakos Georgiou wrote:

> Regarding thread :
>
> http://lists.cs.uiuc.edu/pipermail/llvmdev/2011-September/043205.html
>
> the approach of throwing away the line number information on the merged node is
> implemented in the attached patch.

+    if (SDNode *ON = CSEMap.FindNodeOrInsertPos(ID, IP)) {
+      DebugLoc dlN = N->getDebugLoc();
+      DebugLoc dlON = ON->getDebugLoc();
+      // Throw away the line number information on the merged node since it is
+      // not possible to preserve the information that operation is associated
+      // with multiple lines. This will make the debugger work better at -O0.
+      if (!(dlON.isUnknown()) && (OptLevel != CodeGenOpt::None) && (dlN != dlON)) {
+        ON->setDebugLoc(DebugLoc());
+      }

This logic could be separated out in a utility function.
Do you have any test cases ?
-
Devang


-------------- next part --------------
A non-text attachment was scrubbed...
Name: DropDebugLocFromMergedSDNodes.diff
Type: text/x-patch
Size: 4410 bytes
Desc: DropDebugLocFromMergedSDNodes.diff
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20111215/c1326a71/attachment.bin>


More information about the llvm-commits mailing list