SelectBasicBlock is rather slow even when it doesn't do anything; skip the
authorEli Friedman <eli.friedman@gmail.com>
Tue, 19 Apr 2011 17:01:08 +0000 (17:01 +0000)
committerEli Friedman <eli.friedman@gmail.com>
Tue, 19 Apr 2011 17:01:08 +0000 (17:01 +0000)
unnecessary work where possible.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129763 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp

index 8e599aef7f30c9083f65209ffe6983ce449263fe..af3188895edaec931e1b1d6c381c6a3361444fe8 100644 (file)
@@ -1017,11 +1017,13 @@ void SelectionDAGISel::SelectAllBasicBlocks(const Function &Fn) {
     else
       ++NumFastIselBlocks;
 
-    // Run SelectionDAG instruction selection on the remainder of the block
-    // not handled by FastISel. If FastISel is not run, this is the entire
-    // block.
-    bool HadTailCall;
-    SelectBasicBlock(Begin, BI, HadTailCall);
+    if (Begin != BI) {
+      // Run SelectionDAG instruction selection on the remainder of the block
+      // not handled by FastISel. If FastISel is not run, this is the entire
+      // block.
+      bool HadTailCall;
+      SelectBasicBlock(Begin, BI, HadTailCall);
+    }
 
     FinishBasicBlock();
     FuncInfo->PHINodesToUpdate.clear();