diff options
| author | Davide Italiano <davide@freebsd.org> | 2016-07-13 19:33:25 +0000 |
|---|---|---|
| committer | Davide Italiano <davide@freebsd.org> | 2016-07-13 19:33:25 +0000 |
| commit | 390b7ea5337af5cb82f94f62f12804ca9bbe1b4d (patch) | |
| tree | 474ed509f44f254b3c19ae7c8cf956228dcd2547 /llvm | |
| parent | 2185001551a3884328f20fa34ff6a39538107a35 (diff) | |
| download | bcm5719-llvm-390b7ea5337af5cb82f94f62f12804ca9bbe1b4d.tar.gz bcm5719-llvm-390b7ea5337af5cb82f94f62f12804ca9bbe1b4d.zip | |
[SCCP] Factor out common code.
llvm-svn: 275308
Diffstat (limited to 'llvm')
| -rw-r--r-- | llvm/lib/Transforms/Scalar/SCCP.cpp | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/llvm/lib/Transforms/Scalar/SCCP.cpp b/llvm/lib/Transforms/Scalar/SCCP.cpp index b5715932d51..236bb076df2 100644 --- a/llvm/lib/Transforms/Scalar/SCCP.cpp +++ b/llvm/lib/Transforms/Scalar/SCCP.cpp @@ -316,6 +316,13 @@ public: } private: + // pushToWorkList - Helper for markConstant/markForcedConstant + void pushToWorkList(LatticeVal &IV, Value *V) { + if (IV.isOverdefined()) + return OverdefinedInstWorkList.push_back(V); + InstWorkList.push_back(V); + } + // markConstant - Make a value be marked as "constant". If the value // is not already a constant, add it to the instruction work list so that // the users of the instruction are updated later. @@ -323,10 +330,7 @@ private: void markConstant(LatticeVal &IV, Value *V, Constant *C) { if (!IV.markConstant(C)) return; DEBUG(dbgs() << "markConstant: " << *C << ": " << *V << '\n'); - if (IV.isOverdefined()) - OverdefinedInstWorkList.push_back(V); - else - InstWorkList.push_back(V); + pushToWorkList(IV, V); } void markConstant(Value *V, Constant *C) { @@ -339,10 +343,7 @@ private: LatticeVal &IV = ValueState[V]; IV.markForcedConstant(C); DEBUG(dbgs() << "markForcedConstant: " << *C << ": " << *V << '\n'); - if (IV.isOverdefined()) - OverdefinedInstWorkList.push_back(V); - else - InstWorkList.push_back(V); + pushToWorkList(IV, V); } |

