Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(16)

Unified Diff: src/IceCfgNode.cpp

Issue 1318553003: Compute the loop nest depth of each CfgNode and weight Variables by it. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/IceCfgNode.h ('k') | src/IceClFlags.cpp » ('j') | src/IceOperand.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/IceCfgNode.cpp
diff --git a/src/IceCfgNode.cpp b/src/IceCfgNode.cpp
index f0fae92af6de29990c3fd0fb42e16d76460dc83b..03c75bd50d3490d54da3ebe227cd24627f1bcf08 100644
--- a/src/IceCfgNode.cpp
+++ b/src/IceCfgNode.cpp
@@ -218,6 +218,11 @@ void CfgNode::deletePhis() {
// not contain duplicates.
CfgNode *CfgNode::splitIncomingEdge(CfgNode *Pred, SizeT EdgeIndex) {
CfgNode *NewNode = Func->makeNode();
+ // Depth is the minimum as it works if both are the same, but if one is
+ // outside the loop and the other is inside, the new node should be placed
+ // outside and not be executed multiple times within the loop.
+ NewNode->setLoopNestDepth(
+ std::min(getLoopNestDepth(), Pred->getLoopNestDepth()));
if (BuildDefs::dump())
NewNode->setName("split_" + Pred->getName() + "_" + getName() + "_" +
std::to_string(EdgeIndex));
@@ -1179,9 +1184,12 @@ void CfgNode::dump(Cfg *Func) const {
Func->setCurrentNode(this);
Ostream &Str = Func->getContext()->getStrDump();
Liveness *Liveness = Func->getLiveness();
- if (Func->isVerbose(IceV_Instructions)) {
- Str << getName() << ":\n";
- }
+ if (Func->isVerbose(IceV_Instructions))
+ Str << getName() << ":";
+ // Dump the loop nest depth
+ if (Func->isVerbose(IceV_Loop))
+ Str << " // LoopNestDepth = " << getLoopNestDepth();
+ Str << "\n";
Jim Stichnoth 2015/09/03 23:23:30 Whoops. This "\n" should only be dumped if verbos
ascull 2015/09/04 00:23:51 Done.
// Dump list of predecessor nodes.
if (Func->isVerbose(IceV_Preds) && !InEdges.empty()) {
Str << " // preds = ";
« no previous file with comments | « src/IceCfgNode.h ('k') | src/IceClFlags.cpp » ('j') | src/IceOperand.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698