This is an archive of the discontinued LLVM Phabricator instance.

When hoisting instructions out of loops their debug loc should be removed (MLICM pass).
ClosedPublic

Authored by wolfgangp on Nov 30 2016, 5:37 PM.

Details

Summary

The Machine Loop Invariant Code Motion pass (MLICM) hoists loop invariant instructions out of loops, e.g. address and other constant generating instructions. Retaining their debug location can cause erratic stepping behavior during debugging as well as incorrect source attribution wrt AutoFDO.
This patch proposes to remove debug locations for these instructions.

This is the first of 3 patches with the theme of instruction hoisting. I'm keeping them separate b/c 3 different passes are involved.

This is a case of true code motion, so retaining the original debug location is not justified.

Diff Detail

Repository
rL LLVM

Event Timeline

wolfgangp updated this revision to Diff 79844.Nov 30 2016, 5:37 PM
wolfgangp retitled this revision from to When hoisting instructions out of loops their debug loc should be removed (MLICM pass)..
wolfgangp updated this object.
wolfgangp added a subscriber: llvm-commits.
dblaikie edited edge metadata.Dec 1 2016, 1:18 PM

Seems reasonable - any chance of simplifying the test case further?

lib/CodeGen/MachineLICM.cpp
1339 ↗(On Diff #79844)

Might be worth a comment

wolfgangp updated this revision to Diff 79995.Dec 1 2016, 4:03 PM
wolfgangp edited edge metadata.

Simplified test case and added comment.

Seems reasonable - any chance of simplifying the test case further?

Thanks for the review, David. I simplified the test case and added a comment.

dblaikie accepted this revision.Dec 1 2016, 4:05 PM
dblaikie edited edge metadata.
This revision is now accepted and ready to land.Dec 1 2016, 4:05 PM

Right, Phab doesn't send zero content approvals - anyway, signed off. Carry on.

This revision was automatically updated to reflect the committed changes.