[LLVMdev] Handling of DebugLocs during CSE of SelectionDAG nodes.

Jakob Stoklund Olesen stoklund at 2pi.dk
Wed Sep 14 10:34:48 PDT 2011


On Sep 14, 2011, at 7:37 AM, Richard Osborne wrote:

> Is there a view on which of the following approaches is better in 
> general when two nodes with debug locations are merged because of CSE 
> (either in the MachineCSE pass or because of the CSEMap in the 
> SelectionDAG):
> 
> 1) Use the DebugLoc of either of the pair of nodes (chosen arbitrarily).
> 2) 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.
> 
> The current approach seems to be 1). Would you consider patches to 
> change the behavior to 2)?

At -O0, SelectionDAG nodes are scheduled in source order when possible.

When merging identical nodes, you should make sure that the resulting node has the earlier source order, and the debug location should match.

That way, CSE simply looks like the last definition of a value has been removed.  Debug location and source order of the first definition should be preserved.

/jakob




More information about the llvm-dev mailing list