This is an archive of the discontinued LLVM Phabricator instance.

[LoopUnswitch] Add an else clause to IsTrivialUnswitchCondition() when checking HeaderTerm instruction type
ClosedPublic

Authored by chenli on Jul 15 2015, 1:49 PM.

Details

Summary

This is a trivial code change with no functionality effect.

When LoopUnswitch determines trivial unswitch condition, it checks whether the loop header's terminator instruction is a branch instruction or switch instruction since trivial unswitch condition can only apply to these two instruction types. The current code does not fail the check directly on other instruction types, but check the nullness of LoopExitBB variable instead. The added else clause makes the check fail immediately on other instruction types and makes the code more obvious.

Diff Detail

Event Timeline

chenli updated this revision to Diff 29822.Jul 15 2015, 1:49 PM
chenli retitled this revision from to [LoopUnswitch] Add an else clause to IsTrivialUnswitchCondition() when checking HeaderTerm instruction type.
chenli updated this object.
chenli added a reviewer: reames.
chenli added a subscriber: llvm-commits.
reames accepted this revision.Jul 15 2015, 2:14 PM
reames edited edge metadata.

LGTM.

lib/Transforms/Scalar/LoopUnswitch.cpp
644

The comment doesn't seem to add much value. Possibly remove?

No need for curly braces.

This revision is now accepted and ready to land.Jul 15 2015, 2:14 PM
chenli updated this revision to Diff 29832.Jul 15 2015, 2:34 PM
chenli edited edge metadata.

Revise wrt Philip's comments.

chenli marked an inline comment as done.Jul 15 2015, 2:34 PM
chenli closed this revision.Jul 15 2015, 3:41 PM