summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2002-05-02 20:32:51 +0000
committerChris Lattner <sabre@nondot.org>2002-05-02 20:32:51 +0000
commit5364d1a74ae584d0e3a008e59e82061b657a8d15 (patch)
tree3244448453373fd1b34e3ee6814b038877664f70
parent39e976d83ac23b7d5a2db0204483041313e7234e (diff)
downloadbcm5719-llvm-5364d1a74ae584d0e3a008e59e82061b657a8d15.tar.gz
bcm5719-llvm-5364d1a74ae584d0e3a008e59e82061b657a8d15.zip
* Simplify the code by not bothering to name the folded constant
* Do not skip the instruction immediately after a folded instruction. This was causing the testcase failure: test/Regression/Transforms/SCCP/2002-05-02-MissSecondInst.ll llvm-svn: 2443
-rw-r--r--llvm/lib/Transforms/Scalar/SCCP.cpp17
1 files changed, 7 insertions, 10 deletions
diff --git a/llvm/lib/Transforms/Scalar/SCCP.cpp b/llvm/lib/Transforms/Scalar/SCCP.cpp
index e4e1e7c42fa..a5966e96a28 100644
--- a/llvm/lib/Transforms/Scalar/SCCP.cpp
+++ b/llvm/lib/Transforms/Scalar/SCCP.cpp
@@ -288,18 +288,15 @@ bool SCCP::runOnFunction(Function *F) {
// Replaces all of the uses of a variable with uses of the constant.
Inst->replaceAllUsesWith(Const);
- // Remove the operator from the list of definitions...
- BB->getInstList().remove(BI);
-
- // The new constant inherits the old name of the operator...
- if (Inst->hasName() && !Const->hasName())
- Const->setName(Inst->getName(), F->getSymbolTableSure());
-
- // Delete the operator now...
- delete Inst;
+ // Remove the operator from the list of definitions... and delete it.
+ delete BB->getInstList().remove(BI);
// Hey, we just changed something!
MadeChanges = true;
+
+ // Do NOT advance the iterator, skipping the next instruction...
+ continue;
+
} else if (TerminatorInst *TI = dyn_cast<TerminatorInst>(Inst)) {
MadeChanges |= ConstantFoldTerminator(BB, BI, TI);
}
@@ -457,7 +454,7 @@ void SCCP::visitBinaryOperator(Instruction *I) {
V1State.getConstant(),
V2State.getConstant());
if (Result)
- markConstant(I, Result); // This instruction constant fold!s
+ markConstant(I, Result); // This instruction constant folds!
else
markOverdefined(I); // Don't know how to fold this instruction. :(
}
OpenPOWER on IntegriCloud