This is an archive of the discontinued LLVM Phabricator instance.

[LowerSwitch] Skip dead blocks for processSwitchInst()
ClosedPublic

Authored by chenli on Aug 11 2015, 11:37 AM.

Details

Summary

This patch adds check for dead blocks and skip them for processSwitchInst(). This will help reduce compilation time.

Diff Detail

Repository
rL LLVM

Event Timeline

chenli retitled this revision from to [LowerSwitch] Skip dead blocks for processSwitchInst().
chenli updated this object.
chenli added reviewers: reames, hans.
chenli added a subscriber: llvm-commits.
hans added inline comments.Aug 11 2015, 12:40 PM
lib/Transforms/Utils/LowerSwitch.cpp
127 ↗(On Diff #31842)

Seems we're ending up with both the DeleteList and checking for dead blocks in the loop? It would be nice if we only had to check in one place.

Perhaps one solution would be to make DeleteList a SmallPtrSet instead, and in the loop we could do "if (DeleteSet.contains(Cur)) continue;"

chenli updated this revision to Diff 31849.Aug 11 2015, 1:05 PM

Update w.r.t. Hans' comments.

chenli marked an inline comment as done.Aug 11 2015, 1:06 PM
hans accepted this revision.Aug 11 2015, 1:12 PM
hans edited edge metadata.

lgtm with style comments.

lib/Transforms/Utils/LowerSwitch.cpp
126 ↗(On Diff #31849)

nit: I would probably skip the braces around this one-line if body.

411 ↗(On Diff #31849)

This line is over the 80 column limit.

This revision is now accepted and ready to land.Aug 11 2015, 1:12 PM
chenli closed this revision.Aug 11 2015, 1:16 PM
This revision was automatically updated to reflect the committed changes.