[PATCH] D22092: AMDGPU: Reduce the duration of whole-quad-mode

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 26 16:37:47 PDT 2016


arsenm added inline comments.

================
Comment at: lib/Target/AMDGPU/SIWholeQuadMode.cpp:156-168
@@ -153,1 +155,15 @@
 
+static std::string stateString(int state) {
+  std::string Str;
+
+  if (state & StateWQM)
+    Str = "WQM";
+  if (state & StateExact) {
+    if (!Str.empty())
+      Str += '|';
+    Str += "Exact";
+  }
+
+  return Str;
+}
+
----------------
I think it would be simpler to just write to the ostream directly instead of building a string and printing that

================
Comment at: lib/Target/AMDGPU/SIWholeQuadMode.cpp:172-173
@@ +171,4 @@
+  for (const auto &BII : Blocks) {
+    dbgs() << "\nBB#" << BII.first->getNumber() << ":\n";
+    dbgs() << "  InNeeds = " << stateString(BII.second.InNeeds)
+           << ", Needs = " << stateString(BII.second.Needs)
----------------
Can be combined into one statement

================
Comment at: lib/Target/AMDGPU/SIWholeQuadMode.cpp:182-183
@@ +181,4 @@
+
+      dbgs() << "  " << MI;
+      dbgs() << "    Needs = " << stateString(III->second.Needs)
+             << ", OutNeeds = " << stateString(III->second.OutNeeds) << "\n";
----------------
Ditto

================
Comment at: lib/Target/AMDGPU/SIWholeQuadMode.cpp:184
@@ +183,3 @@
+      dbgs() << "    Needs = " << stateString(III->second.Needs)
+             << ", OutNeeds = " << stateString(III->second.OutNeeds) << "\n";
+    }
----------------
Single quotes

================
Comment at: lib/Target/AMDGPU/SIWholeQuadMode.cpp:228-231
@@ +227,6 @@
+
+        // Since we're in machine SSA, we do not need to track physical
+        // registers across basic blocks.
+        if (Value->isPHIDef())
+          continue;
+
----------------
This isn't actually true in the case of SCC. It's rare but possible to come up with test cases that break this. A uniform branch with a use of the same i1 value in a later block should do it if you want to try to break things


https://reviews.llvm.org/D22092





More information about the llvm-commits mailing list