This is an archive of the discontinued LLVM Phabricator instance.

[SimplifyCFG] Merge debug locations when hoisting an instruction from a then/else branch. NFC.
ClosedPublic

Authored by andreadb on Dec 15 2016, 6:30 AM.

Details

Summary

Now that a new API to merge debug locations has been committed at r289661 (see revision D26256 for more details), we can use it to "improve" the following commit: https://reviews.llvm.org/rL280995

Instead of nulling the debugloc of a commoned instruction, we use the "merged" debug location.
At the moment, this is just a no functional change since function getMergedLocation is just a stub and would always return a null location.

Please let me know if okay to commit.

Thanks,
Andrea

Diff Detail

Repository
rL LLVM

Event Timeline

andreadb updated this revision to Diff 81567.Dec 15 2016, 6:30 AM
andreadb retitled this revision from to [SimplifyCFG] Merge debug locations when hoisting an instruction from a then/else branch. NFC..
andreadb updated this object.
andreadb added a subscriber: llvm-commits.
aprantl accepted this revision.Dec 15 2016, 9:25 AM
aprantl edited edge metadata.

Awesome, thanks!

lib/Transforms/Utils/SimplifyCFG.cpp
1279 ↗(On Diff #81567)

Wouldn't it make more sense to make getMergedLocation() be an identity operation if the locations are identical?

This revision is now accepted and ready to land.Dec 15 2016, 9:25 AM

Thanks for the review Adrian.

lib/Transforms/Utils/SimplifyCFG.cpp
1279 ↗(On Diff #81567)

Yes.

I was chatting with Robert about this. He told me that he plans to send a patch to improve DILocation::getMergeLocation() and fix the FIXMEs in DILocation::canDiscriminate(). From what I understand, his idea is to use DILocation::canDiscriminate() from within getMergeLocation to disambiguate cases where two locations are identical (not just same pointers, but also same values).

If it is okay for you, then I would just commit this patch and leave to Rob the task of improving getMergedLocation(). What do you think?

Yes, just keep an eye on the patch and make sure that the cleanup is applied in SimplifyCFG.cpp when it is ready.

thanks!

This revision was automatically updated to reflect the committed changes.