[PATCH] D13963: Create a new interface addSuccessorWithoutWeight(MBB*) in MBB to add successors when optimization is disabled.

David Li via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 23 14:14:54 PDT 2015


davidxl added inline comments.

================
Comment at: lib/CodeGen/MachineBasicBlock.cpp:510
@@ +509,3 @@
+  // Weight list is either empty (if successor list isn't empty, this means
+  // diabled optimization) or has the same size as successor list.
+  if (!Weights.empty() || Successors.empty())
----------------
diabled -- disabled.

================
Comment at: lib/CodeGen/MachineBasicBlock.cpp:511
@@ -516,1 +510,3 @@
+  // diabled optimization) or has the same size as successor list.
+  if (!Weights.empty() || Successors.empty())
     Weights.push_back(Weight);
----------------
I find it more readable to say

if (! (Weights.empty() && !Successors.empty())) {
   ...
}

Since this interface is called only when optimization enabled, so 
 (Weights.empty () && Successors.empty()) == false should be asserted -- basically the above if condition is always  true?


http://reviews.llvm.org/D13963





More information about the llvm-commits mailing list