summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2001-06-29 23:56:23 +0000
committerChris Lattner <sabre@nondot.org>2001-06-29 23:56:23 +0000
commitcb056de508c4938304b3a5a75e77eee19f6f98d1 (patch)
tree6e556ee2d703ae605edb88a732ef9be6dffa0503 /lib
parent4b52471bed9df4cd5323671cdf3c9cdc6befed97 (diff)
downloadllvm-cb056de508c4938304b3a5a75e77eee19f6f98d1.tar.gz
llvm-cb056de508c4938304b3a5a75e77eee19f6f98d1.tar.bz2
llvm-cb056de508c4938304b3a5a75e77eee19f6f98d1.tar.xz
Added documentation. Constant fold terminators.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/Transforms/Scalar/SCCP.cpp21
1 files changed, 16 insertions, 5 deletions
diff --git a/lib/Transforms/Scalar/SCCP.cpp b/lib/Transforms/Scalar/SCCP.cpp
index ba271b4e26..7273aec3f4 100644
--- a/lib/Transforms/Scalar/SCCP.cpp
+++ b/lib/Transforms/Scalar/SCCP.cpp
@@ -165,10 +165,19 @@ private:
BBWorkList.push_back(BB); // Add the block to the work list!
}
- void OperandChangedState(User *U);
+
+ // UpdateInstruction - Something changed in this instruction... Either an
+ // operand made a transition, or the instruction is newly executable. Change
+ // the value type of I to reflect these changes if appropriate.
+ //
void UpdateInstruction(Instruction *I);
-};
+ // OperandChangedState - This method is invoked on all of the users of an
+ // instruction that was just changed state somehow.... Based on this
+ // information, we need to update the specified user of this instruction.
+ //
+ void OperandChangedState(User *U);
+};
//===----------------------------------------------------------------------===//
@@ -259,9 +268,12 @@ bool SCCP::doSCCP() {
// Hey, we just changed something!
MadeChanges = true;
- } else {
- ++II;
+ continue; // Skip the ++II at the end of the loop here...
+ } else if (Inst->isTerminator()) {
+ MadeChanges |= ConstantFoldTerminator((TerminatorInst*)Inst);
}
+
+ ++II;
}
// Merge identical constants last: this is important because we may have just
@@ -491,7 +503,6 @@ void SCCP::OperandChangedState(User *U) {
}
-
// DoSparseConditionalConstantProp - Use Sparse Conditional Constant Propogation
// to prove whether a value is constant and whether blocks are used.
//