Improve performance of SimplifyInstructionsInBlock
authorFiona Glaser <escha@apple.com>
Mon, 28 Sep 2015 18:56:07 +0000 (18:56 +0000)
committerFiona Glaser <escha@apple.com>
Mon, 28 Sep 2015 18:56:07 +0000 (18:56 +0000)
commitc4a5a9a48e4d79809b502ed4aca520beeb323759
tree3f3be2b05707e713aff93183e02da6d5d732ef3f
parent71e99129b835415dcc9b19cb353a95ac7ad8d048
Improve performance of SimplifyInstructionsInBlock

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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@248727 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/Utils/Local.cpp