This is an archive of the discontinued LLVM Phabricator instance.

[LoopDeletion] Emit a remark when a dead loop is deleted
ClosedPublic

Authored by thegameg on Jul 2 2020, 10:15 PM.

Details

Summary

This emits a remark when LoopDeletion deletes a dead loop, using the source location of the loop's header. There are currently two reasons for removing the loop: invariant loop or loop that never executes.

Diff Detail

Event Timeline

thegameg created this revision.Jul 2 2020, 10:15 PM
Herald added a project: Restricted Project. · View Herald TranscriptJul 2 2020, 10:15 PM
Herald added a subscriber: hiraditya. · View Herald Transcript
fhahn accepted this revision.Jul 3 2020, 1:57 AM

LGTM, thanks! I've added a few suggestions with respect to tests.

llvm/test/Transforms/LoopDeletion/basic-remark.ll
2

Does this need -mtriple? If so, the test would probably need ; REQUIRES: x86-registered-target or may fail on builds without the x86 target enabled.

llvm/test/Transforms/LoopDeletion/unreachable-loops.ll
1–2

I think it would probably be better to just add a second test function with a loop that never executes to basic-remark.ll and not check for remarks in this file. Without checking for the location/containing function of the remarks, it is hard to verify what the check lines check precisely.

This revision is now accepted and ready to land.Jul 3 2020, 1:57 AM
thegameg updated this revision to Diff 275465.Jul 3 2020, 3:19 PM
thegameg marked 2 inline comments as done.
thegameg added inline comments.
llvm/test/Transforms/LoopDeletion/basic-remark.ll
2

Nope, it doesn't, I removed it.

llvm/test/Transforms/LoopDeletion/unreachable-loops.ll
1–2

I agree. I decided to change the test to check the YAML output and use CHECK-LABEL to find the function name. Thanks for pointing this out, turns out 2 checks were in the wrong function :)

This revision was automatically updated to reflect the committed changes.