[llvm] [SimplifyCFG] Don't delete basic block if it is a partial cleanuppad (PR #157363)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 9 06:10:55 PDT 2025


================
@@ -875,6 +875,13 @@ class Instruction : public User,
   /// a form of returning control flow here).
   LLVM_ABI bool willReturn() const LLVM_READONLY;
 
+  /// Return true if the instruction is a variety of EH-block, that needs a
+  /// corresponding return instruction.
+  bool isEHPadWithCorrespondingTerminator() const {
+    unsigned OpCode = getOpcode();
+    return OpCode == Instruction::CatchPad || OpCode == Instruction::CleanupPad;
+  }
----------------
nikic wrote:

Let's not pollute the Instruction API with trivial helper methods used in a single place.

https://github.com/llvm/llvm-project/pull/157363


More information about the llvm-commits mailing list