[PATCH] D13063: Faster SimplifyInstructionsInBlock

escha via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 22 11:52:21 PDT 2015

escha created this revision.
escha added reviewers: marcello.maggioni, resistor, reames.
escha added a subscriber: llvm-commits.
escha set the repository for this revision to rL LLVM.

From the original RFC:

1. Use a worklist, not a recursive approach, to avoid needless revisitation and being repeatedly forced to jump back to the start of the BB if a handle is invalidated.
2. Only insert operands to the worklist if they become unused after a dead instruction is removed, so we don’t have to visit them again in most cases.
3. Use a SmallSetVector to track the worklist.
4. Instead of pre-initting the SmallSetVector like in DeadCodeEliminationPass, only put things into the worklist if they have to be revisited after the first run-through. This minimizes how much the actual SmallSetVector gets used, which saves a lot of time.

One small change since the original is fix a bug where we were adding the users to the list even if they were the current instruction, which is possible with phi nodes (and causes a crash).




-------------- next part --------------
A non-text attachment was scrubbed...
Name: D13063.35400.patch
Type: text/x-patch
Size: 3822 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150922/5bb843a4/attachment.bin>

More information about the llvm-commits mailing list