Calculate getTerminator only when necessary
authorAditya Kumar <1894981+hiraditya@users.noreply.github.com>
Sun, 13 Jun 2021 18:32:28 +0000 (11:32 -0700)
committerAditya Kumar <1894981+hiraditya@users.noreply.github.com>
Mon, 14 Jun 2021 03:16:07 +0000 (20:16 -0700)
Differential Revision: https://reviews.llvm.org/D104202

llvm/lib/Transforms/IPO/HotColdSplitting.cpp

index 8dc480f..833049d 100644 (file)
@@ -150,9 +150,10 @@ static bool mayExtractBlock(const BasicBlock &BB) {
   //
   // Resumes that are not reachable from a cleanup landing pad are considered to
   // be unreachable. It’s not safe to split them out either.
+  if (BB.hasAddressTaken() || BB.isEHPad())
+    return false;
   auto Term = BB.getTerminator();
-  return !BB.hasAddressTaken() && !BB.isEHPad() && !isa<InvokeInst>(Term) &&
-         !isa<ResumeInst>(Term);
+  return !isa<InvokeInst>(Term) && !isa<ResumeInst>(Term);
 }
 
 /// Mark \p F cold. Based on this assumption, also optimize it for minimum size.