aboutsummaryrefslogtreecommitdiff
path: root/lib/Transforms/Scalar/JumpThreading.cpp
diff options
context:
space:
mode:
authorGordon Henriksen <gordonhenriksen@mac.com>2008-05-08 17:46:35 +0000
committerGordon Henriksen <gordonhenriksen@mac.com>2008-05-08 17:46:35 +0000
commita8a118b68fa3ca1632e7280cd6994aa0f8f1eec1 (patch)
treedfddd3293b9fa7128bad1510c579c83bfa325305 /lib/Transforms/Scalar/JumpThreading.cpp
parent2539e3389361115f5e75e4134bdd123171688ddc (diff)
Improve pass documentation and comments.
Patch by Matthijs Kooijman! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50861 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Scalar/JumpThreading.cpp')
-rw-r--r--lib/Transforms/Scalar/JumpThreading.cpp33
1 files changed, 17 insertions, 16 deletions
diff --git a/lib/Transforms/Scalar/JumpThreading.cpp b/lib/Transforms/Scalar/JumpThreading.cpp
index 991b11110b..964fe90c46 100644
--- a/lib/Transforms/Scalar/JumpThreading.cpp
+++ b/lib/Transforms/Scalar/JumpThreading.cpp
@@ -9,6 +9,23 @@
//
// This file implements the Jump Threading pass.
//
+// Jump threading tries to find distinct threads of control flow running through
+// a basic block. This pass looks at blocks that have multiple predecessors and
+// multiple successors. If one or more of the predecessors of the block can be
+// proven to always cause a jump to one of the successors, we forward the edge
+// from the predecessor to the successor by duplicating the contents of this
+// block.
+//
+// An example of when this can occur is code like this:
+//
+// if () { ...
+// X = 4;
+// }
+// if (X < 3) {
+//
+// In this case, the unconditional branch at the end of the first if can be
+// revectored to the false side of the second if.
+//
//===----------------------------------------------------------------------===//
#define DEBUG_TYPE "jump-threading"
@@ -33,22 +50,6 @@ Threshold("jump-threading-threshold",
cl::init(6), cl::Hidden);
namespace {
- /// This pass performs 'jump threading', which looks at blocks that have
- /// multiple predecessors and multiple successors. If one or more of the
- /// predecessors of the block can be proven to always jump to one of the
- /// successors, we forward the edge from the predecessor to the successor by
- /// duplicating the contents of this block.
- ///
- /// An example of when this can occur is code like this:
- ///
- /// if () { ...
- /// X = 4;
- /// }
- /// if (X < 3) {
- ///
- /// In this case, the unconditional branch at the end of the first if can be
- /// revectored to the false side of the second if.
- ///
class VISIBILITY_HIDDEN JumpThreading : public FunctionPass {
public:
static char ID; // Pass identification