fix a SCCP miscompilation that could happen when a

forced constant is changed to a constant, we would end
up adding the instruction to the wrong worklist, 
preventing it from being properly revisited.  This fixes
rdar://7832370


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100837 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner
2010-04-09 01:14:31 +00:00
parent 4285b294a8
commit 8829cec25f
2 changed files with 105 additions and 3 deletions

View File

@@ -317,7 +317,10 @@ private:
void markConstant(LatticeVal &IV, Value *V, Constant *C) {
if (!IV.markConstant(C)) return;
DEBUG(dbgs() << "markConstant: " << *C << ": " << *V << '\n');
InstWorkList.push_back(V);
if (IV.isOverdefined())
OverdefinedInstWorkList.push_back(V);
else
InstWorkList.push_back(V);
}
void markConstant(Value *V, Constant *C) {
@@ -327,9 +330,13 @@ private:
void markForcedConstant(Value *V, Constant *C) {
assert(!V->getType()->isStructTy() && "Should use other method");
ValueState[V].markForcedConstant(C);
LatticeVal &IV = ValueState[V];
IV.markForcedConstant(C);
DEBUG(dbgs() << "markForcedConstant: " << *C << ": " << *V << '\n');
InstWorkList.push_back(V);
if (IV.isOverdefined())
OverdefinedInstWorkList.push_back(V);
else
InstWorkList.push_back(V);
}