[PATCH] D22551: CodeGen: If Convert blocks that would form a diamond when tail-merged.

Kyle Butt via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 25 13:14:58 PDT 2016


iteratee added inline comments.

================
Comment at: lib/CodeGen/IfConversion.cpp:692
@@ +691,3 @@
+  if (!TT)
+    TT = getNextBlock(TrueBBI.BB);
+  if (!TF)
----------------
davidxl wrote:
> is 'fallthough' check needed here?
No. It's just checking if the branch is analyzable. 

================
Comment at: lib/CodeGen/IfConversion.cpp:702
@@ +701,3 @@
+    return false;
+  if  (TrueBBI.BB->pred_size() > 1 || FalseBBI.BB->pred_size() > 1)
+    return false;
----------------
davidxl wrote:
> Can this check be moved earlier? If so, common check can be extracted and shared across this and ValidDiamond.
It's short enough that I don't think it's worth factoring out. If there were more checks in common, then maybe, but there aren't.

================
Comment at: lib/CodeGen/IfConversion.cpp:739
@@ +738,3 @@
+    std::vector<MachineOperand> PredDefs;
+    while (BIB != BIE) {
+      // Skip dbg_value instructions. These do not count.
----------------
davidxl wrote:
> I have not looked in details here. Is there existing code that can be refactored/reused by any chance? 
The function that is the most similar is ScanInstructions. I think they're different enough that having them share code would  be more confusing than helpful.

================
Comment at: lib/CodeGen/IfConversion.cpp:818
@@ -653,3 +817,3 @@
       (TrueBBI.ClobbersPred && FalseBBI.ClobbersPred))
     return false;
 
----------------
I renamed it ForkedDiamond, and added more comments about it.


https://reviews.llvm.org/D22551





More information about the llvm-commits mailing list