diff options
author | Chris Lattner <sabre@nondot.org> | 2010-04-09 01:14:31 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2010-04-09 01:14:31 +0000 |
commit | 8829cec25fe77cadbd99dcf7bbbce4969eb5704a (patch) | |
tree | 747748dca3b222f061d030093aa515bf7306db1c /lib | |
parent | 4285b294a86f507822b8c00d85888e78f69672e5 (diff) | |
download | llvm-8829cec25fe77cadbd99dcf7bbbce4969eb5704a.tar.gz llvm-8829cec25fe77cadbd99dcf7bbbce4969eb5704a.tar.bz2 llvm-8829cec25fe77cadbd99dcf7bbbce4969eb5704a.tar.xz |
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
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Transforms/Scalar/SCCP.cpp | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/lib/Transforms/Scalar/SCCP.cpp b/lib/Transforms/Scalar/SCCP.cpp index 4f09bee53a..59cdee652d 100644 --- a/lib/Transforms/Scalar/SCCP.cpp +++ b/lib/Transforms/Scalar/SCCP.cpp @@ -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); } |