This is an archive of the discontinued LLVM Phabricator instance.

[LoopUnroll] Improve debug locations for instructions created during loop unrolling.
ClosedPublic

Authored by samsonov on Jun 10 2015, 1:45 PM.

Details

Summary
Commit 1

[LoopUnroll] Use IRBuilder to create branch instructions.

Use IRBuilder::Create(Cond)?Br instead of constructing instructions
manually with BranchInst::Create(). It's consistent with other
uses of IRBuilder in this pass, and has an additional important
benefit:

Using IRBuilder will ensure that new branch instruction will get
the same debug location as original terminator instruction it will
eventually replace.

For now I'm not adding a testcase, as currently original terminator
instruction also lack debug location due to missing debug location
propagation in BasicBlock::splitBasicBlock. That is, the testcase
will accompany the fix for the latter I'm going to mail soon.

Commit 2

Set proper debug location for branch added in BasicBlock::splitBasicBlock().

This improves debug locations in passes that do a lot of basic block
transformations. Important case is LoopUnroll pass, the test for correct
debug locations accompanies this change.

Diff Detail

Event Timeline

samsonov updated this revision to Diff 27464.Jun 10 2015, 1:45 PM
samsonov retitled this revision from to [LoopUnroll] Improve debug locations for instructions created during loop unrolling. ==== Commit 1 ==== [LoopUnroll] Use IRBuilder to create branch instructions..
samsonov updated this object.
samsonov edited the test plan for this revision. (Show Details)
samsonov added reviewers: dblaikie, sanjoy.
samsonov added a subscriber: Unknown Object (MLST).
samsonov retitled this revision from [LoopUnroll] Improve debug locations for instructions created during loop unrolling. ==== Commit 1 ==== [LoopUnroll] Use IRBuilder to create branch instructions. to [LoopUnroll] Improve debug locations for instructions created during loop unrolling..Jun 10 2015, 1:46 PM
samsonov updated this object.
dblaikie accepted this revision.Jun 10 2015, 2:51 PM
dblaikie edited edge metadata.

Looks reasonable (though your description of two separate commits was a bit confusing, since the code review doesn't break it out/make it clear which parts are which)

This revision is now accepted and ready to land.Jun 10 2015, 2:51 PM

Thanks for the review! Sorry about unclear commit breakdown, I failed to use arc correctly this time =/

This revision was automatically updated to reflect the committed changes.