[PATCH] D22696: [CodeGenPrep] Skip merging empty case blocks

David Li via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 19 15:30:39 PDT 2016


davidxl added inline comments.

================
Comment at: lib/CodeGen/CodeGenPrepare.cpp:424
@@ -412,1 +423,3 @@
 
+    // Try to skip merging if BB is terminated by a switch instruction and BB is
+    // used as an incoming block of a PHI in DestBB. In such case, merging BB
----------------
If the unique Predecessor of BB is terminated ..

================
Comment at: lib/CodeGen/CodeGenPrepare.cpp:427
@@ +426,3 @@
+    // and DestBB would cause ISel to add COPY instructions in the header of
+    // switch.  This could potentially increase dynamic instructions, especially
+    // when the switch is in a loop. By keeping the empty block (BB), ISel will
----------------
Do you have actual examples showing the problem of extra copy instruction added? I could not connect the dots here.

================
Comment at: lib/CodeGen/CodeGenPrepare.cpp:444
@@ +443,3 @@
+      if (IsIncomingBlock) {
+        // Since a branch instruction could be added in the empty case block by
+        // skipping merging it, we skip merging the empty case only when the
----------------
How about the size impact (for Os build) ?


https://reviews.llvm.org/D22696





More information about the llvm-commits mailing list