Revision 289661 introduced the function DILocation::getMergedLocation for merging of debug locations. At the time is was simply a stub which always returned no location. This patch modifies getMergedLocation to handle the case where the two locations are the same or can't be discriminated.
The patch:
- Changes getMergedLocation to use DILocation::canDiscriminate.
- Fixes DILocation::canDiscriminate to add checks for directory, column and discriminator.
- Updates SimplifyCFG HoistThenElseCodeToIf to remove redundant check.
The patch also adds an additional test to simplifycfg_sink_last_inst.ll - when the debug locations of the sunk instructions are the same we should now use that location for the common instruction.
OK to commit?
Thanks,
Rob.
I would reorder these conditions so the most common mismatches come first.
Perhaps: Line, Column, Discriminator, Filename, Directory?