[llvm] [IR][NFC] Fix MSVC deprecation warnings about BranchInst (PR #187702)

Alexis Engelke via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 20 08:01:00 PDT 2026


https://github.com/aengelke updated https://github.com/llvm/llvm-project/pull/187702

>From 6a803cb7bec70a3b91f143094fbc168205b1612f Mon Sep 17 00:00:00 2001
From: Alexis Engelke <engelke at in.tum.de>
Date: Fri, 20 Mar 2026 14:05:47 +0000
Subject: [PATCH 1/2] [spr] initial version

Created using spr 1.3.8-wip
---
 llvm/include/llvm/IR/Instructions.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/llvm/include/llvm/IR/Instructions.h b/llvm/include/llvm/IR/Instructions.h
index 37c0dd4d5c8b8..ce6a08255f871 100644
--- a/llvm/include/llvm/IR/Instructions.h
+++ b/llvm/include/llvm/IR/Instructions.h
@@ -3287,9 +3287,6 @@ struct OperandTraits<CondBrInst> : public FixedNumOperandTraits<CondBrInst, 3> {
 
 DEFINE_TRANSPARENT_OPERAND_ACCESSORS(CondBrInst, Value)
 
-// Suppress deprecation warnings from BranchInst.
-LLVM_SUPPRESS_DEPRECATED_DECLARATIONS_POP
-
 //===----------------------------------------------------------------------===//
 //                     BranchInst Out-Of-Line Functions
 //===----------------------------------------------------------------------===//
@@ -3321,6 +3318,9 @@ inline void BranchInst::swapSuccessors() {
   cast<CondBrInst>(this)->swapSuccessors();
 }
 
+// Suppress deprecation warnings from BranchInst.
+LLVM_SUPPRESS_DEPRECATED_DECLARATIONS_POP
+
 //===----------------------------------------------------------------------===//
 //                               SwitchInst Class
 //===----------------------------------------------------------------------===//

>From d9062084503818926dc85f6feff9632fd24b8f49 Mon Sep 17 00:00:00 2001
From: Alexis Engelke <engelke at in.tum.de>
Date: Fri, 20 Mar 2026 15:00:20 +0000
Subject: [PATCH 2/2] suppress warnings in Instructions.cpp

Created using spr 1.3.8-wip
---
 llvm/lib/IR/Instructions.cpp | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/llvm/lib/IR/Instructions.cpp b/llvm/lib/IR/Instructions.cpp
index 516bcee843b3b..80776857fa3d9 100644
--- a/llvm/lib/IR/Instructions.cpp
+++ b/llvm/lib/IR/Instructions.cpp
@@ -1189,6 +1189,9 @@ UnreachableInst::UnreachableInst(LLVMContext &Context,
 //                        UncondBrInst Implementation
 //===----------------------------------------------------------------------===//
 
+// Suppress deprecation warnings from BranchInst.
+LLVM_SUPPRESS_DEPRECATED_DECLARATIONS_PUSH
+
 UncondBrInst::UncondBrInst(BasicBlock *IfTrue, InsertPosition InsertBefore)
     : BranchInst(Type::getVoidTy(IfTrue->getContext()), Instruction::UncondBr,
                  AllocMarker, InsertBefore) {
@@ -1243,6 +1246,9 @@ void CondBrInst::swapSuccessors() {
   swapProfMetadata();
 }
 
+// Suppress deprecation warnings from BranchInst.
+LLVM_SUPPRESS_DEPRECATED_DECLARATIONS_POP
+
 //===----------------------------------------------------------------------===//
 //                        AllocaInst Implementation
 //===----------------------------------------------------------------------===//



More information about the llvm-commits mailing list