Fix a C++ violation.
Ice::Inst::NumberSentinel is defined within the Inst class definition:
class Inst {
...
static const InstNumberT NumberDeleted = -1;
static const InstNumberT NumberSentinel = 0;
...
};
Under some compilers/options, this causes a link error when passing NumberSentinel as a const T& argument.
(Another option would be to move the actual definitions into IceInst.cpp.)
BUG= none
R=jfb@chromium.org
Review URL: https://codereview.chromium.org/311243006
diff --git a/src/IceCfgNode.cpp b/src/IceCfgNode.cpp
index 3fd63e2..2f2897c 100644
--- a/src/IceCfgNode.cpp
+++ b/src/IceCfgNode.cpp
@@ -235,8 +235,9 @@
// with the sentinel instruction number 0.
std::vector<InstNumberT> &LiveBegin = Liveness->getLiveBegin(this);
std::vector<InstNumberT> &LiveEnd = Liveness->getLiveEnd(this);
- LiveBegin.assign(NumVars, Inst::NumberSentinel);
- LiveEnd.assign(NumVars, Inst::NumberSentinel);
+ InstNumberT Sentinel = Inst::NumberSentinel;
+ LiveBegin.assign(NumVars, Sentinel);
+ LiveEnd.assign(NumVars, Sentinel);
// Initialize Live to be the union of all successors' LiveIn.
for (NodeList::const_iterator I = OutEdges.begin(), E = OutEdges.end();
I != E; ++I) {