[Loop Unswitch] Patch to selective unswitch only the reachable branch instructions.
authorAbhilash Bhandari <abhilash_bhandari@yahoo.co.in>
Fri, 25 Nov 2016 14:07:44 +0000 (14:07 +0000)
committerAbhilash Bhandari <abhilash_bhandari@yahoo.co.in>
Fri, 25 Nov 2016 14:07:44 +0000 (14:07 +0000)
commit54e5a1a4da56d976d9cb4fdeaa50decd87c58ff6
tree5af38fd03915a6d92bdd3722b2b705b5a3c466fd
parenteddec09ee480ca575909efb95c64c992cbe83ce7
[Loop Unswitch] Patch to selective unswitch only the reachable branch instructions.

Summary:
The iterative algorithm for Loop Unswitching may render some of the branches unreachable in the unswitched loops.
Given the exponential nature of the algorithm, this is quite an overhead.
This patch fixes this problem by selectively unswitching only those branches within a loop that are reachable from the loop header.

Reviewers: Michael Zolothukin, Anna Thomas, Weiming Zhao.
Subscribers: llvm-commits.

Differential Revision: http://reviews.llvm.org/D26299

llvm-svn: 287925
llvm/lib/Transforms/Scalar/LoopUnswitch.cpp
llvm/test/Transforms/LoopUnswitch/elseif-non-exponential-behavior.ll [new file with mode: 0644]