This is an archive of the discontinued LLVM Phabricator instance.

Make sure total loop body weight is preserved in loop peeling
ClosedPublic

Authored by trentxintong on Dec 30 2016, 10:53 AM.

Details

Summary

Regardless how the loop body weight is distributed, we should preserve
total loop body weight. i.e. we should have same weight reaching the body of the loop
or its duplicates in peeled and unpeeled case.

Event Timeline

trentxintong retitled this revision from to Make sure total loop body weight is preserved in loop peeling.
trentxintong updated this object.
trentxintong added reviewers: mkuper, davidxl, anemet.
trentxintong added a subscriber: llvm-commits.

Rework BE count for the remainder loop a bit.

mkuper accepted this revision.Jan 2 2017, 12:22 AM
mkuper edited edge metadata.

Argh, you're right, I got the accounting wrong.
LGTM. thanks for fixing this.

This revision is now accepted and ready to land.Jan 2 2017, 12:22 AM
davidxl added inline comments.Jan 2 2017, 1:09 AM
lib/Transforms/Utils/LoopUnrollPeel.cpp
338

Might be better to name it

CurHeaderWeight or just HeaderWeight

351

This comment is not accurate. Better

"Subtract the exit weight from the current header weight -- the exit weight is exactly ..."

393

remaining loop body weight --> current header weight

loop body entry count --> current loop exit weight

trentxintong edited edge metadata.

Address davidxl suggestions.

davidxl accepted this revision.Jan 2 2017, 9:46 AM
davidxl edited edge metadata.

lgtm

This revision was automatically updated to reflect the committed changes.